Previous

Section

<<<

Isosurface Generation Using VTK

Next

Section

>>>

VTK Basics

 

 

3.5.1.1.  Creating the Pipeline: vtkImageReader

 

You are here:

  • This pipeline will take input from a file with volumetric data which has dimensions of 256x256x577 with individual unsigned 16-bit units.  Because of the inherent flaws with the technology used to generate this data, it is necessary to extract a region that does not show the machine or table used to generate this data.  Also, it will be useful to select a range of slices to view at one time instead of the entire body.  For performance reasons, the data should be able to be subsampled to achieve better interactive performance.  Additionally, it would be nice to view any single region of the entire dataset.  This volumetric data should be viewable using any isosurface value.  So, once the region of interest is extracted, a specific isosurface value of the dataset should be chosen to view.  By itself, this isosurface will be invisible unless some additional configuration occurs.  For this reason, the user should be able to choose any color and amount of opacity of the surface.  In order to get better interactive performance when manipulating the model, it might be helpful to have the model have a lower level of details.

 

The pipeline so far is:

  • (nothing)

 

Studying the highlighted section:

·        “take input from a file with volumetric data which has dimensions of 256x256x577 with individual unsigned 16-bit units”

o       vtkImageReader is the choice here because some image dataset must be read from a file.

§         The phrase “volumetric data” involves 3-D data, so calling SetFileDimensionality( int ) with a value of 3 is necessary.

§         The next phrase “has dimensions of 256x256x577” is a sure sign to use SetDataExtent( int,int, int,int, int,int ) where the x-dimension extent will be 0,255, the y-dimension extent will be 0,255, and the z-extent will be 0,576.

§         The next part “with individual unsigned 16-bit units” means that two function calls must be made.  The first call is to SetDataScalarType( int type ) with a value of vtk.VTK_UNSIGNED_SHORT.  Alternatively, one could make a more direct call to SetDataScalarTypeToUnsignedShort().  The second call should be made to SetNumberOfScalarComponents( int ) with a value of 1 since there was no mention of RGB.  Sometimes when you translate, it is what one does not read that also provides the answer.

§         As far as the remaining miscellaneous calls:

·        SetDataSpacing( 1, 1, 1 ) since this would be the expected structure of a 3-D image file.

·        SetDataByteOrderToBigEndian().   This is how the Visible Woman file was generated based on the file that was given to the author.  Do not forget this line or else everything will look very weird.

·        Calling SetFileName( const char * ) once you know the file path would also be useful.

 

·        “Because of the inherent flaws with the technology used to generate this data, it is necessary to extract a region that does not show the machine or table used to generate this data.  Also, it will be useful to select a range of slices to view at one time instead of the entire body.  For performance reasons, the data should be able to be subsampled to achieve better interactive performance.  Additionally, it would be nice to view any single region of the entire dataset.”

o       This is the same thing said a few different ways.  The essence of this oversized description is that it is necessary to extract a volume of interest and sample it.  Since the actually body height is encapsulated in the slices, changing the z-extent (“range of slices”) will affect what portion of the body is shown.  Changing the x-extent and y-extent will hide some of the machine surface and other noise that may appear in the volume (“does not show the machine or table”).  The bottom line is that the VTK class named vtkExtractVOI needs to be used.

§         The first call to make is to SetVOI( int,int, int,int, int,int ).  From working with the Visible Woman dataset, the following values are probably suitable for getting rid of unwanted surfaces and isolating the head for viewing:  ( 0,255, 60,255, 0,100 )

§         The next call is the sampling rate.  No specific rate was specified, but one needs to think about what may be implied.  Seeing the individual slices stacked together (z-extent) is probably more important than a single slice (x-, y- extents).  Additionally, there could be a specification that says “view slices at resolutions of 256x256, 128x128, 64x64”.  Using these desired settings would result in the following function calls (remember, the parameters are integers, so there is no continuous gradient of subsampling):

·        256x256: SetSampleRate( 1, 1, 1 )

·        128x128: SetSampleRate( 2, 2, 1 )

·        64x64: SetSampleRate( 3, 3, 1 )

 

 

<<< Previous

Creating the Pipeline

 

Table of Contents

 

Next >>>

Creating the Pipeline: vtkExtractVOI