Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkMetric.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 
00011 #ifndef __mitkMetric_h
00012 #define __mitkMetric_h
00013 
00014 #include "mitkProcessObject.h"
00015 #include "mitkTransform.h"
00016 #include "mitkInterpolateFilter.h"
00017 #include "mitkRCPtr.h"
00018 
00019 #define INVALID_PIXEL   1e10
00020 #define YITA            1e-10
00021 
00032 
00033 #ifdef MITK_REGISTRATION_USE_HISTOGRAM
00034 class mitkHistogram;
00035 #endif
00036 
00037 class MITK_REGISTRATION_API mitkMetric : public mitkProcessObject
00038 {
00039 public:
00040     MITK_TYPE(mitkMetric, mitkProcessObject)    
00041     virtual void PrintSelf(ostream &os);
00042 
00047     void SetFixedVolume(mitkVolume *fixedVolume) {m_FixedVolume = fixedVolume;}
00048 
00053     mitkVolume* GetFixedVolume() {return m_FixedVolume;}
00054 
00059     void SetMovingVolume(mitkVolume *movingVolume) {m_MovingVolume = movingVolume;}
00060 
00065     mitkVolume* GetMovingVolume() {return m_MovingVolume;}
00066 
00071     void SetInterpolator(mitkInterpolateFilter *interpolator) {m_Interpolator = interpolator;}
00072 
00077     mitkInterpolateFilter* GetInterpolator();
00078 
00083     void SetTransform(mitkTransform *transform) {m_Transform = transform;}
00084 
00089     mitkTransform* GetTransform();
00090 
00095     void SetTransformParameters(const VectorParameterType & parameters);
00096 
00101     VectorParameterType & GetTransformParameters();
00102 
00107     virtual void Update();
00108 
00113     ScalarParameterType GetSimilarity() {return m_Similarity;}
00114 
00121     virtual bool GetSimilarity(const mitkMatrixType *matrix, ScalarParameterType &similarity);
00122 
00129     virtual bool GetSimilarity(const VectorParameterType & parameters, ScalarParameterType &similarity);
00130 
00138     virtual bool GetSimilarityAndDerivative(const VectorParameterType & parameters,
00139                                             ScalarParameterType &       similarity,
00140                                             VectorParameterType &       derivative);
00141 
00146     mitkInterpolateFilter* GetGradientImageInterpolator();
00147 
00152     void SetComputeImageGradientFlag(bool flag);
00153 
00157     void SetInitialTransformMatrix();
00158 
00163     void SetInitialTransformMatrix(mitkMatrixScalarType* matrix);
00164 
00165     void SetRegion(const VectorIndexType& r);
00166 
00167     const VectorIndexType& GetRegion() const;
00168 
00169     const VectorIndexType& GetFixedImageRegion();
00170 
00171 #ifdef MITK_REGISTRATION_USE_HISTOGRAM
00172     void SetHistogramSize(unsigned int x, unsigned int y);
00173     void SetLowerBound(ScalarParameterType x, ScalarParameterType y);
00174     void SetUpperBound(ScalarParameterType x, ScalarParameterType y);
00175 #endif
00176 
00177 protected:
00178     mitkMetric();
00179     virtual ~mitkMetric();  
00180     virtual bool Execute();
00181     virtual void ComputeGradientImage();
00182 #ifdef MITK_REGISTRATION_USE_HISTOGRAM
00183     virtual void ComputeHistogram(const VectorParameterType & parameters, mitkHistogram* histogram = NULL);
00184 #endif
00185 
00186     mitkRCPtr<mitkTransform>                            m_Transform;
00187     mitkRCPtr<mitkInterpolateFilter>                    m_Interpolator;
00188     mitkRCPtr<mitkInterpolateFilter>                    m_GradientImageInterpolator;
00189 
00190     mitkRCPtr<mitkVolume>                               m_FixedVolume;
00191     mitkRCPtr<mitkVolume>                               m_MovingVolume;
00192     mitkVolumeIteratorBase*                             m_FixedIterator;
00193 
00194     ScalarParameterType                                 m_Similarity;
00195     VectorIndexType                                     m_Region;
00196     int                                                 m_Dimensions[3];
00197 
00198     unsigned int                                        m_ImageDimension;
00199     unsigned int                                        m_ParameterDimension;
00200     unsigned long                                       m_NumberOfPixelsCounted;
00201 
00202     bool                                                m_FlagFirstRun;
00203     bool                                                m_FlagComputeGradient;
00204     bool                                                m_FlagDefinedRegion;
00205 
00206 #ifdef MITK_REGISTRATION_USE_HISTOGRAM
00207     bool                                                m_FlagComputeHistogram;
00208     mitkHistogram*                                      m_Histogram;
00209     VectorIndexType                                     m_HistogramSize;
00210     VectorParameterType                                 m_HistogramLowerBound;
00211     VectorParameterType                                 m_HistogramUpperBound;
00212     double                                              m_UpperBoundIncreaseFactor;
00213 #endif
00214 
00215 
00216 private:
00217     mitkMetric(const mitkMetric&);
00218     void operator = (const mitkMetric&);
00219 
00220 };
00221 
00222 
00223 //#define DEFINED_mitkMetric
00224 
00225 
00226 
00227 #endif
00228 

Generated on Tue Feb 25 15:00:37 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3