00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __freIterativeInverseDeformationFieldImageFilterController_h
00023 #define __freIterativeInverseDeformationFieldImageFilterController_h
00024
00025 #include "freImageToImageFilterControllerBase.h"
00026 #include "freTransformFieldMediaController.h"
00027 #include "freInterpolatorControllerBase.h"
00028
00029 #include "itkIterativeInverseDeformationFieldImageFilter.h"
00030
00031 namespace FREE
00032 {
00033
00043 freControllerIDMacro(IterativeInverseDeformationFieldImageFilterControllerBase, "IterativeInverseDeformationFieldImageFilterBase");
00044 template <class TInputImage>
00045 class IterativeInverseDeformationFieldImageFilterControllerBase : public ImageToImageFilterControllerBase< itk::IterativeInverseDeformationFieldImageFilter<TInputImage, TInputImage> >
00046 {
00047 public:
00048 typedef itk::IterativeInverseDeformationFieldImageFilter<TInputImage, TInputImage> ComponentType;
00049 typedef ImageToImageFilterControllerBase<ComponentType> Superclass;
00050 typedef IterativeInverseDeformationFieldImageFilterControllerBase<TInputImage> Self;
00051
00052 typedef typename ComponentType::Pointer ComponentPointer;
00053 typedef typename Superclass::GenericComponentType GenericComponentType;
00054 typedef typename Superclass::GenericComponentPointer GenericComponentPointer;
00055 typedef typename Superclass::GenericMediaPointer GenericMediaPointer;
00056
00057 DeclareParameterMacro(InverseIterations);
00058 DeclareParameterMacro(InverseError);
00059
00060 itkTypeMacro(IterativeInverseDeformationFieldImageFilterControllerBase, ImageToImageFilterControllerBase);
00061
00062 protected:
00063 IterativeInverseDeformationFieldImageFilterControllerBase()
00064 {
00065
00066 this->UpdateControllerID(ControllerID::IterativeInverseDeformationFieldImageFilterControllerBase);
00067 this->m_Description = "Basis for itk::IterativeInverseDeformationFieldImageFilter";
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_InverseIterations,Parameter::PVTInteger,cParamDsc_InverseIterations,1,"5");
00078 profile.Parameters().AddParameter(cParam_InverseError,Parameter::PVTDouble,cParamDsc_InverseError,1,"0.001");
00079
00080
00081 profile.MediaMap().AddMedia("input",ControllerID::TransformFieldMediaControllerBase,DASet,ComponentType::InputImageType::ImageDimension);
00082 profile.MediaMap().AddMedia("output",ControllerID::TransformFieldMediaControllerBase,DAGet,ComponentType::InputImageType::ImageDimension);
00083 };
00084
00085 virtual void ActualizeMainComponent(ComponentType* pMainComponent,
00086 SessionComponentCache* pComponentCache,
00087 SessionInfo* pSessionInfo,
00088 const unsigned int& iActLevel) const
00089 {
00090 Superclass::ActualizeMainComponent(pMainComponent,pComponentCache, pSessionInfo, iActLevel);
00091
00092 double dError;
00093 int iIterationCount;
00094
00095 try
00096 {
00097 SessionAccessor::GetParameterValue(pComponentCache,cParam_InverseIterations,iIterationCount);
00098 SessionAccessor::GetParameterValue(pComponentCache,cParam_InverseError,dError);
00099 }
00100 catchAllNPassMacro("Error while retrieving parameter values.");
00101
00102 pMainComponent->SetNumberOfIterations(iIterationCount);
00103 pMainComponent->SetStopValue(dError);
00104 };
00105
00106 };
00107
00108 template <class TInputImage>
00109 const char* const IterativeInverseDeformationFieldImageFilterControllerBase<TInputImage> :: cParam_InverseIterations = "InverseIterations";
00110 template <class TInputImage>
00111 const char* const IterativeInverseDeformationFieldImageFilterControllerBase<TInputImage> :: cParamDsc_InverseIterations = "Number of iterations used to invert the transformation field.";
00112 template <class TInputImage>
00113 const char* const IterativeInverseDeformationFieldImageFilterControllerBase<TInputImage> :: cParam_InverseError = "InverseError";
00114 template <class TInputImage>
00115 const char* const IterativeInverseDeformationFieldImageFilterControllerBase<TInputImage> :: cParamDsc_InverseError = "Maximum error allowed when inverting the transformation field.";
00116
00122 freControllerIDMacro(IterativeInverseDeformationField2DImageFilterController, "Iterative Inverse Deformation Field 2D Image Filter");
00123 class IterativeInverseDeformationField2DImageFilterController : public IterativeInverseDeformationFieldImageFilterControllerBase< ImageTypes<2>::TransformationFieldType >
00124 {
00125 public:
00126 typedef IterativeInverseDeformationFieldImageFilterControllerBase< ImageTypes<2>::TransformationFieldType> Superclass;
00127 typedef IterativeInverseDeformationField2DImageFilterController Self;
00128
00129 typedef Superclass::ComponentType ComponentType;
00130 typedef ComponentType::Pointer ComponentPointer;
00131 typedef Superclass::GenericComponentType GenericComponentType;
00132 typedef Superclass::GenericComponentPointer GenericComponentPointer;
00133 typedef Superclass::GenericMediaPointer GenericMediaPointer;
00134
00135 itkTypeMacro(IterativeInverseDeformationField2DImageFilterController, IterativeInverseDeformationFieldImageFilterControllerBase);
00136
00137 IterativeInverseDeformationField2DImageFilterController();
00138 };
00139
00145 freControllerIDMacro(IterativeInverseDeformationField3DImageFilterController, "Iterative Inverse Deformation Field 3D Image Filter");
00146 class IterativeInverseDeformationField3DImageFilterController : public IterativeInverseDeformationFieldImageFilterControllerBase< ImageTypes<3>::TransformationFieldType >
00147 {
00148 public:
00149 typedef IterativeInverseDeformationFieldImageFilterControllerBase< ImageTypes<3>::TransformationFieldType> Superclass;
00150 typedef IterativeInverseDeformationField3DImageFilterController Self;
00151
00152 typedef Superclass::ComponentType ComponentType;
00153 typedef ComponentType::Pointer ComponentPointer;
00154 typedef Superclass::GenericComponentType GenericComponentType;
00155 typedef Superclass::GenericComponentPointer GenericComponentPointer;
00156 typedef Superclass::GenericMediaPointer GenericMediaPointer;
00157
00158 itkTypeMacro(IterativeInverseDeformationField3DImageFilterController, IterativeInverseDeformationFieldImageFilterControllerBase);
00159
00160 IterativeInverseDeformationField3DImageFilterController();
00161 };
00162
00163 }
00164
00165 #endif