[vtkusers] Creating a contour from volume data
Rene Tschirley
pooh at cs.tu-berlin.de
Mon Jul 22 10:55:01 EDT 2002
Dear VTK gurus,
I'm quite near to despairation. With upgrading to VTK 4.0 (I used to work
with 2.3 and 3.2 by now) I rearranged some applications. But now, I seem
to be unable to create a simple isosurface from a volume dataset as it
worked quite well with 2.3 and 3.2. It's a pity that there are so few
examples for 4.0, especially the most interesting examples have been
removed, e.g. medical[1-3].cxx, so I have nothing to look at how things
work well.
Here's the relevant C++ code:
vtkImageReader *reader = vtkImageReader::New();
reader->SetFilePrefix(filename);
reader->SetFileNameSliceOffset(sliceoffset);
reader->SetFilePattern(pattern);
reader->SetDataExtent(0, xsize-1, 0, ysize-1, 0, zsize-1);
reader->SetDataScalarTypeToUnsignedChar();
reader->SetDataSpacing (xspacing, yspacing, zspacing);
reader->SetDataMask(mask);
reader->Update();
cout << "Reader has "
<< reader->GetOutput()->GetNumberOfPoints()
<< "points.\n"; // at runtime this tells me that there are
// 13107200 data cells available which is
// correct for 512*512*50 @ 8bpp
vtkImageShrink3D *shrinker = vtkImageShrink3D::New();
shrinker->SetShrinkFactors(xshrink,yshrink,zshrink);
shrinker->SetInput(reader->GetOutput());
shrinker->Update(); // a PrintSelf() makes me sure that I didn't loose
// any points yet.
vtkMarchingCubes *skinExtractor = vtkMarchingCubes::New();
skinExtractor->SetInput(shrinker->GetOutput());
skinExtractor->SetValue(0, isolevel);
cout << "Creating " << skinExtractor->GetOutput()->GetNumberOfPolys()
<< " polygons.\n";
// at runtime this tells me that there are
// 0 polygons created which is obviously not what
// I wanted.
After that I use vtkDecimatePro and vtkPolyDataMapper to continue the
pipeline, but without any polygons, the pipeline is not of any use.
Below follows the PrintSelf() output of reader->GetOutput() and Marching
Cubes object if this is of any help.
This part of the pipeline worked well with VTK 2.3 and 3.2 so I wonder if
there is any little nifty mistake in it. I hope somebody of you will
point it out.
Yours,
René
PrintSelf of reader->GetOutput:
Debug: Off
Modified Time: 128
Reference Count: 1
Registered Events: (none)
Source: 0x8055328
Release Data: Off
Data Released: False
Global Release Data: Off
MaximumNumberOfPieces: -1
PipelineMTime: 122
UpdateTime: 129
UpdateExtent: Not Initialized
Update Number Of Pieces: 1
Update Piece: 0
Update Ghost Level: 0
RequestExactExtent: Off
UpdateExtent: 0, 511, 0, 511, 0, 49
WholeExtent: 0, 511, 0, 511, 0, 49
Field Data:
Debug: Off
Modified Time: 71
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Locality: 0
NumberOfConsumers: 0
ExtentTranslator: (0x8055680)
MaximumNumberOfPieces: -1
Number Of Points: 13107200
Number Of Cells: 12794929
Cell Data:
Debug: Off
Modified Time: 75
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Flags: ( 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
Point Data:
Debug: Off
Modified Time: 128
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 1
Array 0 name = ImageValues
Number Of Components: 1
Number Of Tuples: 13107200
Copy Flags: ( 1 1 1 1 1 )
Scalars:
Debug: Off
Modified Time: 125
Reference Count: 1
Registered Events: (none)
Name: ImageValues
Number Of Components: 1
Number Of Tuples: 13107200
Size: 13107200
MaxId: 13107199
LookupTable: (none)
Array: 0x4254a008
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
Bounds:
Xmin,Xmax: (0, 511)
Ymin,Ymax: (0, 511)
Zmin,Zmax: (0, 49)
Compute Time: 0
Release Data: Off
ScalarType: 3
NumberOfScalarComponents: 1
Spacing: (1, 1, 1)
Origin: (0, 0, 0)
Dimensions: (512, 512, 50)
Increments: (1, 512, 262144)
Extent: (0, 511, 0, 511, 0, 49)
WholeExtent: (0, 511, 0, 511, 0, 49)
PrintSelf of skinExtractor (vtkMarchingCubes):
number of contours = 1
Debug: Off
Modified Time: 153
Reference Count: 2
Registered Events: (none)
Number Of Required Inputs: 1
Input 0: (0x80553c0)
AbortExecute: Off
Progress: 1
Progress Text: (None)
Output 0: (0x8058a98)
Contour Values:
Value 0: 30
Compute Normals: On
Compute Gradients: Off
Compute Scalars: On
Locator:0x8059060
Debug: Off
Modified Time: 153
Reference Count: 1
Registered Events: (none)
DataSet: (none)
Automatic: On
Tolerance: 0.001
Level: 8
MaxLevel: 8
Retain Cell Lists: On
Build Time: 0
Number of Points Per Bucket: 3
Divisions: (42, 42, 42)
--
Dipl.-Inform. René Tschirley http://www.cs.tu-berlin.de/~pooh
TU Berlin, Computer Graphics and Computer Assisted Medicine research group
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020722/8bbae2a2/attachment.pgp>
More information about the vtkusers
mailing list