OFFIS DCMTK  Version 3.6.0
dcdirrec.h
1 /*
2  *
3  * Copyright (C) 1994-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmdata
15  *
16  * Author: Gerd Ehlers, Andreas Barth
17  *
18  * Purpose: Interface of class DcmDirectoryRecord
19  *
20  * Last Update: $Author: uli $
21  * Update Date: $Date: 2010-11-15 13:58:43 $
22  * CVS/RCS Revision: $Revision: 1.47 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef DCDIRREC_H
30 #define DCDIRREC_H
31 
32 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
33 
34 #include "dcmtk/dcmdata/dcitem.h"
35 #include "dcmtk/dcmdata/dcsequen.h"
36 #include "dcmtk/dcmdata/dcfilefo.h"
37 
38 
40 typedef enum {
42  ERT_root = 0,
44  ERT_Curve = 1,
46  ERT_FilmBox = 2,
48  ERT_FilmSession = 3,
50  ERT_Image = 4,
52  ERT_ImageBox = 5,
54  ERT_Interpretation = 6,
56  ERT_ModalityLut = 7,
58  ERT_Mrdr = 8,
60  ERT_Overlay = 9,
62  ERT_Patient = 10,
64  ERT_PrintQueue = 11,
66  ERT_Private = 12,
68  ERT_Results = 13,
70  ERT_Series = 14,
72  ERT_Study = 15,
74  ERT_StudyComponent = 16,
76  ERT_Topic = 17,
78  ERT_Visit = 18,
80  ERT_VoiLut = 19,
82  ERT_SRDocument = 20,
84  ERT_Presentation = 21,
86  ERT_Waveform = 22,
88  ERT_RTDose = 23,
90  ERT_RTStructureSet = 24,
92  ERT_RTPlan = 25,
94  ERT_RTTreatRecord = 26,
96  ERT_StoredPrint = 27,
98  ERT_KeyObjectDoc = 28,
100  ERT_Registration = 29,
102  ERT_Fiducial = 30,
104  ERT_RawData = 31,
106  ERT_Spectroscopy = 32,
108  ERT_EncapDoc = 33,
110  ERT_ValueMap = 34,
112  ERT_HangingProtocol = 35,
114  ERT_Stereometric = 36,
116  ERT_HL7StrucDoc = 37,
118  ERT_Palette = 38,
120  ERT_Surface = 39,
122  ERT_Measurement = 40,
124  ERT_Implant = 41,
126  ERT_ImplantGroup = 42,
128  ERT_ImplantAssy = 43
129 } E_DirRecType;
130 
131 
132 class DcmDicomDir;
133 
137 {
138 
139  friend class DcmDicomDir;
140 
141 public:
144 
149  DcmDirectoryRecord(const DcmTag &tag,
150  const Uint32 len);
151 
157  DcmDirectoryRecord(const E_DirRecType recordType,
158  const char *referencedFileID, // DICOM format with '\\'
159  const char *sourceFileName); // OS Format
160 
166  DcmDirectoryRecord(const char *recordTypeName,
167  const char *referencedFileID, // DICOM Format with '\\'
168  const char *sourceFileName); // OS Format
169 
173  DcmDirectoryRecord(const DcmDirectoryRecord &oldDirRec);
174 
179 
181  virtual ~DcmDirectoryRecord();
182 
186  virtual DcmObject *clone() const
187  {
188  return new DcmDirectoryRecord(*this);
189  }
190 
203  virtual OFCondition copyFrom(const DcmObject& rhs);
204 
211  virtual DcmEVR ident() const;
212 
214  inline OFCondition error() const { return errorFlag; }
215 
223  virtual void print(STD_NAMESPACE ostream&out,
224  const size_t flags = 0,
225  const int level = 0,
226  const char *pixelFileName = NULL,
227  size_t *pixelCounter = NULL);
228 
229 
243  virtual OFCondition read(DcmInputStream & inStream,
244  const E_TransferSyntax xfer,
245  const E_GrpLenEncoding glenc = EGL_noChange,
246  const Uint32 maxReadLength = DCM_MaxReadLength);
247 
253  virtual OFCondition writeXML(STD_NAMESPACE ostream&out,
254  const size_t flags = 0);
255 
256 
261  virtual OFCondition verify(const OFBool autocorrect = OFFalse);
262 
284  virtual OFCondition search(const DcmTagKey &xtag, // in
285  DcmStack &resultStack, // inout
286  E_SearchMode mode = ESM_fromHere, // in
287  OFBool searchIntoSub = OFTrue); // in
288 
290  virtual E_DirRecType getRecordType();
291 
297 
302  virtual OFCondition assignToMRDR(DcmDirectoryRecord *mrdr ); // in
303 
312  virtual OFCondition assignToSOPFile(const char *referencedFileID,
313  const char *sourceFileName);
314 
316  virtual unsigned long cardSub();
317 
324  virtual OFCondition insertSub(DcmDirectoryRecord* dirRec,
325  unsigned long where = DCM_EndOfListIndex,
326  OFBool before = OFFalse);
327 
336  OFBool before = OFFalse);
337 
343  virtual DcmDirectoryRecord* getSub(const unsigned long num);
344 
349  virtual DcmDirectoryRecord* nextSub(const DcmDirectoryRecord *dirRec);
350 
357  virtual DcmDirectoryRecord* removeSub(const unsigned long num);
358 
366 
371  virtual OFCondition deleteSubAndPurgeFile(const unsigned long num);
372 
378 
380  virtual OFCondition clearSub();
381 
385  virtual void setRecordsOriginFile(const char *fname);
386 
388  virtual const char* getRecordsOriginFile();
389 
391  Uint32 getFileOffset() const;
392 
393 protected:
394 
395  // side-effect-free conversion routines:
396  E_DirRecType recordNameToType(const char *recordTypeName);
397  char* buildFileName(const char *origName, char *destName);
398  OFCondition checkHierarchy(const E_DirRecType upperRecord,
399  const E_DirRecType lowerRecord);
400 
401  // access to data elements within the Directory Records:
402  OFCondition setRecordType(E_DirRecType newType);
403  E_DirRecType lookForRecordType();
404  OFCondition setReferencedFileID( const char *referencedFileID);
405  const char* lookForReferencedFileID();
406  DcmDirectoryRecord* lookForReferencedMRDR();
407  const char* getReferencedFileName(); // local or in MRDR
408  OFCondition setRecordInUseFlag(const Uint16 newFlag);
409  Uint16 lookForRecordInUseFlag();
410  Uint32 setFileOffset(Uint32 position);
411 
412 
413  // access to MRDR data element:
414  OFCondition setNumberOfReferences(Uint32 newRefNum);
415  Uint32 lookForNumberOfReferences();
416  Uint32 increaseRefNum();
417  Uint32 decreaseRefNum();
418 
419  // misc:
420  OFCondition fillElementsAndReadSOP(const char *referencedFileID,
421  const char *sourceFileName);
422  OFCondition masterInsertSub(DcmDirectoryRecord *dirRec,
423  const unsigned long where = DCM_EndOfListIndex);
424  OFCondition purgeReferencedFile();
425 
426 private:
427 
430 
433 
435  E_DirRecType DirRecordType;
436 
439 
442 
444  Uint32 offsetInFile;
445 
446 };
447 
448 
449 #endif // DCDIRREC_H
450 
451 
452 /*
453 ** CVS/RCS Log:
454 ** $Log: dcdirrec.h,v $
455 ** Revision 1.47 2010-11-15 13:58:43 uli
456 ** Fixed some errors in doxygen comments.
457 **
458 ** Revision 1.46 2010-11-05 13:11:11 joergr
459 ** Added support for new directory record types IMPLANT, IMPLANT GROUP and
460 ** IMPLANT ASSY from Supplement 131 (Implant Templates).
461 **
462 ** Revision 1.45 2010-10-14 13:15:40 joergr
463 ** Updated copyright header. Added reference to COPYRIGHT file.
464 **
465 ** Revision 1.44 2010-10-01 08:06:16 joergr
466 ** Added new directory record type MEASUREMENT from Supplement 144.
467 **
468 ** Revision 1.43 2010-09-30 16:43:18 joergr
469 ** Added new directory record types HL7 STRUC DOC, PALETTE and SURFACE.
470 **
471 ** Revision 1.42 2010-03-01 09:08:44 uli
472 ** Removed some unnecessary include directives in the headers.
473 **
474 ** Revision 1.41 2010-02-22 11:39:53 uli
475 ** Remove some unneeded includes.
476 **
477 ** Revision 1.40 2008-07-17 11:19:48 onken
478 ** Updated copyFrom() documentation.
479 **
480 ** Revision 1.39 2008-07-17 10:30:23 onken
481 ** Implemented copyFrom() method for complete DcmObject class hierarchy, which
482 ** permits setting an instance's value from an existing object. Implemented
483 ** assignment operator where necessary.
484 **
485 ** Revision 1.38 2008-06-03 13:41:40 meichel
486 ** DcmDirectoryRecord::getFileOffset() is now const and public.
487 **
488 ** Revision 1.37 2007/11/29 14:30:35 meichel
489 ** Updated doxygen API documentation
490 **
491 ** Revision 1.36 2007/06/29 14:17:49 meichel
492 ** Code clean-up: Most member variables in module dcmdata are now private,
493 ** not protected anymore.
494 **
495 ** Revision 1.35 2007/02/19 15:04:34 meichel
496 ** Removed searchErrors() methods that are not used anywhere and added
497 ** error() methods only in the DcmObject subclasses where really used.
498 **
499 ** Revision 1.34 2006/08/16 09:41:26 joergr
500 ** Added missing CVS log entry.
501 **
502 ** Revision 1.33 2006/08/15 15:49:56 meichel
503 ** Updated all code in module dcmdata to correctly compile when
504 ** all standard C++ classes remain in namespace std.
505 **
506 ** Revision 1.32 2006/07/27 13:05:05 joergr
507 ** Added support for DICOMDIR record type "STEREOMETRIC" (CP 628).
508 ** Renamed ERT_StructReport to ERT_SRDocument.
509 **
510 ** Revision 1.31 2006/05/11 17:48:53 joergr
511 ** Fixed wrong CVS log entry.
512 **
513 ** Revision 1.30 2006/05/11 08:53:36 joergr
514 ** Added "offset" attribute to DICOMDIR record items.
515 **
516 ** Revision 1.29 2005/12/08 16:28:10 meichel
517 ** Changed include path schema for all DCMTK header files
518 **
519 ** Revision 1.28 2005/10/27 13:30:20 joergr
520 ** Added support for Encapsulated Document, Real World Value Mapping and
521 ** Hanging Protocol objects to DICOMDIR tools.
522 **
523 ** Revision 1.27 2004/07/01 12:28:25 meichel
524 ** Introduced virtual clone method for DcmObject and derived classes.
525 **
526 ** Revision 1.26 2004/02/13 17:36:46 joergr
527 ** Added support for new directory records RAW DATA and SPECTROSCOPY introduced
528 ** with CP 343.
529 **
530 ** Revision 1.25 2004/02/13 14:10:57 joergr
531 ** Added support for new directory records REGISTRATION and FIDUCIAL introduced
532 ** with supplement 73 (Spatial Registration Storage SOP Classes).
533 **
534 ** Revision 1.24 2003/08/08 14:14:04 joergr
535 ** Translated remaining German comments.
536 **
537 ** Revision 1.23 2003/08/08 14:04:16 joergr
538 ** Added two new methods insertSubAtCurrentPos() and nextSub() which allow for
539 ** a much more efficient insertion (avoids re-searching for correct position).
540 **
541 ** Revision 1.22 2002/12/06 12:49:09 joergr
542 ** Enhanced "print()" function by re-working the implementation and replacing
543 ** the boolean "showFullData" parameter by a more general integer flag.
544 ** Added doc++ documentation.
545 ** Made source code formatting more consistent with other modules/files.
546 **
547 ** Revision 1.21 2002/08/27 16:55:31 meichel
548 ** Initial release of new DICOM I/O stream classes that add support for stream
549 ** compression (deflated little endian explicit VR transfer syntax)
550 **
551 ** Revision 1.20 2001/09/25 17:19:25 meichel
552 ** Adapted dcmdata to class OFCondition
553 **
554 ** Revision 1.19 2001/06/20 14:59:15 joergr
555 ** Added support for new SOP class Key Object Selection Document (suppl. 59).
556 **
557 ** Revision 1.18 2001/06/01 15:48:39 meichel
558 ** Updated copyright header
559 **
560 ** Revision 1.17 2000/12/14 12:47:20 joergr
561 ** Updated for 2000 edition of the DICOM standard (added: SR, PR, WV, SP, RT).
562 **
563 ** Revision 1.16 2000/04/14 16:02:23 meichel
564 ** Removed default value from output stream passed to print() method.
565 ** Required for use in multi-thread environments.
566 **
567 ** Revision 1.15 2000/03/08 16:26:14 meichel
568 ** Updated copyright header.
569 **
570 ** Revision 1.14 2000/03/03 14:05:23 meichel
571 ** Implemented library support for redirecting error messages into memory
572 ** instead of printing them to stdout/stderr for GUI applications.
573 **
574 ** Revision 1.13 2000/02/10 10:50:50 joergr
575 ** Added new feature to dcmdump (enhanced print method of dcmdata): write
576 ** pixel data/item value fields to raw files.
577 **
578 ** Revision 1.12 1999/03/31 09:24:36 meichel
579 ** Updated copyright header in module dcmdata
580 **
581 ** Revision 1.11 1999/03/22 14:10:57 meichel
582 ** Added support for Structured Reports to dcmgpdir.
583 ** Added preliminary support for including sequences into a DICOMDIR.
584 **
585 ** Revision 1.10 1998/07/15 15:48:46 joergr
586 ** Removed several compiler warnings reported by gcc 2.8.1 with
587 ** additional options, e.g. missing copy constructors and assignment
588 ** operators, initialization of member variables in the body of a
589 ** constructor instead of the member initialization list, hiding of
590 ** methods by use of identical names, uninitialized member variables,
591 ** missing const declaration of char pointers. Replaced tabs by spaces.
592 **
593 ** Revision 1.9 1997/07/21 08:00:45 andreas
594 ** - Corrected error in DcmDirectoryRecord::write since this routine can
595 ** change the length of the record after this is calculated in the
596 ** sequence.
597 ** - DcmDirectoryRecord can be build with a referenced Name and a source
598 ** filename. These name now can differ (lower case - upper case
599 ** characters).
600 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL)
601 ** with one unique boolean type OFBool.
602 **
603 ** Revision 1.8 1997/07/07 07:42:04 andreas
604 ** - Changed parameter type DcmTag & to DcmTagKey & in all search functions
605 ** in DcmItem, DcmSequenceOfItems, DcmDirectoryRecord and DcmObject
606 **
607 ** Revision 1.7 1997/05/16 08:31:21 andreas
608 ** - Revised handling of GroupLength elements and support of
609 ** DataSetTrailingPadding elements. The enumeratio E_GrpLenEncoding
610 ** got additional enumeration values (for a description see dctypes.h).
611 ** addGroupLength and removeGroupLength methods are replaced by
612 ** computeGroupLengthAndPadding. To support Padding, the parameters of
613 ** element and sequence write functions changed.
614 **
615 ** Revision 1.6 1997/05/09 13:12:02 hewett
616 ** Added a member variable and associated get/set methods to DcmDirectoryRecord
617 ** to allow the origin of a directory record to be noted.
618 **
619 ** Revision 1.5 1997/05/06 09:22:35 hewett
620 ** Added a "before" flag to the insertion of items for compatibility with
621 ** insertion in normal Sequences.
622 **
623 ** Revision 1.4 1997/03/26 16:56:25 hewett
624 ** Removed the DcmDirectoryRecord member function fillTypeElements since it
625 ** did nothing useful. Smoothed out some poor indentation.
626 **
627 ** Revision 1.3 1996/08/05 08:45:20 andreas
628 ** new print routine with additional parameters:
629 ** - print into files
630 ** - fix output length for elements
631 ** corrected error in search routine with parameter ESM_fromStackTop
632 **
633 ** Revision 1.2 1996/01/05 13:22:54 andreas
634 ** - changed to support new streaming facilities
635 ** - more cleanups
636 ** - merged read / write methods for block and file transfer
637 **
638 */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2