![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsReadDICOM.cpp 00003 00004 ReadDICOM class (cpp file). 00005 00006 SUKITTI PUNAK (05/19/2008) 00007 UPDATE (05/19/2008) 00008 ******************************************************************************/ 00009 #include "TAPsReadDICOM.hpp" 00010 // Using Inclusion Model (i.e. definitions are included in declarations) 00011 // (this name.cpp is included in name.hpp) 00012 // Each friend is defined directly inside its declaration. 00013 00014 BEGIN_NAMESPACE_TAPs 00015 //============================================================================= 00016 // Constructors 00017 //----------------------------------------------------------------------------- 00018 template <typename T> 00019 ReadDICOM<T>::ReadDICOM ( T x, T y, T z ) 00020 : m_tX( x ), m_tY( y ), m_tZ( z ) 00021 {} 00022 //----------------------------------------------------------------------------- 00023 template <typename T> 00024 ReadDICOM<T>::ReadDICOM ( T a[3] ) 00025 : m_tX( a[0] ), m_tY( a[1] ), m_tZ( a[2] ) 00026 {} 00027 //----------------------------------------------------------------------------- 00028 template <typename T> 00029 ReadDICOM<T>::ReadDICOM ( ReadDICOM<T> const &v ) 00030 : m_tX( v.m_tX ), m_tY( v.m_tY ), m_tZ( v.m_tZ ) 00031 {} 00032 //----------------------------------------------------------------------------- 00033 template <typename T> 00034 ReadDICOM<T>::~ReadDICOM () 00035 {} 00036 //----------------------------------------------------------------------------- 00037 template <typename T> 00038 std::string ReadDICOM<T>::PrtInfo () 00039 { 00040 std::ostringstream ss; 00041 ss << "ReadDICOM<" << typeid(T).name() << ">"; 00042 ss << m_tX << ", " << m_tY << ", " << m_tZ; 00043 return ss.str(); 00044 } 00045 //----------------------------------------------------------------------------- 00046 //============================================================================= 00047 // Assignment Operator 00048 //----------------------------------------------------------------------------- 00049 template <typename T> 00050 inline ReadDICOM<T> & ReadDICOM<T>::operator= ( ReadDICOM<T> const &v ) 00051 { 00052 m_tX = v.m_tX; 00053 m_tY = v.m_tY; 00054 m_tZ = v.m_tZ; 00055 return *this; 00056 } 00057 //============================================================================= 00058 // Comparison Operators 00059 //----------------------------------------------------------------------------- 00060 template <typename T> 00061 inline bool ReadDICOM<T>::operator== ( ReadDICOM<T> const &v ) const 00062 { return ( m_tX == v.m_tX && m_tY == v.m_tY && m_tZ == v.m_tZ ); } 00063 //----------------------------------------------------------------------------- 00064 template <typename T> 00065 inline bool ReadDICOM<T>::operator< ( ReadDICOM<T> const &v ) const 00066 { 00067 if ( m_tX > v.m_tX ) return false; 00068 if ( m_tY > v.m_tY ) return false; 00069 if ( m_tZ > v.m_tZ ) return false; 00070 if ( m_tX < v.m_tX ) return true; 00071 if ( m_tY < v.m_tY ) return true; 00072 if ( m_tZ < v.m_tZ ) return true; 00073 } 00074 //----------------------------------------------------------------------------- 00075 template <typename T> 00076 inline bool ReadDICOM<T>::operator<= ( ReadDICOM<T> const &v ) const 00077 { 00078 if ( m_tX > v.m_tX ) return false; 00079 if ( m_tY > v.m_tY ) return false; 00080 if ( m_tZ > v.m_tZ ) return false; 00081 return true; 00082 } 00083 //----------------------------------------------------------------------------- 00084 template <typename T> 00085 inline bool ReadDICOM<T>::operator> ( ReadDICOM<T> const &v ) const 00086 { 00087 if ( m_tX < v.m_tX ) return false; 00088 if ( m_tY < v.m_tY ) return false; 00089 if ( m_tZ < v.m_tZ ) return false; 00090 if ( m_tX > v.m_tX ) return true; 00091 if ( m_tY > v.m_tY ) return true; 00092 if ( m_tZ > v.m_tZ ) return true; 00093 } 00094 //----------------------------------------------------------------------------- 00095 template <typename T> 00096 inline bool ReadDICOM<T>::operator>= ( ReadDICOM<T> const &v ) const 00097 { 00098 if ( m_tX < v.m_tX ) return false; 00099 if ( m_tY < v.m_tY ) return false; 00100 if ( m_tZ < v.m_tZ ) return false; 00101 return true; 00102 } 00103 //----------------------------------------------------------------------------- 00104 template <typename T> 00105 inline int ReadDICOM<T>::Dominate ( ReadDICOM<T> const &a, ReadDICOM<T> const &b ) 00106 { 00107 if ( a > b ) return 1; 00108 if ( a < b ) return -1; 00109 return 0; 00110 } 00111 //----------------------------------------------------------------------------- 00112 //============================================================================= 00113 END_NAMESPACE_TAPs 00114 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00115 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----