From d8115ca2c9f25daea15a64644e56e005adfb720c Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Mon, 26 Sep 2011 09:01:31 +0200 Subject: [PATCH] Add PrintOptions and change orientation type names --- ...tivePositionConstraintToLabelImageFilter.h | 5 +- ...vePositionConstraintToLabelImageFilter.txx | 68 ++++++++++++++----- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/itk/clitkAddRelativePositionConstraintToLabelImageFilter.h b/itk/clitkAddRelativePositionConstraintToLabelImageFilter.h index 6e578db..fa5e95b 100644 --- a/itk/clitkAddRelativePositionConstraintToLabelImageFilter.h +++ b/itk/clitkAddRelativePositionConstraintToLabelImageFilter.h @@ -78,7 +78,7 @@ namespace clitk { typedef itk::Image FloatImageType; /** Orientation types */ - typedef enum { AtRightTo = 0, AtLeftTo = 1, + typedef enum { RightTo = 0, LeftTo = 1, AntTo = 2, PostTo = 3, InfTo = 4, SupTo = 5, Angle = 6 } OrientationTypeEnumeration; @@ -130,6 +130,9 @@ namespace clitk { // I dont want to verify inputs information virtual void VerifyInputInformation() { } + + // For debug + void PrintOptions(); protected: AddRelativePositionConstraintToLabelImageFilter(); diff --git a/itk/clitkAddRelativePositionConstraintToLabelImageFilter.txx b/itk/clitkAddRelativePositionConstraintToLabelImageFilter.txx index 54f4311..694910c 100644 --- a/itk/clitkAddRelativePositionConstraintToLabelImageFilter.txx +++ b/itk/clitkAddRelativePositionConstraintToLabelImageFilter.txx @@ -121,22 +121,22 @@ clitk::AddRelativePositionConstraintToLabelImageFilter:: AddOrientationTypeString(std::string t) { m_OrientationTypeString.push_back(t); - switch (t[0]) { - case 'L' : AddOrientationType(AtLeftTo); break; - case 'R' : AddOrientationType(AtRightTo);break; - case 'A' : AddOrientationType(AntTo);break; - case 'P' : AddOrientationType(PostTo);break; - case 'S' : AddOrientationType(SupTo);break; - case 'I' : AddOrientationType(InfTo);break; - 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)"); - } + + if (t == "LeftTo") { AddOrientationType(LeftTo); return; } + if (t == "RightTo") { AddOrientationType(RightTo); return; } + if (t == "AntTo") { AddOrientationType(AntTo); return; } + if (t == "PostTo") { AddOrientationType(PostTo); return; } + if (t == "SupTo") { AddOrientationType(SupTo); return; } + if (t == "InfTo") { AddOrientationType(InfTo); return; } + + if (t == "NotLeftTo") { AddOrientationType(LeftTo); InverseOrientationFlagOn(); return; } + if (t == "NotRightTo") { AddOrientationType(RightTo); InverseOrientationFlagOn(); return; } + if (t == "NotAntTo") { AddOrientationType(AntTo); InverseOrientationFlagOn(); return; } + if (t == "NotPostTo") { AddOrientationType(PostTo); InverseOrientationFlagOn(); return; } + if (t == "NotSupTo") { AddOrientationType(SupTo); InverseOrientationFlagOn(); return; } + if (t == "NotInfTo") { AddOrientationType(InfTo); InverseOrientationFlagOn(); return; } + + clitkExceptionMacro("Error, you must provide LeftTo,RightTo or AntTo,PostTo or SupTo,InfTo (or NotLeftTo, NotRightTo etc) but you give " << t); } //-------------------------------------------------------------------- @@ -192,11 +192,11 @@ AddOrientationType(OrientationTypeEnumeration orientation) { m_OrientationType.push_back(orientation); switch (orientation) { - case AtRightTo: + case RightTo: m_Angle1.push_back(clitk::deg2rad(0)); m_Angle2.push_back(clitk::deg2rad(0)); break; - case AtLeftTo: + case LeftTo: m_Angle1.push_back(clitk::deg2rad(180)); m_Angle2.push_back(clitk::deg2rad(0)); break; @@ -230,6 +230,26 @@ AddOrientationType(OrientationTypeEnumeration orientation) //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +template +void +clitk::AddRelativePositionConstraintToLabelImageFilter:: +PrintOptions() +{ + DD((int)this->GetBackgroundValue()); + DD((int)this->GetObjectBackgroundValue()); + DDV(this->GetOrientationTypeString(), (uint)this->GetNumberOfAngles()); + DD(this->GetIntermediateSpacingFlag()); + DD(this->GetIntermediateSpacing()); + DD(this->GetFuzzyThreshold()); + DD(this->GetAutoCropFlag()); + DD(this->GetInverseOrientationFlag()); + DD(this->GetRemoveObjectFlag()); + DD(this->GetCombineWithOrFlag()); +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- template void @@ -240,6 +260,18 @@ GenerateData() clitkExceptionMacro("Add at least one orientation type"); } + if (GetVerboseOptionFlag()) { + for(int i=0; i(itk::ProcessObject::GetInput(0)); object = dynamic_cast(itk::ProcessObject::GetInput(1)); -- 2.47.1