]> Creatis software - clitk.git/commitdiff
Correct bug: when crop is only performed along a single direction.
authordsarrut <david.sarrut@gmail.com>
Tue, 12 Jul 2011 06:10:21 +0000 (08:10 +0200)
committerdsarrut <david.sarrut@gmail.com>
Tue, 12 Jul 2011 06:10:21 +0000 (08:10 +0200)
itk/clitkCropLikeImageFilter.txx

index 0af957bb20c6e8ae57e5b560920c3a907719ceea..28772392ff7fff31a4b9b738b5a08e69909832e3 100644 (file)
@@ -136,6 +136,16 @@ GenerateOutputInformation() {
                           << ") of 'like' is " << likeSpacing[i] << ".");
     }
   }
+
+  // Check that we must crop along each dimension. If not, we use the
+  // size of the input image
+  for(unsigned int i=0; i<ImageType::ImageDimension; i++) {
+    if (m_CropAlongThisDimension[i] == false) {
+      likeStart[i] = input->GetLargestPossibleRegion().GetIndex()[i];
+      likeSize[i] = input->GetLargestPossibleRegion().GetSize()[i];
+    }
+  }
+
   // Define output region 
   m_OutputRegion.SetIndex(likeStart);
   m_OutputRegion.SetSize(likeSize);