]> Creatis software - clitk.git/blobdiff - itk/clitkResampleImageWithOptionsFilter.txx
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
[clitk.git] / itk / clitkResampleImageWithOptionsFilter.txx
index 1bf5448782819792a906d03aafa0268e3e055a54..a3f88beb3db8443f08fa376da1480433f24e4051 100644 (file)
@@ -3,7 +3,7 @@
 
   Authors belong to:
   - University of LYON              http://www.universite-lyon.fr/
-  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
 
   This software is distributed WITHOUT ANY WARRANTY; without even
@@ -14,7 +14,7 @@
 
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-  ======================================================================-====*/
+  ===========================================================================**/
 
 // clitk
 #include "clitkDD.h"
@@ -125,11 +125,15 @@ GenerateOutputInformation()
       // floor() is used to intentionally reduce the number of slices 
       // because, from a clinical point of view, it's better to 
       // remove data than to add data that privously didn't exist.
+      if(inputSpacing[i]*m_OutputSpacing[i]<0)
+        itkExceptionMacro( << "Input and output spacings don't have the same signs, can't cope with that" );
       m_OutputSize[i] = (int)floor(inputSize[i]*inputSpacing[i]/m_OutputSpacing[i]);
     }
   } else {
     if (m_OutputSpacing[0] != -1) { // apply spacing, compute size
       for(unsigned int i=0; i<dim; i++) {
+        if(inputSpacing[i]*m_OutputSpacing[i]<0)
+          itkExceptionMacro( << "Input and output spacings don't have the same signs, can't cope with that" );
        // see comment above for the use of floor()
        m_OutputSize[i] = (int)floor(inputSize[i]*inputSpacing[i]/m_OutputSpacing[i]);
       }
@@ -151,7 +155,7 @@ GenerateOutputInformation()
     m_OutputSize[l] = inputSize[l];
     m_OutputSpacing[l] = inputSpacing[l];
   }
-    
+
   // Set Size/Spacing
   OutputImagePointer outputImage = this->GetOutput(0);
   // OutputImageRegionType region;