X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkAddRelativePositionConstraintToLabelImageFilter.txx;h=54f431109728bd8b31b4bdbd8b5d09cc9679e441;hb=13408338a1ef8779be07f538aacb787683aa5ddb;hp=f56c4f44bedf4c303fe11f74dfdf808b77e1acc3;hpb=9e5e119f00eb9051aa56e480aba3e86d053cdb80;p=clitk.git diff --git a/itk/clitkAddRelativePositionConstraintToLabelImageFilter.txx b/itk/clitkAddRelativePositionConstraintToLabelImageFilter.txx index f56c4f4..54f4311 100644 --- a/itk/clitkAddRelativePositionConstraintToLabelImageFilter.txx +++ b/itk/clitkAddRelativePositionConstraintToLabelImageFilter.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,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ======================================================================-====*/ + ===========================================================================**/ // clitk #include "clitkCommon.h" @@ -32,7 +32,11 @@ #include #include #include -#include +#if ITK_VERSION_MAJOR >= 4 + #include +#else + #include +#endif // itk [Bloch et al] #include "RelativePositionPropImageFilter.h" @@ -55,6 +59,8 @@ AddRelativePositionConstraintToLabelImageFilter(): InverseOrientationFlagOff(); RemoveObjectFlagOn(); CombineWithOrFlagOff(); + VerboseStepFlagOff(); + WriteStepFlagOff(); } //-------------------------------------------------------------------- @@ -122,7 +128,14 @@ AddOrientationTypeString(std::string t) case 'P' : AddOrientationType(PostTo);break; case 'S' : AddOrientationType(SupTo);break; case 'I' : AddOrientationType(InfTo);break; - default: clitkExceptionMacro("Error, you must provide L,R or A,P or S,I"); + case 'N': + if (t == "NotLeftTo") { AddOrientationType(AtLeftTo); InverseOrientationFlagOn(); break; } + if (t == "NotRightTo") { AddOrientationType(AtRightTo); InverseOrientationFlagOn(); break; } + if (t == "NotAntTo") { AddOrientationType(AntTo); InverseOrientationFlagOn(); break; } + if (t == "NotPostTo") { AddOrientationType(PostTo); InverseOrientationFlagOn(); break; } + if (t == "NotSupTo") { AddOrientationType(SupTo); InverseOrientationFlagOn(); break; } + if (t == "NotInfTo") { AddOrientationType(InfTo); InverseOrientationFlagOn(); break; } + default: clitkExceptionMacro("Error, you must provide L,R or A,P or S,I (or NotLeftTo, NotRightTo etc)"); } } //-------------------------------------------------------------------- @@ -350,10 +363,16 @@ GenerateData() // Divide by the number of relpos if (GetNumberOfAngles() != 1) { +#if ITK_VERSION_MAJOR >= 4 + typedef itk::DivideImageFilter DivideFilter; + typename DivideFilter::Pointer divideFilter = DivideFilter::New(); + divideFilter->SetConstant2(GetNumberOfAngles()); +#else typedef itk::DivideByConstantImageFilter DivideFilter; typename DivideFilter::Pointer divideFilter = DivideFilter::New(); - divideFilter->SetInput(m_FuzzyMap); divideFilter->SetConstant(GetNumberOfAngles()); +#endif + divideFilter->SetInput(m_FuzzyMap); divideFilter->Update(); m_FuzzyMap = divideFilter->GetOutput(); } @@ -425,7 +444,6 @@ GenerateData() typename PasteFilterType::Pointer padFilter2 = PasteFilterType::New(); padFilter2->SetSourceImage(working_image); padFilter2->SetDestinationImage(temp); - // DD(input->GetLargestPossibleRegion().GetIndex()); padFilter2->SetDestinationIndex(input->GetLargestPossibleRegion().GetIndex()); padFilter2->SetSourceRegion(working_image->GetLargestPossibleRegion()); padFilter2->Update();