00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __freWeightedAddImageFilterController_h
00023 #define __freWeightedAddImageFilterController_h
00024
00025 #include "freBinaryFunctorImageFilterControllerBase.h"
00026
00027 #include "itkWeightedAddImageFilter.h"
00028
00029 namespace FREE
00030 {
00031
00041 freControllerIDMacro(WeightedAddImageFilterControllerBase, "WeightedAddImageFilterBase");
00042 template <class TInputImage>
00043 class WeightedAddImageFilterControllerBase : public BinaryFunctorImageFilterControllerBase< itk::WeightedAddImageFilter<TInputImage, TInputImage, TInputImage> >
00044 {
00045 public:
00046 typedef itk::WeightedAddImageFilter<TInputImage, TInputImage, TInputImage> ComponentType;
00047 typedef BinaryFunctorImageFilterControllerBase<ComponentType> Superclass;
00048 typedef WeightedAddImageFilterControllerBase<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 itkTypeMacro(WeightedAddImageFilterControllerBase, BinaryFunctorImageFilterControllerBase);
00056
00057 DeclareParameterMacro(Alpha);
00058
00059 protected:
00060 WeightedAddImageFilterControllerBase()
00061 {
00062
00063 this->UpdateControllerID(ControllerID::WeightedAddImageFilterControllerBase);
00064 this->m_Description = "Basis for itk::WeightedAddImageFilter";
00065
00066 };
00067
00068 virtual void GenerateProfile(CtrlProfile::ControllerProfile& profile,
00069 const SessionComponentCache* pComponentCache,
00070 bool bRegardOldSetup) const
00071 {
00072 Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00073
00074
00075 profile.Parameters().AddParameter(cParam_Alpha,Parameter::PVTDouble,cParamDsc_Alpha,1,"0.5");
00076 };
00077
00078 virtual void ActualizeMainComponent(ComponentType* pMainComponent,
00079 SessionComponentCache* pComponentCache,
00080 SessionInfo* pSessionInfo,
00081 const unsigned int& iActLevel) const
00082 {
00083 Superclass::ActualizeMainComponent(pMainComponent,pComponentCache, pSessionInfo, iActLevel);
00084
00085 double dAlpha;
00086
00087 try
00088 {
00089 SessionAccessor::GetParameterValue(pComponentCache,cParam_Alpha,dAlpha);
00090 }
00091 catchAllNPassMacro("Error while setting shrink factor.");
00092
00093 pMainComponent->SetAlpha(dAlpha);
00094 };
00095 };
00096
00097 template <class TInputImage>
00098 const char* const WeightedAddImageFilterControllerBase<TInputImage> :: cParam_Alpha = "Alpha";
00099 template <class TInputImage>
00100 const char* const WeightedAddImageFilterControllerBase<TInputImage> :: cParamDsc_Alpha = "Weighting factor between 1st and 2nd image. Pixels of the first image will be weighted by alpha and pixels of the second image by (1 - alpha).";
00101
00107 freControllerIDMacro(WeightedAdd2DImageFilterController, "Weighted Add 2D Image Filter");
00108 class WeightedAdd2DImageFilterController : public WeightedAddImageFilterControllerBase< ImageTypes<2>::InternalImageType >
00109 {
00110 public:
00111 typedef WeightedAddImageFilterControllerBase< ImageTypes<2>::InternalImageType > Superclass;
00112 typedef WeightedAdd2DImageFilterController Self;
00113
00114 typedef Superclass::ComponentType ComponentType;
00115 typedef ComponentType::Pointer ComponentPointer;
00116 typedef Superclass::GenericComponentType GenericComponentType;
00117 typedef Superclass::GenericComponentPointer GenericComponentPointer;
00118 typedef Superclass::GenericMediaPointer GenericMediaPointer;
00119
00120 itkTypeMacro(WeightedAdd2DImageFilterController, WeightedAddImageFilterControllerBase);
00121
00122 WeightedAdd2DImageFilterController();
00123 };
00124
00130 freControllerIDMacro(WeightedAdd3DImageFilterController, "Weighted Add 3D Image Filter");
00131 class WeightedAdd3DImageFilterController : public WeightedAddImageFilterControllerBase< ImageTypes<3>::InternalImageType >
00132 {
00133 public:
00134 typedef WeightedAddImageFilterControllerBase< ImageTypes<3>::InternalImageType > Superclass;
00135 typedef WeightedAdd3DImageFilterController Self;
00136
00137 typedef Superclass::ComponentType ComponentType;
00138 typedef ComponentType::Pointer ComponentPointer;
00139 typedef Superclass::GenericComponentType GenericComponentType;
00140 typedef Superclass::GenericComponentPointer GenericComponentPointer;
00141 typedef Superclass::GenericMediaPointer GenericMediaPointer;
00142
00143 itkTypeMacro(WeightedAdd3DImageFilterController, WeightedAddImageFilterControllerBase);
00144
00145 WeightedAdd3DImageFilterController();
00146 };
00147
00148 }
00149
00150 #endif