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 __cmtkScalarImageSimilarity_h_included_
00034 #define __cmtkScalarImageSimilarity_h_included_
00035
00036 #include <cmtkconfig.h>
00037
00038 #include <Base/cmtkScalarImage.h>
00039 #include <Registration/cmtkTypedArraySimilarity.h>
00040
00041 #include <vector>
00042
00043 namespace
00044 cmtk
00045 {
00046
00049
00051 class ScalarImageSimilarityMemory :
00053 public TypedArraySimilarityMemory
00054 {
00055 };
00056
00065 class ScalarImageSimilarity :
00067 public TypedArraySimilarity
00068 {
00069 public:
00071 typedef enum {
00073 MI = 0,
00075 NMI = 1,
00077 RMI = 2,
00079 RNMI = 3,
00081 CR = 4,
00083 CC = 5,
00085 MSD = 6,
00087 PSNR = 7,
00089 DAE = 8,
00091 GradientCorrelation = 9,
00093 PatternIntensity = 10
00094 } ID;
00095
00100 static ReturnType GetMutualInformation( const ScalarImage* image0, const ScalarImage* image1, ScalarImageSimilarityMemory *const memory = NULL );
00101
00106 static ReturnType GetNormalizedMutualInformation( const ScalarImage* image0, const ScalarImage* image1, ScalarImageSimilarityMemory *const memory = NULL );
00107
00109 static ReturnType GetMutualInformation( std::vector<const ScalarImage*>& array0, std::vector<const ScalarImage*>& array1, const bool normalized = false )
00110 {
00111 std::vector<const TypedArray*> data0(array0.size());
00112 std::vector<const TypedArray*> data1(array1.size());
00113 for ( size_t i = 0; i < array0.size(); ++i )
00114 {
00115 data0[i] = array0[i]->GetPixelData();
00116 }
00117 for ( size_t i = 0; i < array1.size(); ++i )
00118 {
00119 data1[i] = array1[i]->GetPixelData();
00120 }
00121 return TypedArraySimilarity::GetMutualInformation( data0, data1, normalized );
00122 }
00123
00125 static ReturnType GetNormalizedMutualInformation( std::vector<const ScalarImage*>& array0, std::vector<const ScalarImage*>& array1 )
00126 {
00127 return GetMutualInformation( array0, array1, true );
00128 }
00129
00132 static ReturnType GetRegionalMutualInformation( const ScalarImage* image0, const ScalarImage* image1, const int radius = 2 );
00133
00136 static ReturnType GetMinusMeanSquaredDifference( const ScalarImage* image0, const ScalarImage* image1 );
00137
00141 static ReturnType GetCrossCorrelation( const ScalarImage* image0, const ScalarImage* image1 );
00142
00146 static ReturnType GetGradientCorrelation( const ScalarImage* image0, const ScalarImage* image1 );
00147
00151 static ReturnType GetGradientDifference( const ScalarImage* image0, const ScalarImage* image1, const ReturnType Ax = 1, const ReturnType Ay = 1 );
00152
00156 static ReturnType GetPatternIntensity( const ScalarImage* image0, const ScalarImage* image1, const ReturnType sigma = 10, const int radius = 3 );
00157
00161 static ReturnType GetDifferenceImageEntropy( const ScalarImage* image0, const ScalarImage* image1 );
00162
00167 static ReturnType GetDifferenceImageEntropy( const ScalarImage* image0, const ScalarImage* image1, Types::DataItem &scaleFactor );
00168
00169
00173 static ReturnType GetCorrelationRatio( const ScalarImage* image0, const ScalarImage* image1 );
00174
00176 static bool CheckImageDimensions( const ScalarImage* image0, const ScalarImage* image1 );
00177 };
00178
00180
00181 }
00182
00183 #endif // #ifndef __cmtkScalarImageSimilarity_h_included_