[vtkusers] vtkImagePlaneWidget, segmentation fault

Eric Pichon eric at ece.gatech.edu
Tue Oct 7 17:25:36 EDT 2003


Hi All,

I am trying to visualize a 3D image with several scalar components using a
vtkImagePlaneWidget object. I would like to interactively choose the
component that will be used by the widget.

The vtkImageData is built by:

vtkImageData *image;
image = vtkImageData::New();
image->SetDimensions( dim );
image->SetSpacing( spacing );
image->GetPointData->AddArray( array1 );
image->GetPointData->AddArray( array2 );

where array1 and array2 are 2 vtkFloatArray of the correct dimension.

We choose the active array (the one we want the widget to use) by:

image->GetPointData()->SetActiveScalars( "1" );

Then the widget is set up with:

vtkImagePlaneWidget *axialSlice;
axialSlice = vtkImagePlaneWidget::New();
axialSlice->SetInput( image );

The problem is that when I try to translate the plane along the normal
vector, the porgram will crash with a segmentation fault. However if
instead of translating it, my first operation is to rotate it then
subsequent translations do not pose any problem.

Moreover everything goes fine if the vtkImageData contains only one scalar
field, i.e. if I comment out:

// image->GetPointData->AddArray( array2 );

Any idea ? Am I doing something wrong ? (I do not allocate anything
explicitely for the vtkImageData, when I tried to it did not solve
anything). Have you had more success than I did on visualizing more
than one scalar field with a vtkPlaneWidget ?

Thanks for any help,

Eric

PS: this is with:

VTK CVS of Sep 30, 2003
g++ (GCC) 3.2.2 20030222
Linux, Red Hat 9.0



More information about the vtkusers mailing list