[vtk-developers] vtkImagePlaneWidget fixes before release

Dean Inglis dean.inglis at on.aibn.com
Thu Apr 18 15:16:47 EDT 2002


Hi,

I've fixed a couple of things that were not correct with vtkImagePlaneWidget
and its test /Hybrid/Testing/Cxx/ImagePlaneTest.cxx in anticipation of
adding it to the list of srcs in /Hybrid/CmakeLists.txt and then announcing
to vtkusers.  Here are the changes:

1) In SetInput(vtkImageData*) the call to GenerateTexurePlane() is required
and within GenerateTexurePlane() itself one must set the initial plane
orientation.  This initializes the vtkImageReslice and the texure mapping
properly through calls to UpdateNormal() and UpdateOrigin().

2) Fixed a bug with WindowLevel() : was getting a bad vtkLookupTable range
due to this->LookupTable->SetRange(rmin,rmax) when rmin > rmax.   Now a
check is done prior to updatin g the table range.

3) Removed calls to UpdateNormal() and UpdateOrigin() int SetEnabled() since
these are already performed at SetInput()

4) RestrictPlaneToVolume has to be 'On' in the class constructor and for the
stuff in GenerateTexturePlane() to work properly otherwise I was getting a
bad plane definition error with vtkPlaneSource.

5) In the test app I added some calls to a new convenience method
SetSliceIndex() which sets the slice position in terms of data extents.
This was not working correctly in the last revision which led to fix 1).

Would anyone mind trying this class and the example out and letting me know
how things went prior to my announcing to vtkusers and adding to the CMake
build process.

In the works:

Currently left and middle mouse buttons do the same thing: drag the plane.
I have another version in the works that sets the left mouse button to pop
up a cross hair cursor on the plane which then probes the original image
data and spits out the image x-y-z coords and the associated scalar value to
a vtkTextMapper / vtkScaledTextActor pair.  The text just defaults out to
the lower left corner of a render window.  I have a problem with the cross
hairs though: to determine which side of the vtkPlaneSource to plot the
cross hairs on I take the dot product with the plane normal and the current
camera's direction of projection. If the plane is zoomed in too closely this
does not work: either the cross hairs are not plotted or they are plotted on
the flip side.


Any feedback on this cursor idea would be helpful.

thanks,
Dean




More information about the vtk-developers mailing list