[vtkusers] How to extract isosurfaces from a series of 2D slices?

安 继业 an_jiye at hotmail.com
Mon Feb 9 20:24:53 EST 2004


Hi.

I have taken a look at the Examples\Medical\Cxx\Medical2.cxx. Now I got the 
idea that I can extract multiple isosurfaces use vtkContourFilter and 
display them together. But I have some questions.


1. The example use a vtkVolume16Reader to generate the input data. My input 
data is a series of 2D slices of DICOM format. Now I can read each slice 
separately and get a 2D array to store the actural data of each slice. Then 
how can I create an vtkImageData object from these 2D data arrays? I write 
the following codes according to the VTK user's guide:

// Create the image data
vtkImageData *source = vtkImageData::New();
source->SetDimensions(64, 64, 93);
source->SetScalarTypeToUnsignedInt();
source->SetNumberOfScalarComponents(1);
source->AllocateScalars();

// Fill in scalar values
unsigned int *ptr = (unsigned int *)source->GetScalarPointer();

... ...

Here I don't know how to fill the scalar array with the actural image data. 
The dimentions of vtkImageData structure is X*Y*Z, then how does the scalar 
pointer points to the data? I guess it should be start from the top left 
corner of the first slice image. Then the ptr++ statement will let the 
pointer goes along the X axis. After the first line has been traversed(ptr 
has been increased by X), the pointer will goes to the first point of the 
second line. ... After the first slice image has been traversed(ptr has 
been increased by X*Y), the pointer will goes to the first point of the 
second slice, that is, I need add one to the Z axis.

Am I right?


2.The example use vtkContourFilter::SetValue(...) to extract isosurface 
from the input data. By passing 500 to extract skin and 1150 to extract 
bone. The my question comes, does it means I must know the exact scalar 
value of the isosurface I am going to extract?

Since my slice images are from a CT scan, which was stored in 16 bits. I am 
interested some surfaces from the slices, include the body, some organs. 
For example, the outline of the body may be a closed curve in one slice. 
But the scalar value along this curve may not 
be constant. Then how should I extract these surfaces and display them?

I have also thinked of the following method. First manually contour each 
slice. To simplify the process, imagining draw two circles inside each 
slice. Circle A is bigger and circle B is inside A. Then if I do the 
following work to each slice: assign scalar value zero to the regions 
outside circle A, assign one to the regions between A and B, and assign two 

to the regions inside B, can I extract the two isosurfaces represent A and 
B from the contoured fake data?

Any suggestion will be appreciated. Thank you in advance.

_________________________________________________________________
免费下载 MSN Explorer:   http://explorer.msn.com/lccn/  




More information about the vtkusers mailing list