OFFIS DCMTK  Version 3.6.0
dsrdoctn.h
1 /*
2  *
3  * Copyright (C) 2000-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: dcmsr
15  *
16  * Author: Joerg Riesmeier
17  *
18  * Purpose:
19  * classes: DSRDocumentTreeNode
20  *
21  * Last Update: $Author: joergr $
22  * Update Date: $Date: 2010-10-14 13:16:32 $
23  * CVS/RCS Revision: $Revision: 1.27 $
24  * Status: $State: Exp $
25  *
26  * CVS/RCS Log at end of file
27  *
28  */
29 
30 
31 #ifndef DSRDOCTN_H
32 #define DSRDOCTN_H
33 
34 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
35 
36 #include "dcmtk/dcmsr/dsrtree.h"
37 #include "dcmtk/dcmsr/dsrcodvl.h"
38 #include "dcmtk/dcmdata/dcitem.h"
39 
40 
41 /*-----------------------*
42  * forward declaration *
43  *-----------------------*/
44 
46 
47 
48 /*---------------------*
49  * class declaration *
50  *---------------------*/
51 
55  : public DSRTreeNode
56 {
57  // allow access to getConceptNamePtr()
58  friend class DSRContentItem;
59 
60  public:
61 
72  DSRDocumentTreeNode(const E_RelationshipType relationshipType,
73  const E_ValueType valueType);
74 
77  virtual ~DSRDocumentTreeNode();
78 
82  virtual void clear();
83 
89  virtual OFBool isValid() const;
90 
97  virtual OFBool isShort(const size_t flags) const;
98 
108  virtual OFCondition print(STD_NAMESPACE ostream &stream,
109  const size_t flags) const;
110 
119  virtual OFCondition read(DcmItem &dataset,
120  const DSRIODConstraintChecker *constraintChecker,
121  const size_t flags);
122 
132  virtual OFCondition write(DcmItem &dataset,
133  DcmStack *markedItems = NULL);
134 
143  virtual OFCondition readXML(const DSRXMLDocument &doc,
144  DSRXMLCursor cursor,
145  const E_DocumentType documentType,
146  const size_t flags);
147 
153  virtual OFCondition writeXML(STD_NAMESPACE ostream &stream,
154  const size_t flags) const;
155 
167  virtual OFCondition renderHTML(STD_NAMESPACE ostream &docStream,
168  STD_NAMESPACE ostream &annexStream,
169  const size_t nestingLevel,
170  size_t &annexNumber,
171  const size_t flags) const;
172 
178  inline OFBool isSigned()
179  {
180  return (DigitalSignatures.card() > 0);
181  }
182 
190  inline OFBool isMarked() const
191  {
192  return MarkFlag;
193  }
194 
199  inline void setMark(const OFBool flag)
200  {
201  MarkFlag = flag;
202  }
203 
207  inline OFBool isReferenceTarget() const
208  {
209  return ReferenceTarget;
210  }
211 
215  inline void setReferenceTarget(const OFBool isTarget = OFTrue)
216  {
217  ReferenceTarget = isTarget;
218  }
219 
223  inline OFBool hasChildNodes() const
224  {
225  return (Down != NULL);
226  }
227 
231  inline OFBool hasSiblingNodes() const
232  {
233  return (Prev != NULL) || (Next != NULL);
234  }
235 
239  inline size_t getNodeID() const
240  {
241  return Ident;
242  }
243 
248  {
249  return RelationshipType;
250  }
251 
255  inline E_ValueType getValueType() const
256  {
257  return ValueType;
258  }
259 
263  inline const DSRCodedEntryValue &getConceptName() const
264  {
265  return ConceptName;
266  }
267 
274  OFCondition getConceptName(DSRCodedEntryValue &conceptName) const;
275 
284  virtual OFCondition setConceptName(const DSRCodedEntryValue &conceptName);
285 
291  inline const OFString &getObservationDateTime() const
292  {
293  return ObservationDateTime;
294  }
295 
304  virtual OFCondition setObservationDateTime(const OFString &observationDateTime);
305 
318  OFCondition getTemplateIdentification(OFString &templateIdentifier,
319  OFString &mappingResource) const;
320 
328  virtual OFCondition setTemplateIdentification(const OFString &templateIdentifier,
329  const OFString &mappingResource);
330 
335  void removeSignatures();
336 
337 
338  protected:
339 
344  {
345  return &ConceptName;
346  }
347 
360  const E_RelationshipType relationshipType,
361  const E_ValueType valueType,
362  const DSRIODConstraintChecker *constraintChecker = NULL);
363 
370  virtual OFCondition readContentItem(DcmItem &dataset);
371 
378  virtual OFCondition writeContentItem(DcmItem &dataset) const;
379 
387  virtual OFCondition readXMLContentItem(const DSRXMLDocument &doc,
388  DSRXMLCursor cursor);
389 
401  virtual OFCondition renderHTMLContentItem(STD_NAMESPACE ostream &docStream,
402  STD_NAMESPACE ostream &annexStream,
403  const size_t nestingLevel,
404  size_t &annexNumber,
405  const size_t flags) const;
406 
413  void writeXMLItemStart(STD_NAMESPACE ostream &stream,
414  const size_t flags,
415  const OFBool closingBracket = OFTrue) const;
416 
421  void writeXMLItemEnd(STD_NAMESPACE ostream &stream,
422  const size_t flags) const;
423 
431  const DSRIODConstraintChecker *constraintChecker,
432  const size_t flags);
433 
441  DcmStack *markedItems);
442 
451  const DSRIODConstraintChecker *constraintChecker,
452  const OFString &posString,
453  const size_t flags);
454 
462  DcmStack *markedItems);
463 
471  const OFString &posString,
472  const size_t flags);
473 
479 
488  const DSRIODConstraintChecker *constraintChecker,
489  const OFString &posString,
490  const size_t flags);
491 
499  DcmStack *markedItems) const;
500 
507  OFCondition renderHTMLConceptName(STD_NAMESPACE ostream &docStream,
508  const size_t flags) const;
509 
519  OFCondition renderHTMLChildNodes(STD_NAMESPACE ostream &docStream,
520  STD_NAMESPACE ostream &annexStream,
521  const size_t nestingLevel,
522  size_t &annexNumber,
523  const size_t flags) const;
524 
525  // --- static function ---
526 
535  static const OFString &getRelationshipText(const E_RelationshipType relationshipType,
536  OFString &relationshipText,
537  const size_t flags);
538 
539 
540  private:
541 
543  OFBool MarkFlag;
546 
551 
556 
561 
566 
567 
568  // --- declaration of default/copy constructor and assignment operator
569 
572  DSRDocumentTreeNode &operator=(const DSRDocumentTreeNode &);
573 };
574 
575 
576 #endif
577 
578 
579 /*
580  * CVS/RCS Log:
581  * $Log: dsrdoctn.h,v $
582  * Revision 1.27 2010-10-14 13:16:32 joergr
583  * Updated copyright header. Added reference to COPYRIGHT file.
584  *
585  * Revision 1.26 2009-10-13 14:57:50 uli
586  * Switched to logging mechanism provided by the "new" oflog module.
587  *
588  * Revision 1.25 2008-05-19 09:48:32 joergr
589  * Fixed typo.
590  *
591  * Revision 1.24 2007-11-15 16:33:30 joergr
592  * Added support for output in XHTML 1.1 format.
593  *
594  * Revision 1.23 2006/08/15 16:40:03 meichel
595  * Updated the code in module dcmsr to correctly compile when
596  * all standard C++ classes remain in namespace std.
597  *
598  * Revision 1.22 2006/05/11 09:18:21 joergr
599  * Moved containsExtendedCharacters() from dcmsr to dcmdata module.
600  *
601  * Revision 1.21 2005/12/08 16:05:00 meichel
602  * Changed include path schema for all DCMTK header files
603  *
604  * Revision 1.20 2004/11/22 16:39:09 meichel
605  * Added method that checks if the SR document contains non-ASCII characters
606  * in any of the strings affected by SpecificCharacterSet.
607  *
608  * Revision 1.19 2003/12/16 15:57:51 joergr
609  * Added note that the condition for the Content Template Sequence is currently
610  * not checked.
611  *
612  * Revision 1.18 2003/10/30 17:53:02 joergr
613  * Added full support for the ContentTemplateSequence (read/write, get/set
614  * template identification). Template constraints are not checked yet.
615  *
616  * Revision 1.17 2003/10/06 09:52:58 joergr
617  * Added new flag which allows to ignore content item errors when reading an SR
618  * document (e.g. missing value type specific attributes).
619  *
620  * Revision 1.16 2003/09/15 14:18:54 joergr
621  * Introduced new class to facilitate checking of SR IOD relationship content
622  * constraints. Replaced old implementation distributed over numerous classes.
623  *
624  * Revision 1.15 2003/08/07 17:31:00 joergr
625  * Removed libxml dependency from header files. Simplifies linking (MSVC).
626  *
627  * Revision 1.14 2003/08/07 12:34:06 joergr
628  * Added readXML functionality.
629  * Updated documentation to get rid of doxygen warnings.
630  *
631  * Revision 1.13 2002/08/02 12:38:31 joergr
632  * Enhanced debug output of dcmsr::read() routines (e.g. add position string
633  * of invalid content items to error messages).
634  *
635  * Revision 1.12 2001/11/09 16:10:49 joergr
636  * Added preliminary support for Mammography CAD SR.
637  *
638  * Revision 1.11 2001/09/26 13:04:07 meichel
639  * Adapted dcmsr to class OFCondition
640  *
641  * Revision 1.10 2001/04/03 08:24:01 joergr
642  * Added new command line option: ignore relationship content constraints
643  * specified for each SR document class.
644  *
645  * Revision 1.9 2001/02/02 14:37:33 joergr
646  * Added new option to dsr2xml allowing to specify whether value and/or
647  * relationship type are to be encoded as XML attributes or elements.
648  *
649  * Revision 1.8 2001/01/18 15:53:34 joergr
650  * Added support for digital signatures.
651  *
652  * Revision 1.7 2000/11/13 10:26:21 joergr
653  * Added output of optional observation datetime to rendered HTML page.
654  *
655  * Revision 1.6 2000/11/07 18:14:28 joergr
656  * Enhanced support for by-reference relationships.
657  *
658  * Revision 1.5 2000/11/01 16:23:19 joergr
659  * Added support for conversion to XML.
660  *
661  * Revision 1.4 2000/10/26 14:17:38 joergr
662  * Added support for "Comprehensive SR".
663  *
664  * Revision 1.3 2000/10/23 15:10:29 joergr
665  * Added/updated doc++ comments.
666  *
667  * Revision 1.2 2000/10/18 17:02:27 joergr
668  * Added methods allowing direct access to certain content item values.
669  * Made some functions inline.
670  *
671  * Revision 1.1 2000/10/13 07:49:26 joergr
672  * Added new module 'dcmsr' providing access to DICOM structured reporting
673  * documents (supplement 23). Doc++ documentation not yet completed.
674  *
675  *
676  */


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