X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkBooleanOperatorLabelImageFilter.txx;h=ff0f5748063503d5b7c5656c714943740020c18c;hb=49a4b154c9a2af76b0f9143b4fabde0a4da6e798;hp=254085b0f17e79389f6a2a540f3b302bd39df698;hpb=ff4abcacee4dbd9d93dfd6ee1ebb15918ebf1f95;p=clitk.git diff --git a/itk/clitkBooleanOperatorLabelImageFilter.txx b/itk/clitkBooleanOperatorLabelImageFilter.txx index 254085b..ff0f574 100644 --- a/itk/clitkBooleanOperatorLabelImageFilter.txx +++ b/itk/clitkBooleanOperatorLabelImageFilter.txx @@ -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,14 +14,14 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ======================================================================-====*/ + ===========================================================================**/ #ifndef CLITKBOOLEANOPERATORLABELIMAGEFILTER_TXX #define CLITKBOOLEANOPERATORLABELIMAGEFILTER_TXX #include "clitkCommon.h" #include "clitkBooleanOperatorLabelImageFilter.h" -#include "clitkSegmentationUtils.h" +#include "clitkBoundingBoxUtils.h" namespace clitk { @@ -116,9 +116,9 @@ namespace clitk { static const unsigned int Dim = Input1ImageType::ImageDimension; for(unsigned int i=0; iGetSpacing()[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(input1, bb, input1Region); ComputeRegionFromBB(input2, bb, input2Region); ComputeRegionFromBB(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 //--------------------------------------------------------------------