[Insight-developers] Typo in itkMetaImageIO.cxx

Peter Cech pcech at vision.ee.ethz.ch
Wed Feb 8 11:39:35 EST 2006


Hi,

there is a bug in computation of Offset field when writing MetaImage file and

1. Index of image region is not zero filled.
2. Image consists of anisotropic pixels.
3. Direction is not identity.

Due to mixup of inner and outer loop control variables, current CVS code
applies spacing to each component of direction cosines vectors instead
of scaling whole vector with the corresponding spacing element.

Patch is attached, please review and apply if it looks correct.

Thanks!

Peter
-------------- next part --------------
Index: itkMetaImageIO.cxx
===================================================================
RCS file: /cvsroot/Insight/Insight/Code/IO/itkMetaImageIO.cxx,v
retrieving revision 1.60
diff -u -3 -d -r1.60 itkMetaImageIO.cxx
--- itkMetaImageIO.cxx	12 Dec 2005 20:29:57 -0000	1.60
+++ itkMetaImageIO.cxx	8 Feb 2006 16:03:41 -0000
@@ -1049,7 +1049,7 @@
     int j;
     for(j=0; j<nDims; j++)
       {
-      eOrigin[i] += indx[j] * eSpacing[i] * this->GetDirection(j)[i];
+      eOrigin[i] += indx[j] * eSpacing[j] * this->GetDirection(j)[i];
       }
     }
 


More information about the Insight-developers mailing list