00001 /* 00002 * 00003 * Copyright (C) 1994-2005, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: dcmdata 00019 * 00020 * Author: Gerd Ehlers, Andreas Barth, Andrew Hewett 00021 * 00022 * Purpose: Definition of the DcmVR class for Value Representation 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:28:50 $ 00026 * Source File: $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcmtk/dcmdata/dcvr.h,v $ 00027 * CVS/RCS Revision: $Revision: 1.24 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 #ifndef DCMVR_H 00035 #define DCMVR_H 1 00036 00037 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00038 #include "dcmtk/dcmdata/dctypes.h" 00039 #include "dcmtk/ofstd/ofglobal.h" 00040 00041 #define INCLUDE_CSTDLIB 00042 #include "dcmtk/ofstd/ofstdinc.h" 00043 00046 extern OFGlobal<OFBool> dcmEnableUnknownVRGeneration; /* default OFTrue */ 00047 00050 extern OFGlobal<OFBool> dcmEnableUnlimitedTextVRGeneration; /* default OFTrue */ 00051 00056 extern OFGlobal<OFBool> dcmEnableUnknownVRConversion; /* default OFFalse */ 00057 00058 /* 00059 ** VR Enumerations. 00060 ** NB: The order of entries has to conform to the order in DcmVRDict (see dcmvr.cc)! 00061 ** If not an error message is reported and the program aborts (only in DEBUG mode). 00062 */ 00063 enum DcmEVR 00064 { 00065 EVR_AE, 00066 EVR_AS, 00067 EVR_AT, 00068 EVR_CS, 00069 EVR_DA, 00070 EVR_DS, 00071 EVR_DT, 00072 EVR_FL, 00073 EVR_FD, 00074 EVR_IS, 00075 EVR_LO, 00076 EVR_LT, 00077 EVR_OB, 00078 EVR_OF, 00079 EVR_OW, 00080 EVR_PN, 00081 EVR_SH, 00082 EVR_SL, 00083 EVR_SQ, 00084 EVR_SS, 00085 EVR_ST, 00086 EVR_TM, 00087 EVR_UI, 00088 EVR_UL, 00089 EVR_US, 00090 EVR_UT, 00091 00092 EVR_ox, /* OB or OW depending on context */ 00093 EVR_xs, /* SS or US depending on context */ 00094 EVR_lt, /* US, SS or OW depending on context, used for LUT Data (thus the name) */ 00095 EVR_na, /* na="not applicable", for data which has no VR */ 00096 EVR_up, /* up="unsigned pointer", used internally for DICOMDIR support */ 00097 00098 EVR_item, /* used internally */ 00099 EVR_metainfo, /* used internally */ 00100 EVR_dataset, /* used internally */ 00101 EVR_fileFormat, /* used internally */ 00102 EVR_dicomDir, /* used internally */ 00103 EVR_dirRecord, /* used internally */ 00104 00105 EVR_pixelSQ, /* used internally */ 00106 EVR_pixelItem, /* used internally */ 00107 00108 EVR_UNKNOWN, /* used internally */ 00109 EVR_UN, /* Unknown value representation - defined in supplement 14 */ 00110 EVR_PixelData, /* used internally */ 00111 EVR_OverlayData, /* used internally */ 00112 00113 EVR_UNKNOWN2B /* like EVR_UNKNOWN but without extended length property in explicit VR */ 00114 }; 00115 00116 00119 class DcmVR 00120 { 00121 public: 00122 00124 DcmVR() 00125 : vr(EVR_UNKNOWN) 00126 { 00127 } 00128 00132 DcmVR(DcmEVR evr) 00133 : vr(EVR_UNKNOWN) 00134 { 00135 // the set method is safeguarded against incorrect passing of integer values 00136 setVR(evr); 00137 } 00138 00142 DcmVR(const char* vrName) 00143 : vr(EVR_UNKNOWN) 00144 { 00145 setVR(vrName); 00146 } 00147 00149 DcmVR(const DcmVR& avr) 00150 : vr(avr.vr) 00151 { 00152 } 00153 00157 void setVR(DcmEVR evr); 00158 00162 void setVR(const char* vrName); 00163 00167 void setVR(const DcmVR& avr) { vr = avr.vr; } 00168 00172 DcmVR& operator=(const DcmVR& arg) 00173 { 00174 vr = arg.vr; 00175 return *this; 00176 } 00177 00181 DcmEVR getEVR() const { return vr; } 00182 00189 DcmEVR getValidEVR() const; 00190 00194 const char* getVRName() const ; 00195 00202 const char* getValidVRName() const; 00203 00210 size_t getValueWidth() const; 00211 00215 OFBool isStandard() const; 00216 00220 OFBool isForInternalUseOnly() const; 00221 00225 OFBool isaString() const; 00226 00230 OFBool usesExtendedLengthEncoding() const; 00231 00238 OFBool isEquivalent(const DcmVR& avr) const; 00239 00240 /* minimum and maximum length of a value with this VR 00241 ** (in bytes assuming single byte characters) 00242 */ 00243 00247 Uint32 getMinValueLength() const; 00248 00252 Uint32 getMaxValueLength() const; 00253 00254 private: 00256 DcmEVR vr; 00257 }; 00258 00259 00260 #endif /* !DCMVR_H */ 00261 00262 00263 /* 00264 * CVS/RCS Log: 00265 * $Log: dcvr.h,v $ 00266 * Revision 1.24 2005/12/08 16:28:50 meichel 00267 * Changed include path schema for all DCMTK header files 00268 * 00269 * Revision 1.23 2005/11/15 18:28:02 meichel 00270 * Added new global flag dcmEnableUnknownVRConversion that enables the automatic 00271 * re-conversion of defined length UN elements read in an explicit VR transfer 00272 * syntax, if the real VR is defined in the data dictionary. Default is OFFalse, 00273 * i.e. to retain the previous behavior. 00274 * 00275 * Revision 1.22 2005/11/15 16:59:24 meichel 00276 * Added new pseudo VR type EVR_lt that is used for LUT Data when read in 00277 * implicit VR, which may be US, SS or OW. DCMTK always treats EVR_lt like OW. 00278 * 00279 * Revision 1.21 2003/06/12 13:31:46 joergr 00280 * Fixed inconsistent API documentation reported by Doxygen. 00281 * 00282 * Revision 1.20 2003/03/21 13:06:46 meichel 00283 * Minor code purifications for warnings reported by MSVC in Level 4 00284 * 00285 * Revision 1.19 2002/12/06 12:20:19 joergr 00286 * Added support for new value representation Other Float String (OF). 00287 * 00288 * Revision 1.18 2002/11/27 12:07:24 meichel 00289 * Adapted module dcmdata to use of new header file ofstdinc.h 00290 * 00291 * Revision 1.17 2001/06/01 15:48:47 meichel 00292 * Updated copyright header 00293 * 00294 * Revision 1.16 2000/04/14 15:42:56 meichel 00295 * Global VR generation flags are now derived from OFGlobal and, thus, 00296 * safe for use in multi-thread applications. 00297 * 00298 * Revision 1.15 2000/03/08 16:26:21 meichel 00299 * Updated copyright header. 00300 * 00301 * Revision 1.14 2000/02/29 11:48:38 meichel 00302 * Removed support for VS value representation. This was proposed in CP 101 00303 * but never became part of the standard. 00304 * 00305 * Revision 1.13 2000/02/23 15:11:42 meichel 00306 * Corrected macro for Borland C++ Builder 4 workaround. 00307 * 00308 * Revision 1.12 2000/02/01 10:12:03 meichel 00309 * Avoiding to include <stdlib.h> as extern "C" on Borland C++ Builder 4, 00310 * workaround for bug in compiler header files. 00311 * 00312 * Revision 1.11 1999/06/10 10:44:51 meichel 00313 * Replaced some #if statements by more robust #ifdef 00314 * 00315 * Revision 1.10 1999/03/31 09:24:54 meichel 00316 * Updated copyright header in module dcmdata 00317 * 00318 * 00319 */