[vtkusers] ImagePlaneWidget

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Mar 27 16:20:37 EST 2003


Thanks for the code -- I have modified this to work in python.

I have one render window with the three vtkImagePlaneWidgets and 3
other windows with views of the three slices in three other window
windows.

I also want to include cross hairs on the ortho views, so that changes
in the cross hairs in the main view are reflected in cross hairs in
the ortho views and vice versa.  

With a slight modification of your code, I am inserting an
vtk.vtkImageCursor3D in the pipeline

    cursor = vtk.vtkImageCursor3D()
    cursor.SetInput(planeWidgetX.GetResliceOutput())
    cursor.SetCursorPosition(255,255,0)
    cursor.SetCursorValue(255)
    cursor.SetCursorRadius(255)

    colorMap1.SetInput(cursor.GetOutput())
    imageActor1.SetInput(colorMap1.GetOutput())     

By making a call to 

  planeWidgetX.AddObserver('InteractionEvent', update_ortho1)

with a suitably defined update_ortho1, I can update the cross hairs in
the observer window with the values from the image plane widget, but
don't know if I'll be able to go vice versa (cursor in the ortho view
to the image plane widget) because I don't see any method to set the
cursor position in the vtkImagePlaneWidget API.

I would also like to set the color of the cursor, and have seen
several posts asking how to do this in the archives, but no responses.
With my nascent understanding of VTK, I am beginning to think this is
not possible, because the cursor is an image filter, and so my read on
this is that it just filters the image along the cursor lines
replacing the pixel values with the value specified by SetCursorValue.
Hence if I have a 255 grayscale image, I am limited to those choices,
correct?  I took a look at the vtkImagePlaneWidget.cxx src code, which
generates colored cursors, and notice that the code *does not* use the
cursor class but rather manually generated cursor properties and
colors.

Anyway, thanks for the help thus far.  Any more enlightment about
these issues will be much obliged.

Thanks,
John Hunter



More information about the vtkusers mailing list