📄 dsrdoctr.h
字号:
/* * * Copyright (C) 2000-2005, OFFIS * * This software and supporting documentation were developed by * * Kuratorium OFFIS e.V. * Healthcare Information and Communication Systems * Escherweg 2 * D-26121 Oldenburg, Germany * * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. * * Module: dcmsr * * Author: Joerg Riesmeier * * Purpose: * classes: DSRDocumentTree * * Last Update: $Author: meichel $ * Update Date: $Date: 2005/12/08 16:05:01 $ * CVS/RCS Revision: $Revision: 1.16 $ * Status: $State: Exp $ * * CVS/RCS Log at end of file * */#ifndef DSRDOCTR_H#define DSRDOCTR_H#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */#include "dcmtk/dcmsr/dsrtree.h"#include "dcmtk/dcmsr/dsrdoctn.h"#include "dcmtk/dcmsr/dsrcitem.h"#include "dcmtk/dcmdata/dcitem.h"/*-----------------------* * forward declaration * *-----------------------*/class DSRIODConstraintChecker;/*---------------------* * class declaration * *---------------------*//** Class managing the SR document tree */class DSRDocumentTree : public DSRTree{ public: /** constructor ** @param documentType document type of the associated document */ DSRDocumentTree(const E_DocumentType documentType); /** destructor */ virtual ~DSRDocumentTree(); /** clear internal member variables. * The document type is not changed (e.g. set to DT_invalid). */ virtual void clear(); /** check whether the current internal state is valid. * The SR document is valid if the document type is supported, the tree is not * empty the root item is a container and has the internal relationship type * RT_isRoot. ** @return OFTrue if valid, OFFalse otherwise */ virtual OFBool isValid() const; /** set the log stream. * The log stream is used to report any warnings and error messages. ** @param stream pointer to the log stream (might be NULL = no messages) */ void setLogStream(OFConsole *stream); /** print current SR document tree to specified output stream ** @param stream output stream * @param flags flag used to customize the output (see DSRTypes::PF_xxx) ** @return status, EC_Normal if successful, an error code otherwise */ OFCondition print(ostream &stream, const size_t flags = 0); /** read SR document tree from DICOM dataset. * Please note that the current document tree is also deleted if the reading fails. * If the log stream is set and valid the reason for any error might be obtained * from the error/warning output. ** @param dataset reference to DICOM dataset where the tree should be read from * @param documentType document type of the SR document from which the tree is read * @param flags flag used to customize the reading process (see DSRTypes::RF_xxx) ** @return status, EC_Normal if successful, an error code otherwise */ OFCondition read(DcmItem &dataset, const E_DocumentType documentType, const size_t flags = 0); /** write current SR document tree to DICOM dataset ** @param dataset reference to DICOM dataset where the current tree should be * written to * @param markedItems optional stack where pointers to all 'marked' content items * (DICOM datasets/items) are added to during the write process. * Can be used to digitally sign parts of the document tree. ** @return status, EC_Normal if successful, an error code otherwise */ OFCondition write(DcmItem &dataset, DcmStack *markedItems = NULL); /** read XML document tree ** @param doc document containing the XML file content * @param cursor cursor pointing to the starting node * @param flags optional flag used to customize the reading process (see DSRTypes::XF_xxx) ** @return status, EC_Normal if successful, an error code otherwise */ OFCondition readXML(const DSRXMLDocument &doc, DSRXMLCursor cursor, const size_t flags); /** write current SR document tree in XML format ** @param stream output stream to which the XML document is written * @param flags flag used to customize the output (see DSRTypes::XF_xxx) ** @return status, EC_Normal if successful, an error code otherwise */ OFCondition writeXML(ostream &stream, const size_t flags); /** render current SR document tree in HTML format ** @param docStream output stream to which the main HTML document is written * @param annexStream output stream to which the HTML document annex is written * @param flags flag used to customize the output (see DSRTypes::HF_xxx) ** @return status, EC_Normal if successful, an error code otherwise */ OFCondition renderHTML(ostream &docStream, ostream &annexStream, const size_t flags = 0); /** get document type ** return current document type (might be DT_invalid) */ E_DocumentType getDocumentType() const { return DocumentType; } /** change document type. * Please note that the document tree is deleted if the specified 'documentType' * is supported. Otherwise the current document remains in force. ** @param documentType new document type to be set (should be != DT_invalid) ** @return status, EC_Normal if successful, an error code otherwise */ OFCondition changeDocumentType(const E_DocumentType documentType); /** check whether specified content item can be added to the current one. * If the tree is currently empty only a CONTAINER with the internal relationship * type RT_isRoot is allowed (as the new root node). Always returns true if no * constraint checker is available. This method can be used to decide which type * of content items can be added prior to really do so. ** @param relationshipType relationship type of node to be checked with regard * to the current one * @param valueType value type of node to be checked * @param addMode flag specifying at which position the new node would * be added. * (AM_afterCurrent, AM_beforeCurrent, AM_belowCurrent) ** @return OFTrue if specified node can be added, OFFalse otherwise */ OFBool canAddContentItem(const E_RelationshipType relationshipType, const E_ValueType valueType, const E_AddMode addMode = AM_afterCurrent); /** check whether specified by-reference relationship can be added to the current * content item. Always returns true if no constraint checker is available. ** @param relationshipType type of relationship between current and target node * @param targetValueType value type of the referenced target node ** @return OFTrue if specified by-reference relationship can be added, OFFalse otherwise */ OFBool canAddByReferenceRelationship(const E_RelationshipType relationshipType, const E_ValueType targetValueType); /** add specified content item to the current one. * If possible this method creates a new node as specified and adds it to the current * one. The method canAddContentItem() is called internally to check parameters first. ** @param relationshipType relationship type of node to be added with regard * to the current one * @param valueType value type of node to be added * @param addMode flag specifying at which position to add the new node. * (AM_afterCurrent, AM_beforeCurrent, AM_belowCurrent) ** @return ID of new node if successful, 0 otherwise */ size_t addContentItem(const E_RelationshipType relationshipType, const E_ValueType valueType, const E_AddMode addMode = AM_afterCurrent);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -