]> Creatis software - clitk.git/blobdiff - itk/clitkBooleanOperatorLabelImageFilter.txx
Do not compile those tests by default
[clitk.git] / itk / clitkBooleanOperatorLabelImageFilter.txx
index 254085b0f17e79389f6a2a540f3b302bd39df698..1a7a98bd91eb3e22fdc3d374e89c6e4e4101344c 100644 (file)
@@ -116,9 +116,9 @@ namespace clitk {
     static const unsigned int Dim = Input1ImageType::ImageDimension;
     for(unsigned int i=0; i<Dim; i++) {
       if (input1->GetSpacing()[i] != input2->GetSpacing()[i]) {
-        itkExceptionMacro(<< "Input 1&2 must have the same spacing. " << std::endl
-                          << "\t input1 =  " << input1->GetSpacing() << std::endl
-                          << "\t input2 =  " << input2->GetSpacing() << std::endl);
+        clitkExceptionMacro("Input 1&2 must have the same spacing. " << std::endl
+                            << "\t input1 =  " << input1->GetSpacing() << std::endl
+                            << "\t input2 =  " << input2->GetSpacing() << std::endl);
       }
       // if (input1->GetLargestPossibleRegion().GetSize()[i] != input2->GetLargestPossibleRegion().GetSize()[i]) {
 //         itkExceptionMacro(<< "Input 1&2 must have the same size. " << std::endl
@@ -169,7 +169,6 @@ namespace clitk {
     ComputeRegionFromBB<Input1ImageType>(input1, bb, input1Region);
     ComputeRegionFromBB<Input2ImageType>(input2, bb, input2Region);
     ComputeRegionFromBB<OutputImageType>(outputImage, bb, outputRegion);
-
   }
   //--------------------------------------------------------------------
 
@@ -213,6 +212,7 @@ namespace clitk {
     switch (m_OperationType) {
     case AndNot: LoopAndNot(it1, it2, ot);  break;
     case And: LoopAnd(it1, it2, ot);  break;
+    case Or: LoopOr(it1, it2, ot);  break;
     }
   }
   //--------------------------------------------------------------------
@@ -233,7 +233,8 @@ namespace clitk {
 
   //--------------------------------------------------------------------
   LOOP_BEGIN(LoopAndNot)
-  if ((it1.Get() != mBackgroundValue1) && (it2.Get() == mBackgroundValue2)) { ot.Set(mForegroundValue); }
+  if ((it1.Get() != mBackgroundValue1) && (it2.Get() == mBackgroundValue2)) 
+    { ot.Set(mForegroundValue); }
   else { ot.Set(mBackgroundValue); }
   LOOP_END
   //--------------------------------------------------------------------
@@ -241,7 +242,17 @@ namespace clitk {
  
   //--------------------------------------------------------------------
   LOOP_BEGIN(LoopAnd)
-  if ((it1.Get() != mBackgroundValue1) && (it2.Get() != mBackgroundValue2)) { ot.Set(mForegroundValue); }
+  if ((it1.Get() != mBackgroundValue1) && (it2.Get() != mBackgroundValue2)) 
+    { ot.Set(mForegroundValue); }
+  else { ot.Set(mBackgroundValue); }
+  LOOP_END
+  //--------------------------------------------------------------------
+
+  //--------------------------------------------------------------------
+  LOOP_BEGIN(LoopOr)
+  if ((it1.Get() != mBackgroundValue1) || (it2.Get() != mBackgroundValue2)) 
+    { ot.Set(mForegroundValue); }
   else { ot.Set(mBackgroundValue); }
   LOOP_END
   //--------------------------------------------------------------------