[vtkusers] Newbie question re vtkImageClip

Jeremy Winston winston at cat.rpi.edu
Thu Sep 5 10:44:39 EDT 2002


Hi Folks,
     I've skimmed the User's Guide & the textbook, but
I'm still having trouble using vtkImageClip.  All I want
to do is interactively zoom in on a ROI in a CT image 
(for the purpose of applying a contour filter only on the
ROI).  Here is the Tcl code I'm using:
# ----- Begin -----
  package require vtk
  package require vtkinteraction

  vtkGESignaReader vhdReader
    vhdReader SetFileName blah/blah/blah.CT

  vtkImageClip vhdClip
    vhdClip SetInput [vhdReader GetOutput]
    vhdClip ClipDataOn

  vtkImageViewer2 viewer
    viewer SetInput [vhdClip GetOutput]

  vtkRenderWindowInteractor iren
    iren SetRenderWindow [viewer GetRenderWindow]
    iren AddObserver UserEvent {wm deiconify .vtkInteract}
    iren Initialize

  viewer Render

  wm withdraw .
# ----- End -------

It first renders the image OK, but as soon as I try to enter
(for example)

   vhdClip SetOutputWholeExtent 120 511 0 511 0 0
   viewer Render

in the vtk Interactor window, I get these error messages:

   ERROR: In C:\martink\vtk40\VTK\Common\vtkDataObject.cxx, line 582
   vtkImageData (0x020CA6F0): Update extent does not lie within whole extent

   ERROR: In C:\martink\vtk40\VTK\Common\vtkDataObject.cxx, line 589
   vtkImageData (0x020CA6F0): Update extent is: 0, 511, 0, 511, 0, 0

   ERROR: In C:\martink\vtk40\VTK\Common\vtkDataObject.cxx, line 596
   vtkImageData (0x020CA6F0): Whole extent is: 120, 511, 0, 511, 0, 0

How do I get the update extent to be constrained to the whole extent?
Or, if that is the wrong approach, what am I doing wrong?

TIA,
-Jeremy

PS. I'm using the VTK 4.0 precompiled binaries from the CD on W2K.



More information about the vtkusers mailing list