freROICoupleController.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freROICoupleController.h,v $
00007   Language:  C++
00008 
00009 
00010 
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016 
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
00020 
00021 =========================================================================*/
00022 #ifndef __freROICoupleController_h
00023 #define __freROICoupleController_h
00024 
00025 #include "freMediaControllerBase.h"
00026 #include "freROI.h"
00027 
00028 #include "itkNearestNeighborInterpolateImageFunction.h"
00029 #include "itkWarpImageFilter.h" 
00030 
00031 namespace FREE
00032 {
00041   freControllerIDMacro(ROICoupleControllerBase, "ROICoupleBase");
00042 template<class TCoupleROI>
00043 class ROICoupleControllerBase : public MediaControllerBase< TCoupleROI >
00044 {
00045 public:  
00046   typedef TCoupleROI ComponentType;
00047   typedef ComponentControllerBase<ComponentType> Superclass;
00048   typedef typename Superclass::GenericComponentType GenericComponentType;
00049   typedef typename Superclass::GenericComponentPointer GenericComponentPointer;
00050   typedef typename Superclass::GenericMediaPointer GenericMediaPointer;
00051 
00052   itkTypeMacro(ROICoupleControllerBase, MediaControllerBase);
00053 
00054   virtual GenericMediaPointer ComputeActualizedMedia(GenericMediaType* pGenericMedia,
00055                                                      GenericMediaType* pGenericTransformationField) const
00056         {
00057                 //TODO
00058                 GenericMediaPointer proxy = itk::LightObject::New();
00059                 return proxy;
00060         };
00061 
00062   virtual GenericMediaPointer ComputeActualizedMediaByFunction(GenericMediaType* pGenericMedia,
00063                                                                GenericMediaType* pGenericTransformationFunction) const
00064         {
00065                 //TODO
00066                 GenericMediaPointer proxy = itk::LightObject::New();
00067                 return proxy;
00068         };
00069 
00070 protected:
00073   ROICoupleControllerBase()
00074   {
00075     this->UpdateControllerID(ControllerID::ROICoupleControllerBase);
00076     this->m_Description = "A couple of ROIs (e.g. for registration, only abstrace, not for practical use";
00077   };
00078 
00079   virtual void GenerateProfile(CtrlProfile::ControllerProfile& profile,
00080                                const SessionComponentCache* pComponentCache,
00081                                bool bRegardOldSetup) const
00082   {
00083     Superclass::GenerateProfile(profile, pComponentCache, bRegardOldSetup);
00084 
00085     profile.MediaMap().Reset();
00086 
00087     //Parameter info
00088     profile.Parameters().AddParameter(cParam_ROI_M_Origin,Parameter::PVTDouble,cParamDsc_ROI_M_Origin,TCoupleROI::GetImageDimension(),"0",1,false,1);
00089     profile.Parameters().AddParameter(cParam_ROI_M_Size,Parameter::PVTDouble,cParamDsc_ROI_M_Size,TCoupleROI::GetImageDimension(),"1",1,false,1);
00090     profile.Parameters().AddParameter(cParam_ROI_F_Origin,Parameter::PVTDouble,cParamDsc_ROI_F_Origin,TCoupleROI::GetImageDimension(),"0",1,false,2);
00091     profile.Parameters().AddParameter(cParam_ROI_F_Size,Parameter::PVTDouble,cParamDsc_ROI_F_Size,TCoupleROI::GetImageDimension(),"1",1,false,2);
00092 
00093     //Media
00094     profile.MediaMap().AddMedia("media",this->ControllerID(), DAGet,this->GetMediaDimension());
00095   };
00096 
00101         virtual void ActualizeMainComponent(ComponentType* pMainComponent,
00102                                       SessionComponentCache* pComponentCache,
00103                                       SessionInfo* pSessionInfo,
00104                                                                                                                                                         const unsigned int& iActLevel) const
00105   {
00106     double dSize;
00107     double dOrigin;
00108     for (unsigned int i = 0; i<TCoupleROI::GetImageDimension(); i++)
00109     {
00110       try
00111       {
00112         SessionAccessor::GetParameterValue(pComponentCache,cParam_ROI_M_Origin,dOrigin, i);
00113         SessionAccessor::GetParameterValue(pComponentCache,cParam_ROI_M_Size,dSize, i);
00114       }
00115       catchAllNPassMacro("Error while retrieving parameter values.");    
00116 
00117       pMainComponent->Moving().SetOriginPoint(dOrigin, i);
00118       pMainComponent->Moving().SetSize(dSize, i);
00119 
00120       try
00121       {
00122         SessionAccessor::GetParameterValue(pComponentCache,cParam_ROI_F_Origin,dOrigin, i);
00123         SessionAccessor::GetParameterValue(pComponentCache,cParam_ROI_F_Size,dSize, i);
00124       }
00125       catchAllNPassMacro("Error while retrieving parameter values.");    
00126     
00127       pMainComponent->Fixed().SetOriginPoint(dOrigin, i);
00128       pMainComponent->Fixed().SetSize(dSize, i);
00129 
00130     }
00131   };
00132 };
00133 
00142   freControllerIDMacro(ROICouple2DController, "ROI Couple 2D");
00143 class ROICouple2DController : public ROICoupleControllerBase< ImageROICoupleBase<2> >
00144 {
00145 public:  
00146   typedef ImageROICoupleBase<2> ComponentType;
00147   typedef ROICoupleControllerBase<ComponentType> Superclass;
00148 
00149   itkTypeMacro(ROICouple2DController, ROICoupleControllerBase);
00150 
00151   ROICouple2DController();
00152 };
00153 
00162   freControllerIDMacro(ROICouple3DController, "ROI Couple 3D");
00163 class ROICouple3DController : public ROICoupleControllerBase< ImageROICoupleBase<3> >
00164 {
00165 public:  
00166   typedef ImageROICoupleBase<3> ComponentType;
00167   typedef ROICoupleControllerBase<ComponentType> Superclass;
00168 
00169   itkTypeMacro(ROICouple3DController, ROICoupleControllerBase);
00170 
00171   ROICouple3DController();
00172 };
00173 
00174 } //end of namespace free
00175 
00176 #endif

Generated at Sat Oct 13 17:27:13 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000