00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00069 profile.SubComponents().AddSubComponent(cComp_ROI,0);
00070
00071
00072
00073 profile.MediaMap().AddMedia(MediaID_movingImage,ControllerID::IntensityImageMediaControllerBase, DASet,ComponentType::ImageDimension);
00074 profile.MediaMap().AddMedia(MediaID_fixedImage,ControllerID::IntensityImageMediaControllerBase, DASet,ComponentType::ImageDimension);
00075
00076
00077 CtrlProfile::ProfileOption* pOption;
00078
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 }
00120
00121 #endif