00001 /* 00002 // 00003 // Copyright 1997-2009 Torsten Rohlfing 00004 // 00005 // Copyright 2004-2010 SRI International 00006 // 00007 // This file is part of the Computational Morphometry Toolkit. 00008 // 00009 // http://www.nitrc.org/projects/cmtk/ 00010 // 00011 // The Computational Morphometry Toolkit is free software: you can 00012 // redistribute it and/or modify it under the terms of the GNU General Public 00013 // License as published by the Free Software Foundation, either version 3 of 00014 // the License, or (at your option) any later version. 00015 // 00016 // The Computational Morphometry Toolkit is distributed in the hope that it 00017 // will be useful, but WITHOUT ANY WARRANTY; without even the implied 00018 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License along 00022 // with the Computational Morphometry Toolkit. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 // 00025 // $Revision: 2578 $ 00026 // 00027 // $LastChangedDate: 2010-12-01 14:27:46 -0800 (Wed, 01 Dec 2010) $ 00028 // 00029 // $LastChangedBy: torstenrohlfing $ 00030 // 00031 */ 00032 00033 #ifndef __cmtkImagePairSimilarityMeasure_h_included_ 00034 #define __cmtkImagePairSimilarityMeasure_h_included_ 00035 00036 #include <cmtkconfig.h> 00037 00038 #include <Base/cmtkUniformVolume.h> 00039 #include <Base/cmtkTypes.h> 00040 #include <Base/cmtkFunctional.h> 00041 #include <Base/cmtkUniformVolumeInterpolatorBase.h> 00042 00043 #include <System/cmtkSmartPtr.h> 00044 00045 namespace 00046 cmtk 00047 { 00048 00051 00054 class ImagePairSimilarityMeasure 00055 { 00056 public: 00058 typedef ImagePairSimilarityMeasure Self; 00059 00061 typedef SmartPointer<Self> SmartPtr; 00062 00064 typedef Functional::ReturnType ReturnType; 00065 00068 ImagePairSimilarityMeasure 00069 ( const UniformVolume::SmartConstPtr& refVolume, 00070 const UniformVolume::SmartConstPtr& fltVolume, 00071 const Interpolators::InterpolationEnum interpolation = Interpolators::DEFAULT 00072 ); 00073 00076 ImagePairSimilarityMeasure() {}; 00077 00079 virtual ~ImagePairSimilarityMeasure() {}; 00080 00082 virtual void SetReferenceVolume( const UniformVolume::SmartConstPtr& refVolume ); 00083 00087 virtual void SetFloatingVolume( const UniformVolume::SmartConstPtr& fltVolume ); 00088 00090 virtual void Reset() {} 00091 00093 Types::DataItem GetSampleX ( const size_t index ) const 00094 { 00095 Types::DataItem data; 00096 this->m_ReferenceData->Get( data, index ); 00097 return data; 00098 } 00099 00101 bool GetSampleX ( Types::DataItem& sample, const size_t index ) const 00102 { 00103 return this->m_ReferenceData->Get( sample, index ); 00104 } 00105 00107 size_t GetNumberOfSamplesX() const 00108 { 00109 return this->m_ReferenceData->GetDataSize(); 00110 } 00111 00113 const Types::DataItemRange GetDataRangeX() const 00114 { 00115 return this->m_ReferenceData->GetRange(); 00116 } 00117 00119 Types::DataItem GetSampleY( const int* index, const Types::Coordinate* frac ) const 00120 { 00121 return this->m_FloatingImageInterpolator->GetDataDirect( index, frac ); 00122 } 00123 00125 size_t GetNumberOfSamplesY() const 00126 { 00127 return this->m_FloatingData->GetDataSize(); 00128 } 00129 00131 const Types::DataItemRange GetDataRangeY() const 00132 { 00133 return this->m_FloatingData->GetRange(); 00134 } 00135 00137 virtual Types::DataItem GetFloatingValueScaled( const Types::DataItem value ) const 00138 { 00139 return value; 00140 } 00141 00143 virtual Self::ReturnType Get() const = 0; 00144 00145 private: 00147 UniformVolume::SmartConstPtr m_ReferenceVolume; 00148 00150 TypedArray::SmartConstPtr m_ReferenceData; 00151 00153 UniformVolume::SmartConstPtr m_FloatingVolume; 00154 00156 TypedArray::SmartConstPtr m_FloatingData; 00157 00159 Interpolators::InterpolationEnum m_InterpolationMethod; 00160 00162 cmtk::UniformVolumeInterpolatorBase::SmartConstPtr m_FloatingImageInterpolator; 00163 }; 00164 00166 00167 } // namespace cmtk 00168 00169 #endif // #ifndef __cmtkImagePairSimilarityMeasure_h_included_