00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef DIDOCU_H
00031 #define DIDOCU_H
00032
00033 #include "dcmtk/config/osconfig.h"
00034
00035 #include "dcmtk/dcmdata/dctypes.h"
00036 #include "dcmtk/dcmdata/dcfilefo.h"
00037 #include "dcmtk/dcmdata/dcxfer.h"
00038 #include "dcmtk/dcmimgle/diobjcou.h"
00039 #include "dcmtk/ofstd/ofstring.h"
00040
00041 #define INCLUDE_CSTDDEF
00042 #include "dcmtk/ofstd/ofstdinc.h"
00043
00044
00045
00046
00047
00048
00049 class DcmStack;
00050 class DcmObject;
00051 class DcmTagKey;
00052 class DcmElement;
00053 class DcmPixelData;
00054 class DcmSequenceOfItems;
00055
00056
00057
00058
00059
00060
00066 class DiDocument
00067 : public DiObjectCounter
00068 {
00069
00070 public:
00071
00079 DiDocument(const char *filename,
00080 const unsigned long flags = 0,
00081 const unsigned long fstart = 0,
00082 const unsigned long fcount = 0);
00083
00092 DiDocument(DcmObject *object,
00093 const E_TransferSyntax xfer,
00094 const unsigned long flags = 0,
00095 const unsigned long fstart = 0,
00096 const unsigned long fcount = 0);
00097
00100 virtual ~DiDocument();
00101
00106 inline int good() const
00107 {
00108 return Object != NULL;
00109 }
00110
00115 inline DcmObject *getDicomObject() const
00116 {
00117 return Object;
00118 }
00119
00124 inline DcmDataset *getDataset() const
00125 {
00126 return OFstatic_cast(DcmDataset *, Object);
00127 }
00128
00133 inline unsigned long getFrameStart() const
00134 {
00135 return FrameStart;
00136 }
00137
00142 inline unsigned long getFrameCount() const
00143 {
00144 return FrameCount;
00145 }
00146
00151 inline unsigned long getFlags() const
00152 {
00153 return Flags;
00154 }
00155
00160 inline E_TransferSyntax getTransferSyntax() const
00161 {
00162 return Xfer;
00163 }
00164
00171 inline const char *getPhotometricInterpretation() const
00172 {
00173 return PhotometricInterpretation.c_str();
00174 }
00175
00180 inline DcmPixelData *getPixelData() const
00181 {
00182 return PixelData;
00183 }
00184
00189 inline OFBool isCompressed() const
00190 {
00191 return DcmXfer(Xfer).isEncapsulated();
00192 }
00193
00201 DcmElement *search(const DcmTagKey &tag,
00202 DcmObject *obj = NULL) const;
00203
00211 int search(const DcmTagKey &tag,
00212 DcmStack &stack) const;
00213
00214
00221 unsigned long getVM(const DcmTagKey &tag) const;
00222
00233 unsigned long getValue(const DcmTagKey &tag,
00234 Uint16 &returnVal,
00235 const unsigned long pos = 0,
00236 DcmObject *item = NULL,
00237 const OFBool allowSigned = OFFalse) const;
00238
00247 unsigned long getValue(const DcmTagKey &tag,
00248 Sint16 &returnVal,
00249 const unsigned long pos = 0) const;
00250
00259 unsigned long getValue(const DcmTagKey &tag,
00260 Uint32 &returnVal,
00261 const unsigned long pos = 0) const;
00262
00271 unsigned long getValue(const DcmTagKey &tag,
00272 Sint32 &returnVal,
00273 const unsigned long pos = 0) const;
00274
00283 unsigned long getValue(const DcmTagKey &tag,
00284 double &returnVal,
00285 const unsigned long pos = 0) const;
00286
00295 unsigned long getValue(const DcmTagKey &tag,
00296 const Uint16 *&returnVal,
00297 DcmObject *item = NULL) const;
00298
00307 unsigned long getValue(const DcmTagKey &tag,
00308 const char *&returnVal,
00309 DcmObject *item = NULL) const;
00310
00320 unsigned long getValue(const DcmTagKey &tag,
00321 OFString &returnVal,
00322 const unsigned long pos = 0,
00323 DcmObject *item = NULL) const;
00324
00332 unsigned long getSequence(const DcmTagKey &tag,
00333 DcmSequenceOfItems *&seq) const;
00334
00335
00336
00346 static unsigned long getElemValue(const DcmElement *elem,
00347 Uint16 &returnVal,
00348 const unsigned long pos = 0,
00349 const OFBool allowSigned = OFFalse);
00350
00358 static unsigned long getElemValue(const DcmElement *elem,
00359 const Uint16 *&returnVal);
00360
00368 static unsigned long getElemValue(const DcmElement *elem,
00369 const char *&returnVal);
00370
00379 static unsigned long getElemValue(const DcmElement *elem,
00380 OFString &returnVal,
00381 const unsigned long pos = 0);
00382
00383
00384 protected:
00385
00388 void convertPixelData();
00389
00390
00391 private:
00392
00394 DcmObject *Object;
00396 DcmFileFormat *FileFormat;
00398 DcmPixelData *PixelData;
00400 E_TransferSyntax Xfer;
00401
00403 unsigned long FrameStart;
00405 unsigned long FrameCount;
00406
00408 unsigned long Flags;
00409
00411 OFString PhotometricInterpretation;
00412
00413
00414
00415 DiDocument(const DiDocument &);
00416 DiDocument &operator=(const DiDocument &);
00417 };
00418
00419
00420 #endif
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519