]> Creatis software - clitk.git/commitdiff
Limit uniformity test to first 3 dimensions (usually the spatial ones)
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Tue, 23 Aug 2011 17:16:48 +0000 (19:16 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Tue, 23 Aug 2011 17:16:48 +0000 (19:16 +0200)
    to avoid problems when spacing was randomly assigned in 4th
    dimension

common/clitkXdrImageIOReader.cxx

index b9380a2e2ff476421d98676a2d0c592b861683d0..07384efe5cc9e965e9f07e3ed33655128a68a5c2 100644 (file)
@@ -700,11 +700,13 @@ int clitk::XdrImageIO::ReadImageInformationWithError()
         SetOrigin(i,10*p[0]);
 
         //Test if rectilinear image is actually uniform (tolerance 0.1 mm)
-        for (j=0; j<GetDimensions(i)-1; j++) {
-          if (fabs((p[j+1]-p[j])*10-GetSpacing(i))>0.1) {
-            free(points);
-            fclose(fstream);
-            return ER_NOT_HANDLED;
+        if(i<3) { // Only for first 3 dimensions because spacing is barely used in other dims
+          for (j=0; j<GetDimensions(i)-1; j++) {
+            if (fabs((p[j+1]-p[j])*10-GetSpacing(i))>0.1) {
+              free(points);
+              fclose(fstream);
+              return ER_NOT_HANDLED;
+            }
           }
         }
         p += (int)GetDimensions(i);