Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

dsrdoctn.h

00001 /*
00002  *
00003  *  Copyright (C) 2000-2003, 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: joergr $
00026  *  Update Date:      $Date: 2003/12/16 15:57:51 $
00027  *  CVS/RCS Revision: $Revision: 1.19 $
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 "osconfig.h"   /* make sure OS specific configuration is included first */
00039 
00040 #include "dsrtree.h"
00041 #include "dsrcodvl.h"
00042 #include "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 
00349 
00350   protected:
00351 
00355     inline DSRCodedEntryValue *getConceptNamePtr()
00356     {
00357         return &ConceptName;
00358     }
00359 
00371     OFCondition createAndAppendNewNode(DSRDocumentTreeNode *&previousNode,
00372                                        const E_RelationshipType relationshipType,
00373                                        const E_ValueType valueType,
00374                                        const DSRIODConstraintChecker *constraintChecker = NULL);
00375 
00383     virtual OFCondition readContentItem(DcmItem &dataset,
00384                                         OFConsole *logStream);
00385 
00393     virtual OFCondition writeContentItem(DcmItem &dataset,
00394                                          OFConsole *logStream) const;
00395 
00403     virtual OFCondition readXMLContentItem(const DSRXMLDocument &doc,
00404                                            DSRXMLCursor cursor);
00405 
00418     virtual OFCondition renderHTMLContentItem(ostream &docStream,
00419                                               ostream &annexStream,
00420                                               const size_t nestingLevel,
00421                                               size_t &annexNumber,
00422                                               const size_t flags,
00423                                               OFConsole *logStream) const;
00424 
00431     void writeXMLItemStart(ostream &stream,
00432                            const size_t flags,
00433                            const OFBool closingBracket = OFTrue) const;
00434 
00439     void writeXMLItemEnd(ostream &stream,
00440                          const size_t flags) const;
00441 
00449     OFCondition readSRDocumentContentModule(DcmItem &dataset,
00450                                             const DSRIODConstraintChecker *constraintChecker,
00451                                             const size_t flags,
00452                                             OFConsole *logStream);
00453 
00461     OFCondition writeSRDocumentContentModule(DcmItem &dataset,
00462                                              DcmStack *markedItems,
00463                                              OFConsole *logStream);
00464 
00473     OFCondition readDocumentRelationshipMacro(DcmItem &dataset,
00474                                               const DSRIODConstraintChecker *constraintChecker,
00475                                               const OFString &posString,
00476                                               const size_t flags,
00477                                               OFConsole *logStream);
00478 
00486     OFCondition writeDocumentRelationshipMacro(DcmItem &dataset,
00487                                                DcmStack *markedItems,
00488                                                OFConsole *logStream);
00489 
00497     OFCondition readDocumentContentMacro(DcmItem &dataset,
00498                                          const OFString &posString,
00499                                          const size_t flags,
00500                                          OFConsole *logStream);
00501 
00507     OFCondition writeDocumentContentMacro(DcmItem &dataset,
00508                                           OFConsole *logStream) const;
00509 
00518     OFCondition readContentSequence(DcmItem &dataset,
00519                                     const DSRIODConstraintChecker *constraintChecker,
00520                                     const OFString &posString,
00521                                     const size_t flags,
00522                                     OFConsole *logStream);
00523 
00531     OFCondition writeContentSequence(DcmItem &dataset,
00532                                      DcmStack *markedItems,
00533                                      OFConsole *logStream) const;
00534 
00542     OFCondition renderHTMLConceptName(ostream &docStream,
00543                                       const size_t flags,
00544                                       OFConsole *logStream) const;
00545 
00556     OFCondition renderHTMLChildNodes(ostream &docStream,
00557                                      ostream &annexStream,
00558                                      const size_t nestingLevel,
00559                                      size_t &annexNumber,
00560                                      const size_t flags,
00561                                      OFConsole *logStream) const;
00562 
00563   // --- static function ---
00564 
00573     static const OFString &getRelationshipText(const E_RelationshipType relationshipType,
00574                                                OFString &relationshipText,
00575                                                const size_t flags);
00576 
00577 
00578   private:
00579 
00581     OFBool                   MarkFlag;
00583     OFBool                   ReferenceTarget;
00584 
00586     const E_RelationshipType RelationshipType;
00588     const E_ValueType        ValueType;
00589 
00591     DSRCodedEntryValue       ConceptName;
00593     OFString                 ObservationDateTime;
00594 
00596     OFString                 TemplateIdentifier;
00598     OFString                 MappingResource;
00599 
00601     DcmSequenceOfItems       MACParameters;
00603     DcmSequenceOfItems       DigitalSignatures;
00604 
00605 
00606  // --- declaration of default/copy constructor and assignment operator
00607 
00608     DSRDocumentTreeNode();
00609     DSRDocumentTreeNode(const DSRDocumentTreeNode &);
00610     DSRDocumentTreeNode &operator=(const DSRDocumentTreeNode &);
00611 };
00612 
00613 
00614 #endif
00615 
00616 
00617 /*
00618  *  CVS/RCS Log:
00619  *  $Log: dsrdoctn.h,v $
00620  *  Revision 1.19  2003/12/16 15:57:51  joergr
00621  *  Added note that the condition for the Content Template Sequence is currently
00622  *  not checked.
00623  *
00624  *  Revision 1.18  2003/10/30 17:53:02  joergr
00625  *  Added full support for the ContentTemplateSequence (read/write, get/set
00626  *  template identification). Template constraints are not checked yet.
00627  *
00628  *  Revision 1.17  2003/10/06 09:52:58  joergr
00629  *  Added new flag which allows to ignore content item errors when reading an SR
00630  *  document (e.g. missing value type specific attributes).
00631  *
00632  *  Revision 1.16  2003/09/15 14:18:54  joergr
00633  *  Introduced new class to facilitate checking of SR IOD relationship content
00634  *  constraints. Replaced old implementation distributed over numerous classes.
00635  *
00636  *  Revision 1.15  2003/08/07 17:31:00  joergr
00637  *  Removed libxml dependency from header files. Simplifies linking (MSVC).
00638  *
00639  *  Revision 1.14  2003/08/07 12:34:06  joergr
00640  *  Added readXML functionality.
00641  *  Updated documentation to get rid of doxygen warnings.
00642  *
00643  *  Revision 1.13  2002/08/02 12:38:31  joergr
00644  *  Enhanced debug output of dcmsr::read() routines (e.g. add position string
00645  *  of invalid content items to error messages).
00646  *
00647  *  Revision 1.12  2001/11/09 16:10:49  joergr
00648  *  Added preliminary support for Mammography CAD SR.
00649  *
00650  *  Revision 1.11  2001/09/26 13:04:07  meichel
00651  *  Adapted dcmsr to class OFCondition
00652  *
00653  *  Revision 1.10  2001/04/03 08:24:01  joergr
00654  *  Added new command line option: ignore relationship content constraints
00655  *  specified for each SR document class.
00656  *
00657  *  Revision 1.9  2001/02/02 14:37:33  joergr
00658  *  Added new option to dsr2xml allowing to specify whether value and/or
00659  *  relationship type are to be encoded as XML attributes or elements.
00660  *
00661  *  Revision 1.8  2001/01/18 15:53:34  joergr
00662  *  Added support for digital signatures.
00663  *
00664  *  Revision 1.7  2000/11/13 10:26:21  joergr
00665  *  Added output of optional observation datetime to rendered HTML page.
00666  *
00667  *  Revision 1.6  2000/11/07 18:14:28  joergr
00668  *  Enhanced support for by-reference relationships.
00669  *
00670  *  Revision 1.5  2000/11/01 16:23:19  joergr
00671  *  Added support for conversion to XML.
00672  *
00673  *  Revision 1.4  2000/10/26 14:17:38  joergr
00674  *  Added support for "Comprehensive SR".
00675  *
00676  *  Revision 1.3  2000/10/23 15:10:29  joergr
00677  *  Added/updated doc++ comments.
00678  *
00679  *  Revision 1.2  2000/10/18 17:02:27  joergr
00680  *  Added methods allowing direct access to certain content item values.
00681  *  Made some functions inline.
00682  *
00683  *  Revision 1.1  2000/10/13 07:49:26  joergr
00684  *  Added new module 'dcmsr' providing access to DICOM structured reporting
00685  *  documents (supplement 23).  Doc++ documentation not yet completed.
00686  *
00687  *
00688  */


Generated on 26 Apr 2005 for OFFIS DCMTK Version 3.5.3 by Doxygen 1.4.2