freImageRegistrationControllerBase.txx

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: freImageRegistrationControllerBase.txx,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 __freImageRegistrationControllerBase_txx
00023 #define __freImageRegistrationControllerBase_txx
00024 
00025 #include "freImageRegistrationControllerBase.h"
00026 #include "freSessionAccessor.h"
00027 #include "freIntensityImageMediaController.h"
00028 
00029 namespace FREE
00030 {
00034 
00035 template <class TControlledProcessor>
00036 const char* const ImageRegistrationControllerBase<TControlledProcessor>
00037 :: MediaID_movingImage = "movingImage";
00038 
00039 template <class TControlledProcessor>
00040 const char* const ImageRegistrationControllerBase<TControlledProcessor>
00041 :: MediaIDDsc_movingImage = "Media that should be used as moving image of the registration.";
00042 
00043 template <class TControlledProcessor>
00044 const char* const ImageRegistrationControllerBase<TControlledProcessor>
00045 :: MediaID_fixedImage = "fixedImage";
00046 
00047 template <class TControlledProcessor>
00048 const char* const ImageRegistrationControllerBase<TControlledProcessor>
00049 :: MediaIDDsc_fixedImage = "Media that should be used as fixed image of the registration.";
00050 
00051 template <class TControlledProcessor>
00052 ImageRegistrationControllerBase<TControlledProcessor>::
00053 ImageRegistrationControllerBase()
00054 {
00055   this->UpdateControllerID(ControllerID::ImageRegistrationControllerBase);
00056   this->m_Description = "Base class for registration processor controller; not for practical use.";
00057 };
00058 
00059 template <class TControlledProcessor>
00060 void
00061 ImageRegistrationControllerBase<TControlledProcessor>::
00062 GenerateProfile(CtrlProfile::ControllerProfile& profile, 
00063                 const SessionComponentCache* pComponentCache,
00064                 bool bRegardOldSetup) const
00065 {
00066   Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00067 
00068   //Subcomponents
00069   profile.SubComponents().AddSubComponent(cComp_ROI,0);
00070 
00071 
00072   //media
00073   profile.MediaMap().AddMedia(MediaID_movingImage,ControllerID::IntensityImageMediaControllerBase, DASet,ComponentType::ImageDimension);
00074   profile.MediaMap().AddMedia(MediaID_fixedImage,ControllerID::IntensityImageMediaControllerBase, DASet,ComponentType::ImageDimension);
00075 
00076   //Requirements
00077   CtrlProfile::ProfileOption* pOption;
00078   //ROI
00079   pOption = profile.Requirements().AddRequirement(cComp_ROI)->AddProfileOption();
00080   pOption->Inheritance().AddAncestor(ControllerID::ROICoupleControllerBase);
00081   pOption->CheckForInheritance();
00082   pOption->MediaMap().AddMedia("movingROI",ControllerID::ROICoupleControllerBase, DASet, TControlledProcessor::ImageDimension,1,true);
00083   pOption->MediaMap().AddMedia("fixedROI",ControllerID::ROICoupleControllerBase, DASet, TControlledProcessor::ImageDimension,1,true);
00084   pOption->CheckForIO();
00085 };
00086 
00087 
00088 template <class TControlledProcessor>
00089 typename ImageRegistrationControllerBase<TControlledProcessor>::GenericMediaPointer
00090 ImageRegistrationControllerBase<TControlledProcessor>::
00091 GetMediaCasted(const MediaID& mediaID,ComponentType* pComponent, SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo) const
00092 {
00093   GenericMediaPointer smpMedia;
00094   if (mediaID == MediaID_movingImage) return GenericMediaPointer(pComponent->GetMovingImage());
00095         if (mediaID == MediaID_fixedImage) return GenericMediaPointer(pComponent->GetFixedImage());
00096 
00097   return Superclass::GetMediaCasted(mediaID, pComponent, pComponentCache, pSessionInfo);
00098 }; 
00099 
00100 template <class TControlledProcessor>
00101 void
00102 ImageRegistrationControllerBase<TControlledProcessor>::
00103 SetMediaCasted(const MediaID& mediaID, GenericMediaType* pMedia, ComponentType* pComponent, SessionComponentCache* pComponentCache,
00104                SessionInfo* pSessionInfo) const
00105 {
00106   if (mediaID == MediaID_movingImage)
00107   {
00108     pComponent->SetMovingImage(dynamic_cast<typename ComponentType::ImageType*>(pMedia));
00109     this->ActualizeMediaValidityTag(MediaID_movingImage,pComponentCache);
00110   }
00111         else if (mediaID == MediaID_fixedImage)
00112   {
00113     pComponent->SetFixedImage(dynamic_cast<typename ComponentType::ImageType*>(pMedia));
00114     this->ActualizeMediaValidityTag(MediaID_fixedImage,pComponentCache);
00115   }
00116   else Superclass::SetMediaCasted(mediaID, pMedia, pComponent, pComponentCache, pSessionInfo);
00117 }; 
00118 
00119 } //end of namespace FREE
00120 
00121 #endif

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