1 /* 2 * 3 * Copyright (C) 1998-2012, OFFIS e.V. 4 * All rights reserved. See COPYRIGHT file for details. 5 * 6 * This software and supporting documentation were developed by 7 * 8 * OFFIS e.V. 9 * R&D Division Health 10 * Escherweg 2 11 * D-26121 Oldenburg, Germany 12 * 13 * 14 * Module: dcmpstat 15 * 16 * Author: Marco Eichelberg 17 * 18 * Purpose: 19 * classes: DVPSPresentationLUT_PList 20 * 21 */ 22 23 #ifndef DVPSPLL_H 24 #define DVPSPLL_H 25 26 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 27 #include "dcmtk/dcmpstat/dvpstyp.h" /* for enum types */ 28 #include "dcmtk/dcmpstat/dpdefine.h" 29 #include "dcmtk/ofstd/oflist.h" 30 #include "dcmtk/dcmnet/dimse.h" 31 32 class DVPSPresentationLUT; 33 class DVPSImageBoxContent_PList; 34 35 /** the list of presentation LUTs contained in a stored print object. 36 * This class manages the data structures comprising one complete 37 * Presentation LUT Content Sequence. 38 */ 39 40 class DCMTK_DCMPSTAT_EXPORT DVPSPresentationLUT_PList 41 { 42 public: 43 /// default constructor 44 DVPSPresentationLUT_PList(); 45 46 /// copy constructor 47 DVPSPresentationLUT_PList(const DVPSPresentationLUT_PList& copy); 48 49 /** clone method. 50 * @return a pointer to a new DVPSPresentationLUT_PList object containing 51 * a deep copy of this object. 52 */ clone()53 DVPSPresentationLUT_PList *clone() { return new DVPSPresentationLUT_PList(*this); } 54 55 /// destructor 56 virtual ~DVPSPresentationLUT_PList(); 57 58 /** reads a list of Presentation LUTs (Presentation LUT Content Sequence) from a DICOM dataset. 59 * The DICOM elements of the image references item are copied from the dataset to this object. 60 * The completeness of all items (presence of all required elements, 61 * value multiplicity) is checked. 62 * If this method returns an error code, the object is in undefined state afterwards. 63 * @param dset the DICOM dataset from which the sequence is to be read 64 * @return EC_Normal if successful, an error code otherwise. 65 */ 66 OFCondition read(DcmItem &dset); 67 68 /** writes the list of Presentation LUTs managed by this object to a DICOM dataset. 69 * Copies of the DICOM element managed by this object are inserted into 70 * the DICOM dataset. 71 * @param dset the DICOM dataset to which the ReferencedImageSequence is written 72 * @return EC_Normal if successful, an error code otherwise. 73 */ 74 OFCondition write(DcmItem &dset); 75 76 /** reset the object to initial state. 77 * After this call, the object is in the same state as after 78 * creation with the default constructor. 79 */ 80 void clear(); 81 82 /** gets the number of Presentation LUTs in this list. 83 * @return the number of Presentation LUTs. 84 */ size()85 size_t size() const { return list_.size(); } 86 87 /** finds a presentation LUT by its SOP instance UID. 88 * @param instanceUID SOP instance UID 89 * @return pointer to matching presentation LUT if found, NULL otherwise. 90 */ 91 DVPSPresentationLUT *findPresentationLUT(const char *instanceUID); 92 93 /** removes all presentation LUT entries that are not 94 * referenced from the film box or image box level. 95 * @param filmBox Presentation LUT UID reference on film box level, may be NULL. 96 * @param imageBoxes list of image boxes 97 */ 98 void cleanup(const char *filmBox, DVPSImageBoxContent_PList& imageBoxes); 99 100 /** adds a Presentation LUT to the list of managed LUTs. 101 * The referenced LUT is copied. If an identical LUT already exists, 102 * no duplicate is created. 103 * @param newLUT pointer to new Presentation LUT. May be NULL. 104 * @param inversePLUT true if presentation LUT is for Monochrome1 and must be inversed. 105 * @return UID of referenced Presentation LUT. May be NULL (if input was NULL). 106 */ 107 const char *addPresentationLUT(DVPSPresentationLUT *newLUT, OFBool inversePLUT); 108 109 /** adds a Presentation LUT to the list of managed LUT. The LUT object becomes 110 * owned by this object and is destroyed upon destruction of the list. 111 * @param newLUT LUT to be added. 112 */ insert(DVPSPresentationLUT * newLUT)113 void insert(DVPSPresentationLUT *newLUT) { if (newLUT) list_.push_back(newLUT); } 114 115 /** performs a Print SCP Presentation LUT N-DELETE operation. 116 * The results of the N-DELETE operation are stored in the object passed as rsp. 117 * @param rq N-DELETE request message 118 * @param rsp N-DELETE response message 119 */ 120 void printSCPDelete(T_DIMSE_Message& rq, T_DIMSE_Message& rsp); 121 122 private: 123 124 /** private undefined assignment operator 125 */ 126 DVPSPresentationLUT_PList& operator=(const DVPSPresentationLUT_PList&); 127 128 /** the list maintained by this object 129 */ 130 OFList<DVPSPresentationLUT *> list_; 131 132 }; 133 134 135 #endif 136