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

dsrdoc.h

00001 /*
00002  *
00003  *  Copyright (C) 2000-2004, 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: DSRDocument
00024  *
00025  *  Last Update:      $Author: joergr $
00026  *  Update Date:      $Date: 2004/04/16 13:24:07 $
00027  *  CVS/RCS Revision: $Revision: 1.34 $
00028  *  Status:           $State: Exp $
00029  *
00030  *  CVS/RCS Log at end of file
00031  *
00032  */
00033 
00034 
00035 #ifndef DSRDOC_H
00036 #define DSRDOC_H
00037 
00038 #include "osconfig.h"   /* make sure OS specific configuration is included first */
00039 
00040 #include "dsrdoctr.h"
00041 #include "dsrsoprf.h"
00042 #include "dsrcsidl.h"
00043 
00044 #include "ofstream.h"
00045 
00046 
00047 /*---------------------*
00048  *  class declaration  *
00049  *---------------------*/
00050 
00056 class DSRDocument
00057   : protected DSRTypes
00058 {
00059 
00060   public:
00061 
00062   // --- constructors and destructor ---
00063 
00068     DSRDocument(const E_DocumentType documentType = DT_BasicTextSR);
00069 
00072     virtual ~DSRDocument();
00073 
00074 
00075   // --- misc routines ---
00076 
00079     void clear();
00080 
00086     OFBool isValid();
00087 
00095     OFBool isFinalized() const;
00096 
00103     void setLogStream(OFConsole *stream);
00104 
00105 
00106   // --- input and output ---
00107 
00114     OFCondition print(ostream &stream,
00115                       const size_t flags = 0);
00116 
00135     OFCondition read(DcmItem &dataset,
00136                      const size_t flags = 0);
00137 
00151     OFCondition write(DcmItem &dataset,
00152                       DcmStack *markedItems = NULL);
00153 
00165     OFCondition readXML(const OFString &filename,
00166                         const size_t flags = 0);
00167 
00175     OFCondition writeXML(ostream &stream,
00176                          const size_t flags = 0);
00177 
00185     OFCondition renderHTML(ostream &stream,
00186                            const size_t flags = 0,
00187                            const char *styleSheet = NULL);
00188 
00189 
00190   // --- get/set misc attributes ---
00191 
00195     E_DocumentType getDocumentType() const;
00196 
00200     inline DSRDocumentTree &getTree()
00201     {
00202         return DocumentTree;
00203     }
00204 
00212     E_CharacterSet getSpecificCharacterSetType() const;
00213 
00218     OFCondition setSpecificCharacterSetType(const E_CharacterSet characterSet);
00219 
00224     E_CompletionFlag getCompletionFlag() const;
00225 
00230     const char *getCompletionFlagDescription() const;
00231 
00237     const OFString &getCompletionFlagDescription(OFString &description) const;
00238 
00243     E_VerificationFlag getVerificationFlag() const;
00244 
00252     size_t getNumberOfVerifyingObservers();
00253 
00268     OFCondition getVerifyingObserver(const size_t idx,
00269                                      OFString &dateTime,
00270                                      OFString &observerName,
00271                                      OFString &organization);
00272 
00289     OFCondition getVerifyingObserver(const size_t idx,
00290                                      OFString &dateTime,
00291                                      OFString &observerName,
00292                                      DSRCodedEntryValue &observerCode,
00293                                      OFString &organization);
00294 
00307     DSRSOPInstanceReferenceList &getPredecessorDocuments();
00308 
00322     DSRSOPInstanceReferenceList &getIdenticalDocuments();
00323 
00338     DSRSOPInstanceReferenceList &getCurrentRequestedProcedureEvidence();
00339 
00348     DSRSOPInstanceReferenceList &getPertinentOtherEvidence();
00349 
00355     DSRCodingSchemeIdentificationList &getCodingSchemeIdentification();
00356 
00357   // --- get DICOM string attributes (C string) ---
00358   // --- (these functions return the whole string value,
00359   // ---  i.e. all components of multi-valued attributes)
00360 
00364     const char *getModality() const;
00365 
00369     const char *getSOPClassUID() const;
00370 
00374     const char *getStudyInstanceUID() const;
00375 
00379     const char *getSeriesInstanceUID() const;
00380 
00384     const char *getSOPInstanceUID() const;
00385 
00389     const char *getInstanceCreatorUID() const;
00390 
00394     const char *getSpecificCharacterSet() const;
00395 
00399     const char *getPatientsName() const;
00400 
00404     const char *getPatientsBirthDate() const;
00405 
00409     const char *getPatientsSex() const;
00410 
00414     const char *getReferringPhysiciansName() const;
00415 
00419     const char *getStudyDescription() const;
00420 
00424     const char *getSeriesDescription() const;
00425 
00429     const char *getManufacturer() const;
00430 
00434     const char *getStudyDate() const;
00435 
00439     const char *getStudyTime() const;
00440 
00444     const char *getInstanceCreationDate() const;
00445 
00449     const char *getInstanceCreationTime() const;
00450 
00454     const char *getContentDate() const;
00455 
00459     const char *getContentTime() const;
00460 
00464     const char *getStudyID() const;
00465 
00469     const char *getPatientID() const;
00470 
00474     const char *getSeriesNumber() const;
00475 
00479     const char *getInstanceNumber() const;
00480 
00484     const char *getAccessionNumber() const;
00485 
00486 
00487   // --- get DICOM string attributes (C++ string) ---
00488   // --- (these functions return only the first
00489   // ---  component of multi-valued attributes)
00490 
00495     const OFString &getModality(OFString &value) const;
00496 
00501     const OFString &getSOPClassUID(OFString &value) const;
00502 
00507     const OFString &getStudyInstanceUID(OFString &value) const;
00508 
00513     const OFString &getSeriesInstanceUID(OFString &value) const;
00514 
00519     const OFString &getSOPInstanceUID(OFString &value) const;
00520 
00525     const OFString &getInstanceCreatorUID(OFString &value) const;
00526 
00531     const OFString &getSpecificCharacterSet(OFString &value) const;
00532 
00537     const OFString &getPatientsName(OFString &value) const;
00538 
00543     const OFString &getPatientsBirthDate(OFString &value) const;
00544 
00549     const OFString &getPatientsSex(OFString &value) const;
00550 
00555     const OFString &getReferringPhysiciansName(OFString &value) const;
00556 
00561     const OFString &getStudyDescription(OFString &value) const;
00562 
00567     const OFString &getSeriesDescription(OFString &value) const;
00568 
00573     const OFString &getManufacturer(OFString &value) const;
00574 
00579     const OFString &getStudyDate(OFString &value) const;
00580 
00585     const OFString &getStudyTime(OFString &value) const;
00586 
00591     const OFString &getInstanceCreationDate(OFString &value) const;
00592 
00597     const OFString &getInstanceCreationTime(OFString &value) const;
00598 
00603     const OFString &getContentDate(OFString &value) const;
00604 
00609     const OFString &getContentTime(OFString &value) const;
00610 
00615     const OFString &getStudyID(OFString &value) const;
00616 
00621     const OFString &getPatientID(OFString &value) const;
00622 
00627     const OFString &getSeriesNumber(OFString &value) const;
00628 
00633     const OFString &getInstanceNumber(OFString &value) const;
00634 
00639     const OFString &getAccessionNumber(OFString &value) const;
00640 
00641 
00642   // --- set DICOM string attributes ---
00643 
00650     OFCondition setSpecificCharacterSet(const OFString &value);
00651 
00658     OFCondition setCompletionFlagDescription(const OFString &value);
00659 
00665     OFCondition setPatientsName(const OFString &value);
00666 
00672     OFCondition setPatientsBirthDate(const OFString &value);
00673 
00679     OFCondition setPatientsSex(const OFString &value);
00680 
00686     OFCondition setReferringPhysiciansName(const OFString &value);
00687 
00693     OFCondition setStudyDescription(const OFString &value);
00694 
00700     OFCondition setSeriesDescription(const OFString &value);
00701 
00707     OFCondition setManufacturer(const OFString &value);
00708 
00716     OFCondition setContentDate(const OFString &value);
00717 
00725     OFCondition setContentTime(const OFString &value);
00726 
00732     OFCondition setStudyID(const OFString &value);
00733 
00739     OFCondition setPatientID(const OFString &value);
00740 
00748     OFCondition setSeriesNumber(const OFString &value);
00749 
00757     OFCondition setInstanceNumber(const OFString &value);
00758 
00764     OFCondition setAccessionNumber(const OFString &value);
00765 
00766 
00767   // --- document management functions ---
00768 
00774     void createNewStudy();
00775 
00781     void createNewSeries();
00782 
00790     OFCondition createNewSeriesInStudy(const OFString &studyUID);
00791 
00803     void createNewSOPInstance();
00804 
00810     OFCondition createNewDocument();
00811 
00818     OFCondition createNewDocument(const E_DocumentType documentType);
00819 
00837     OFCondition createRevisedVersion(const OFBool clearList = OFTrue);
00838 
00846     OFCondition completeDocument();
00847 
00857     OFCondition completeDocument(const OFString &description);
00858 
00871     OFCondition verifyDocument(const OFString &observerName,
00872                                const OFString &organization);
00873 
00884     OFCondition verifyDocument(const OFString &observerName,
00885                                const OFString &organization,
00886                                const OFString &dateTime /*= ""*/);
00887 
00901     OFCondition verifyDocument(const OFString &observerName,
00902                                const DSRCodedEntryValue &observerCode,
00903                                const OFString &organization);
00904 
00916     OFCondition verifyDocument(const OFString &observerName,
00917                                const DSRCodedEntryValue &observerCode,
00918                                const OFString &organization,
00919                                const OFString &dateTime /*= ""*/);
00920 
00928     void removeVerification();
00929 
00942     OFCondition finalizeDocument();
00943 
00944 
00945   protected:
00946 
00953     OFCondition readXMLDocumentHeader(DSRXMLDocument &doc,
00954                                       DSRXMLCursor cursor,
00955                                       const size_t flags);
00956 
00963     OFCondition readXMLPatientData(const DSRXMLDocument &doc,
00964                                    DSRXMLCursor cursor,
00965                                    const size_t flags);
00966 
00973     OFCondition readXMLStudyData(const DSRXMLDocument &doc,
00974                                  DSRXMLCursor cursor,
00975                                  const size_t flags);
00976 
00983     OFCondition readXMLSeriesData(const DSRXMLDocument &doc,
00984                                   DSRXMLCursor cursor,
00985                                   const size_t flags);
00986 
00993     OFCondition readXMLInstanceData(const DSRXMLDocument &doc,
00994                                     DSRXMLCursor cursor,
00995                                     const size_t flags);
00996 
01003     OFCondition readXMLDocumentData(const DSRXMLDocument &doc,
01004                                     DSRXMLCursor cursor,
01005                                     const size_t flags);
01006 
01013     OFCondition readXMLVerifyingObserverData(const DSRXMLDocument &doc,
01014                                              DSRXMLCursor cursor,
01015                                              const size_t flags);
01016 
01021     void renderHTMLPatientData(ostream &stream,
01022                                const size_t flags);
01023 
01029     void renderHTMLReferenceList(ostream &stream,
01030                                  DSRSOPInstanceReferenceList &refList,
01031                                  const size_t flags);
01032 
01041     OFCondition checkDatasetForReading(DcmItem &dataset,
01042                                        E_DocumentType &documentType);
01043 
01049     void updateAttributes(const OFBool updateAll = OFTrue);
01050 
01051 
01052   private:
01053 
01055     DSRDocumentTree DocumentTree;
01056 
01058     OFConsole *LogStream;
01059 
01061     OFBool             FinalizedFlag;
01063     E_CompletionFlag   CompletionFlagEnum;
01065     E_VerificationFlag VerificationFlagEnum;
01067     E_CharacterSet     SpecificCharacterSetEnum;
01068 
01069     // DICOM attributes are listed ordered by module.
01070     // The comments for each attribute describe "Name: (VR, VM, Type)".
01071     // Please note that for particular SR documents (e.g. Key Object Selection)
01072     // other rules might apply.  See DICOM standard for further reference.
01073 
01074     // --- SOP Common Module (M) ---
01075     // (see SR Document General Module)
01076 
01078     DcmUniqueIdentifier SOPClassUID;
01080     DcmUniqueIdentifier SOPInstanceUID;
01082     DcmCodeString       SpecificCharacterSet;
01084     DcmDate             InstanceCreationDate;
01086     DcmTime             InstanceCreationTime;
01088     DcmUniqueIdentifier InstanceCreatorUID;
01090     DSRCodingSchemeIdentificationList CodingSchemeIdentification;
01091 
01092     // --- General Study Module (M) ---
01093 
01095     DcmUniqueIdentifier StudyInstanceUID;
01097     DcmDate             StudyDate;
01099     DcmTime             StudyTime;
01101     DcmPersonName       ReferringPhysiciansName;
01103     DcmShortString      StudyID;
01105     DcmShortString      AccessionNumber;
01107     DcmLongString       StudyDescription;
01108 
01109     // --- General Series Module ---
01110     // (see SR Document Series Module)
01111 
01113     DcmLongString       SeriesDescription;
01114 
01115     // --- Patient Module (M) ---
01116 
01118     DcmPersonName       PatientsName;
01120     DcmLongString       PatientID;
01122     DcmDate             PatientsBirthDate;
01124     DcmCodeString       PatientsSex;
01125 
01126     // --- General Equipment Module (M) ---
01127 
01129     DcmLongString       Manufacturer;
01130 
01131     // --- SR Document Series Module (M) ---
01132 
01134     DcmCodeString       Modality;
01136     DcmUniqueIdentifier SeriesInstanceUID;
01138     DcmIntegerString    SeriesNumber;
01140     DcmSequenceOfItems  ReferencedPerformedProcedureStepSequence;
01141 
01142     // --- SR Document General Module (M) ---
01143 
01145     DcmIntegerString    InstanceNumber;
01147     DcmCodeString       CompletionFlag;
01149     DcmLongString       CompletionFlagDescription;
01151     DcmCodeString       VerificationFlag;
01153     DcmDate             ContentDate;
01155     DcmTime             ContentTime;
01157     DcmSequenceOfItems  VerifyingObserver;
01159     DSRSOPInstanceReferenceList PredecessorDocuments;
01161     DSRSOPInstanceReferenceList IdenticalDocuments;
01162     //  Referenced Request Sequence: (SQ, 1, 1C)
01163         // -- not yet supported --
01165     DcmSequenceOfItems  PerformedProcedureCode;
01167     DSRSOPInstanceReferenceList CurrentRequestedProcedureEvidence;
01169     DSRSOPInstanceReferenceList PertinentOtherEvidence;
01170 
01171  // --- declaration copy constructor and assignment operator
01172 
01173     DSRDocument(const DSRDocument &);
01174     DSRDocument &operator=(const DSRDocument &);
01175 };
01176 
01177 
01178 #endif
01179 
01180 
01181 /*
01182  *  CVS/RCS Log:
01183  *  $Log: dsrdoc.h,v $
01184  *  Revision 1.34  2004/04/16 13:24:07  joergr
01185  *  Restructured code to avoid default parameter values for "complex types" like
01186  *  OFString. Required for Sun CC 2.0.1.
01187  *
01188  *  Revision 1.33  2004/01/05 14:36:02  joergr
01189  *  Removed acknowledgements with e-mail addresses from CVS log.
01190  *
01191  *  Revision 1.32  2003/10/30 17:53:23  joergr
01192  *  Added full support for the ContentTemplateSequence (read/write, get/set
01193  *  template identification). Template constraints are not checked yet.
01194  *
01195  *  Revision 1.31  2003/10/09 13:18:16  joergr
01196  *  Added text from Supplement 66 to getCurrentRequestedProcedureEvidence() API
01197  *  comment.
01198  *
01199  *  Revision 1.30  2003/09/10 13:16:13  joergr
01200  *  Replaced PrivateCodingSchemeUID by new CodingSchemeIdenticationSequence as
01201  *  required by CP 324.
01202  *
01203  *  Revision 1.29  2003/08/07 18:01:42  joergr
01204  *  Removed libxml dependency from header files.
01205  *
01206  *  Revision 1.28  2003/08/07 12:31:46  joergr
01207  *  Added readXML functionality.
01208  *  Updated documentation to get rid of doxygen warnings.
01209  *  Made method isFinalized() const.
01210  *  Added new option to createRevisedVersion() which allows to keep the current
01211  *  list of predecessor documents.
01212  *  Changed interface to access the list of predecessor documents. Now using the
01213  *  existing class DSRSOPInstanceReferenceList.
01214  *  Added preliminary support for the Identical Documents Sequence.
01215  *  Renamed parameters/variables "string" to avoid name clash with STL class.
01216  *
01217  *  Revision 1.27  2002/05/14 08:15:24  joergr
01218  *  Updated comments.
01219  *
01220  *  Revision 1.26  2002/05/07 12:49:31  joergr
01221  *  Added support for the Current Requested Procedure Evidence Sequence and the
01222  *  Pertinent Other Evidence Sequence to the dcmsr module.
01223  *
01224  *  Revision 1.25  2002/04/16 13:50:52  joergr
01225  *  Added configurable support for C++ ANSI standard includes (e.g. streams).
01226  *
01227  *  Revision 1.24  2001/11/09 16:10:48  joergr
01228  *  Added preliminary support for Mammography CAD SR.
01229  *
01230  *  Revision 1.23  2001/09/26 13:04:06  meichel
01231  *  Adapted dcmsr to class OFCondition
01232  *
01233  *  Revision 1.22  2001/04/03 08:24:01  joergr
01234  *  Added new command line option: ignore relationship content constraints
01235  *  specified for each SR document class.
01236  *
01237  *  Revision 1.21  2001/01/29 17:37:14  joergr
01238  *  Added methods to support a new state of finalized and unfinalized documents.
01239  *
01240  *  Revision 1.20  2001/01/25 11:48:43  joergr
01241  *  Corrected typos / enhanced comments.
01242  *
01243  *  Revision 1.19  2001/01/18 15:53:33  joergr
01244  *  Added support for digital signatures.
01245  *
01246  *  Revision 1.18  2000/12/08 13:42:40  joergr
01247  *  Renamed createNewSeries(studyUID) to createNewSeriesInStudy(studyUID).
01248  *
01249  *  Revision 1.17  2000/11/16 13:31:27  joergr
01250  *  Corrected behaviour of updateDicomAttributes().
01251  *
01252  *  Revision 1.16  2000/11/14 17:27:25  joergr
01253  *  Added method to remove verification information.
01254  *
01255  *  Revision 1.15  2000/11/14 16:36:21  joergr
01256  *  Added methods to set the content date/time.
01257  *
01258  *  Revision 1.14  2000/11/14 11:45:50  joergr
01259  *  Corrected behaviour of method createRevisedVersion().
01260  *
01261  *  Revision 1.13  2000/11/13 14:19:06  joergr
01262  *  Updated comments.
01263  *
01264  *  Revision 1.12  2000/11/13 10:26:21  joergr
01265  *  Added output of optional observation datetime to rendered HTML page.
01266  *
01267  *  Revision 1.11  2000/11/10 18:10:20  joergr
01268  *  Corrected behaviour of createNewSOPInstance() and createRevisedDocument().
01269  *
01270  *  Revision 1.10  2000/11/10 17:44:49  joergr
01271  *  Added new methods to set the completion flag description, create new study/
01272  *  series UIDs. Added missing type 2 sequence to dataset. Corrected wrong format
01273  *  of predecessor documents sequence. Changed behaviour of completion/verification
01274  *  flags. Improved HTML and print/dump output.
01275  *
01276  *  Revision 1.9  2000/11/09 20:32:07  joergr
01277  *  Added support for non-ASCII characters in HTML 3.2 (use numeric value).
01278  *
01279  *  Revision 1.8  2000/11/07 18:12:25  joergr
01280  *  Enhanced rendered HTML output of date, time, datetime and pname.
01281  *
01282  *  Revision 1.7  2000/11/01 16:16:33  joergr
01283  *  dded support for conversion to XML.
01284  *  Added support for Cascading Style Sheet (CSS) used optionally for HTML
01285  *  rendering.
01286  *  Enhanced support for specific character sets.
01287  *
01288  *  Revision 1.6  2000/10/26 14:17:06  joergr
01289  *  Added support for "Comprehensive SR".
01290  *
01291  *  Revision 1.5  2000/10/18 17:01:47  joergr
01292  *  Made some functions inline.
01293  *
01294  *  Revision 1.4  2000/10/17 12:35:05  joergr
01295  *  Added methods to retrieve information on predecessor documents and
01296  *  verifying observers.
01297  *
01298  *  Revision 1.3  2000/10/16 16:30:23  joergr
01299  *  Added missing get/setSeriesDescription() methods.
01300  *  Updated comments.
01301  *
01302  *  Revision 1.2  2000/10/16 11:59:04  joergr
01303  *  Made method creating a new SOP instance public. Added check for correct SOP
01304  *  instance UID and SOP class UID to validity check.
01305  *
01306  *  Revision 1.1  2000/10/13 07:49:25  joergr
01307  *  Added new module 'dcmsr' providing access to DICOM structured reporting
01308  *  documents (supplement 23).  Doc++ documentation not yet completed.
01309  *
01310  *
01311  */


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