[vtkusers] Re: Bug in vtkExtractVOI

Jeremy Winston jbw at ieee.org
Tue Sep 9 12:25:29 EDT 2003


Jeremy Winston wrote:
> Berk Geveci wrote:
> > Please take a look at:
> > http://public.kitware.com/pipermail/vtk-developers/2003-April/002424.html
> 
> Oops, sorry for the wasted bandwidth. Now I go rewrite my scripts.

Argh.  I've been grinding on this for over two hours & I'm no closer
to understanding the problem than when I started.  Could someone
with a better brain explain the problem?

I read in a CT slice & display it, extract contours (within a user-
defined ROI) based on a user-defined threshhold value, display the
contours overlaid on the slice, and allow the user to select which
contours she's interested in.

The problem is that now when the ROI min values are not zero, the
contours are "messed up" (in a way whose cause is mysterious to me).
A screen shot of the the messed up contours can be viewed here:

http://home.carolina.rr.com/jwinston2/wrappedContours.png

The extracted contours are in blue.  When the ROI X min value is
Xmin > 0, the leftmost blue contour point is 2*Xmin, and the horizontal
extent of the contour points is equal to the width of the ROI box (when
the threshhold is such that contours extend across the entire width).
The contours "wrap around" horizontally.  The contours can be 'p'icked
in their apparent positions on the screen.


Here is the relevant part of my pipeline:

   vtkGESignaReader ctReader

   vtkExtractVOI extract
     extract SetInput [ctReader GetOutput]

   vtkImageMapper ctMapper
     ctMapper SetInput [ctReader GetOutput]
   vtkActor2D ctActor
     ctActor SetMapper ctMapper

   vtkMergePoints ctLocator
   vtkMarchingSquares ctContour
     ctContour SetInput [extract GetOutput]
     ctContour SetLocator ctLocator

   vtkStripper ctStrip
     ctStrip SetInput [ctContour GetOutput]

   vtkTransform ctTrans
   vtkTransformPolyDataFilter ctTransF
     ctTransF SetInput [ctStrip GetOutput]
     ctTransF SetTransform ctTrans

   vtkPolyDataMapper2D ctContMapper
     ctContMapper SetInput [ctTransF GetOutput]
   vtkActor2D ctContActor
     ctContActor SetMapper ctContMapper

I use ctTrans to map the extracted contours to screen coords,
and its inverse to map the pick screen coords back into CT coords.
(I wrote my own pick routine to find the closest contour to the
picked point.)  I update ctTrans when the user changes the ROI:

   ctTrans Identity
   ctTrans Translate $xmin $ymin 0
   ctTrans Scale $xScale $yScale 1
   ctTrans Translate [expr -$xOrig] [expr -$yOrig] 0
   ctTransF Update

where xmin, ymin are the ROI min values in screen coords,
xScale, yScale are the inverses of the pixel spacings in
the CT image, and xOrig,yOrig are the origin as obtained
from
    [extract GetOutput] GetOrigin
after updating extract.

Any help appreciated,
-Jeremy





More information about the vtkusers mailing list