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 __cmtkMultiChannelHistogramRegistrationFunctional_h_included_
00034 #define __cmtkMultiChannelHistogramRegistrationFunctional_h_included_
00035
00036 #include <cmtkconfig.h>
00037
00038 #include <Registration/cmtkMultiChannelRegistrationFunctional.h>
00039
00040 #include <Base/cmtkHashMapSTL.h>
00041 #include <Base/cmtkUniformVolume.h>
00042 #include <Base/cmtkUniformVolumeInterpolator.h>
00043 #include <Base/cmtkLinearInterpolator.h>
00044
00045 #include <System/cmtkSmartPtr.h>
00046
00047 #include <vector>
00048
00049 namespace
00050 cmtk
00051 {
00052
00056 template<class TDataType = float,
00057 class TInterpolator = cmtk::UniformVolumeInterpolator<cmtk::Interpolators::Linear>,
00058 class THashKeyType = unsigned int,
00059 char NBitsPerChannel=6>
00060 class MultiChannelHistogramRegistrationFunctional :
00062 public MultiChannelRegistrationFunctional<TInterpolator>
00063 {
00064 public:
00066 static const char m_HistogramBitsPerChannel = NBitsPerChannel;
00067
00069 typedef MultiChannelHistogramRegistrationFunctional<TDataType,THashKeyType> Self;
00070
00072 typedef SmartPointer<Self> SmartPtr;
00073
00075 typedef MultiChannelRegistrationFunctional<TInterpolator> Superclass;
00076
00078 typedef TDataType DataType;
00079
00081 typedef THashKeyType HashKeyType;
00082
00084 virtual void AddReferenceChannel( UniformVolume::SmartPtr& channel );
00085
00087 virtual void AddFloatingChannel( UniformVolume::SmartPtr& channel );
00088
00090 virtual void ClearAllChannels();
00091
00092 protected:
00094 class MetricData
00095 {
00096 private:
00098 typedef MultiChannelHistogramRegistrationFunctional<TDataType,TInterpolator,THashKeyType,NBitsPerChannel> Parent;
00099
00101 Parent* m_Parent;
00102
00103 public:
00105 typedef MetricData Self;
00106
00108 void Init( Parent *const parent );
00109
00111 typedef HashMapSTL<HashKeyType, int> HashTableType;
00112
00114 HashTableType m_JointHash;
00115
00117 HashTableType m_ReferenceHash;
00118
00120 HashTableType m_FloatingHash;
00121
00123 size_t m_TotalNumberOfSamples;
00124
00126 Self& operator=( const Self& source );
00127
00129 Self& operator+=( const Self& other );
00130
00132 Self& operator-=( const Self& other );
00133
00135 void operator+=( const Types::DataItem* values );
00136
00138 void operator-=( const Types::DataItem* values );
00139 };
00140
00142 MetricData m_MetricData;
00143
00145 virtual void ContinueMetric( MetricData& metricData, const size_t rindex, const Vector3D& fvector );
00146
00148 virtual Functional::ReturnType GetMetric( const MetricData& metricData ) const;
00149
00150 private:
00152 std::vector<TDataType> m_HashKeyScaleRef;
00153
00155 std::vector<TDataType> m_HashKeyScaleFlt;
00156
00158 std::vector<TDataType> m_HashKeyOffsRef;
00159
00161 std::vector<TDataType> m_HashKeyOffsFlt;
00162
00164 size_t m_HashKeyShiftRef;
00165 };
00166
00168
00169 }
00170
00171 #include "cmtkMultiChannelHistogramRegistrationFunctional.txx"
00172 #include "cmtkMultiChannelHistogramRegistrationFunctionalMetricData.txx"
00173
00174 #endif // #ifndef __cmtkMultiChannelHistogramRegistrationFunctional_h_included_