[vtkusers] Importing dicom data for vtkContourFilter

Catherine Peloquin cepeloquin at gmail.com
Mon Jul 16 14:21:19 EDT 2007


I want to read in dicom data using a different parser than the one
included in VTK, then create an isosurface with that data using the
vtkContourFilter.  When I attempted to visualize the results, I get a
plane with some squares on it.

The HU data is read from a series of image slices and saved in the 3-D
int array "HUData".   The number of rows of data is stored as R.  The
number of columns of data is stored as C.  Here is my code for
importing that HUData:
	//import C array of pixel data into VTK by using vtkImageImport
	vtkImageImport* image2D = vtkImageImport::New();
	image2D->SetWholeExtent(0, C-1, 0, R-1, 0,0);
	image2D->SetDataExtentToWholeExtent();
	image2D->SetDataScalarTypeToInt();  //Array to be passed into filter
will be of type int
	image2D->SetImportVoidPointer(HUData);  //pass HUData array into importer

I then use the imported data with the filter like so:
       contourExtractor->SetInput((vtkDataSet *) image2D->GetOutput());
       contourExtractor->SetValue(0, 500);

My code works when I use the vtkVolume16Reader to get data, but I need
to use my own parser.  I am sure that the parser is working correctly
as I use it in other applications.

Does anyone have any suggestions?

Thank you,
Catherine Peloquin



More information about the vtkusers mailing list