[vtkusers] bug in vtkImageReader.cxx ?

Simon Warfield warfield at bwh.harvard.edu
Sun Jul 8 19:09:17 EDT 2001


I notice that if I read some image data using vtkImageReader and transform
it to correct for patient orientation using the vtkImagerReader::SetTransform
function, then the new origin is at an unexpected location.

I get data looking like:
# vtk DataFile Version 3.0
vtk output
BINARY
DATASET STRUCTURED_POINTS
DIMENSIONS 256 256 90
SPACING 0.703125 0.703125 1.5
ORIGIN -90 -89.2969 -67.5
CELL_DATA 5787225
POINT_DATA 5898240

When I expect to get data looking like:
# vtk DataFile Version 3.0
vtk output
BINARY
DATASET STRUCTURED_POINTS
DIMENSIONS 256 256 90
SPACING 0.703125 0.703125 1.5
ORIGIN -90 -90 -67.5
CELL_DATA 5787225
POINT_DATA 5898240

  I think the problem is that line 936 of imaging/vtkImageReader.cxx should not
read
          (transformedExtent[i*2+1] -  transformedExtent[i*2]);
but instead should be:
          (transformedExtent[i*2+1] -  transformedExtent[i*2]+1);

  This part of vtkImageReader.cxx in the latest vtk nightly is doing a shift 
of the origin when an axis is reflected, but seems to be using one less
than the width of the data to compute the new origin. I think the width
of the data should be used.

  Could someone check this, and make the change to the CVS repository if it
should be fixed ?

-- 
Simon Warfield, Ph.D. warfield at bwh.harvard.edu Phone:617-732-7090
http://www.spl.harvard.edu/~warfield           FAX:  617-582-6033
Thorn 329, Brigham and Women's Hospital, Harvard Medical School
Department of Radiology, 75 Francis St, Boston, MA, 02115




More information about the vtkusers mailing list