[vtkusers] point data with vtkImageMarchingCubes and vtkContourFilter

Eric Pichon eric at ece.gatech.edu
Thu Jun 26 14:41:05 EDT 2003


Hi All,

I am trying to color the iso-surface of one vtkImageData (here: maskTree)
with values from another vtkImageData (here: coloring).

This is described in the vtk manual on a more general dataset. The idea is
to attach the coloring scalar field as point field data to the
vtkImageData that will be used to generate the iso-surface and then call
SetScalarModeToUsePointFieldData() when instantiating the mapper.

My problem is that this works very well with vtkContourFilter but does not
seem to work for the more appropriate vtkImageMarchingCubes.

It looks like vtkImageMarchingCubes (or vtkMarchingCubes) completely
discards the point field data of its input.

Have you ever experienced that ? Or am I doing something wrong ? Or is
there a workaround ? Because my images are large (512^3) I would really
like to use marching vtkImageMarchingCubes...

Thanks for your help !

Eric

-----

PS: I am using vtk 4.2.2 with Visual C++ 6.0.
Here are the relevant parts of my pipeline:



vtkShortArray *array = vtkShortArray::New();
int willBeDeletedIndependently=1;
array->SetArray( (short *)coloring->GetScalarPointer(),
                 coloring->GetNumberOfPoints(), willBeDeletedIndependently
);
array->SetName("HU");
vtkPointData *pointData = maskTree->GetPointData();
pointData->AddArray( array );

// with vtkImageMarchingCubes point field data seems to be discarded ?

//	vtkContourFilter *iso = vtkContourFilter::New();
vtkImageMarchingCubes *iso = vtkImageMarchingCubes::New();
iso->SetInput( maskTree );
iso->SetValue( 0, 1.99 ); // stay close to the inside (label==2)
iso->ComputeScalarsOn();
iso->ComputeNormalsOff();
iso->ComputeGradientsOff();

[...]

vtkPolyDataMapper *isoMapper = vtkPolyDataMapper::New();
isoMapper->SetInput( normals->GetOutput() );
isoMapper->SetLookupTable( lookup );
isoMapper->UseLookupTableScalarRangeOn();
isoMapper->ScalarVisibilityOn();
isoMapper->SetScalarModeToUsePointFieldData();
isoMapper->ColorByArrayComponent("HU", 0);

[...]



More information about the vtkusers mailing list