[vtkusers] Using vtkProbe with vtkPolyData input and vtkImageData source
Jens Ivar Jørdre
jensivar at fmri.no
Thu Jun 9 07:03:25 EDT 2005
Howdy.
Another question from someone who's not too familiar with VTK yet.
I would like to probe an instance of vtkImageData with points from an
instance of vtkPolyData. My image data is imported using vtkImageImport.
The data to be imported is in a form of a float array (named tCoord)
with kNX*kNY*kNZ entries. The dimensions of the data set are kDimX,
kDimY, kDimZ. Hence I import with the following piece of code:
vtkImageImport* ii = vtkImageImport::New();
ii->SetDataScalarTypeToFloat();
ii->SetDataOrigin(0., 0., 0.);
ii->SetWholeExtent(0, kNX - 1, 0, kNY - 1, 0, kNZ - 1);
ii->SetDataExtentToWholeExtent();
ii->SetDataSpacing(kDimX, kDimY, kDimZ);
ii->SetImportVoidPointer((void*) tCoords);
I have my instance of vtkPolyData which has points and triangular cells.
My instance of vtkPolyData is _not_ defined using any source object.
I then define my instance of vtkProbeFilter this way:
vtkProbeFilter* probe = vtkProbeFilter::New();
probe->SetInput(fPolyData);
probe->SetSource(ii->GetOutput());
I later on define a lookup table where I want to use the scalars to
color my mapped polydata:
vtkLookupTable* lut = vtkLookupTable::New();
lut->SetTableRange(fMin, fMax); // min and max of the data in tCoord
lut->SetHueRange(0., 0.5);
lut->SetSaturationRange(1., 1.);
lut->SetValueRange(1., 1.);
lut->Build();
vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
// normals below comes from the output of probe above piped
// through vtkPolyDataNormals()
mapper->SetInput(normals->GetOutput());
mapper->SetLookupTable(lut);
mapper->SetScalarRange(fMin, fMax);
mapper->ScalarVisibilityOn();
However, when I render the entire volume is colored red which is hue 0.
Therefore I guess that the probing went wrong and that all scalar
attributes of my polydata points are 0.
Anyone who can point me in the right direction?
Kind regards
Jens Ivar Jørdre
More information about the vtkusers
mailing list