Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __cmtkFunctionalAffine2D_h_included_
00034 #define __cmtkFunctionalAffine2D_h_included_
00035
00036 #include <cmtkconfig.h>
00037
00038 #include <System/cmtkSmartPtr.h>
00039
00040 #include <Base/cmtkFunctional.h>
00041 #include <Base/cmtkMacros.h>
00042 #include <Base/cmtkScalarImage.h>
00043 #include <Base/cmtkMatrix3x3.h>
00044 #include <Base/cmtkHistogram.h>
00045 #include <Base/cmtkJointHistogram.h>
00046
00047 #include <Registration/cmtkScalarImageSimilarity.h>
00048
00049 #include <vector>
00050
00051 namespace
00052 cmtk
00053 {
00054
00057
00060 class FunctionalAffine2D :
00062 public Functional
00063 {
00065 cmtkGetSetMacro(int,NumberDOFs);
00066
00068 cmtkGetSetMacro(ScalarImageSimilarity::ID,SimilarityMeasure);
00069
00071 cmtkGetSetMacro(bool,HistogramEqualization);
00072
00073 public:
00075 typedef FunctionalAffine2D Self;
00076
00078 typedef SmartPointer<Self> SmartPtr;
00079
00081 typedef Functional Superclass;
00082
00084 FunctionalAffine2D( ScalarImage::SmartPtr& refImage, ScalarImage::SmartPtr& fltImage, const ScalarImage::RegionType* fltROI = NULL );
00085
00087 FunctionalAffine2D( std::vector<ScalarImage::SmartPtr>& refImage, std::vector<ScalarImage::SmartPtr>& fltImage, const ScalarImage::RegionType* fltROI = NULL );
00088
00090 ~FunctionalAffine2D() {};
00091
00093 virtual void SetRefImage( ScalarImage::SmartPtr& refImage )
00094 {
00095 this->RefImages.clear();
00096 this->RefImages.push_back( refImage );
00097 }
00098
00100 virtual void SetRefImages
00101 ( std::vector<ScalarImage::SmartPtr>& refImages )
00102 {
00103 this->RefImages = refImages;
00104 }
00105
00107 virtual void SetFltImage( ScalarImage::SmartPtr& fltImage )
00108 {
00109 this->FltImages.clear();
00110 this->FltImagesROI.clear();
00111 this->FltImages.push_back( fltImage );
00112 this->FltImagesROI.push_back( fltImage );
00113 }
00114
00116 virtual void SetFltImages
00117 ( std::vector<ScalarImage::SmartPtr>& fltImages )
00118 {
00119 this->FltImages = fltImages;
00120 this->FltImagesROI = fltImages;
00121 }
00122
00124 void SetNumberOfBins( const size_t minBins, const size_t maxBins = 0 );
00125
00127 virtual Self::ReturnType Evaluate();
00128
00130 virtual Self::ReturnType EvaluateAt( CoordinateVector& v );
00131
00133 virtual Self::ReturnType EvaluateWithGradient( CoordinateVector&, CoordinateVector&, const Types::Coordinate = 1 )
00134 { return 0; }
00135
00136
00138 virtual void SetParamVector( CoordinateVector& v );
00139
00144 virtual void GetParamVector( CoordinateVector& v );
00145
00147 virtual size_t ParamVectorDim() const { return 8; }
00148
00150 virtual size_t VariableParamVectorDim() const { return this->m_NumberDOFs; }
00151
00153 virtual Types::Coordinate GetParamStep( const size_t idx, const Types::Coordinate mmStep = 1 ) const;
00154
00155 private:
00157 std::vector<ScalarImage::SmartPtr> RefImages;
00158
00160 std::vector<ScalarImage::SmartPtr> FltImages;
00161
00166 std::vector<ScalarImage::SmartPtr> FltImagesROI;
00167
00169 mutable ScalarImageSimilarityMemory ImageSimilarityMemory;
00170
00172 Self::ReturnType GetSimilarity( const ScalarImage* img0, const ScalarImage* img1 ) const;
00173
00175 Self::ReturnType GetSimilarity( std::vector<const ScalarImage*>& imgs0, std::vector<const ScalarImage*>& imgs1 ) const;
00176
00178 CoordinateVector Parameters;
00179
00181 CoordinateMatrix3x3 Transformation;
00182 };
00183
00185
00186 }
00187
00188 #endif // #ifndef __cmtkFunctionalAffine2D_h_included_