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: DSRDocumentTree 00024 * 00025 * Last Update: $Author: meichel $ 00026 * Update Date: $Date: 2005/12/08 16:05:01 $ 00027 * CVS/RCS Revision: $Revision: 1.16 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 00035 #ifndef DSRDOCTR_H 00036 #define DSRDOCTR_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/dsrdoctn.h" 00042 #include "dcmtk/dcmsr/dsrcitem.h" 00043 00044 #include "dcmtk/dcmdata/dcitem.h" 00045 00046 00047 /*-----------------------* 00048 * forward declaration * 00049 *-----------------------*/ 00050 00051 class DSRIODConstraintChecker; 00052 00053 00054 /*---------------------* 00055 * class declaration * 00056 *---------------------*/ 00057 00060 class DSRDocumentTree 00061 : public DSRTree 00062 { 00063 00064 public: 00065 00069 DSRDocumentTree(const E_DocumentType documentType); 00070 00073 virtual ~DSRDocumentTree(); 00074 00078 virtual void clear(); 00079 00086 virtual OFBool isValid() const; 00087 00092 void setLogStream(OFConsole *stream); 00093 00099 OFCondition print(ostream &stream, 00100 const size_t flags = 0); 00101 00111 OFCondition read(DcmItem &dataset, 00112 const E_DocumentType documentType, 00113 const size_t flags = 0); 00114 00123 OFCondition write(DcmItem &dataset, 00124 DcmStack *markedItems = NULL); 00125 00132 OFCondition readXML(const DSRXMLDocument &doc, 00133 DSRXMLCursor cursor, 00134 const size_t flags); 00135 00141 OFCondition writeXML(ostream &stream, 00142 const size_t flags); 00143 00150 OFCondition renderHTML(ostream &docStream, 00151 ostream &annexStream, 00152 const size_t flags = 0); 00153 00157 E_DocumentType getDocumentType() const 00158 { 00159 return DocumentType; 00160 } 00161 00168 OFCondition changeDocumentType(const E_DocumentType documentType); 00169 00183 OFBool canAddContentItem(const E_RelationshipType relationshipType, 00184 const E_ValueType valueType, 00185 const E_AddMode addMode = AM_afterCurrent); 00186 00193 OFBool canAddByReferenceRelationship(const E_RelationshipType relationshipType, 00194 const E_ValueType targetValueType); 00195 00206 size_t addContentItem(const E_RelationshipType relationshipType, 00207 const E_ValueType valueType, 00208 const E_AddMode addMode = AM_afterCurrent); 00209 00218 size_t addByReferenceRelationship(const E_RelationshipType relationshipType, 00219 const size_t referencedNodeID); 00220 00228 size_t removeCurrentContentItem(); 00229 00234 DSRContentItem &getCurrentContentItem(); 00235 00246 size_t gotoNamedNode(const DSRCodedEntryValue &conceptName, 00247 const OFBool startFromRoot = OFTrue, 00248 const OFBool searchIntoSub = OFTrue); 00249 00258 size_t gotoNextNamedNode(const DSRCodedEntryValue &conceptName, 00259 const OFBool searchIntoSub = OFTrue); 00260 00267 void unmarkAllContentItems(); 00268 00273 void removeSignatures(); 00274 00279 OFBool containsExtendedCharacters(); 00280 00281 00282 protected: 00283 00293 virtual size_t addNode(DSRDocumentTreeNode *node, 00294 const E_AddMode addMode = AM_afterCurrent); 00295 00303 virtual size_t removeNode(); 00304 00319 OFCondition checkByReferenceRelationships(const OFBool updateString = OFFalse, 00320 const OFBool updateNodeID = OFFalse); 00321 00322 00323 private: 00324 00332 virtual size_t addNode(DSRTreeNode *node, 00333 const E_AddMode addMode = AM_afterCurrent); 00334 00336 E_DocumentType DocumentType; 00338 OFConsole *LogStream; 00340 DSRContentItem CurrentContentItem; 00342 DSRIODConstraintChecker *ConstraintChecker; 00343 00344 00345 // --- declaration of default/copy constructor and assignment operator 00346 00347 DSRDocumentTree(); 00348 DSRDocumentTree(const DSRDocumentTree &); 00349 DSRDocumentTree &operator=(const DSRDocumentTree &); 00350 }; 00351 00352 00353 #endif 00354 00355 00356 /* 00357 * CVS/RCS Log: 00358 * $Log: dsrdoctr.h,v $ 00359 * Revision 1.16 2005/12/08 16:05:01 meichel 00360 * Changed include path schema for all DCMTK header files 00361 * 00362 * Revision 1.15 2005/07/27 16:36:38 joergr 00363 * Added methods that allow to go to a named node, i.e. using a given concept 00364 * name. 00365 * 00366 * Revision 1.14 2004/11/22 16:39:09 meichel 00367 * Added method that checks if the SR document contains non-ASCII characters 00368 * in any of the strings affected by SpecificCharacterSet. 00369 * 00370 * Revision 1.13 2003/09/15 14:18:54 joergr 00371 * Introduced new class to facilitate checking of SR IOD relationship content 00372 * constraints. Replaced old implementation distributed over numerous classes. 00373 * 00374 * Revision 1.12 2003/08/07 12:35:27 joergr 00375 * Added readXML functionality. 00376 * Updated documentation to get rid of doxygen warnings. 00377 * 00378 * Revision 1.11 2002/04/11 13:02:34 joergr 00379 * Corrected typo and/or enhanced documentation. 00380 * 00381 * Revision 1.10 2001/11/09 16:10:49 joergr 00382 * Added preliminary support for Mammography CAD SR. 00383 * 00384 * Revision 1.9 2001/09/26 13:04:07 meichel 00385 * Adapted dcmsr to class OFCondition 00386 * 00387 * Revision 1.8 2001/04/03 08:24:01 joergr 00388 * Added new command line option: ignore relationship content constraints 00389 * specified for each SR document class. 00390 * 00391 * Revision 1.7 2001/01/25 11:48:43 joergr 00392 * Corrected typos / enhanced comments. 00393 * 00394 * Revision 1.6 2001/01/18 15:53:34 joergr 00395 * Added support for digital signatures. 00396 * 00397 * Revision 1.5 2000/11/07 18:14:29 joergr 00398 * Enhanced support for by-reference relationships. 00399 * 00400 * Revision 1.4 2000/11/01 16:23:20 joergr 00401 * Added support for conversion to XML. 00402 * 00403 * Revision 1.3 2000/10/18 17:02:57 joergr 00404 * Added doc++ comments. 00405 * 00406 * Revision 1.2 2000/10/16 16:31:45 joergr 00407 * Added doc++ comments. 00408 * 00409 * Revision 1.1 2000/10/13 07:49:26 joergr 00410 * Added new module 'dcmsr' providing access to DICOM structured reporting 00411 * documents (supplement 23). Doc++ documentation not yet completed. 00412 * 00413 * 00414 */