[vtkusers] bug in vtkExtractVOI?

David Gobbi dgobbi at atamai.com
Wed Dec 7 17:53:28 EST 2005


Hi Grace,

The definition of "origin" is the same: it means the coordinates of 
index (0,0,0) of the image.

The confusing bit is that VTK extents don't always start at zero.  That 
means that index (0,0,0)
doesn't always mean the corner of image.  You can have an image that 
starts at index (5,0,0),
which means that the origin is located off to the side of the corner by 
a distance of 5*Spacing[0].

When you set an output extent for vtkExtractVOI or vtkImageClip, the 
indexing starts at the
beginning of the extent that you set.  You need to use 
vtkImageTranslateExtent to shift the extent
so that it starts at index (0,0,0) again.  After translating the extent, 
the origin will be what you
expect.

 - David


Grace Chen wrote:

>Hi there,
>
>I try to compute the initial translation of the two 3D data.  However, after
>I use vtkExtractVOI to extract a part (also a volume) from one of the 3D
>data.  The origin stays the same!  In my program, the vtkImageData is used
>to be converted to itk::Image to compute the initial translation, so if the
>origin information stay the same, the center of the image is wrong.  So, I
>wonder if the definition of the term "origin" differs in vtk and itk?
>
>Thanx!
>
>Grace
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>  
>




More information about the vtkusers mailing list