00001 /* 00002 * 00003 * Copyright (C) 1994-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * 00014 * Module: dcmdata 00015 * 00016 * Author: Gerd Ehlers, Andreas Barth, Andrew Hewett 00017 * 00018 * Purpose: Definition of the DcmVR class for Value Representation 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:15:42 $ 00022 * CVS/RCS Revision: $Revision: 1.28 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 #ifndef DCMVR_H 00030 #define DCMVR_H 1 00031 00032 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00033 #include "dcmtk/ofstd/ofglobal.h" 00034 00037 extern OFGlobal<OFBool> dcmEnableUnknownVRGeneration; /* default OFTrue */ 00038 00041 extern OFGlobal<OFBool> dcmEnableUnlimitedTextVRGeneration; /* default OFTrue */ 00042 00047 extern OFGlobal<OFBool> dcmEnableUnknownVRConversion; /* default OFFalse */ 00048 00049 /* 00050 ** VR Enumerations. 00051 ** NB: The order of entries has to conform to the order in DcmVRDict (see dcmvr.cc)! 00052 ** If not an error message is reported and the program aborts (only in DEBUG mode). 00053 */ 00054 enum DcmEVR 00055 { 00056 00058 EVR_AE, 00059 00061 EVR_AS, 00062 00064 EVR_AT, 00065 00067 EVR_CS, 00068 00070 EVR_DA, 00071 00073 EVR_DS, 00074 00076 EVR_DT, 00077 00079 EVR_FL, 00080 00082 EVR_FD, 00083 00085 EVR_IS, 00086 00088 EVR_LO, 00089 00091 EVR_LT, 00092 00094 EVR_OB, 00095 00097 EVR_OF, 00098 00100 EVR_OW, 00101 00103 EVR_PN, 00104 00106 EVR_SH, 00107 00109 EVR_SL, 00110 00112 EVR_SQ, 00113 00115 EVR_SS, 00116 00118 EVR_ST, 00119 00121 EVR_TM, 00122 00124 EVR_UI, 00125 00127 EVR_UL, 00128 00130 EVR_US, 00131 00133 EVR_UT, 00134 00136 EVR_ox, 00137 00139 EVR_xs, 00140 00142 EVR_lt, 00143 00145 EVR_na, 00146 00148 EVR_up, 00149 00151 EVR_item, 00152 00154 EVR_metainfo, 00155 00157 EVR_dataset, 00158 00160 EVR_fileFormat, 00161 00163 EVR_dicomDir, 00164 00166 EVR_dirRecord, 00167 00169 EVR_pixelSQ, 00170 00172 EVR_pixelItem, 00173 00175 EVR_UNKNOWN, 00176 00178 EVR_UN, 00179 00181 EVR_PixelData, 00182 00184 EVR_OverlayData, 00185 00187 EVR_UNKNOWN2B 00188 }; 00189 00190 00193 class DcmVR 00194 { 00195 public: 00196 00198 DcmVR() 00199 : vr(EVR_UNKNOWN) 00200 { 00201 } 00202 00206 DcmVR(DcmEVR evr) 00207 : vr(EVR_UNKNOWN) 00208 { 00209 // the set method is safeguarded against incorrect passing of integer values 00210 setVR(evr); 00211 } 00212 00216 DcmVR(const char* vrName) 00217 : vr(EVR_UNKNOWN) 00218 { 00219 setVR(vrName); 00220 } 00221 00225 DcmVR(const DcmVR& avr) 00226 : vr(avr.vr) 00227 { 00228 } 00229 00233 void setVR(DcmEVR evr); 00234 00238 void setVR(const char* vrName); 00239 00243 void setVR(const DcmVR& avr) { vr = avr.vr; } 00244 00248 DcmVR& operator=(const DcmVR& arg) 00249 { 00250 vr = arg.vr; 00251 return *this; 00252 } 00253 00257 DcmEVR getEVR() const { return vr; } 00258 00265 DcmEVR getValidEVR() const; 00266 00270 const char* getVRName() const ; 00271 00278 const char* getValidVRName() const; 00279 00286 size_t getValueWidth() const; 00287 00291 OFBool isStandard() const; 00292 00296 OFBool isForInternalUseOnly() const; 00297 00301 OFBool isaString() const; 00302 00306 OFBool usesExtendedLengthEncoding() const; 00307 00314 OFBool isEquivalent(const DcmVR& avr) const; 00315 00316 /* minimum and maximum length of a value with this VR 00317 ** (in bytes assuming single byte characters) 00318 */ 00319 00323 Uint32 getMinValueLength() const; 00324 00328 Uint32 getMaxValueLength() const; 00329 00330 private: 00332 DcmEVR vr; 00333 }; 00334 00335 00336 #endif /* !DCMVR_H */ 00337 00338 00339 /* 00340 * CVS/RCS Log: 00341 * $Log: dcvr.h,v $ 00342 * Revision 1.28 2010-10-14 13:15:42 joergr 00343 * Updated copyright header. Added reference to COPYRIGHT file. 00344 * 00345 * Revision 1.27 2010-03-01 09:08:45 uli 00346 * Removed some unnecessary include directives in the headers. 00347 * 00348 * Revision 1.26 2008-06-23 12:09:13 joergr 00349 * Fixed inconsistencies in Doxygen API documentation. 00350 * 00351 * Revision 1.25 2007/11/29 14:30:35 meichel 00352 * Updated doxygen API documentation 00353 * 00354 * Revision 1.24 2005/12/08 16:28:50 meichel 00355 * Changed include path schema for all DCMTK header files 00356 * 00357 * Revision 1.23 2005/11/15 18:28:02 meichel 00358 * Added new global flag dcmEnableUnknownVRConversion that enables the automatic 00359 * re-conversion of defined length UN elements read in an explicit VR transfer 00360 * syntax, if the real VR is defined in the data dictionary. Default is OFFalse, 00361 * i.e. to retain the previous behavior. 00362 * 00363 * Revision 1.22 2005/11/15 16:59:24 meichel 00364 * Added new pseudo VR type EVR_lt that is used for LUT Data when read in 00365 * implicit VR, which may be US, SS or OW. DCMTK always treats EVR_lt like OW. 00366 * 00367 * Revision 1.21 2003/06/12 13:31:46 joergr 00368 * Fixed inconsistent API documentation reported by Doxygen. 00369 * 00370 * Revision 1.20 2003/03/21 13:06:46 meichel 00371 * Minor code purifications for warnings reported by MSVC in Level 4 00372 * 00373 * Revision 1.19 2002/12/06 12:20:19 joergr 00374 * Added support for new value representation Other Float String (OF). 00375 * 00376 * Revision 1.18 2002/11/27 12:07:24 meichel 00377 * Adapted module dcmdata to use of new header file ofstdinc.h 00378 * 00379 * Revision 1.17 2001/06/01 15:48:47 meichel 00380 * Updated copyright header 00381 * 00382 * Revision 1.16 2000/04/14 15:42:56 meichel 00383 * Global VR generation flags are now derived from OFGlobal and, thus, 00384 * safe for use in multi-thread applications. 00385 * 00386 * Revision 1.15 2000/03/08 16:26:21 meichel 00387 * Updated copyright header. 00388 * 00389 * Revision 1.14 2000/02/29 11:48:38 meichel 00390 * Removed support for VS value representation. This was proposed in CP 101 00391 * but never became part of the standard. 00392 * 00393 * Revision 1.13 2000/02/23 15:11:42 meichel 00394 * Corrected macro for Borland C++ Builder 4 workaround. 00395 * 00396 * Revision 1.12 2000/02/01 10:12:03 meichel 00397 * Avoiding to include <stdlib.h> as extern "C" on Borland C++ Builder 4, 00398 * workaround for bug in compiler header files. 00399 * 00400 * Revision 1.11 1999/06/10 10:44:51 meichel 00401 * Replaced some #if statements by more robust #ifdef 00402 * 00403 * Revision 1.10 1999/03/31 09:24:54 meichel 00404 * Updated copyright header in module dcmdata 00405 * 00406 * 00407 */