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

mitkNode.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 __mitkNode_h
00012 #define __mitkNode_h
00013 
00014 #include "mitkCommonIncludes.h"
00015 #include "mitkObject.h"
00016 
00017 typedef int Index[3];
00018 
00022 class  MITK_COMMON_API mitkNode : public mitkObject
00023 {
00024 public:
00025     MITK_TYPE(mitkNode,mitkObject)
00026     
00027     mitkNode(){};
00028 
00035     void SetIndex(int x, int y, int z)
00036     {
00037         m_index[0] = x;
00038         m_index[1] = y;
00039         m_index[2] = z;
00040     }
00041 
00048     void SetIndex(Index index)
00049     {
00050         SetIndex(index[0], index[1], index[2]);
00051     }
00052 
00059     void GetIndex(Index index) const
00060     {
00061         index[0] = m_index[0];
00062         index[1] = m_index[1];
00063         index[2] = m_index[2];
00064     }
00065 
00070     void SetValue(double value){m_value = value;}
00071 
00076     double GetValue() const{return this->m_value;}
00077 
00084     bool operator>(const mitkNode &right)
00085     {
00086         return this->m_value > right.GetValue();
00087     }
00088 
00095     bool operator<(const mitkNode &right)
00096     {
00097         return this->m_value < right.GetValue();
00098     }
00099 
00105     mitkNode& operator=(const mitkNode& right)
00106     {
00107         Index index;
00108         right.GetIndex(index);
00109         this->SetIndex(index);
00110         this->SetValue(right.GetValue());
00111         return *this;
00112     }
00113     
00114     virtual ~mitkNode(){};
00115 
00120     mitkNode(const mitkNode& node)
00121     {
00122         Index index;
00123         node.GetIndex(index);
00124         SetIndex(index);
00125         SetValue(node.GetValue());
00126     }
00127 
00128     
00129 private:
00130     Index m_index;
00131     double m_value;
00132 };
00133 
00134 class  MITK_COMMON_API mitkIntNode : public mitkObject
00135 {
00136 public:
00137     MITK_TYPE(mitkIntNode,mitkObject)
00138     
00139     mitkIntNode(){};
00140     void SetIndex(int x, int y, int z)
00141     {
00142         m_index[0] = x;
00143         m_index[1] = y;
00144         m_index[2] = z;
00145     }
00146     void SetIndex(Index index)
00147     {
00148         SetIndex(index[0], index[1], index[2]);
00149     }
00150     void GetIndex(Index index) const
00151     {
00152         index[0] = m_index[0];
00153         index[1] = m_index[1];
00154         index[2] = m_index[2];
00155     }
00156     void SetValue(int value){m_value = value;}
00157     int GetValue() const{return this->m_value;}
00158     bool operator>(const mitkIntNode &right)
00159     {
00160         return this->m_value > right.m_value;
00161     }
00162     bool operator<(const mitkIntNode &right)
00163     {
00164         return this->m_value < right.GetValue();
00165     }
00166     mitkIntNode& operator=(mitkIntNode& right)
00167     {
00168         Index index;
00169         right.GetIndex(index);
00170         this->SetIndex(index);
00171         this->SetValue(right.GetValue());
00172         return *this;
00173     }
00174     virtual ~mitkIntNode(){};
00175     mitkIntNode(const mitkIntNode& node)
00176     {
00177         Index index;
00178         node.GetIndex(index);
00179         SetIndex(index);
00180         SetValue(node.GetValue());
00181     }
00182 private:
00183     Index m_index;
00184     int m_value;
00185 };
00186 
00187 
00188 #endif
00189 

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