00001 /* 00002 * 00003 * Copyright (C) 1998-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: dcmpstat 00015 * 00016 * Author: Marco Eichelberg 00017 * 00018 * Purpose: 00019 * classes: DcmPresentationState 00020 * 00021 * Last Update: $Author: joergr $ 00022 * Update Date: $Date: 2010-10-14 13:16:35 $ 00023 * CVS/RCS Revision: $Revision: 1.7 $ 00024 * Status: $State: Exp $ 00025 * 00026 * CVS/RCS Log at end of file 00027 * 00028 */ 00029 00030 #ifndef DCMPSTAT_H 00031 #define DCMPSTAT_H 00032 00033 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00034 #include "dcmtk/dcmdata/dctk.h" 00035 00036 #include "dcmtk/ofstd/ofstring.h" /* for class OFString */ 00037 #include "dcmtk/dcmpstat/dvpstyp.h" /* for enum types */ 00038 #include "dcmtk/dcmpstat/dvpsovl.h" /* for DVPSOverlay_PList */ 00039 #include "dcmtk/dcmpstat/dvpsgll.h" /* for DVPSGraphicLayer_PList */ 00040 #include "dcmtk/dcmpstat/dvpsrsl.h" /* for DVPSReferencedSeries_PList */ 00041 #include "dcmtk/dcmpstat/dvpsall.h" /* for DVPSOverlayCurveActivationLayer_PList */ 00042 #include "dcmtk/dcmpstat/dvpsgal.h" /* for DVPSGraphicObject_PList */ 00043 #include "dcmtk/dcmpstat/dvpscul.h" /* for DVPSCurve_PList */ 00044 #include "dcmtk/dcmpstat/dvpsvll.h" /* for DVPSVOILUT_PList */ 00045 #include "dcmtk/dcmpstat/dvpsvwl.h" /* for DVPSVOIWindow_PList */ 00046 #include "dcmtk/dcmpstat/dvpsdal.h" /* for DVPSDisplayedArea_PList */ 00047 #include "dcmtk/dcmpstat/dvpssvl.h" /* for DVPSSoftcopyVOI_PList */ 00048 #include "dcmtk/dcmpstat/dvpspl.h" /* for DVPSPresentationLUT */ 00049 00050 class DVPSTextObject; 00051 class DVPSGraphicObject; 00052 class DVPSCurve; 00053 class DVPSDisplayedArea; 00054 class DVPSSoftcopyVOI; 00055 00061 class DcmPresentationState 00062 { 00063 public: 00066 DcmPresentationState(); 00067 00069 virtual ~DcmPresentationState(); 00070 00081 OFCondition read(DcmItem &dset); 00082 00093 OFCondition write(DcmItem &dset, OFBool replaceSOPInstanceUID); 00094 00098 const char *createInstanceUID(); 00099 00103 const char *getInstanceUID(); 00104 00108 const char *getSOPClassUID(); 00109 00112 const char *getPatientID(); 00113 00117 const char *getStudyUID(); 00118 00134 OFCondition addImageReference( 00135 const char *studyUID, 00136 const char *seriesUID, 00137 const char *sopclassUID, 00138 const char *instanceUID, 00139 const char *frames=NULL, 00140 const char *aetitle=NULL, 00141 const char *filesetID=NULL, 00142 const char *filesetUID=NULL); 00143 00153 OFCondition addImageReference( 00154 DcmItem &dset, 00155 const char *aetitle=NULL, 00156 const char *filesetID=NULL, 00157 const char *filesetUID=NULL); 00158 00165 OFCondition removeImageReference( 00166 const char *studyUID, 00167 const char *seriesUID, 00168 const char *instanceUID); 00169 00174 OFCondition removeImageReference(DcmItem &dset); 00175 00179 size_t numberOfImageReferences(); 00180 00193 OFCondition getImageReference( 00194 size_t idx, 00195 OFString& studyUID, 00196 OFString& seriesUID, 00197 OFString& sopclassUID, 00198 OFString& instanceUID, 00199 OFString& frames, 00200 OFString& aetitle, 00201 OFString& filesetID, 00202 OFString& filesetUID); 00203 00204 00209 void clear(); 00210 00237 OFCondition createFromImage(DcmItem &dset, 00238 DVPSoverlayActivation overlayActivation = DVPSO_copyOverlays, 00239 DVPSVOIActivation voiActivation = DVPSV_preferVOILUT, 00240 OFBool curveActivation = OFTrue, 00241 OFBool shutterActivation = OFTrue, 00242 OFBool presentationActivation = OFTrue, 00243 DVPSGraphicLayering layering = DVPSG_twoLayers, 00244 const char * aetitle = NULL, 00245 const char * filesetID = NULL, 00246 const char * filesetUID = NULL); 00247 00248 00249 /* Presentation LUT Interface */ 00250 00254 DVPSPresentationLUTType getPresentationLUT() { return presentationLUT.getType(); } 00255 00262 OFBool havePresentationLookupTable() { return presentationLUT.haveTable(); } 00263 00271 const char *getCurrentPresentationLUTExplanation() { return presentationLUT.getCurrentExplanation(); } 00272 00278 const char *getPresentationLUTExplanation() { return presentationLUT.getLUTExplanation(); } 00279 00283 DVPSPresentationLUT *getPresentationLUTData() { return &presentationLUT; } 00284 00285 /* Rotate/Flip Interface */ 00286 00290 DVPSRotationType getRotation(); 00291 00295 OFBool getFlip(); 00296 00301 OFCondition setRotation(DVPSRotationType rotation); 00302 00307 OFCondition setFlip(OFBool isFlipped); 00308 00309 00310 /* VOI Transform Interface */ 00311 00312 /* Displayed Area Interface */ 00313 00314 00315 /* shutter Interface */ 00316 00321 OFBool haveShutter(DVPSShutterType type); 00322 00323 /* rectangular shutter Interface */ 00324 00329 Sint32 getRectShutterLV(); 00330 00335 Sint32 getRectShutterRV(); 00336 00341 Sint32 getRectShutterUH(); 00342 00347 Sint32 getRectShutterLH(); 00348 00349 00350 /* circular shutter Interface */ 00351 00356 Sint32 getCenterOfCircularShutter_x(); 00357 00362 Sint32 getCenterOfCircularShutter_y(); 00363 00374 Sint32 getRadiusOfCircularShutter(); 00375 00376 /* polygonal shutter Interface */ 00377 00382 size_t getNumberOfPolyShutterVertices(); 00383 00393 OFCondition getPolyShutterVertex(size_t idx, Sint32& x, Sint32& y); 00394 00403 OFCondition setPolyShutterOrigin(Sint32 x, Sint32 y); 00404 00405 /* bitmap shutter Interface 00406 * 00407 * see methods: 00408 * overlayIsBitmapShutter(), 00409 * overlayIsSuitableAsBitmapShutter(), 00410 * activateOverlayAsBitmapShutter() 00411 * in overlay interface definitions. 00412 */ 00413 00414 /* shutter presentation value Interface */ 00415 00420 Uint16 getShutterPresentationValue(); 00421 00426 OFCondition setShutterPresentationValue(Uint16 pvalue); 00427 00428 /* Presentation State Label, Description and Name Interface */ 00429 00434 const char *getPresentationLabel(); 00435 00440 const char *getPresentationDescription(); 00441 00446 const char *getPresentationCreatorsName(); 00447 00454 OFCondition setPresentationLabel(const char *label); 00455 00462 OFCondition setPresentationDescription(const char *descr); 00463 00470 OFCondition setPresentationCreatorsName(const char *name); 00471 00472 /* specific character set */ 00473 00478 OFCondition setCharset(DVPScharacterSet charset); 00479 00483 DVPScharacterSet getCharset(); 00484 00488 const char *getCharsetString(); 00489 00490 /* graphic layers */ 00491 00500 void sortGraphicLayers(); 00501 00505 size_t getNumberOfGraphicLayers(); 00506 00513 const char *getGraphicLayerName(size_t idx); 00514 00521 size_t getGraphicLayerIndex(const char *name); 00522 00523 00530 const char *getGraphicLayerDescription(size_t idx); 00531 00536 OFBool haveGraphicLayerRecommendedDisplayValue(size_t idx); 00537 00546 OFCondition getGraphicLayerRecommendedDisplayValueGray(size_t idx, Uint16& gray); 00547 00557 OFCondition getGraphicLayerRecommendedDisplayValueRGB(size_t idx, Uint16& r, Uint16& g, Uint16& b); 00558 00566 OFCondition setGraphicLayerRecommendedDisplayValueGray(size_t idx, Uint16 gray); 00567 00577 OFCondition setGraphicLayerRecommendedDisplayValueRGB(size_t idx, Uint16 r, Uint16 g, Uint16 b); 00578 00584 void removeGraphicLayerRecommendedDisplayValue(size_t idx, OFBool rgb, OFBool monochrome); 00585 00595 OFCondition setGraphicLayerName(size_t idx, const char *name); 00596 00602 OFCondition setGraphicLayerDescription(size_t idx, const char *descr); 00603 00613 OFCondition toFrontGraphicLayer(size_t idx); 00614 00623 OFCondition toBackGraphicLayer(size_t idx); 00624 00632 OFCondition exchangeGraphicLayers(size_t idx1, size_t idx2); 00633 00643 OFCondition addGraphicLayer( 00644 const char *gLayer, 00645 const char *gLayerDescription=NULL); 00646 00647 00648 /* text objects */ 00649 00650 /* graphic objects */ 00651 00652 /* curves */ 00653 00659 size_t getNumberOfCurves(size_t layer); 00660 00667 OFCondition removeCurve(size_t layer, size_t idx); 00668 00678 OFCondition moveCurve(size_t old_layer, size_t idx, size_t new_layer); 00679 00680 00681 /* overlays */ 00682 00688 size_t getNumberOfActiveOverlays(size_t layer); 00689 00695 Uint16 getActiveOverlayGroup(size_t layer, size_t idx); 00696 00701 size_t getNumberOfOverlaysInPresentationState(); 00702 00707 Uint16 getOverlayInPresentationStateGroup(size_t idx); 00708 00713 const char *getOverlayInPresentationStateLabel(size_t idx); 00714 00719 const char *getOverlayInPresentationStateDescription(size_t idx); 00720 00728 size_t getOverlayInPresentationStateActivationLayer(size_t idx); 00729 00735 OFBool overlayIsBitmapShutter(size_t idx); 00736 00742 OFBool overlayInPresentationStateIsROI(size_t idx); 00743 00753 OFCondition moveOverlay(size_t old_layer, size_t idx, size_t new_layer); 00754 00755 /* attached image */ 00756 00757 /* Display transform */ 00758 00759 /* print related methods */ 00760 00761 private: 00762 00765 DcmPresentationState(const DcmPresentationState& copy); 00766 00769 DcmPresentationState& operator=(const DcmPresentationState& obj); 00770 00780 OFCondition createDummyValues(OFBool replaceSOPInstanceUID); 00781 00787 void cleanupLayers(); 00788 00789 protected: 00790 00796 OFCondition createDefaultDisplayedArea(DcmItem &dset); 00797 00798 /* Module: Patient (M) 00799 */ 00801 DcmPersonName patientName; 00803 DcmLongString patientID; 00805 DcmDate patientBirthDate; 00807 DcmCodeString patientSex; 00808 00809 /* Module: General Study (M) 00810 */ 00812 DcmUniqueIdentifier studyInstanceUID; 00814 DcmDate studyDate; 00816 DcmTime studyTime; 00818 DcmPersonName referringPhysicianName; 00820 DcmShortString studyID; 00822 DcmShortString accessionNumber; 00823 00824 /* Module: General Series (M) 00825 */ 00827 DcmUniqueIdentifier seriesInstanceUID; 00829 DcmIntegerString seriesNumber; 00830 00831 /* Module: Presentation Series (M) - specializes general series 00832 */ 00833 // modality; see General Series 00834 00835 /* Module: General Equipment (M) 00836 */ 00838 DcmLongString manufacturer; 00839 00840 /* Module: Displayed Area (M) 00841 */ 00843 DVPSDisplayedArea_PList displayedAreaSelectionList; 00844 00845 /* Module: Softcopy Presentation LUT (M) 00846 * There must never be more that one Presentation LUT for one Presentation State, 00847 * therefore we need not save a list of LUTs. 00848 */ 00850 DVPSPresentationLUT presentationLUT; 00851 00852 /* Module: Presentation State (M) 00853 * specializes mask and display shutter 00854 */ 00856 DcmIntegerString imageNumber; 00858 DcmCodeString presentationLabel; 00860 DcmLongString presentationDescription; 00862 DcmDate presentationCreationDate; 00864 DcmTime presentationCreationTime; 00866 DcmPersonName presentationCreatorsName; 00868 DVPSReferencedSeries_PList referencedSeriesList; 00869 // shutterPresentationValue; Type 1c. See Display Shutter module 00870 00871 /* Module: SOP Common (M) 00872 * we don't store the SOP Class UID because it is well known. 00873 */ 00875 DcmUniqueIdentifier sOPInstanceUID; 00877 DcmCodeString specificCharacterSet; 00879 DcmDate instanceCreationDate; 00881 DcmTime instanceCreationTime; 00883 DcmUniqueIdentifier instanceCreatorUID; 00884 00885 /* Module: Display Shutter (C) 00886 * "required if display shutter to be applied and BitmapDispShutter not present" 00887 */ 00889 OFBool useShutterRectangular; 00891 OFBool useShutterCircular; 00893 OFBool useShutterPolygonal; 00895 OFBool useShutterBitmap; 00897 DcmCodeString shutterShape; 00899 DcmIntegerString shutterLeftVerticalEdge; 00901 DcmIntegerString shutterRightVerticalEdge; 00903 DcmIntegerString shutterUpperHorizontalEdge; 00905 DcmIntegerString shutterLowerHorizontalEdge; 00907 DcmIntegerString centerOfCircularShutter; 00909 DcmIntegerString radiusOfCircularShutter; 00911 DcmIntegerString verticesOfThePolygonalShutter; 00913 DcmUnsignedShort shutterPresentationValue; 00914 00915 /* Module: Bitmap Display Shutter (C) 00916 * "required if display shutter to be applied and DispShutter not present" 00917 */ 00919 DcmUnsignedShort shutterOverlayGroup; 00920 // shutterPresentationValue already defined in Display Shutter module 00921 // shutterShape already defined in Display Shutter module 00922 00923 /* Module: Overlay Plane (C) 00924 * "required if overlay to be applied or BitmapDispShutter present" 00925 */ 00927 DVPSOverlay_PList overlayList; 00928 00929 /* Module: Overlay/Curve Activation (C) 00930 * "required if ref. image contains overlay or curve to be displayed" 00931 */ 00933 DVPSOverlayCurveActivationLayer_PList activationLayerList; 00934 00935 /* Module: Graphic Annotation (C) 00936 * "required if graphical annotation to be applied" 00937 */ 00939 DVPSGraphicAnnotation_PList graphicAnnotationList; 00940 00941 /* Module: Spatial Transformation (C) 00942 * "required if rotation/flipping/magnification to be applied" 00943 */ 00945 DcmUnsignedShort imageRotation; 00947 DcmCodeString imageHorizontalFlip; 00948 00949 /* Module: Graphic Layer (C) 00950 * "required if graphic annotation, overlays or curves to be applied" 00951 */ 00953 DVPSGraphicLayer_PList graphicLayerList; 00954 00955 /* Module: Modality LUT (C) 00956 * "required if modality LUT to be applied" 00957 * There must never be more that one Modality LUT for one Presentation State, 00958 * therefore we need not save a list of LUTs. 00959 */ 00961 OFBool useModalityRescale; 00963 OFBool useModalityLUT; 00965 DcmUnsignedShort modalityLUTDescriptor; 00967 DcmLongString modalityLUTExplanation; 00969 DcmLongString modalityLUTType; 00971 DcmUnsignedShort modalityLUTData; 00973 DcmDecimalString rescaleIntercept; 00975 DcmDecimalString rescaleSlope; 00977 DcmLongString rescaleType; 00978 00979 /* Module: Softcopy VOI LUT (C) 00980 * "required if VOI LUT to be applied" 00981 */ 00983 DVPSSoftcopyVOI_PList softcopyVOIList; 00984 00985 }; 00986 00987 #endif 00988 00989 /* 00990 * $Log: dcmpstat.h,v $ 00991 * Revision 1.7 2010-10-14 13:16:35 joergr 00992 * Updated copyright header. Added reference to COPYRIGHT file. 00993 * 00994 * Revision 1.6 2010-10-07 14:31:35 joergr 00995 * Removed leading underscore characters from preprocessor symbols (reserved). 00996 * 00997 * Revision 1.5 2010-08-09 13:20:50 joergr 00998 * Updated data dictionary to 2009 edition of the DICOM standard. From now on, 00999 * the official "keyword" is used for the attribute name which results in a 01000 * number of minor changes (e.g. "PatientsName" is now called "PatientName"). 01001 * 01002 * Revision 1.4 2009-11-24 14:12:57 uli 01003 * Switched to logging mechanism provided by the "new" oflog module. 01004 * 01005 * Revision 1.3 2009-05-28 10:40:20 joergr 01006 * Fixed various Doxygen API documentation issues. 01007 * 01008 * Revision 1.2 2005/12/08 16:03:29 meichel 01009 * Changed include path schema for all DCMTK header files 01010 * 01011 * Revision 1.1 2003/08/27 14:57:19 meichel 01012 * Splitted class DVPresentationState into a base class DcmPresentationState 01013 * that does not depend on module dcmimgle and current derived class with 01014 * public API identical to the previous version. 01015 * 01016 * 01017 */