dsrdoctn.h

00001 /*
00002  *
00003  *  Copyright (C) 2000-2005, OFFIS
00004  *
00005  *  This software and supporting documentation were developed by
00006  *
00007  *    Kuratorium OFFIS e.V.
00008  *    Healthcare Information and Communication Systems
00009  *    Escherweg 2
00010  *    D-26121 Oldenburg, Germany
00011  *
00012  *  THIS SOFTWARE IS MADE AVAILABLE,  AS IS,  AND OFFIS MAKES NO  WARRANTY
00013  *  REGARDING  THE  SOFTWARE,  ITS  PERFORMANCE,  ITS  MERCHANTABILITY  OR
00014  *  FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES  OR
00015  *  ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
00016  *  PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
00017  *
00018  *  Module: dcmsr
00019  *
00020  *  Author: Joerg Riesmeier
00021  *
00022  *  Purpose:
00023  *    classes: DSRDocumentTreeNode
00024  *
00025  *  Last Update:      $Author: meichel $
00026  *  Update Date:      $Date: 2005/12/08 16:05:00 $
00027  *  CVS/RCS Revision: $Revision: 1.21 $
00028  *  Status:           $State: Exp $
00029  *
00030  *  CVS/RCS Log at end of file
00031  *
00032  */
00033 
00034 
00035 #ifndef DSRDOCTN_H
00036 #define DSRDOCTN_H
00037 
00038 #include "dcmtk/config/osconfig.h"   /* make sure OS specific configuration is included first */
00039 
00040 #include "dcmtk/dcmsr/dsrtree.h"
00041 #include "dcmtk/dcmsr/dsrcodvl.h"
00042 #include "dcmtk/dcmdata/dcitem.h"
00043 
00044 
00045 /*-----------------------*
00046  *  forward declaration  *
00047  *-----------------------*/
00048 
00049 class DSRIODConstraintChecker;
00050 
00051 
00052 /*---------------------*
00053  *  class declaration  *
00054  *---------------------*/
00055 
00058 class DSRDocumentTreeNode
00059   : public DSRTreeNode
00060 {
00061     // allow access to getConceptNamePtr()
00062     friend class DSRContentItem;
00063 
00064   public:
00065 
00076     DSRDocumentTreeNode(const E_RelationshipType relationshipType,
00077                         const E_ValueType valueType);
00078 
00081     virtual ~DSRDocumentTreeNode();
00082 
00086     virtual void clear();
00087 
00093     virtual OFBool isValid() const;
00094 
00101     virtual OFBool isShort(const size_t flags) const;
00102 
00112     virtual OFCondition print(ostream &stream,
00113                               const size_t flags) const;
00114 
00124     virtual OFCondition read(DcmItem &dataset,
00125                              const DSRIODConstraintChecker *constraintChecker,
00126                              const size_t flags,
00127                              OFConsole *logStream = NULL);
00128 
00139     virtual OFCondition write(DcmItem &dataset,
00140                               DcmStack *markedItems = NULL,
00141                               OFConsole *logStream = NULL);
00142 
00151     virtual OFCondition readXML(const DSRXMLDocument &doc,
00152                                 DSRXMLCursor cursor,
00153                                 const E_DocumentType documentType,
00154                                 const size_t flags);
00155 
00162     virtual OFCondition writeXML(ostream &stream,
00163                                  const size_t flags,
00164                                  OFConsole *logStream = NULL) const;
00165 
00178     virtual OFCondition renderHTML(ostream &docStream,
00179                                    ostream &annexStream,
00180                                    const size_t nestingLevel,
00181                                    size_t &annexNumber,
00182                                    const size_t flags,
00183                                    OFConsole *logStream = NULL) const;
00184 
00190     inline OFBool isSigned()
00191     {
00192         return (DigitalSignatures.card() > 0);
00193     }
00194 
00202     inline OFBool isMarked() const
00203     {
00204         return MarkFlag;
00205     }
00206 
00211     inline void setMark(const OFBool flag)
00212     {
00213         MarkFlag = flag;
00214     }
00215 
00219     inline OFBool isReferenceTarget() const
00220     {
00221         return ReferenceTarget;
00222     }
00223 
00227     inline void setReferenceTarget(const OFBool isTarget = OFTrue)
00228     {
00229         ReferenceTarget = isTarget;
00230     }
00231 
00235     inline OFBool hasChildNodes() const
00236     {
00237         return (Down != NULL);
00238     }
00239 
00243     inline OFBool hasSiblingNodes() const
00244     {
00245         return (Prev != NULL) || (Next != NULL);
00246     }
00247 
00251     inline size_t getNodeID() const
00252     {
00253         return Ident;
00254     }
00255 
00259     inline E_RelationshipType getRelationshipType() const
00260     {
00261         return RelationshipType;
00262     }
00263 
00267     inline E_ValueType getValueType() const
00268     {
00269         return ValueType;
00270     }
00271 
00275     inline const DSRCodedEntryValue &getConceptName() const
00276     {
00277         return ConceptName;
00278     }
00279 
00286     OFCondition getConceptName(DSRCodedEntryValue &conceptName) const;
00287 
00296     virtual OFCondition setConceptName(const DSRCodedEntryValue &conceptName);
00297 
00303     inline const OFString &getObservationDateTime() const
00304     {
00305         return ObservationDateTime;
00306     }
00307 
00316     virtual OFCondition setObservationDateTime(const OFString &observationDateTime);
00317 
00330     OFCondition getTemplateIdentification(OFString &templateIdentifier,
00331                                           OFString &mappingResource) const;
00332 
00340     virtual OFCondition setTemplateIdentification(const OFString &templateIdentifier,
00341                                                   const OFString &mappingResource);
00342 
00347     void removeSignatures();
00348 
00353     virtual OFBool containsExtendedCharacters() const;
00354 
00355   protected:
00356 
00360     inline DSRCodedEntryValue *getConceptNamePtr()
00361     {
00362         return &ConceptName;
00363     }
00364 
00376     OFCondition createAndAppendNewNode(DSRDocumentTreeNode *&previousNode,
00377                                        const E_RelationshipType relationshipType,
00378                                        const E_ValueType valueType,
00379                                        const DSRIODConstraintChecker *constraintChecker = NULL);
00380 
00388     virtual OFCondition readContentItem(DcmItem &dataset,
00389                                         OFConsole *logStream);
00390 
00398     virtual OFCondition writeContentItem(DcmItem &dataset,
00399                                          OFConsole *logStream) const;
00400 
00408     virtual OFCondition readXMLContentItem(const DSRXMLDocument &doc,
00409                                            DSRXMLCursor cursor);
00410 
00423     virtual OFCondition renderHTMLContentItem(ostream &docStream,
00424                                               ostream &annexStream,
00425                                               const size_t nestingLevel,
00426                                               size_t &annexNumber,
00427                                               const size_t flags,
00428                                               OFConsole *logStream) const;
00429 
00436     void writeXMLItemStart(ostream &stream,
00437                            const size_t flags,
00438                            const OFBool closingBracket = OFTrue) const;
00439 
00444     void writeXMLItemEnd(ostream &stream,
00445                          const size_t flags) const;
00446 
00454     OFCondition readSRDocumentContentModule(DcmItem &dataset,
00455                                             const DSRIODConstraintChecker *constraintChecker,
00456                                             const size_t flags,
00457                                             OFConsole *logStream);
00458 
00466     OFCondition writeSRDocumentContentModule(DcmItem &dataset,
00467                                              DcmStack *markedItems,
00468                                              OFConsole *logStream);
00469 
00478     OFCondition readDocumentRelationshipMacro(DcmItem &dataset,
00479                                               const DSRIODConstraintChecker *constraintChecker,
00480                                               const OFString &posString,
00481                                               const size_t flags,
00482                                               OFConsole *logStream);
00483 
00491     OFCondition writeDocumentRelationshipMacro(DcmItem &dataset,
00492                                                DcmStack *markedItems,
00493                                                OFConsole *logStream);
00494 
00502     OFCondition readDocumentContentMacro(DcmItem &dataset,
00503                                          const OFString &posString,
00504                                          const size_t flags,
00505                                          OFConsole *logStream);
00506 
00512     OFCondition writeDocumentContentMacro(DcmItem &dataset,
00513                                           OFConsole *logStream) const;
00514 
00523     OFCondition readContentSequence(DcmItem &dataset,
00524                                     const DSRIODConstraintChecker *constraintChecker,
00525                                     const OFString &posString,
00526                                     const size_t flags,
00527                                     OFConsole *logStream);
00528 
00536     OFCondition writeContentSequence(DcmItem &dataset,
00537                                      DcmStack *markedItems,
00538                                      OFConsole *logStream) const;
00539 
00547     OFCondition renderHTMLConceptName(ostream &docStream,
00548                                       const size_t flags,
00549                                       OFConsole *logStream) const;
00550 
00561     OFCondition renderHTMLChildNodes(ostream &docStream,
00562                                      ostream &annexStream,
00563                                      const size_t nestingLevel,
00564                                      size_t &annexNumber,
00565                                      const size_t flags,
00566                                      OFConsole *logStream) const;
00567 
00568   // --- static function ---
00569 
00578     static const OFString &getRelationshipText(const E_RelationshipType relationshipType,
00579                                                OFString &relationshipText,
00580                                                const size_t flags);
00581 
00582 
00583   private:
00584 
00586     OFBool                   MarkFlag;
00588     OFBool                   ReferenceTarget;
00589 
00591     const E_RelationshipType RelationshipType;
00593     const E_ValueType        ValueType;
00594 
00596     DSRCodedEntryValue       ConceptName;
00598     OFString                 ObservationDateTime;
00599 
00601     OFString                 TemplateIdentifier;
00603     OFString                 MappingResource;
00604 
00606     DcmSequenceOfItems       MACParameters;
00608     DcmSequenceOfItems       DigitalSignatures;
00609 
00610 
00611  // --- declaration of default/copy constructor and assignment operator
00612 
00613     DSRDocumentTreeNode();
00614     DSRDocumentTreeNode(const DSRDocumentTreeNode &);
00615     DSRDocumentTreeNode &operator=(const DSRDocumentTreeNode &);
00616 };
00617 
00618 
00619 #endif
00620 
00621 
00622 /*
00623  *  CVS/RCS Log:
00624  *  $Log: dsrdoctn.h,v $
00625  *  Revision 1.21  2005/12/08 16:05:00  meichel
00626  *  Changed include path schema for all DCMTK header files
00627  *
00628  *  Revision 1.20  2004/11/22 16:39:09  meichel
00629  *  Added method that checks if the SR document contains non-ASCII characters
00630  *    in any of the strings affected by SpecificCharacterSet.
00631  *
00632  *  Revision 1.19  2003/12/16 15:57:51  joergr
00633  *  Added note that the condition for the Content Template Sequence is currently
00634  *  not checked.
00635  *
00636  *  Revision 1.18  2003/10/30 17:53:02  joergr
00637  *  Added full support for the ContentTemplateSequence (read/write, get/set
00638  *  template identification). Template constraints are not checked yet.
00639  *
00640  *  Revision 1.17  2003/10/06 09:52:58  joergr
00641  *  Added new flag which allows to ignore content item errors when reading an SR
00642  *  document (e.g. missing value type specific attributes).
00643  *
00644  *  Revision 1.16  2003/09/15 14:18:54  joergr
00645  *  Introduced new class to facilitate checking of SR IOD relationship content
00646  *  constraints. Replaced old implementation distributed over numerous classes.
00647  *
00648  *  Revision 1.15  2003/08/07 17:31:00  joergr
00649  *  Removed libxml dependency from header files. Simplifies linking (MSVC).
00650  *
00651  *  Revision 1.14  2003/08/07 12:34:06  joergr
00652  *  Added readXML functionality.
00653  *  Updated documentation to get rid of doxygen warnings.
00654  *
00655  *  Revision 1.13  2002/08/02 12:38:31  joergr
00656  *  Enhanced debug output of dcmsr::read() routines (e.g. add position string
00657  *  of invalid content items to error messages).
00658  *
00659  *  Revision 1.12  2001/11/09 16:10:49  joergr
00660  *  Added preliminary support for Mammography CAD SR.
00661  *
00662  *  Revision 1.11  2001/09/26 13:04:07  meichel
00663  *  Adapted dcmsr to class OFCondition
00664  *
00665  *  Revision 1.10  2001/04/03 08:24:01  joergr
00666  *  Added new command line option: ignore relationship content constraints
00667  *  specified for each SR document class.
00668  *
00669  *  Revision 1.9  2001/02/02 14:37:33  joergr
00670  *  Added new option to dsr2xml allowing to specify whether value and/or
00671  *  relationship type are to be encoded as XML attributes or elements.
00672  *
00673  *  Revision 1.8  2001/01/18 15:53:34  joergr
00674  *  Added support for digital signatures.
00675  *
00676  *  Revision 1.7  2000/11/13 10:26:21  joergr
00677  *  Added output of optional observation datetime to rendered HTML page.
00678  *
00679  *  Revision 1.6  2000/11/07 18:14:28  joergr
00680  *  Enhanced support for by-reference relationships.
00681  *
00682  *  Revision 1.5  2000/11/01 16:23:19  joergr
00683  *  Added support for conversion to XML.
00684  *
00685  *  Revision 1.4  2000/10/26 14:17:38  joergr
00686  *  Added support for "Comprehensive SR".
00687  *
00688  *  Revision 1.3  2000/10/23 15:10:29  joergr
00689  *  Added/updated doc++ comments.
00690  *
00691  *  Revision 1.2  2000/10/18 17:02:27  joergr
00692  *  Added methods allowing direct access to certain content item values.
00693  *  Made some functions inline.
00694  *
00695  *  Revision 1.1  2000/10/13 07:49:26  joergr
00696  *  Added new module 'dcmsr' providing access to DICOM structured reporting
00697  *  documents (supplement 23).  Doc++ documentation not yet completed.
00698  *
00699  *
00700  */


Generated on 20 Dec 2005 for OFFIS DCMTK Version 3.5.4 by Doxygen 1.4.5