00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __freROIController_h
00023 #define __freROIController_h
00024
00025 #include "freMediaControllerBase.h"
00026 #include "freROI.h"
00027
00028 #include "itkNearestNeighborInterpolateImageFunction.h"
00029 #include "itkWarpImageFilter.h"
00030
00031 namespace FREE
00032 {
00033
00042 freControllerIDMacro(ROIControllerBase, "ROIBase");
00043 template<class TSingleROI>
00044 class ROIControllerBase : public MediaControllerBase< TSingleROI >
00045 {
00046 public:
00047 typedef TSingleROI ComponentType;
00048 typedef ComponentControllerBase<ComponentType> Superclass;
00049 typedef typename Superclass::GenericComponentType GenericComponentType;
00050 typedef typename Superclass::GenericComponentPointer GenericComponentPointer;
00051 typedef typename Superclass::GenericMediaPointer GenericMediaPointer;
00052
00053 itkTypeMacro(ROIControllerBase, MediaControllerBase);
00054
00055 virtual GenericMediaPointer ComputeActualizedMedia(GenericMediaType* pGenericMedia,
00056 GenericMediaType* pGenericTransformationField) const
00057 {
00058
00059 GenericMediaPointer proxy = itk::LightObject::New();
00060 return proxy;
00061 };
00062
00063 virtual GenericMediaPointer ComputeActualizedMediaByFunction(GenericMediaType* pGenericMedia,
00064 GenericMediaType* pGenericTransformationFunction) const
00065 {
00066
00067 GenericMediaPointer proxy = itk::LightObject::New();
00068 return proxy;
00069 };
00070
00071 protected:
00074 ROIControllerBase()
00075 {
00076 this->UpdateControllerID(ControllerID::ROIControllerBase);
00077 this->m_Description = "A single region of interest (ROI), only abstract, not for practical use";
00078 };
00079
00080 virtual void GenerateProfile(CtrlProfile::ControllerProfile& profile,
00081 const SessionComponentCache* pComponentCache,
00082 bool bRegardOldSetup) const
00083 {
00084 Superclass::GenerateProfile(profile, pComponentCache, bRegardOldSetup);
00085
00086 profile.MediaMap().Reset();
00087
00088
00089 profile.Parameters().AddParameter(cParam_ROIOrigin,CtrlProfile::Parameter::PVTDouble,cParamDsc_ROIOrigin,TSingleROI::GetImageDimension(),"0");
00090 profile.Parameters().AddParameter(cParam_ROISize,CtrlProfile::Parameter::PVTDouble,cParamDsc_ROISize,TSingleROI::GetImageDimension(),"1");
00091
00092
00093 profile.MediaMap().AddMedia("media",this->ControllerID(), DAGet,this->GetMediaDimension());
00094 };
00095
00100 virtual void ActualizeMainComponent(ComponentType* pMainComponent,
00101 SessionComponentCache* pComponentCache,
00102 SessionInfo* pSessionInfo,
00103 const unsigned int& iActLevel) const
00104 {
00105 double dSize;
00106 double dOrigin;
00107 for (unsigned int i = 0; i<TSingleROI::GetImageDimension(); i++)
00108 {
00109 try
00110 {
00111 SessionAccessor::GetParameterValue(pComponentCache,cParam_ROIOrigin,dOrigin, i);
00112 SessionAccessor::GetParameterValue(pComponentCache,cParam_ROISize,dSize, i);
00113 }
00114 catchAllNPassMacro("Error while retrieving parameter values.");
00115
00116 pMainComponent->SetOriginPoint(dOrigin, i);
00117 pMainComponent->SetSize(dSize, i);
00118 }
00119
00120 };
00121 };
00122
00131 freControllerIDMacro(ROI2DController, "ROI 2D");
00132 class ROI2DController : public ROIControllerBase< ImageROIBase<2> >
00133 {
00134 public:
00135 typedef ImageROIBase<2> ComponentType;
00136 typedef ROIControllerBase<ComponentType> Superclass;
00137
00138 itkTypeMacro(ROI2DController, ROIControllerBase);
00139
00140 ROI2DController();
00141 };
00142
00151 freControllerIDMacro(ROI3DController, "ROI 3D");
00152 class ROI3DController : public ROIControllerBase< ImageROIBase<3> >
00153 {
00154 public:
00155 typedef ImageROIBase<3> ComponentType;
00156 typedef ROIControllerBase<ComponentType> Superclass;
00157
00158 itkTypeMacro(ROI3DController, ROIControllerBase);
00159
00160 ROI3DController();
00161 };
00162
00163 }
00164
00165 #endif