00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __freBinaryThresholdImageFilterController_h
00023 #define __freBinaryThresholdImageFilterController_h
00024
00025 #include "freImageToImageFilterControllerBase.h"
00026
00027 #include "itkBinaryThresholdImageFilter.h"
00028
00029 namespace FREE
00030 {
00031
00041 freControllerIDMacro(BinaryThresholdImageFilterControllerBase, "BinaryThresholdImageFilterBase");
00042 template <class TInputImage>
00043 class BinaryThresholdImageFilterControllerBase : public ImageToImageFilterControllerBase< itk::BinaryThresholdImageFilter<TInputImage, TInputImage> >
00044 {
00045 public:
00046 typedef itk::BinaryThresholdImageFilter<TInputImage, TInputImage> ComponentType;
00047 typedef ImageToImageFilterControllerBase<ComponentType> Superclass;
00048 typedef BinaryThresholdImageFilterControllerBase<TInputImage> Self;
00049
00050 typedef typename ComponentType::Pointer ComponentPointer;
00051 typedef typename Superclass::GenericComponentType GenericComponentType;
00052 typedef typename Superclass::GenericComponentPointer GenericComponentPointer;
00053 typedef typename Superclass::GenericMediaPointer GenericMediaPointer;
00054
00055 DeclareParameterMacro(InsideValue);
00056 DeclareParameterMacro(OutsideValue);
00057 DeclareParameterMacro(LowerThreshold);
00058 DeclareParameterMacro(UpperThreshold);
00059
00060 itkTypeMacro(BinaryThresholdImageFilterControllerBase, ImageToImageFilterControllerBase);
00061
00062 protected:
00063 BinaryThresholdImageFilterControllerBase()
00064 {
00065
00066 this->UpdateControllerID(ControllerID::BinaryThresholdImageFilterControllerBase);
00067 this->m_Description = "Basis for itk::BinaryThresholdImageFilter";
00068 };
00069
00070 virtual void GenerateProfile(CtrlProfile::ControllerProfile& profile,
00071 const SessionComponentCache* pComponentCache,
00072 bool bRegardOldSetup) const
00073 {
00074 Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00075
00076
00077 profile.Parameters().AddParameter(cParam_InsideValue,Parameter::PVTDouble,cParamDsc_InsideValue,1,"1.0");
00078 profile.Parameters().AddParameter(cParam_OutsideValue,Parameter::PVTDouble,cParamDsc_OutsideValue,1,"0.0");
00079 profile.Parameters().AddParameter(cParam_LowerThreshold,Parameter::PVTDouble,cParam_LowerThreshold,1,"0.5");
00080 profile.Parameters().AddParameter(cParam_UpperThreshold,Parameter::PVTDouble,cParam_UpperThreshold,1,"0.5");
00081 };
00082
00083 virtual void ActualizeMainComponent(ComponentType* pMainComponent,
00084 SessionComponentCache* pComponentCache,
00085 SessionInfo* pSessionInfo,
00086 const unsigned int& iActLevel) const
00087 {
00088 Superclass::ActualizeMainComponent(pMainComponent,pComponentCache, pSessionInfo, iActLevel);
00089
00090 double dInsideValue;
00091 double dOutsideValue;
00092 double dLowerThreshold;
00093 double dUpperThreshold;
00094
00095 try
00096 {
00097 SessionAccessor::GetParameterValue(pComponentCache,cParam_InsideValue,dInsideValue);
00098 SessionAccessor::GetParameterValue(pComponentCache,cParam_OutsideValue,dOutsideValue);
00099 SessionAccessor::GetParameterValue(pComponentCache,cParam_LowerThreshold,dLowerThreshold);
00100 SessionAccessor::GetParameterValue(pComponentCache,cParam_UpperThreshold,dUpperThreshold);
00101 }
00102 catchAllNPassMacro("Error while retrieving parameter values.");
00103
00104 pMainComponent->SetInsideValue(dInsideValue);
00105 pMainComponent->SetOutsideValue(dOutsideValue);
00106 pMainComponent->SetLowerThreshold(dLowerThreshold);
00107 pMainComponent->SetUpperThreshold(dUpperThreshold);
00108 };
00109
00110 };
00111
00112 template <class TInputImage>
00113 const char* const BinaryThresholdImageFilterControllerBase<TInputImage> :: cParam_InsideValue = "InsideValue";
00114 template <class TInputImage>
00115 const char* const BinaryThresholdImageFilterControllerBase<TInputImage> :: cParamDsc_InsideValue = "Value of all pixels inside the threshold.";
00116 template <class TInputImage>
00117 const char* const BinaryThresholdImageFilterControllerBase<TInputImage> :: cParam_OutsideValue = "OutsideValue";
00118 template <class TInputImage>
00119 const char* const BinaryThresholdImageFilterControllerBase<TInputImage> :: cParamDsc_OutsideValue = "Value of all pixels outside the threshold.";
00120 template <class TInputImage>
00121 const char* const BinaryThresholdImageFilterControllerBase<TInputImage> :: cParam_LowerThreshold = "LowerThreshold";
00122 template <class TInputImage>
00123 const char* const BinaryThresholdImageFilterControllerBase<TInputImage> :: cParamDsc_LowerThreshold = "The lower threshold.";
00124 template <class TInputImage>
00125 const char* const BinaryThresholdImageFilterControllerBase<TInputImage> :: cParam_UpperThreshold = "UpperThreshold";
00126 template <class TInputImage>
00127 const char* const BinaryThresholdImageFilterControllerBase<TInputImage> :: cParamDsc_UpperThreshold = "The upper threshold.";
00128
00134 freControllerIDMacro(BinaryThreshold2DImageFilterController, "Binary Threshold 2D Image Filter");
00135 class BinaryThreshold2DImageFilterController : public BinaryThresholdImageFilterControllerBase< ImageTypes<2>::InternalImageType >
00136 {
00137 public:
00138 typedef BinaryThresholdImageFilterControllerBase< ImageTypes<2>::InternalImageType > Superclass;
00139 typedef BinaryThreshold2DImageFilterController Self;
00140
00141 typedef Superclass::ComponentType ComponentType;
00142 typedef ComponentType::Pointer ComponentPointer;
00143 typedef Superclass::GenericComponentType GenericComponentType;
00144 typedef Superclass::GenericComponentPointer GenericComponentPointer;
00145 typedef Superclass::GenericMediaPointer GenericMediaPointer;
00146
00147 itkTypeMacro(BinaryThreshold2DImageFilterController, BinaryThresholdImageFilterControllerBase);
00148
00149 BinaryThreshold2DImageFilterController();
00150 };
00151
00157 freControllerIDMacro(BinaryThreshold3DImageFilterController, "Binary Threshold 3D Image Filter");
00158 class BinaryThreshold3DImageFilterController : public BinaryThresholdImageFilterControllerBase< ImageTypes<3>::InternalImageType >
00159 {
00160 public:
00161 typedef BinaryThresholdImageFilterControllerBase< ImageTypes<3>::InternalImageType > Superclass;
00162 typedef BinaryThreshold3DImageFilterController Self;
00163
00164 typedef Superclass::ComponentType ComponentType;
00165 typedef ComponentType::Pointer ComponentPointer;
00166 typedef Superclass::GenericComponentType GenericComponentType;
00167 typedef Superclass::GenericComponentPointer GenericComponentPointer;
00168 typedef Superclass::GenericMediaPointer GenericMediaPointer;
00169
00170 itkTypeMacro(BinaryThreshold3DImageFilterController, BinaryThresholdImageFilterControllerBase);
00171
00172 BinaryThreshold3DImageFilterController();
00173 };
00174
00175 }
00176
00177 #endif