00001 /*========================================================================= 00002 00003 Program: Open IGT Link Library 00004 Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink2_beta/Source/igtlImgmetaMessage.h $ 00005 Language: C++ 00006 Date: $Date: 2009-12-16 23:58:02 -0500 (Wed, 16 Dec 2009) $ 00007 Version: $Revision: 5466 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notices for more information. 00014 00015 =========================================================================*/ 00016 00017 #ifndef __igtlImageMetaMessage_h 00018 #define __igtlImageMetaMessage_h 00019 00020 #include <vector> 00021 #include <string> 00022 00023 #include "igtlObject.h" 00024 //#include "igtlMacros.h" 00025 #include "igtlMath.h" 00026 #include "igtlMessageBase.h" 00027 #include "igtlTypes.h" 00028 00029 #include "igtlImageMessage.h" 00030 00031 namespace igtl 00032 { 00033 00034 class IGTLCommon_EXPORT ImageMetaElement: public Object 00035 { 00036 public: 00037 typedef ImageMetaElement Self; 00038 typedef Object Superclass; 00039 typedef SmartPointer<Self> Pointer; 00040 typedef SmartPointer<const Self> ConstPointer; 00041 00042 igtlTypeMacro(igtl::ImageMetaElement, igtl::Object); 00043 igtlNewMacro(igtl::ImageMetaElement); 00044 00045 public: 00046 int SetName(const char* name); 00047 const char* GetName() { return this->m_Name.c_str(); }; 00048 00049 int SetDeviceName(const char* devname); 00050 const char* GetDeviceName() { return this->m_DeviceName.c_str(); }; 00051 00052 int SetModality(const char* modality); 00053 const char* GetModality() { return this->m_Modality.c_str(); }; 00054 00055 int SetPatientName(const char* patname); 00056 const char* GetPatientName() { return this->m_PatientName.c_str(); }; 00057 00058 int SetPatientID(const char* patid); 00059 const char* GetPatientID() { return this->m_PatientID.c_str(); } 00060 00061 void SetTimeStamp(igtl::TimeStamp::Pointer& time); 00062 void GetTimeStamp(igtl::TimeStamp::Pointer& time); 00063 00064 void SetSize(igtlUint16 size[3]); 00065 void SetSize(igtlUint16 sx, igtlUint16 sy, igtlUint16 sz); 00066 void GetSize(igtlUint16* size); 00067 void GetSize(igtlUint16& sx, igtlUint16& sy, igtlUint16& sz); 00068 00069 void SetScalarType(igtlUint8 type); 00070 igtlUint8 GetScalarType(); 00071 00072 protected: 00073 ImageMetaElement(); 00074 ~ImageMetaElement(); 00075 00076 protected: 00077 00078 std::string m_Name; /* name / description (< 64 bytes)*/ 00079 std::string m_DeviceName; /* device name to query the IMAGE and COLORT */ 00080 std::string m_Modality; /* modality name (< 32 bytes) */ 00081 std::string m_PatientName; /* patient name (< 64 bytes) */ 00082 std::string m_PatientID; /* patient ID (MRN etc.) (< 64 bytes) */ 00083 TimeStamp::Pointer m_TimeStamp; /* scan time */ 00084 igtlUint16 m_Size[3]; /* entire image volume size */ 00085 igtlUint8 m_ScalarType; /* scalar type. see scalar_type in IMAGE message */ 00086 00087 }; 00088 00089 00090 class IGTLCommon_EXPORT GetImageMetaMessage: public MessageBase 00091 { 00092 public: 00093 typedef GetImageMetaMessage Self; 00094 typedef MessageBase Superclass; 00095 typedef SmartPointer<Self> Pointer; 00096 typedef SmartPointer<const Self> ConstPointer; 00097 00098 igtlTypeMacro(igtl::GetImageMetaMessage, igtl::MessageBase); 00099 igtlNewMacro(igtl::GetImageMetaMessage); 00100 00101 protected: 00102 GetImageMetaMessage() : MessageBase() { this->m_DefaultBodyType = "GET_IMGMETA"; }; 00103 ~GetImageMetaMessage() {}; 00104 protected: 00105 virtual int GetBodyPackSize() { return 0; }; 00106 virtual int PackBody() { AllocatePack(); return 1; }; 00107 virtual int UnpackBody() { return 1; }; 00108 }; 00109 00110 00111 class IGTLCommon_EXPORT ImageMetaMessage: public MessageBase 00112 { 00113 public: 00114 typedef ImageMetaMessage Self; 00115 typedef MessageBase Superclass; 00116 typedef SmartPointer<Self> Pointer; 00117 typedef SmartPointer<const Self> ConstPointer; 00118 00119 igtlTypeMacro(igtl::ImageMetaMessage, igtl::MessageBase); 00120 igtlNewMacro(igtl::ImageMetaMessage); 00121 00122 public: 00123 int AddImageMetaElement(ImageMetaElement::Pointer& elem); 00124 void ClearImageMetaElement(); 00125 00126 int GetNumberOfImageMetaElement(); 00127 void GetImageMetaElement(int index, ImageMetaElement::Pointer& elem); 00128 00129 00130 protected: 00131 ImageMetaMessage(); 00132 ~ImageMetaMessage(); 00133 00134 protected: 00135 00136 virtual int GetBodyPackSize(); 00137 virtual int PackBody(); 00138 virtual int UnpackBody(); 00139 00140 std::vector<ImageMetaElement::Pointer> m_ImageMetaList; 00141 00142 }; 00143 00144 00145 } // namespace igtl 00146 00147 #endif // _igtlImageMetaMessage_h 00148 00149 00150 00151