MeVisLabToolboxReference
|
00001 //---------------------------------------------------------------------------------- 00002 // **InsertLicense** code 00003 //---------------------------------------------------------------------------------- 00005 00010 //---------------------------------------------------------------------------------- 00011 00012 #ifndef HEADER_DCMTREE_LIB 00013 #define HEADER_DCMTREE_LIB 00014 00015 #ifdef _MSC_VER 00016 // Disable some boost and system header warnings. 00017 // 4265: 'boost::exception_detail::error_info_container' : class has virtual functions, but destructor is not virtual 00018 // 4365: signed/unsigned mismatch 00019 // 4548: expression before comma has no effect; expected expression with side-effect 00020 // 4619: #pragma warning : there is no warning number '4284' 00021 #pragma warning (push) 00022 #pragma warning (disable : 4265 4365 4548 4619) 00023 #endif 00024 00025 #include <utility> 00026 #include <map> 00027 #include <vector> 00028 #include <string> 00029 00030 #include "boost/smart_ptr.hpp" 00031 00032 #if defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) 00033 // Including string.h here is required since gcc version 4.3. Older gcc 00034 // versions provide it in a header file that is not included. 00035 #include <string.h> 00036 #endif 00037 00038 #if defined (WIN32) && (_MSC_VER <= 1200) && defined(_XTREE_) 00039 # pragma message("You do not have a patched XTREE file from $(MLAB_MeVisLab_Foundation)\\BuildTools\\win32\\patches\\msvc6\\XTREE or http://www.dinkumware.com/vc_fixes.html installed.") 00040 # pragma message("Replace the old XTREE file in 'Program Files\\Microsoft Visual Studio\\VC98\\Include' with the patched version.") 00041 # error "YOUR MODULE WILL NOT WORK." 00042 #endif 00043 00044 #ifdef _MSC_VER 00045 #pragma warning (pop) 00046 #endif 00047 00048 #include "DCMTree_Defines.h" 00049 #include "DCMTree_Serialization.h" 00050 00051 00052 namespace DCMTree 00053 { 00054 class Tag; 00055 00057 typedef boost::shared_ptr<Tag> TagPtr; 00058 typedef boost::shared_ptr<const Tag> Const_TagPtr; 00059 00060 class MFPixelTag; 00062 typedef boost::shared_ptr<MFPixelTag> MFPixelTagPtr; 00063 typedef boost::shared_ptr<const MFPixelTag> Const_MFPixelTagPtr; 00064 00065 class Tree; 00067 typedef boost::shared_ptr<Tree> TreePtr; 00068 typedef boost::shared_ptr<const Tree> Const_TreePtr; 00069 00070 class Message; 00071 typedef boost::shared_ptr<Message> MessagePtr; 00072 typedef boost::shared_ptr<const Message> Const_MessagePtr; 00073 00074 class TagInfo; 00076 typedef boost::shared_ptr<TagInfo> TagInfoPtr; 00077 typedef boost::shared_ptr<const TagInfo> Const_TagInfoPtr; 00078 00080 typedef std::vector<TreePtr> TreePtrVector; 00081 00082 class Value; 00083 00085 typedef boost::shared_ptr<Value> ValuePtr; 00086 typedef boost::shared_ptr<const Value> Const_ValuePtr; 00087 00088 class Dict; 00089 00091 typedef boost::shared_ptr<Dict> DictPtr; 00092 typedef boost::shared_ptr<const Dict> Const_DictPtr; 00093 00094 class Exception; 00095 00097 typedef boost::shared_ptr<Exception> ExceptionPtr; 00098 typedef boost::shared_ptr<const Exception> Const_ExceptionPtr; 00099 00101 class TagId; 00102 typedef boost::shared_ptr<TagId> TagIdPtr; 00103 typedef std::pair<TagIdPtr,TagIdPtr> TagIdPtrPair; 00104 typedef unsigned int RawTagId; 00105 00107 typedef std::vector<TagId> TagIdVector; 00108 00110 typedef boost::shared_ptr<TagIdVector> TagIdVectorPtr; 00111 typedef boost::shared_ptr<const TagIdVector> Const_TagIdVectorPtr; 00112 00114 typedef std::map<TagId,TagPtr> TagPtrMap; 00115 typedef std::map<TagId,Const_TagPtr> Const_TagPtrMap; 00116 typedef boost::shared_ptr<Const_TagPtrMap> Const_TagPtrMapPtr; 00117 00118 class Reader; 00119 00121 typedef boost::shared_ptr<Reader> ReaderPtr; 00122 typedef boost::shared_ptr<const Reader> Const_ReaderPtr; 00123 00125 class StructuredMF; 00126 typedef boost::shared_ptr<StructuredMF> StructuredMFPtr; 00127 typedef boost::shared_ptr<const StructuredMF> Const_StructuredMFPtr; 00128 00130 typedef std::pair<unsigned,unsigned> TagValueMultiplicity; 00131 00133 class IOParameter; 00134 typedef boost::shared_ptr<IOParameter> IOParameterPtr; 00135 00137 struct DCMTREE_EXPORT Date 00138 { 00139 Date( int year = 0, int month = 0, int day = 0 ); 00140 00141 unsigned short _year; // 0000-9999 00142 unsigned char _month; // 00-12 00143 unsigned char _day; // 00-31 00144 }; 00145 00147 struct DCMTREE_EXPORT Time 00148 { 00149 Time( int hour = 0, int minute = 0, int second = 0, int msec = 0 ); 00150 00151 unsigned char _hour; // 00-23 00152 unsigned char _minute; // 00-59 00153 unsigned char _second; // 00-59 00154 double _fraction; // 0.0-0.999999 00155 }; 00156 00158 typedef std::pair<Date,Time> DateTime; 00159 00161 00162 00163 00164 enum Vr 00165 { 00166 AE, AS, CS, DA, DS, DT, IS, LO, LT, PN, SH, ST, TM, UT, 00167 UI, SS, US, AT, SL, UL, FL, FD, OB, OW, OL, OF, SQ, UN, VRCOUNT 00168 }; 00169 00170 typedef std::vector<Vr> VrVector; 00171 00173 enum VRCType 00174 { 00175 TY_String,TY_Date,TY_DateTime,TY_Time, 00176 TY_Float,TY_Double,TY_Seq,TY_Int, 00177 TY_UInt,TY_Short,TY_UShort,TY_Bin, 00178 TY_Att 00179 }; 00180 00182 DCMTREE_EXPORT bool isType (Vr vr,VRCType vrctype); 00183 00185 enum TransferSyntax 00186 { 00187 INVALID_TRANSFER_SYNTAX, 00188 IMPLICIT_LITTLE_ENDIAN, 00189 EXPLICIT_LITTLE_ENDIAN, 00190 EXPLICIT_BIG_ENDIAN, 00191 IMPLICIT_BIG_ENDIAN, 00192 DEFLATED_EXPLICIT_LITTLE_ENDIAN, 00193 RLE, 00194 JPEG_BASELINE, 00195 JPEG_EXTENDED_2_4, 00196 JPEG_EXTENDED_3_5, 00197 JPEG_SPEC_NON_HIER_6_8, 00198 JPEG_SPEC_NON_HIER_7_9, 00199 JPEG_FULL_PROG_NON_HIER_10_12, 00200 JPEG_FULL_PROG_NON_HIER_11_13, 00201 JPEG_LOSSLESS_NON_HIER_14, 00202 JPEG_LOSSLESS_NON_HIER_15, 00203 JPEG_EXTENDED_HIER_16_18, 00204 JPEG_EXTENDED_HIER_17_19, 00205 JPEG_SPEC_HIER_20_22, 00206 JPEG_SPEC_HIER_21_23, 00207 JPEG_FULL_PROG_HIER_24_26, 00208 JPEG_FULL_PROG_HIER_25_27, 00209 JPEG_LOSSLESS_HIER_28, 00210 JPEG_LOSSLESS_HIER_29, 00211 JPEG_LOSSLESS_HIER_14, 00212 JPEG_2000_LOSSLESS_ONLY, 00213 JPEG_2000, 00214 JPEG_LS_LOSSLESS, 00215 JPEG_LS_LOSSY, 00216 MPEG2_MPML, 00217 JPEG_2000_MC_LOSSLESS_ONLY, 00218 JPEG_2000_MC 00219 }; 00220 00227 enum TagSelector 00228 { 00229 AllTags, 00230 NonRoot, 00231 Owned 00232 }; 00233 00234 TransferSyntax defaultTransferSyntax(); 00235 00239 DCMTREE_EXPORT std::string toString (const Vr vr); 00240 00244 DCMTREE_EXPORT Vr toVr (const std::string &vrstr); 00245 00249 DCMTREE_EXPORT bool isValidVrStr (const std::string &vrstr); 00250 00255 DCMTREE_EXPORT std::string toString (const TransferSyntax syntax); 00256 00260 DCMTREE_EXPORT std::string toString (const TagValueMultiplicity &mult); 00261 } 00262 00263 namespace DCMTree_Serialization 00264 { 00265 void serializeX (Sink &sink,const DCMTree::TransferSyntax &syntax); 00266 void deserializeX (Source &source,DCMTree::TransferSyntax &syntax); 00267 void serializeX (Sink &sink,const DCMTree::Vr &vr); 00268 void deserializeX (Source &source,DCMTree::Vr &vr); 00269 } 00270 00271 #endif 00272 00273