[vtkusers] bug in vtkImageReader.cxx ?

Lorensen, William E (CRD) lorensen at crd.ge.com
Mon Jul 9 07:40:49 EDT 2001


Simon,

I checked in your corrections this morning. I also fixed graphics/vtkVolume16Reader. Its logic was
also flawed.

Thanks,

Bill

-----Original Message-----
From: Simon Warfield [mailto:warfield at bwh.harvard.edu]
Sent: Sunday, July 08, 2001 7:09 PM
To: vtkusers at public.kitware.com
Subject: [vtkusers] bug in vtkImageReader.cxx ?



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

_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers




More information about the vtkusers mailing list