1 /* 2 * 3 * Copyright (C) 2000-2017, 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: DSRImageTreeNode 20 * 21 */ 22 23 24 #ifndef DSRIMGTN_H 25 #define DSRIMGTN_H 26 27 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 28 29 #include "dcmtk/dcmsr/dsrdoctn.h" 30 #include "dcmtk/dcmsr/dsrimgvl.h" 31 32 33 /*---------------------* 34 * class declaration * 35 *---------------------*/ 36 37 /** Class for content item IMAGE 38 */ 39 class DCMTK_DCMSR_EXPORT DSRImageTreeNode 40 : public DSRDocumentTreeNode, 41 public DSRImageReferenceValue 42 { 43 44 public: 45 46 /** constructor 47 ** @param relationshipType type of relationship to the parent tree node. Should 48 * not be DSRTypes::RT_invalid or DSRTypes::RT_isRoot. 49 */ 50 DSRImageTreeNode(const E_RelationshipType relationshipType); 51 52 /** copy constructor. 53 * Please note that the comments on the copy constructor of the base class 54 * DSRDocumentTreeNode apply. 55 ** @param node tree node to be copied 56 */ 57 DSRImageTreeNode(const DSRImageTreeNode &node); 58 59 /** destructor 60 */ 61 virtual ~DSRImageTreeNode(); 62 63 /** comparison operator "equal". 64 * Two tree nodes are equal if the comparison operator of the base class DSRDocumentTreeNode 65 * regards them as "equal" (same types and concept names) and the stored values are equal. 66 ** @param node tree node that should be compared to the current one 67 ** @return OFTrue if both tree nodes are equal, OFFalse otherwise 68 */ 69 virtual OFBool operator==(const DSRDocumentTreeNode &node) const; 70 71 /** comparison operator "not equal". 72 * Two tree nodes are not equal if either the comparison operator of the base class 73 * DSRDocumentTreeNode regards them as "not equal" (different types or concept names) or 74 * the stored values are not equal. 75 ** @param node tree node that should be compared to the current one 76 ** @return OFTrue if both tree nodes are not equal, OFFalse otherwise 77 */ 78 virtual OFBool operator!=(const DSRDocumentTreeNode &node) const; 79 80 /** clone this tree node. 81 * Internally, the copy constructor is used, so the corresponding comments apply. 82 ** @return copy of this tree node 83 */ 84 virtual DSRImageTreeNode *clone() const; 85 86 /** clear all member variables. 87 * Please note that the content item might become invalid afterwards. 88 */ 89 virtual void clear(); 90 91 /** check whether the content item is valid. 92 * The content item is valid if the two base classes are valid. This check includes the value 93 * of the content item, which can also be checked separately with hasValidValue(). 94 ** @return OFTrue if tree node is valid, OFFalse otherwise 95 */ 96 virtual OFBool isValid() const; 97 98 /** check whether the value of the content item, i.e.\ the image reference value, is valid 99 ** @return OFTrue if the value is valid, OFFalse otherwise 100 */ 101 virtual OFBool hasValidValue() const; 102 103 /** check whether the content is short. 104 * The method isShort() from the base class DSRImageReferenceValue is called. 105 ** @param flags flag used to customize the output (see DSRTypes::HF_xxx) 106 ** @return OFTrue if the content is short, OFFalse otherwise 107 */ 108 virtual OFBool isShort(const size_t flags) const; 109 110 /** print content item. 111 * A typical output looks like this: contains IMAGE:=(CT image,"1.2.3") or 112 * (CT image,"1.2.3"),(GSPS,"1.2.3.4") if a presentation state is present. 113 * If the SOP class UID is unknown, the UID is printed instead of the related name. 114 * Also, the list of referenced frame numbers is shown, but not the UIDs of the 115 * real world value mapping object (if referenced). 116 ** @param stream output stream to which the content item should be printed 117 * @param flags flag used to customize the output (see DSRTypes::PF_xxx) 118 ** @return status, EC_Normal if successful, an error code otherwise 119 */ 120 virtual OFCondition print(STD_NAMESPACE ostream &stream, 121 const size_t flags) const; 122 123 /** write content item in XML format 124 ** @param stream output stream to which the XML document is written 125 * @param flags flag used to customize the output (see DSRTypes::XF_xxx) 126 ** @return status, EC_Normal if successful, an error code otherwise 127 */ 128 virtual OFCondition writeXML(STD_NAMESPACE ostream &stream, 129 const size_t flags) const; 130 131 132 protected: 133 134 /** read content item (value) from dataset 135 ** @param dataset DICOM dataset from which the content item should be read 136 * @param flags flag used to customize the reading process (see DSRTypes::RF_xxx) 137 ** @return status, EC_Normal if successful, an error code otherwise 138 */ 139 virtual OFCondition readContentItem(DcmItem &dataset, 140 const size_t flags); 141 142 /** write content item (value) to dataset 143 ** @param dataset DICOM dataset to which the content item should be written 144 ** @return status, EC_Normal if successful, an error code otherwise 145 */ 146 virtual OFCondition writeContentItem(DcmItem &dataset) const; 147 148 /** read content item specific XML data 149 ** @param doc document containing the XML file content 150 * @param cursor cursor pointing to the starting node 151 * @param flags flag used to customize the reading process (see DSRTypes::XF_xxx) 152 ** @return status, EC_Normal if successful, an error code otherwise 153 */ 154 virtual OFCondition readXMLContentItem(const DSRXMLDocument &doc, 155 DSRXMLCursor cursor, 156 const size_t flags); 157 158 /** render content item (value) in HTML/XHTML format 159 ** @param docStream output stream to which the main HTML/XHTML document is written 160 * @param annexStream output stream to which the HTML/XHTML document annex is written 161 * @param nestingLevel current nesting level. Used to render section headings. 162 * @param annexNumber reference to the variable where the current annex number is stored. 163 * Value is increased automatically by 1 after a new entry has been added. 164 * @param flags flag used to customize the output (see DSRTypes::HF_xxx) 165 ** @return status, EC_Normal if successful, an error code otherwise 166 */ 167 virtual OFCondition renderHTMLContentItem(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 173 174 private: 175 176 // --- declaration of default constructor and assignment operator 177 178 DSRImageTreeNode(); 179 DSRImageTreeNode &operator=(const DSRImageTreeNode &); 180 }; 181 182 183 #endif 184