00001 /* 00002 * 00003 * Copyright (C) 1999-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: dcmpstat 00019 * 00020 * Author: Marco Eichelberg 00021 * 00022 * Purpose: 00023 * classes: DVPSStoredPrint 00024 * 00025 * Last Update: $Author: meichel $ 00026 * Update Date: $Date: 2005/12/08 16:04:03 $ 00027 * CVS/RCS Revision: $Revision: 1.38 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 00035 #ifndef DVPSSP_H 00036 #define DVPSSP_H 00037 00038 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00039 00040 #include "dcmtk/ofstd/ofstream.h" 00041 #include "dcmtk/ofstd/ofstring.h" 00042 #include "dcmtk/dcmdata/dctk.h" 00043 #include "dcmtk/dcmpstat/dvpstyp.h" /* for enum types */ 00044 #include "dcmtk/dcmpstat/dvpspll.h" /* for class DVPSPresentationLUT_PList */ 00045 #include "dcmtk/dcmpstat/dvpsibl.h" /* for class DVPSImageBoxContent_PList */ 00046 #include "dcmtk/dcmpstat/dvpsabl.h" /* for class DVPSAnnotationContent_PList */ 00047 #include "dcmtk/dcmpstat/dvpstat.h" /* for class DVPresentationState */ 00048 #include "dcmtk/dcmpstat/dvpspr.h" /* for class DVPrintMessageHandler */ 00049 00050 class DicomImage; 00051 class DVPSPresentationLUT; 00052 class DVConfiguration; 00056 class DVPSStoredPrint 00057 { 00058 public: 00064 DVPSStoredPrint(Uint16 illumin, Uint16 reflection, const char *aetitle = NULL); 00065 00067 DVPSStoredPrint(const DVPSStoredPrint& copy); 00068 00073 DVPSStoredPrint *clone() { return new DVPSStoredPrint(*this); } 00074 00076 virtual ~DVPSStoredPrint(); 00077 00082 void clear(); 00083 00093 OFCondition read(DcmItem &dset); 00094 00111 OFCondition write( 00112 DcmItem &dset, 00113 OFBool writeRequestedImageSize, 00114 OFBool limitImages, 00115 OFBool updateDecimateCrop, 00116 OFBool ignoreEmptyImages); 00117 00122 OFCondition setOriginator(const char *aetitle); 00123 00127 OFCondition setDestination(const char *aetitle); 00128 00132 OFCondition setPrinterName(const char *name); 00133 00141 OFCondition setImageDisplayFormat(unsigned long columns, unsigned long rows); 00142 00149 OFCondition setFilmSizeID(const char *value); 00150 00157 OFCondition setMagnificationType(const char *value); 00158 00165 OFCondition setSmoothingType(const char *value); 00166 00173 OFCondition setConfigurationInformation(const char *value); 00174 00181 OFCondition setResolutionID(const char *value); 00182 00189 OFCondition setFilmOrientation(DVPSFilmOrientation value); 00190 00197 OFCondition setTrim(DVPSTrimMode value); 00198 00206 OFCondition setRequestedDecimateCropBehaviour(DVPSDecimateCropBehaviour value); 00207 00214 OFCondition setBorderDensity(const char *value); 00215 00222 OFCondition setEmtpyImageDensity(const char *value); 00223 00230 OFCondition setMaxDensity(const char *value); 00231 00238 OFCondition setMinDensity(const char *value); 00239 00250 OFCondition newPrinter(const char *name = NULL, const char *destinationAE = NULL); // short cut, delete all optional settings 00251 00255 const char *getOriginator(); 00259 const char *getDestination(); 00263 const char *getPrinterName(); 00264 00268 unsigned long getImageDisplayFormatColumns(); 00269 00273 unsigned long getImageDisplayFormatRows(); 00274 00278 DVPSFilmOrientation getFilmOrientation(); 00279 00283 DVPSTrimMode getTrim(); 00284 00289 DVPSDecimateCropBehaviour getRequestedDecimateCropBehaviour() 00290 { 00291 return decimateCropBehaviour; 00292 } 00293 00297 const char *getStudyInstanceUID(); 00298 00302 const char *getSeriesInstanceUID(); 00303 00307 const char *getSOPInstanceUID(); 00308 00312 const char *getFilmSizeID(); 00313 00317 const char *getMagnificationType(); 00318 00322 const char *getSmoothingType(); 00323 00327 const char *getConfigurationInformation(); 00328 00332 const char *getResolutionID(); 00333 00337 const char *getBorderDensity(); 00338 00342 const char *getEmtpyImageDensity(); 00343 00349 const char *getMaxDensity(); 00350 00356 const char *getMinDensity(); 00357 00361 Uint16 getMaxDensityValue(); 00362 00366 Uint16 getMinDensityValue(); 00367 00371 size_t getNumberOfImages() 00372 { 00373 return imageBoxContentList.size(); 00374 } 00375 00379 size_t getNumberOfAnnotations() 00380 { 00381 return annotationContentList.size(); 00382 } 00383 00388 OFCondition deleteImage(size_t idx); 00389 00395 OFCondition deleteMultipleImages(size_t number); 00396 00403 OFCondition deleteSpooledImages(); 00404 00410 OFBool imageHasAdditionalSettings(size_t idx) 00411 { 00412 return imageBoxContentList.imageHasAdditionalSettings(idx); 00413 } 00414 00420 OFCondition setImagePolarity(size_t idx, const char *value) 00421 { 00422 return imageBoxContentList.setImagePolarity(idx, value); 00423 } 00424 00430 OFCondition setImageRequestedSize(size_t idx, const char *value) 00431 { 00432 return imageBoxContentList.setImageRequestedSize(idx, value); 00433 } 00434 00442 OFCondition setImageMagnificationType(size_t idx, const char *value) 00443 { 00444 return imageBoxContentList.setImageMagnificationType(idx, value); 00445 } 00446 00454 OFCondition setImageSmoothingType(size_t idx, const char *value) 00455 { 00456 return imageBoxContentList.setImageSmoothingType(idx, value); 00457 } 00458 00466 OFCondition setImageConfigurationInformation(size_t idx, const char *value) 00467 { 00468 return imageBoxContentList.setImageConfigurationInformation(idx, value); 00469 } 00470 00475 const char *getImagePolarity(size_t idx) 00476 { 00477 return imageBoxContentList.getImagePolarity(idx); 00478 } 00479 00484 const char *getImageRequestedSize(size_t idx) 00485 { 00486 return imageBoxContentList.getImageRequestedSize(idx); 00487 } 00488 00493 const char *getImageMagnificationType(size_t idx) 00494 { 00495 return imageBoxContentList.getImageMagnificationType(idx); 00496 } 00497 00502 const char *getImageSmoothingType(size_t idx) 00503 { 00504 return imageBoxContentList.getImageSmoothingType(idx); 00505 } 00506 00511 const char *getImageConfigurationInformation(size_t idx) 00512 { 00513 return imageBoxContentList.getImageConfigurationInformation(idx); 00514 } 00515 00521 DVPSPresentationLUT *getImagePresentationLUT(size_t idx); 00522 00527 DVPSPresentationLUT *getPresentationLUT(); 00528 00533 OFCondition setDefaultPresentationLUT(); 00534 00540 OFCondition setPresentationLUTShape(DVPSPresentationLUTType shape); 00541 00550 OFCondition setPresentationLookupTable(DcmItem &dset); 00551 00560 Sint32 convertODtoPValue(Uint16 density, unsigned int bits = 8); 00561 00569 OFCondition writeHardcopyImageAttributes(DcmItem &dset); 00570 00583 OFCondition addImageBox( 00584 const char *retrieveaetitle, 00585 const char *refstudyuid, 00586 const char *refseriesuid, 00587 const char *refsopclassuid, 00588 const char *refsopinstanceuid, 00589 const char *requestedimagesize, 00590 const char *patientid, 00591 DVPSPresentationLUT *presentationlut, 00592 OFBool inversePLUT); 00593 00606 OFCondition addImageBox( 00607 const char *retrieveaetitle, 00608 const char *refsopinstanceuid, 00609 const char *requestedimagesize=NULL, 00610 const char *patientid=NULL, 00611 DVPSPresentationLUT *presentationlut=NULL, 00612 OFBool inversePLUT=OFFalse); 00613 00623 OFCondition setSingleAnnotation( 00624 const char *displayformat, 00625 const char *text, 00626 Uint16 position); 00627 00630 void deleteAnnotations(); 00631 00636 OFCondition setInstanceUID(const char *uid); 00637 00641 void clearInstanceUID() { sOPInstanceUID.clear(); } 00642 00650 OFCondition getImageReference(size_t idx, const char *&studyUID, const char *&seriesUID, const char *&instanceUID) 00651 { 00652 return imageBoxContentList.getImageReference(idx, studyUID, seriesUID, instanceUID); 00653 } 00654 00660 DVPSPrintPresentationLUTAlignment getReferencedPresentationLUTAlignment() { return referencedPresentationLUTAlignment; } 00661 00668 OFCondition printSCUgetPrinterInstance(DVPSPrintMessageHandler& printHandler); 00669 00680 OFCondition printSCUpreparePresentationLUT( 00681 DVPSPrintMessageHandler& printHandler, 00682 OFBool printerRequiresMatchingLUT, 00683 OFBool printerLUTRenderingPreferred, 00684 OFBool printerSupports12Bit); 00685 00693 OFCondition printSCUcreateBasicFilmSession( 00694 DVPSPrintMessageHandler& printHandler, 00695 DcmDataset& dset, 00696 OFBool plutInSession); 00697 00706 OFCondition printSCUcreateBasicFilmBox(DVPSPrintMessageHandler& printHandler, OFBool plutInSession); 00707 00717 OFCondition printSCUsetBasicImageBox( 00718 DVPSPrintMessageHandler& printHandler, 00719 size_t idx, 00720 DicomImage& image, 00721 OFBool useMonochrome1=OFFalse); 00722 00729 OFCondition printSCUsetBasicAnnotationBox( 00730 DVPSPrintMessageHandler& printHandler, 00731 size_t idx); 00732 00737 OFCondition printSCUprintBasicFilmBox(DVPSPrintMessageHandler& printHandler); 00738 00743 OFCondition printSCUprintBasicFilmSession(DVPSPrintMessageHandler& printHandler); 00744 00749 OFCondition printSCUdelete(DVPSPrintMessageHandler& printHandler); 00750 00758 OFCondition setPrintIllumination(Uint16 value); 00759 00764 Uint16 getPrintIllumination(); 00765 00773 OFCondition setPrintReflectedAmbientLight(Uint16 value); 00774 00779 Uint16 getPrintReflectedAmbientLight(); 00780 00805 OFBool printSCPCreate( 00806 DVConfiguration& cfg, 00807 const char *cfgname, 00808 DcmDataset *rqDataset, 00809 T_DIMSE_Message& rsp, 00810 DcmDataset *& rspDataset, 00811 OFBool presentationLUTnegotiated, 00812 DVPSPresentationLUT_PList& globalPresentationLUTList, 00813 const char *filmSessionUID, 00814 DcmUniqueIdentifier& study, 00815 DcmUniqueIdentifier& psSeries, 00816 DcmUniqueIdentifier& imgSeries); 00817 00834 OFBool printSCPSet( 00835 DVConfiguration& cfg, 00836 const char *cfgname, 00837 DcmDataset *rqDataset, 00838 T_DIMSE_Message& rsp, 00839 DcmDataset *& rspDataset, 00840 OFBool presentationLUTnegotiated, 00841 DVPSPresentationLUT_PList& globalPresentationLUTList); 00842 00847 OFBool isFilmBoxInstance(const char *c) { if (c && (filmBoxInstanceUID == c)) return OFTrue; else return OFFalse; } 00848 00855 OFBool usesPresentationLUT(const char *c); 00856 00863 DVPSImageBoxContent *duplicateImageBox(const char *uid) { return imageBoxContentList.duplicateImageBox(uid); } 00864 00872 OFBool haveImagePositionClash(const char *uid, Uint16 position) { return imageBoxContentList.haveImagePositionClash(uid, position); } 00873 00879 void replaceImageBox(DVPSImageBoxContent *newImageBox) { imageBoxContentList.replace(newImageBox); } 00880 00888 void updatePresentationLUTList(DVPSPresentationLUT_PList& globalPresentationLUTList); 00889 00895 void setLog(OFConsole *stream, OFBool verbMode, OFBool dbgMode); 00896 00903 OFBool matchesPresentationLUT(DVPSPrintPresentationLUTAlignment align) const 00904 { 00905 return imageBoxContentList.matchesPresentationLUT(align); 00906 } 00907 00917 void overridePresentationLUTSettings( 00918 DcmUnsignedShort& newIllumination, 00919 DcmUnsignedShort& newReflectedAmbientLight, 00920 DcmUniqueIdentifier& newReferencedPLUT, 00921 DVPSPrintPresentationLUTAlignment newAlignment); 00922 00929 OFBool emptyPageWarning() { return imageBoxContentList.emptyPageWarning(); } 00930 00931 private: 00932 00934 DVPSStoredPrint& operator=(const DVPSStoredPrint&); 00935 00936 /* checks if given SOP class UID is an image storage SOP class 00937 * @return OFTrue if image SOP class, OFFalse otherwise. 00938 */ 00939 OFBool isImageStorageSOPClass(OFString& sopclassuid); 00940 00945 OFCondition createDefaultValues(); 00946 00952 OFCondition addReferencedPLUTSQ(DcmItem &dset); 00953 00961 OFCondition addPresentationLUTReference(DcmItem& dset); 00962 00965 void invalidateCache(); 00966 00969 void updateCache(); 00970 00971 /* Module: Patient (M) 00972 */ 00974 DcmPersonName patientName; 00976 DcmLongString patientID; 00978 DcmDate patientBirthDate; 00980 DcmCodeString patientSex; 00981 00982 /* Module: General Study (M) 00983 */ 00985 DcmUniqueIdentifier studyInstanceUID; 00987 DcmDate studyDate; 00989 DcmTime studyTime; 00991 DcmPersonName referringPhysiciansName; 00993 DcmShortString studyID; 00995 DcmShortString accessionNumber; 00996 00997 /* Module: General Series (M) 00998 */ 01000 DcmUniqueIdentifier seriesInstanceUID; 01002 DcmIntegerString seriesNumber; 01003 01004 /* Module: General Equipment (M) 01005 */ 01007 DcmLongString manufacturer; 01008 01009 /* Module: Printer Characteristics (M) 01010 */ 01011 // the PrintManagementCapabilitiesSequence is only created/checked on the fly 01012 01013 // PrinterCharacteristicsSequence 01015 DcmApplicationEntity originator; 01017 DcmApplicationEntity destination; 01019 DcmLongString printerName; 01020 01021 /* Module: Film Box (M) 01022 */ 01024 DcmIntegerString instanceNumber; 01025 /* the following attributes belong to the Film Box Content SQ (Type 1) */ 01027 DcmShortText imageDisplayFormat; 01029 DcmCodeString annotationDisplayFormatID; 01031 DcmCodeString filmOrientation; 01033 DcmCodeString filmSizeID; 01035 DcmCodeString magnificationType; 01037 DcmCodeString smoothingType; 01039 DcmCodeString borderDensity; 01041 DcmCodeString emptyImageDensity; 01043 DcmUnsignedShort minDensity; 01045 DcmUnsignedShort maxDensity; 01047 DcmCodeString trim; 01049 DcmShortText configurationInformation; 01051 DcmUnsignedShort illumination; 01053 DcmUnsignedShort reflectedAmbientLight; 01055 DcmCodeString requestedResolutionID; 01057 DcmUniqueIdentifier referencedPresentationLUTInstanceUID; 01058 01064 DVPSPrintPresentationLUTAlignment referencedPresentationLUTAlignment; 01065 01066 /* Module: Image Box List (M) 01067 */ 01069 DVPSImageBoxContent_PList imageBoxContentList; 01070 01071 /* Module: Annotation List (U) 01072 */ 01074 DVPSAnnotationContent_PList annotationContentList; 01075 01076 /* Module: Presentation LUT List (U) 01077 */ 01078 DVPSPresentationLUT_PList presentationLUTList; 01079 01080 /* Module: SOP Common (M) 01081 * we don't store the SOP Class UID because it is well known. 01082 */ 01084 DcmUniqueIdentifier sOPInstanceUID; 01086 DcmCodeString specificCharacterSet; 01088 DcmDate instanceCreationDate; 01090 DcmTime instanceCreationTime; 01091 01093 DcmUniqueIdentifier imageSeriesInstanceUID; 01094 01096 OFBool currentValuesValid; 01098 unsigned long currentNumCols; 01100 unsigned long currentNumRows; 01101 01103 DVPSDecimateCropBehaviour decimateCropBehaviour; 01104 01106 OFString filmSessionInstanceUID; 01107 01109 OFString filmBoxInstanceUID; 01110 01117 OFString presentationLUTInstanceUID; 01118 01120 DVPSPresentationLUT globalPresentationLUT; 01121 01123 OFBool globalPresentationLUTValid; 01124 01126 OFBool transmitImagesIn12Bit; 01127 01129 OFBool renderPresentationLUTinSCP; 01130 01132 OFString tempDensity; 01133 01136 OFConsole *logstream; 01137 01140 OFBool verboseMode; 01141 01144 OFBool debugMode; 01145 01146 }; 01147 01148 #endif 01149 01150 /* 01151 * $Log: dvpssp.h,v $ 01152 * Revision 1.38 2005/12/08 16:04:03 meichel 01153 * Changed include path schema for all DCMTK header files 01154 * 01155 * Revision 1.37 2004/02/04 15:49:09 joergr 01156 * Removed acknowledgements with e-mail addresses from CVS log. Removed leading 01157 * underscore characters from preprocessor symbols (reserved symbols). 01158 * 01159 * Revision 1.36 2002/04/16 14:02:03 joergr 01160 * Added configurable support for C++ ANSI standard includes (e.g. streams). 01161 * 01162 * Revision 1.35 2001/09/26 15:36:15 meichel 01163 * Adapted dcmpstat to class OFCondition 01164 * 01165 * Revision 1.34 2001/06/01 15:50:21 meichel 01166 * Updated copyright header 01167 * 01168 * Revision 1.33 2000/07/18 16:03:44 joergr 01169 * Moved method convertODtoLum/PValue from class DVInterface to DVPSStoredPrint 01170 * and corrected implementation. 01171 * Changed behaviour of methods getMin/MaxDensityValue (return default value if 01172 * attribute empty/absent). 01173 * 01174 * Revision 1.32 2000/07/07 14:14:24 joergr 01175 * Added support for LIN OD presentation LUT shape. 01176 * 01177 * Revision 1.31 2000/07/05 12:33:29 joergr 01178 * Corrected documentation of one method. 01179 * 01180 * Revision 1.30 2000/07/04 15:58:03 joergr 01181 * Added support for overriding the presentation LUT settings made for the 01182 * image boxes. 01183 * 01184 * Revision 1.29 2000/06/20 14:50:08 meichel 01185 * Added monochrome1 printing mode. 01186 * 01187 * Revision 1.28 2000/06/19 16:29:07 meichel 01188 * Added options for session printing and LIN OD to print tools, fixed 01189 * pixel aspect ratio related bug. 01190 * 01191 * Revision 1.27 2000/06/14 11:28:15 joergr 01192 * Added methods to access the attributes Polarity and Requested Image Size. 01193 * 01194 * Revision 1.26 2000/06/08 10:44:29 meichel 01195 * Implemented Referenced Presentation LUT Sequence on Basic Film Session level. 01196 * Empty film boxes (pages) are not written to file anymore. 01197 * 01198 * Revision 1.25 2000/06/07 14:23:09 joergr 01199 * Added methods to access the image polarity attribute. 01200 * Added missing transformations (polarity, GSDF, presentation LUT, aspect 01201 * ratio) to print preview rendering. 01202 * 01203 * Revision 1.24 2000/06/07 13:17:46 meichel 01204 * added binary and textual log facilities to Print SCP. 01205 * 01206 * Revision 1.23 2000/06/02 16:00:51 meichel 01207 * Adapted all dcmpstat classes to use OFConsole for log and error output 01208 * 01209 * Revision 1.22 2000/05/31 12:56:39 meichel 01210 * Added initial Print SCP support 01211 * 01212 * Revision 1.21 2000/05/31 07:54:24 joergr 01213 * Added support for Stored Print attributes Originator and Destination 01214 * application entity title. 01215 * 01216 * Revision 1.20 2000/05/30 13:42:09 joergr 01217 * Added methods to set, get and store the printer name in the stored print 01218 * object (PrinterCharacteristicsSequence). 01219 * 01220 * Revision 1.19 2000/03/08 16:28:56 meichel 01221 * Updated copyright header. 01222 * 01223 * Revision 1.18 2000/03/03 14:13:55 meichel 01224 * Implemented library support for redirecting error messages into memory 01225 * instead of printing them to stdout/stderr for GUI applications. 01226 * 01227 * Revision 1.17 2000/02/29 12:16:16 meichel 01228 * Fixed bug in dcmpstat library that caused Monochrome1 images 01229 * to be printed inverse if a Presentation LUT was applied. 01230 * 01231 * Revision 1.16 1999/10/19 14:46:04 meichel 01232 * added support for the Basic Annotation Box SOP Class 01233 * as well as access methods for Max Density and Min Density. 01234 * 01235 * Revision 1.15 1999/10/13 14:11:12 meichel 01236 * Fixed bug in routine that renders P-LUTs into a print bitmap 01237 * before sending an image to the printer 01238 * 01239 * Revision 1.14 1999/10/07 17:21:50 meichel 01240 * Reworked management of Presentation LUTs in order to create tighter 01241 * coupling between Softcopy and Print. 01242 * 01243 * Revision 1.13 1999/09/24 15:24:30 meichel 01244 * Added support for CP 173 (Presentation LUT clarifications) 01245 * 01246 * Revision 1.12 1999/09/17 14:33:59 meichel 01247 * Completed print spool functionality including Supplement 22 support 01248 * 01249 * Revision 1.11 1999/09/15 17:43:29 meichel 01250 * Implemented print job dispatcher code for dcmpstat, adapted dcmprtsv 01251 * and dcmpsprt applications. 01252 * 01253 * Revision 1.10 1999/09/13 15:19:10 meichel 01254 * Added implementations for a number of further print API methods. 01255 * 01256 * Revision 1.9 1999/09/10 12:46:47 meichel 01257 * Added implementations for a number of print API methods. 01258 * 01259 * Revision 1.8 1999/09/09 14:57:33 thiel 01260 * Added methods for print spooler 01261 * 01262 * Revision 1.7 1999/09/09 12:20:47 meichel 01263 * Added print API method declarations and implementations (empty for now). 01264 * 01265 * Revision 1.6 1999/09/08 16:46:44 meichel 01266 * Added print API method declarations 01267 * 01268 * Revision 1.5 1999/09/01 16:14:41 meichel 01269 * Added support for requested image size to print routines 01270 * 01271 * Revision 1.4 1999/08/31 14:09:12 meichel 01272 * Added get/set methods for stored print attributes 01273 * 01274 * Revision 1.3 1999/08/27 15:57:57 meichel 01275 * Added methods for saving hardcopy images and stored print objects 01276 * either in file or in the local database. 01277 * 01278 * Revision 1.2 1999/08/26 09:31:00 thiel 01279 * Add extensions for the usage of the StoredPrint 01280 * 01281 * Revision 1.1 1999/07/30 13:34:50 meichel 01282 * Added new classes managing Stored Print objects 01283 * 01284 * 01285 */