[vtkusers] Using a vtkImagePlaneWidget on a vtkImageData
Toh Da Jun
tohdj at bii.a-star.edu.sg
Thu Jul 14 05:52:25 EDT 2005
Using java, I've create a 3D volume render by using
vtkImageData mediumVolume = null;
mediumVolume = new vtkImageData();
mediumVolume.SetWholeExtent(0, m_iDimension_X-1,
0, m_iDimension_Y-1,
0, m_iDimension_Z-1);
mediumVolume.SetUpdateExtent(mediumVolume.GetWholeExtent());
mediumVolume.SetExtent(mediumVolume.GetWholeExtent());
[ other initialisation lines ]
mediumVolume.SetOrigin(0,0,0);
mediumVolume.SetSpacing(1,1,1);
mediumVolume.SetScalarTypeToFloat();
next I tried to use the vtkImagePlaneWidget to provide 2D profiles of
the mediumVolume. Here are the codes...
imagePlaneWidget = new vtkImagePlaneWidget();
imagePlaneWidget.DisplayTextOn();
imagePlaneWidget.SetInput(mediumVolume);
imagePlaneWidget.SetPlaneOrientationToXAxes();
imagePlaneWidget.SetSliceIndex(10);
imagePlaneWidget.GetPlaneProperty().SetColor(0,1,0);
imagePlaneWidget.SetInteractor( displayCanvas.getIren() );
imagePlaneWidget.On();
imagePlaneWidget.InteractionOff();
imagePlaneWidget.RestrictPlaneToVolumeOn();
Problems:
1. The imageplane shows nothing.
2. If imagePlaneWidget.InteractionOn() was used, then the program will
crash.
I've gone through the examples for vtkImagePlaneWidget...where the
HybridCxxTests uses vtkVolume16Reader to read in a file. It uses a
GetOutput() to pass a vtkImageSource to
imagePlaneWidget.SetInput(vtkDataSet *input);
vtkVolume16Reader v16 = new vtkVolume16Reader();
vtkimagePlaneWidget ipw = new vtkimagePlaneWidget();
ipw.SetInput(v16.GetOutput());
since vtkImageData is a concrete implementation of vtkDataSet, why does
it work?
toh da jun
More information about the vtkusers
mailing list