⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsrdoc.h

📁 转化为DIB位图再显示出来的dicom文件C++代码
💻 H
📖 第 1 页 / 共 4 页
字号:
/* * *  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: DSRDocument * *  Last Update:      $Author: meichel $ *  Update Date:      $Date: 2005/12/08 16:04:59 $ *  CVS/RCS Revision: $Revision: 1.38 $ *  Status:           $State: Exp $ * *  CVS/RCS Log at end of file * */#ifndef DSRDOC_H#define DSRDOC_H#include "dcmtk/config/osconfig.h"   /* make sure OS specific configuration is included first */#include "dcmtk/dcmsr/dsrdoctr.h"#include "dcmtk/dcmsr/dsrsoprf.h"#include "dcmtk/dcmsr/dsrcsidl.h"#include "dcmtk/ofstd/ofstream.h"/*---------------------* *  class declaration  * *---------------------*//** Interface class for 'dcmsr' (DICOM Structured Reporting Documents). *  This class supports reading, writing, creation, printing and rendering of DICOM *  SR documents (according to DICOM PS 3.x-2004, formerly known as Supplement 23). *  The list of supported SOP classes is available in file "dsrtypes.h". */class DSRDocument  : protected DSRTypes{  public:  // --- constructors and destructor ---    /** (default) constructor.     *  The parameter 'documentType' is optional and has a default value.     ** @param  documentType  type of the SR document (see DSRTypes::E_DocumentType)     */    DSRDocument(const E_DocumentType documentType = DT_BasicTextSR);    /** destructor     */    virtual ~DSRDocument();  // --- misc routines ---    /** clear all internal member variables     */    void clear();    /** check whether the current internal state is valid.     *  The SR document is valid if the corresponding document tree is valid and     *  the SOP instance UID as well as the SOP class UID are not "empty".     ** @return OFTrue if valid, OFFalse otherwise     */    OFBool isValid();    /** check whether the document is finalized.     *  A new document is originally not finalized but can be finalized using the method     *  finalizeDocument().  This flag is e.g. used to indicate whether the entire document     *  is digitally signed and, therefore, each newly added verifying observer would corrupt     *  all previous signatures.     ** @return OFTrue if finalized, OFFalse otherwise     */    OFBool isFinalized() const;    /** set the log stream.     *  The log stream is used to report warning and error messages.  Unfortunately, the     *  stream cannot be used for 'libxml' messages.  Therefore, the error output of 'libxml'     *  is disabled by default (see readXML() for details).     ** @param  stream  pointer to the log stream (might be NULL = no messages)     */    void setLogStream(OFConsole *stream);  // --- input and output ---    /** print current SR document to specified output stream.     *  The output format is identical to that of the dsrdump command line tool.     ** @param  stream  output stream (e.g. COUT from "ofconsol.h")     *  @param  flags   optional 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 from DICOM dataset.     *  Please note that the current document is also deleted if the reading process 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 from which the document should be read     *  @param  flags    optional flag used to customize the reading process (see DSRTypes::RF_xxx).     *                   E.g. RF_readDigitalSignatures indicates whether to read the digital     *                   signatures from the dataset or not.  If set the MACParametersSequence     *                   and the DigitalSignaturesSequence are read for the general document     *                   header (equivilent to top-level content item) and each content item     *                   of the document tree.     *                   If not removed manually (with 'DSRDocumentTree::removeSignatures')     *                   the signatures are written back to the dataset when the method 'write'     *                   is called.     *                   Please note that the two signature sequences for any other sequence     *                   (e.g. VerifyingObserver or PredecessorDocuments) are never read.     ** @return status, EC_Normal if successful, an error code otherwise     */    OFCondition read(DcmItem &dataset,                     const size_t flags = 0);    /** write current SR document to DICOM dataset.     *  Please note that the ContentTemplateSequence for the root content item is not written     *  automatically for particular SOP Classes (e.g. Key Object Selection Document).     *  Instead, the template identification has to be set manually for the root CONTAINER     *  (see DSRDocumentTreeNode::setTemplateIdentification()).  This is because the template     *  constraints cannot be checked yet.     ** @param  dataset      reference to DICOM dataset to which the current document should be     *                       written     *  @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 SR document from XML file.     *  The format (Schema) of the XML document is expected to conform to the output format     *  of the writeXML() method.  In addition, the document can be validated against an XML     *  Schema by setting the flag XF_validateSchema.  For debug output (errors, warnings,     *  etc.) from 'libxml' the flag XF_enableLibxmlErrorOutput has to be set.     *  Digital signatures in the XML document are not yet supported.     *  Please note that the current document is also deleted if the parsing process fails.     ** @param  filename  name of the file from which the XML document is read ("-" for stdin)     *  @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 OFString &filename,                        const size_t flags = 0);    /** write current SR document in XML format.     *  The output format is identical to that of the dsr2xml command line tool.  Digital     *  signatures in the XML document are not yet supported.     ** @param  stream  output stream to which the XML document is written     *  @param  flags   optional 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 = 0);    /** render current SR document in HTML format.     *  The output format is identical to that of the dsr2html command line tool.     ** @param  stream      output stream to which the HTML document is written     *  @param  flags       optional flag used to customize the output (see DSRTypes::HF_xxx)     *  @param  styleSheet  optional filename/URL of a Cascading Style Sheet (CSS)     ** @return status, EC_Normal if successful, an error code otherwise     */    OFCondition renderHTML(ostream &stream,                           const size_t flags = 0,                           const char *styleSheet = NULL);    /** check if this document contains non-ASCII characters in one of the     *  strings affected by SpecificCharacterSet in DICOM     *  @return true if node contains non-ASCII characters, false otherwise     */    virtual OFBool containsExtendedCharacters();  // --- get/set misc attributes ---    /** get the current SR document type     ** @return document type (might be DT_invalid if read from dataset)     */    E_DocumentType getDocumentType() const;    /** get document tree     ** @return reference to the document tree     */    inline DSRDocumentTree &getTree()    {        return DocumentTree;    }    /** get specific character set type.     *  If the type is unknown the original DICOM defined term can be retrieved     *  with the method getSpecificCharacterSet().  Please note that only the     *  first of possibly multiple values is used to determine the type from the     *  DICOM code string (multiple character sets are not yet supported).     ** @return character set (might be CS_invalid/unknown if not supported)     */    E_CharacterSet getSpecificCharacterSetType() const;    /** set specific character set type.     *  The DICOM defined term (see SpecificCharacterSet) is set accordingly.     ** @return status, EC_Normal if successful, an error code otherwise     */    OFCondition setSpecificCharacterSetType(const E_CharacterSet characterSet);    /** get document completion flag.     *  Not applicable to Key Object Selection Documents.     ** @return completion flag (might be CF_invalid if read from dataset)     */    E_CompletionFlag getCompletionFlag() const;    /** get document completion flag description.     *  Not applicable to Key Object Selection Documents.     ** @return pointer to string value (might be NULL)     */    const char *getCompletionFlagDescription() const;    /** get document completion flag description.     *  Not applicable to Key Object Selection Documents.     ** @param  description  reference to character string in which the value should be stored     ** @return character string (might be empty)     */    const OFString &getCompletionFlagDescription(OFString &description) const;    /** get document verification flag.     *  Not applicable to Key Object Selection Documents.     ** @return verification flag (might be VF_invalid if read from dataset)     */    E_VerificationFlag getVerificationFlag() const;    /** get number of verifying observers.     *  A document can be verified more than once.  The verification flag should be VERIFIED     *  if any verifying observer is specified.  The details on the observer can be retrieved     *  using the getVerifyingObserver() methods.     *  Not applicable to Key Object Selection Documents.     ** @return number of verifying observers (if any), 0 otherwise     */    size_t getNumberOfVerifyingObservers();    /** get information about a verifying observer.     *  All reference variables are cleared before the information is retrieved, i.e. if an error     *  occurs (return value != EC_Normal) non-empty variables do contain valid (empty) data.     *  Not applicable to Key Object Selection Documents.     ** @param  idx           index of the verifying observer to be retrieved (starting with 1).     *                        Use getNumberOfVerifyingObservers() to get the maximum value.     *  @param  dateTime      reference to variable where the date and time when this document     *                        has been verified should be stored (required)     *  @param  observerName  reference to variable where the name of the person who has verified     *                        this document should be stored (required)     *  @param  organization  reference to variable where the name of the organization to which     *                        the observer belongs should be stored (required)     ** @return status, EC_Normal if successful, an error code otherwise     */    OFCondition getVerifyingObserver(const size_t idx,                                     OFString &dateTime,                                     OFString &observerName,                                     OFString &organization);    /** get information about a verifying observer.     *  All reference variables are cleared before the information is retrieved, i.e. if an error     *  occurs (return value != EC_Normal) non-empty variables do contain valid (empty) data.     *  Not applicable to Key Object Selection Documents.     ** @param  idx           index of the verifying observer to be retrieved (starting with 1).     *                        Use getNumberOfVerifyingObservers() to get the maximum value.     *  @param  dateTime      reference to variable where the date and time when this document     *                        has been verified should be stored (required)     *  @param  observerName  reference to variable where the name of the person who has verified     *                        this document should be stored (required)     *  @param  observerCode  reference to variable where the observer code should be stored.     *                        code identifying the verifying observer (optional, see previous method)     *  @param  organization  reference to variable where the name of the organization to which     *                        the observer belongs should be stored (required)     ** @return status, EC_Normal if successful, an error code otherwise     */    OFCondition getVerifyingObserver(const size_t idx,                                     OFString &dateTime,                                     OFString &observerName,                                     DSRCodedEntryValue &observerCode,                                     OFString &organization);    /** get list of predecessor documents.     *  A document can have more than one (direct) predecessor document.  This is e.g. the case     *  when two or more documents have been merged to create it.  The corresponding method     *  createRevisedVersion() automatically adds a reference to the current document.     *  PS 3.3-2004 states: "[The Predecessor Documents Sequence] Shall refer to SR SOP Instances     *  (e.g. prior or provisional reports) whose content has been wholly or partially included in     *  this document with or without modification." and "[...] the use of the Predecessor Document     *  Sequence allows tracing back to the input SR Document, which in this case is the previous     *  version."     *  Not applicable to Key Object Selection Documents.     ** @return reference to list object     */    DSRSOPInstanceReferenceList &getPredecessorDocuments();    /** get list of identical documents.     *  Please note that currently the user is responsible for filling and modifying the content of     *  this list.  However, the list is automatically cleared when a new instance is created (incl.     *  a revised version of the current document).  Possibly, there will be a createDuplicate()     *  method or the like in the future which creates an identical copy of the current document in     *  a new study/series.     *  PS 3.3-2004 states: "If identical copies of an SR Document are to be included in multiple     *  Studies then the entire SR Document shall be duplicated with appropriate changes for     *  inclusion into the different Studies (i.e. Study Instance UID, Series Instance UID, SOP     *  Instance UID, Identical Documents Sequence etc.). The Identical Documents Sequence Attribute     *  in each SOP Instance shall contain references to all other duplicate SOP Instances."     ** @return reference to list object     */    DSRSOPInstanceReferenceList &getIdenticalDocuments();    /** get list of referenced SOP instances (Current Requested Procedure Evidence).     *  PS 3.3-2004 states: "The intent of the Current Requested Procedure Evidence Sequence     *  is to reference all evidence created in order to satisfy the current Requested Procedure(s)     *  for this SR Document. This shall include, but is not limited to, all current evidence     *  referenced in the content tree." and "In the context of the Key Object Selection, the     *  current evidence is considered to be only the set of instances referenced within the Key

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -