00001 /* 00002 * 00003 * Copyright (C) 1999-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: DVPSStoredPrint 00020 * 00021 * Last Update: $Author: joergr $ 00022 * Update Date: $Date: 2010-10-14 13:16:36 $ 00023 * CVS/RCS Revision: $Revision: 1.42 $ 00024 * Status: $State: Exp $ 00025 * 00026 * CVS/RCS Log at end of file 00027 * 00028 */ 00029 00030 00031 #ifndef DVPSSP_H 00032 #define DVPSSP_H 00033 00034 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00035 00036 #include "dcmtk/ofstd/ofstream.h" 00037 #include "dcmtk/ofstd/ofstring.h" 00038 #include "dcmtk/dcmpstat/dvpstyp.h" /* for enum types */ 00039 #include "dcmtk/dcmpstat/dvpspll.h" /* for class DVPSPresentationLUT_PList */ 00040 #include "dcmtk/dcmpstat/dvpsibl.h" /* for class DVPSImageBoxContent_PList */ 00041 #include "dcmtk/dcmpstat/dvpsabl.h" /* for class DVPSAnnotationContent_PList */ 00042 #include "dcmtk/dcmpstat/dvpstat.h" /* for class DVPresentationState */ 00043 #include "dcmtk/dcmpstat/dvpspr.h" /* for class DVPrintMessageHandler */ 00044 00045 class DicomImage; 00046 class DVPSPresentationLUT; 00047 class DVConfiguration; 00051 class DVPSStoredPrint 00052 { 00053 public: 00059 DVPSStoredPrint(Uint16 illumin, Uint16 reflection, const char *aetitle = NULL); 00060 00062 DVPSStoredPrint(const DVPSStoredPrint& copy); 00063 00068 DVPSStoredPrint *clone() { return new DVPSStoredPrint(*this); } 00069 00071 virtual ~DVPSStoredPrint(); 00072 00077 void clear(); 00078 00088 OFCondition read(DcmItem &dset); 00089 00106 OFCondition write( 00107 DcmItem &dset, 00108 OFBool writeRequestedImageSize, 00109 OFBool limitImages, 00110 OFBool updateDecimateCrop, 00111 OFBool ignoreEmptyImages); 00112 00117 OFCondition setOriginator(const char *aetitle); 00118 00122 OFCondition setDestination(const char *aetitle); 00123 00127 OFCondition setPrinterName(const char *name); 00128 00136 OFCondition setImageDisplayFormat(unsigned long columns, unsigned long rows); 00137 00144 OFCondition setFilmSizeID(const char *value); 00145 00152 OFCondition setMagnificationType(const char *value); 00153 00160 OFCondition setSmoothingType(const char *value); 00161 00168 OFCondition setConfigurationInformation(const char *value); 00169 00176 OFCondition setResolutionID(const char *value); 00177 00184 OFCondition setFilmOrientation(DVPSFilmOrientation value); 00185 00192 OFCondition setTrim(DVPSTrimMode value); 00193 00201 OFCondition setRequestedDecimateCropBehaviour(DVPSDecimateCropBehaviour value); 00202 00209 OFCondition setBorderDensity(const char *value); 00210 00217 OFCondition setEmtpyImageDensity(const char *value); 00218 00225 OFCondition setMaxDensity(const char *value); 00226 00233 OFCondition setMinDensity(const char *value); 00234 00245 OFCondition newPrinter(const char *name = NULL, const char *destinationAE = NULL); // short cut, delete all optional settings 00246 00250 const char *getOriginator(); 00254 const char *getDestination(); 00258 const char *getPrinterName(); 00259 00263 unsigned long getImageDisplayFormatColumns(); 00264 00268 unsigned long getImageDisplayFormatRows(); 00269 00273 DVPSFilmOrientation getFilmOrientation(); 00274 00278 DVPSTrimMode getTrim(); 00279 00284 DVPSDecimateCropBehaviour getRequestedDecimateCropBehaviour() 00285 { 00286 return decimateCropBehaviour; 00287 } 00288 00292 const char *getStudyInstanceUID(); 00293 00297 const char *getSeriesInstanceUID(); 00298 00302 const char *getSOPInstanceUID(); 00303 00307 const char *getFilmSizeID(); 00308 00312 const char *getMagnificationType(); 00313 00317 const char *getSmoothingType(); 00318 00322 const char *getConfigurationInformation(); 00323 00327 const char *getResolutionID(); 00328 00332 const char *getBorderDensity(); 00333 00337 const char *getEmtpyImageDensity(); 00338 00344 const char *getMaxDensity(); 00345 00351 const char *getMinDensity(); 00352 00356 Uint16 getMaxDensityValue(); 00357 00361 Uint16 getMinDensityValue(); 00362 00366 size_t getNumberOfImages() 00367 { 00368 return imageBoxContentList.size(); 00369 } 00370 00374 size_t getNumberOfAnnotations() 00375 { 00376 return annotationContentList.size(); 00377 } 00378 00383 OFCondition deleteImage(size_t idx); 00384 00390 OFCondition deleteMultipleImages(size_t number); 00391 00398 OFCondition deleteSpooledImages(); 00399 00405 OFBool imageHasAdditionalSettings(size_t idx) 00406 { 00407 return imageBoxContentList.imageHasAdditionalSettings(idx); 00408 } 00409 00415 OFCondition setImagePolarity(size_t idx, const char *value) 00416 { 00417 return imageBoxContentList.setImagePolarity(idx, value); 00418 } 00419 00425 OFCondition setImageRequestedSize(size_t idx, const char *value) 00426 { 00427 return imageBoxContentList.setImageRequestedSize(idx, value); 00428 } 00429 00437 OFCondition setImageMagnificationType(size_t idx, const char *value) 00438 { 00439 return imageBoxContentList.setImageMagnificationType(idx, value); 00440 } 00441 00449 OFCondition setImageSmoothingType(size_t idx, const char *value) 00450 { 00451 return imageBoxContentList.setImageSmoothingType(idx, value); 00452 } 00453 00461 OFCondition setImageConfigurationInformation(size_t idx, const char *value) 00462 { 00463 return imageBoxContentList.setImageConfigurationInformation(idx, value); 00464 } 00465 00470 const char *getImagePolarity(size_t idx) 00471 { 00472 return imageBoxContentList.getImagePolarity(idx); 00473 } 00474 00479 const char *getImageRequestedSize(size_t idx) 00480 { 00481 return imageBoxContentList.getImageRequestedSize(idx); 00482 } 00483 00488 const char *getImageMagnificationType(size_t idx) 00489 { 00490 return imageBoxContentList.getImageMagnificationType(idx); 00491 } 00492 00497 const char *getImageSmoothingType(size_t idx) 00498 { 00499 return imageBoxContentList.getImageSmoothingType(idx); 00500 } 00501 00506 const char *getImageConfigurationInformation(size_t idx) 00507 { 00508 return imageBoxContentList.getImageConfigurationInformation(idx); 00509 } 00510 00516 DVPSPresentationLUT *getImagePresentationLUT(size_t idx); 00517 00522 DVPSPresentationLUT *getPresentationLUT(); 00523 00528 OFCondition setDefaultPresentationLUT(); 00529 00535 OFCondition setPresentationLUTShape(DVPSPresentationLUTType shape); 00536 00545 OFCondition setPresentationLookupTable(DcmItem &dset); 00546 00555 Sint32 convertODtoPValue(Uint16 density, unsigned int bits = 8); 00556 00564 OFCondition writeHardcopyImageAttributes(DcmItem &dset); 00565 00578 OFCondition addImageBox( 00579 const char *retrieveaetitle, 00580 const char *refstudyuid, 00581 const char *refseriesuid, 00582 const char *refsopclassuid, 00583 const char *refsopinstanceuid, 00584 const char *requestedimagesize, 00585 const char *patientid, 00586 DVPSPresentationLUT *presentationlut, 00587 OFBool inversePLUT); 00588 00601 OFCondition addImageBox( 00602 const char *retrieveaetitle, 00603 const char *refsopinstanceuid, 00604 const char *requestedimagesize=NULL, 00605 const char *patientid=NULL, 00606 DVPSPresentationLUT *presentationlut=NULL, 00607 OFBool inversePLUT=OFFalse); 00608 00618 OFCondition setSingleAnnotation( 00619 const char *displayformat, 00620 const char *text, 00621 Uint16 position); 00622 00625 void deleteAnnotations(); 00626 00631 OFCondition setInstanceUID(const char *uid); 00632 00636 void clearInstanceUID() { sOPInstanceUID.clear(); } 00637 00645 OFCondition getImageReference(size_t idx, const char *&studyUID, const char *&seriesUID, const char *&instanceUID) 00646 { 00647 return imageBoxContentList.getImageReference(idx, studyUID, seriesUID, instanceUID); 00648 } 00649 00655 DVPSPrintPresentationLUTAlignment getReferencedPresentationLUTAlignment() { return referencedPresentationLUTAlignment; } 00656 00663 OFCondition printSCUgetPrinterInstance(DVPSPrintMessageHandler& printHandler); 00664 00675 OFCondition printSCUpreparePresentationLUT( 00676 DVPSPrintMessageHandler& printHandler, 00677 OFBool printerRequiresMatchingLUT, 00678 OFBool printerLUTRenderingPreferred, 00679 OFBool printerSupports12Bit); 00680 00688 OFCondition printSCUcreateBasicFilmSession( 00689 DVPSPrintMessageHandler& printHandler, 00690 DcmDataset& dset, 00691 OFBool plutInSession); 00692 00701 OFCondition printSCUcreateBasicFilmBox(DVPSPrintMessageHandler& printHandler, OFBool plutInSession); 00702 00712 OFCondition printSCUsetBasicImageBox( 00713 DVPSPrintMessageHandler& printHandler, 00714 size_t idx, 00715 DicomImage& image, 00716 OFBool useMonochrome1=OFFalse); 00717 00724 OFCondition printSCUsetBasicAnnotationBox( 00725 DVPSPrintMessageHandler& printHandler, 00726 size_t idx); 00727 00732 OFCondition printSCUprintBasicFilmBox(DVPSPrintMessageHandler& printHandler); 00733 00738 OFCondition printSCUprintBasicFilmSession(DVPSPrintMessageHandler& printHandler); 00739 00744 OFCondition printSCUdelete(DVPSPrintMessageHandler& printHandler); 00745 00753 OFCondition setPrintIllumination(Uint16 value); 00754 00759 Uint16 getPrintIllumination(); 00760 00768 OFCondition setPrintReflectedAmbientLight(Uint16 value); 00769 00774 Uint16 getPrintReflectedAmbientLight(); 00775 00800 OFBool printSCPCreate( 00801 DVConfiguration& cfg, 00802 const char *cfgname, 00803 DcmDataset *rqDataset, 00804 T_DIMSE_Message& rsp, 00805 DcmDataset *& rspDataset, 00806 OFBool presentationLUTnegotiated, 00807 DVPSPresentationLUT_PList& globalPresentationLUTList, 00808 const char *filmSessionUID, 00809 DcmUniqueIdentifier& study, 00810 DcmUniqueIdentifier& psSeries, 00811 DcmUniqueIdentifier& imgSeries); 00812 00829 OFBool printSCPSet( 00830 DVConfiguration& cfg, 00831 const char *cfgname, 00832 DcmDataset *rqDataset, 00833 T_DIMSE_Message& rsp, 00834 DcmDataset *& rspDataset, 00835 OFBool presentationLUTnegotiated, 00836 DVPSPresentationLUT_PList& globalPresentationLUTList); 00837 00842 OFBool isFilmBoxInstance(const char *c) { if (c && (filmBoxInstanceUID == c)) return OFTrue; else return OFFalse; } 00843 00850 OFBool usesPresentationLUT(const char *c); 00851 00858 DVPSImageBoxContent *duplicateImageBox(const char *uid) { return imageBoxContentList.duplicateImageBox(uid); } 00859 00867 OFBool haveImagePositionClash(const char *uid, Uint16 position) { return imageBoxContentList.haveImagePositionClash(uid, position); } 00868 00874 void replaceImageBox(DVPSImageBoxContent *newImageBox) { imageBoxContentList.replace(newImageBox); } 00875 00883 void updatePresentationLUTList(DVPSPresentationLUT_PList& globalPresentationLUTList); 00884 00891 OFBool matchesPresentationLUT(DVPSPrintPresentationLUTAlignment align) const 00892 { 00893 return imageBoxContentList.matchesPresentationLUT(align); 00894 } 00895 00905 void overridePresentationLUTSettings( 00906 DcmUnsignedShort& newIllumination, 00907 DcmUnsignedShort& newReflectedAmbientLight, 00908 DcmUniqueIdentifier& newReferencedPLUT, 00909 DVPSPrintPresentationLUTAlignment newAlignment); 00910 00917 OFBool emptyPageWarning() { return imageBoxContentList.emptyPageWarning(); } 00918 00919 private: 00920 00922 DVPSStoredPrint& operator=(const DVPSStoredPrint&); 00923 00924 /* checks if given SOP class UID is an image storage SOP class 00925 * @return OFTrue if image SOP class, OFFalse otherwise. 00926 */ 00927 OFBool isImageStorageSOPClass(OFString& sopclassuid); 00928 00933 OFCondition createDefaultValues(); 00934 00940 OFCondition addReferencedPLUTSQ(DcmItem &dset); 00941 00949 OFCondition addPresentationLUTReference(DcmItem& dset); 00950 00953 void invalidateCache(); 00954 00957 void updateCache(); 00958 00959 /* Module: Patient (M) 00960 */ 00962 DcmPersonName patientName; 00964 DcmLongString patientID; 00966 DcmDate patientBirthDate; 00968 DcmCodeString patientSex; 00969 00970 /* Module: General Study (M) 00971 */ 00973 DcmUniqueIdentifier studyInstanceUID; 00975 DcmDate studyDate; 00977 DcmTime studyTime; 00979 DcmPersonName referringPhysicianName; 00981 DcmShortString studyID; 00983 DcmShortString accessionNumber; 00984 00985 /* Module: General Series (M) 00986 */ 00988 DcmUniqueIdentifier seriesInstanceUID; 00990 DcmIntegerString seriesNumber; 00991 00992 /* Module: General Equipment (M) 00993 */ 00995 DcmLongString manufacturer; 00996 00997 /* Module: Printer Characteristics (M) 00998 */ 00999 // the PrintManagementCapabilitiesSequence is only created/checked on the fly 01000 01001 // PrinterCharacteristicsSequence 01003 DcmApplicationEntity originator; 01005 DcmApplicationEntity destination; 01007 DcmLongString printerName; 01008 01009 /* Module: Film Box (M) 01010 */ 01012 DcmIntegerString instanceNumber; 01013 /* the following attributes belong to the Film Box Content SQ (Type 1) */ 01015 DcmShortText imageDisplayFormat; 01017 DcmCodeString annotationDisplayFormatID; 01019 DcmCodeString filmOrientation; 01021 DcmCodeString filmSizeID; 01023 DcmCodeString magnificationType; 01025 DcmCodeString smoothingType; 01027 DcmCodeString borderDensity; 01029 DcmCodeString emptyImageDensity; 01031 DcmUnsignedShort minDensity; 01033 DcmUnsignedShort maxDensity; 01035 DcmCodeString trim; 01037 DcmShortText configurationInformation; 01039 DcmUnsignedShort illumination; 01041 DcmUnsignedShort reflectedAmbientLight; 01043 DcmCodeString requestedResolutionID; 01045 DcmUniqueIdentifier referencedPresentationLUTInstanceUID; 01046 01052 DVPSPrintPresentationLUTAlignment referencedPresentationLUTAlignment; 01053 01054 /* Module: Image Box List (M) 01055 */ 01057 DVPSImageBoxContent_PList imageBoxContentList; 01058 01059 /* Module: Annotation List (U) 01060 */ 01062 DVPSAnnotationContent_PList annotationContentList; 01063 01064 /* Module: Presentation LUT List (U) 01065 */ 01066 DVPSPresentationLUT_PList presentationLUTList; 01067 01068 /* Module: SOP Common (M) 01069 * we don't store the SOP Class UID because it is well known. 01070 */ 01072 DcmUniqueIdentifier sOPInstanceUID; 01074 DcmCodeString specificCharacterSet; 01076 DcmDate instanceCreationDate; 01078 DcmTime instanceCreationTime; 01079 01081 DcmUniqueIdentifier imageSeriesInstanceUID; 01082 01084 OFBool currentValuesValid; 01086 unsigned long currentNumCols; 01088 unsigned long currentNumRows; 01089 01091 DVPSDecimateCropBehaviour decimateCropBehaviour; 01092 01094 OFString filmSessionInstanceUID; 01095 01097 OFString filmBoxInstanceUID; 01098 01105 OFString presentationLUTInstanceUID; 01106 01108 DVPSPresentationLUT globalPresentationLUT; 01109 01111 OFBool globalPresentationLUTValid; 01112 01114 OFBool transmitImagesIn12Bit; 01115 01117 OFBool renderPresentationLUTinSCP; 01118 01120 OFString tempDensity; 01121 01122 }; 01123 01124 #endif 01125 01126 /* 01127 * $Log: dvpssp.h,v $ 01128 * Revision 1.42 2010-10-14 13:16:36 joergr 01129 * Updated copyright header. Added reference to COPYRIGHT file. 01130 * 01131 * Revision 1.41 2010-08-09 13:20:50 joergr 01132 * Updated data dictionary to 2009 edition of the DICOM standard. From now on, 01133 * the official "keyword" is used for the attribute name which results in a 01134 * number of minor changes (e.g. "PatientsName" is now called "PatientName"). 01135 * 01136 * Revision 1.40 2009-11-24 14:12:57 uli 01137 * Switched to logging mechanism provided by the "new" oflog module. 01138 * 01139 * Revision 1.39 2009-09-30 10:42:38 uli 01140 * Make dcmpstat's include headers self-sufficient by including all 01141 * needed headers directly and stop using dctk.h 01142 * 01143 * Revision 1.38 2005-12-08 16:04:03 meichel 01144 * Changed include path schema for all DCMTK header files 01145 * 01146 * Revision 1.37 2004/02/04 15:49:09 joergr 01147 * Removed acknowledgements with e-mail addresses from CVS log. Removed leading 01148 * underscore characters from preprocessor symbols (reserved symbols). 01149 * 01150 * Revision 1.36 2002/04/16 14:02:03 joergr 01151 * Added configurable support for C++ ANSI standard includes (e.g. streams). 01152 * 01153 * Revision 1.35 2001/09/26 15:36:15 meichel 01154 * Adapted dcmpstat to class OFCondition 01155 * 01156 * Revision 1.34 2001/06/01 15:50:21 meichel 01157 * Updated copyright header 01158 * 01159 * Revision 1.33 2000/07/18 16:03:44 joergr 01160 * Moved method convertODtoLum/PValue from class DVInterface to DVPSStoredPrint 01161 * and corrected implementation. 01162 * Changed behaviour of methods getMin/MaxDensityValue (return default value if 01163 * attribute empty/absent). 01164 * 01165 * Revision 1.32 2000/07/07 14:14:24 joergr 01166 * Added support for LIN OD presentation LUT shape. 01167 * 01168 * Revision 1.31 2000/07/05 12:33:29 joergr 01169 * Corrected documentation of one method. 01170 * 01171 * Revision 1.30 2000/07/04 15:58:03 joergr 01172 * Added support for overriding the presentation LUT settings made for the 01173 * image boxes. 01174 * 01175 * Revision 1.29 2000/06/20 14:50:08 meichel 01176 * Added monochrome1 printing mode. 01177 * 01178 * Revision 1.28 2000/06/19 16:29:07 meichel 01179 * Added options for session printing and LIN OD to print tools, fixed 01180 * pixel aspect ratio related bug. 01181 * 01182 * Revision 1.27 2000/06/14 11:28:15 joergr 01183 * Added methods to access the attributes Polarity and Requested Image Size. 01184 * 01185 * Revision 1.26 2000/06/08 10:44:29 meichel 01186 * Implemented Referenced Presentation LUT Sequence on Basic Film Session level. 01187 * Empty film boxes (pages) are not written to file anymore. 01188 * 01189 * Revision 1.25 2000/06/07 14:23:09 joergr 01190 * Added methods to access the image polarity attribute. 01191 * Added missing transformations (polarity, GSDF, presentation LUT, aspect 01192 * ratio) to print preview rendering. 01193 * 01194 * Revision 1.24 2000/06/07 13:17:46 meichel 01195 * added binary and textual log facilities to Print SCP. 01196 * 01197 * Revision 1.23 2000/06/02 16:00:51 meichel 01198 * Adapted all dcmpstat classes to use OFConsole for log and error output 01199 * 01200 * Revision 1.22 2000/05/31 12:56:39 meichel 01201 * Added initial Print SCP support 01202 * 01203 * Revision 1.21 2000/05/31 07:54:24 joergr 01204 * Added support for Stored Print attributes Originator and Destination 01205 * application entity title. 01206 * 01207 * Revision 1.20 2000/05/30 13:42:09 joergr 01208 * Added methods to set, get and store the printer name in the stored print 01209 * object (PrinterCharacteristicsSequence). 01210 * 01211 * Revision 1.19 2000/03/08 16:28:56 meichel 01212 * Updated copyright header. 01213 * 01214 * Revision 1.18 2000/03/03 14:13:55 meichel 01215 * Implemented library support for redirecting error messages into memory 01216 * instead of printing them to stdout/stderr for GUI applications. 01217 * 01218 * Revision 1.17 2000/02/29 12:16:16 meichel 01219 * Fixed bug in dcmpstat library that caused Monochrome1 images 01220 * to be printed inverse if a Presentation LUT was applied. 01221 * 01222 * Revision 1.16 1999/10/19 14:46:04 meichel 01223 * added support for the Basic Annotation Box SOP Class 01224 * as well as access methods for Max Density and Min Density. 01225 * 01226 * Revision 1.15 1999/10/13 14:11:12 meichel 01227 * Fixed bug in routine that renders P-LUTs into a print bitmap 01228 * before sending an image to the printer 01229 * 01230 * Revision 1.14 1999/10/07 17:21:50 meichel 01231 * Reworked management of Presentation LUTs in order to create tighter 01232 * coupling between Softcopy and Print. 01233 * 01234 * Revision 1.13 1999/09/24 15:24:30 meichel 01235 * Added support for CP 173 (Presentation LUT clarifications) 01236 * 01237 * Revision 1.12 1999/09/17 14:33:59 meichel 01238 * Completed print spool functionality including Supplement 22 support 01239 * 01240 * Revision 1.11 1999/09/15 17:43:29 meichel 01241 * Implemented print job dispatcher code for dcmpstat, adapted dcmprtsv 01242 * and dcmpsprt applications. 01243 * 01244 * Revision 1.10 1999/09/13 15:19:10 meichel 01245 * Added implementations for a number of further print API methods. 01246 * 01247 * Revision 1.9 1999/09/10 12:46:47 meichel 01248 * Added implementations for a number of print API methods. 01249 * 01250 * Revision 1.8 1999/09/09 14:57:33 thiel 01251 * Added methods for print spooler 01252 * 01253 * Revision 1.7 1999/09/09 12:20:47 meichel 01254 * Added print API method declarations and implementations (empty for now). 01255 * 01256 * Revision 1.6 1999/09/08 16:46:44 meichel 01257 * Added print API method declarations 01258 * 01259 * Revision 1.5 1999/09/01 16:14:41 meichel 01260 * Added support for requested image size to print routines 01261 * 01262 * Revision 1.4 1999/08/31 14:09:12 meichel 01263 * Added get/set methods for stored print attributes 01264 * 01265 * Revision 1.3 1999/08/27 15:57:57 meichel 01266 * Added methods for saving hardcopy images and stored print objects 01267 * either in file or in the local database. 01268 * 01269 * Revision 1.2 1999/08/26 09:31:00 thiel 01270 * Add extensions for the usage of the StoredPrint 01271 * 01272 * Revision 1.1 1999/07/30 13:34:50 meichel 01273 * Added new classes managing Stored Print objects 01274 * 01275 * 01276 */