00001 /* 00002 * 00003 * Copyright (C) 2000-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * 00014 * Module: dcmsr 00015 * 00016 * Author: Joerg Riesmeier 00017 * 00018 * Purpose: 00019 * classes: DSRDocumentTree 00020 * 00021 * Last Update: $Author: joergr $ 00022 * Update Date: $Date: 2010-10-14 13:16:32 $ 00023 * CVS/RCS Revision: $Revision: 1.23 $ 00024 * Status: $State: Exp $ 00025 * 00026 * CVS/RCS Log at end of file 00027 * 00028 */ 00029 00030 00031 #ifndef DSRDOCTR_H 00032 #define DSRDOCTR_H 00033 00034 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00035 00036 #include "dcmtk/dcmsr/dsrtree.h" 00037 #include "dcmtk/dcmsr/dsrdoctn.h" 00038 #include "dcmtk/dcmsr/dsrcitem.h" 00039 00040 #include "dcmtk/dcmdata/dcitem.h" 00041 00042 00043 /*-----------------------* 00044 * forward declaration * 00045 *-----------------------*/ 00046 00047 class DSRIODConstraintChecker; 00048 00049 00050 /*---------------------* 00051 * class declaration * 00052 *---------------------*/ 00053 00056 class DSRDocumentTree 00057 : public DSRTree 00058 { 00059 00060 public: 00061 00065 DSRDocumentTree(const E_DocumentType documentType); 00066 00069 virtual ~DSRDocumentTree(); 00070 00074 virtual void clear(); 00075 00082 virtual OFBool isValid() const; 00083 00089 OFCondition print(STD_NAMESPACE ostream &stream, 00090 const size_t flags = 0); 00091 00101 OFCondition read(DcmItem &dataset, 00102 const E_DocumentType documentType, 00103 const size_t flags = 0); 00104 00113 OFCondition write(DcmItem &dataset, 00114 DcmStack *markedItems = NULL); 00115 00122 OFCondition readXML(const DSRXMLDocument &doc, 00123 DSRXMLCursor cursor, 00124 const size_t flags); 00125 00131 OFCondition writeXML(STD_NAMESPACE ostream &stream, 00132 const size_t flags); 00133 00140 OFCondition renderHTML(STD_NAMESPACE ostream &docStream, 00141 STD_NAMESPACE ostream &annexStream, 00142 const size_t flags = 0); 00143 00147 E_DocumentType getDocumentType() const 00148 { 00149 return DocumentType; 00150 } 00151 00158 OFCondition changeDocumentType(const E_DocumentType documentType); 00159 00173 OFBool canAddContentItem(const E_RelationshipType relationshipType, 00174 const E_ValueType valueType, 00175 const E_AddMode addMode = AM_afterCurrent); 00176 00183 OFBool canAddByReferenceRelationship(const E_RelationshipType relationshipType, 00184 const E_ValueType targetValueType); 00185 00196 size_t addContentItem(const E_RelationshipType relationshipType, 00197 const E_ValueType valueType, 00198 const E_AddMode addMode = AM_afterCurrent); 00199 00208 size_t addByReferenceRelationship(const E_RelationshipType relationshipType, 00209 const size_t referencedNodeID); 00210 00218 size_t removeCurrentContentItem(); 00219 00224 DSRContentItem &getCurrentContentItem(); 00225 00236 size_t gotoNamedNode(const DSRCodedEntryValue &conceptName, 00237 const OFBool startFromRoot = OFTrue, 00238 const OFBool searchIntoSub = OFTrue); 00239 00248 size_t gotoNextNamedNode(const DSRCodedEntryValue &conceptName, 00249 const OFBool searchIntoSub = OFTrue); 00250 00257 void unmarkAllContentItems(); 00258 00263 void removeSignatures(); 00264 00265 00266 protected: 00267 00277 virtual size_t addNode(DSRDocumentTreeNode *node, 00278 const E_AddMode addMode = AM_afterCurrent); 00279 00287 virtual size_t removeNode(); 00288 00303 OFCondition checkByReferenceRelationships(const size_t mode = 0, 00304 const size_t flags = 0); 00305 00309 void resetReferenceTargetFlag(); 00310 00311 00312 private: 00313 00321 virtual size_t addNode(DSRTreeNode *node, 00322 const E_AddMode addMode = AM_afterCurrent); 00323 00325 E_DocumentType DocumentType; 00327 DSRContentItem CurrentContentItem; 00329 DSRIODConstraintChecker *ConstraintChecker; 00330 00331 00332 // --- declaration of default/copy constructor and assignment operator 00333 00334 DSRDocumentTree(); 00335 DSRDocumentTree(const DSRDocumentTree &); 00336 DSRDocumentTree &operator=(const DSRDocumentTree &); 00337 }; 00338 00339 00340 #endif 00341 00342 00343 /* 00344 * CVS/RCS Log: 00345 * $Log: dsrdoctr.h,v $ 00346 * Revision 1.23 2010-10-14 13:16:32 joergr 00347 * Updated copyright header. Added reference to COPYRIGHT file. 00348 * 00349 * Revision 1.22 2009-10-13 14:57:50 uli 00350 * Switched to logging mechanism provided by the "new" oflog module. 00351 * 00352 * Revision 1.21 2008-05-19 09:46:40 joergr 00353 * Reset flag for all content items whether they are target of a by-reference 00354 * relationship (required for an reproducible behavior). 00355 * Changed parameters of checkByReferenceRelationships() method. 00356 * 00357 * Revision 1.20 2007/11/15 16:33:30 joergr 00358 * Added support for output in XHTML 1.1 format. 00359 * 00360 * Revision 1.19 2007/05/11 14:50:05 joergr 00361 * Enhanced debug output when detecting by-reference relationships to non- 00362 * existing content items. 00363 * 00364 * Revision 1.18 2006/08/15 16:40:03 meichel 00365 * Updated the code in module dcmsr to correctly compile when 00366 * all standard C++ classes remain in namespace std. 00367 * 00368 * Revision 1.17 2006/05/11 09:18:21 joergr 00369 * Moved containsExtendedCharacters() from dcmsr to dcmdata module. 00370 * 00371 * Revision 1.16 2005/12/08 16:05:01 meichel 00372 * Changed include path schema for all DCMTK header files 00373 * 00374 * Revision 1.15 2005/07/27 16:36:38 joergr 00375 * Added methods that allow to go to a named node, i.e. using a given concept 00376 * name. 00377 * 00378 * Revision 1.14 2004/11/22 16:39:09 meichel 00379 * Added method that checks if the SR document contains non-ASCII characters 00380 * in any of the strings affected by SpecificCharacterSet. 00381 * 00382 * Revision 1.13 2003/09/15 14:18:54 joergr 00383 * Introduced new class to facilitate checking of SR IOD relationship content 00384 * constraints. Replaced old implementation distributed over numerous classes. 00385 * 00386 * Revision 1.12 2003/08/07 12:35:27 joergr 00387 * Added readXML functionality. 00388 * Updated documentation to get rid of doxygen warnings. 00389 * 00390 * Revision 1.11 2002/04/11 13:02:34 joergr 00391 * Corrected typo and/or enhanced documentation. 00392 * 00393 * Revision 1.10 2001/11/09 16:10:49 joergr 00394 * Added preliminary support for Mammography CAD SR. 00395 * 00396 * Revision 1.9 2001/09/26 13:04:07 meichel 00397 * Adapted dcmsr to class OFCondition 00398 * 00399 * Revision 1.8 2001/04/03 08:24:01 joergr 00400 * Added new command line option: ignore relationship content constraints 00401 * specified for each SR document class. 00402 * 00403 * Revision 1.7 2001/01/25 11:48:43 joergr 00404 * Corrected typos / enhanced comments. 00405 * 00406 * Revision 1.6 2001/01/18 15:53:34 joergr 00407 * Added support for digital signatures. 00408 * 00409 * Revision 1.5 2000/11/07 18:14:29 joergr 00410 * Enhanced support for by-reference relationships. 00411 * 00412 * Revision 1.4 2000/11/01 16:23:20 joergr 00413 * Added support for conversion to XML. 00414 * 00415 * Revision 1.3 2000/10/18 17:02:57 joergr 00416 * Added doc++ comments. 00417 * 00418 * Revision 1.2 2000/10/16 16:31:45 joergr 00419 * Added doc++ comments. 00420 * 00421 * Revision 1.1 2000/10/13 07:49:26 joergr 00422 * Added new module 'dcmsr' providing access to DICOM structured reporting 00423 * documents (supplement 23). Doc++ documentation not yet completed. 00424 * 00425 * 00426 */