1 /* 2 * 3 * Copyright (C) 2008-2012, OFFIS e.V. and ICSMED AG, Oldenburg, Germany 4 * Copyright (C) 2013-2017, J. Riesmeier, Oldenburg, Germany 5 * All rights reserved. See COPYRIGHT file for details. 6 * 7 * Header file for class DRTSourcePatientGroupIdentificationSequence 8 * 9 * Generated automatically from DICOM PS 3.3-2017e 10 * File created on 2017-12-05 09:30:54 11 * 12 */ 13 14 15 #ifndef DRTSPGIS_H 16 #define DRTSPGIS_H 17 18 #include "dcmtk/config/osconfig.h" // make sure OS specific configuration is included first 19 20 #include "dcmtk/ofstd/oflist.h" // for standard list class 21 #include "dcmtk/dcmrt/drttypes.h" // module-specific helper class 22 #include "dcmtk/dcmrt/seq/drtipiqs.h" // for IssuerOfPatientIDQualifiersSequence 23 24 25 /** Interface class for SourcePatientGroupIdentificationSequence (0010,0026) 26 */ 27 class DCMTK_DCMRT_EXPORT DRTSourcePatientGroupIdentificationSequence 28 : protected DRTTypes 29 { 30 31 public: 32 33 /** Item class 34 */ 35 class DCMTK_DCMRT_EXPORT Item 36 : protected DRTTypes 37 { 38 39 public: 40 41 // --- constructors, destructor and operators --- 42 43 /** (default) constructor 44 * @param emptyDefaultItem flag used to mark the empty default item 45 */ 46 Item(const OFBool emptyDefaultItem = OFFalse); 47 48 /** copy constructor 49 * @param copy item object to be copied 50 */ 51 Item(const Item ©); 52 53 /** destructor 54 */ 55 virtual ~Item(); 56 57 /** assigment operator 58 * @param copy item object to be copied 59 * @return reference to this object 60 */ 61 Item &operator=(const Item ©); 62 63 // --- general methods --- 64 65 /** clear all internal member variables 66 */ 67 void clear(); 68 69 /** check if item is empty 70 * @return OFTrue if item is empty, OFFalse otherwise 71 */ 72 OFBool isEmpty(); 73 74 /** check if item is valid, i.e.\ not the empty default item 75 * @return OFTrue if item is valid, OFFalse otherwise 76 */ 77 OFBool isValid() const; 78 79 // --- input/output methods --- 80 81 /** read elements from sequence item 82 * @param item reference to DICOM sequence item from which the elements should be read 83 * @return status, EC_Normal if successful, an error code otherwise 84 */ 85 OFCondition read(DcmItem &item); 86 87 /** write elements to sequence item 88 * @param item reference to DICOM sequence item to which the elements should be written 89 * @return status, EC_Normal if successful, an error code otherwise 90 */ 91 OFCondition write(DcmItem &item); 92 93 // --- get DICOM attribute values --- 94 95 /** get IssuerOfPatientID (0010,0021) 96 * @param value reference to variable in which the value should be stored 97 * @param pos index of the value to get (0..vm-1), -1 for all components 98 * @return status, EC_Normal if successful, an error code otherwise 99 */ 100 OFCondition getIssuerOfPatientID(OFString &value, const signed long pos = 0) const; 101 102 /** get PatientID (0010,0020) 103 * @param value reference to variable in which the value should be stored 104 * @param pos index of the value to get (0..vm-1), -1 for all components 105 * @return status, EC_Normal if successful, an error code otherwise 106 */ 107 OFCondition getPatientID(OFString &value, const signed long pos = 0) const; 108 109 // --- get DICOM sequence attributes --- 110 111 /** get IssuerOfPatientIDQualifiersSequence (0010,0024) 112 * @return reference to sequence element 113 */ getIssuerOfPatientIDQualifiersSequence()114 DRTIssuerOfPatientIDQualifiersSequence &getIssuerOfPatientIDQualifiersSequence() 115 { return IssuerOfPatientIDQualifiersSequence; } 116 117 /** get IssuerOfPatientIDQualifiersSequence (0010,0024) 118 * @return const reference to sequence element 119 */ getIssuerOfPatientIDQualifiersSequence()120 const DRTIssuerOfPatientIDQualifiersSequence &getIssuerOfPatientIDQualifiersSequence() const 121 { return IssuerOfPatientIDQualifiersSequence; } 122 123 // --- set DICOM attribute values --- 124 125 /** set IssuerOfPatientID (0010,0021) 126 * @param value value to be set (single value only) or "" for no value 127 * @param check check 'value' for conformance with VR (LO) and VM (1) if enabled 128 * @return status, EC_Normal if successful, an error code otherwise 129 */ 130 OFCondition setIssuerOfPatientID(const OFString &value, const OFBool check = OFTrue); 131 132 /** set PatientID (0010,0020) 133 * @param value value to be set (single value only) or "" for no value 134 * @param check check 'value' for conformance with VR (LO) and VM (1) if enabled 135 * @return status, EC_Normal if successful, an error code otherwise 136 */ 137 OFCondition setPatientID(const OFString &value, const OFBool check = OFTrue); 138 139 private: 140 141 /// internal flag used to mark the empty default item 142 /*const*/ OFBool EmptyDefaultItem; 143 144 /// IssuerOfPatientID (0010,0021) vr=LO, vm=1, type=3 145 DcmLongString IssuerOfPatientID; 146 /// IssuerOfPatientIDQualifiersSequence (0010,0024) vr=SQ, vm=1, type=3 147 DRTIssuerOfPatientIDQualifiersSequence IssuerOfPatientIDQualifiersSequence; 148 /// PatientID (0010,0020) vr=LO, vm=1, type=1 149 DcmLongString PatientID; 150 151 }; 152 153 // --- constructors, destructor and operators --- 154 155 /** (default) constructor 156 * @param emptyDefaultSequence internal flag used to mark the empty default sequence 157 */ 158 DRTSourcePatientGroupIdentificationSequence(const OFBool emptyDefaultSequence = OFFalse); 159 160 /** copy constructor 161 * @param copy sequence object to be copied 162 */ 163 DRTSourcePatientGroupIdentificationSequence(const DRTSourcePatientGroupIdentificationSequence ©); 164 165 /** destructor 166 */ 167 virtual ~DRTSourcePatientGroupIdentificationSequence(); 168 169 /** assigment operator 170 * @param copy sequence object to be copied 171 * @return reference to this object 172 */ 173 DRTSourcePatientGroupIdentificationSequence &operator=(const DRTSourcePatientGroupIdentificationSequence ©); 174 175 // --- general methods --- 176 177 /** clear all internal member variables 178 */ 179 void clear(); 180 181 /** check if sequence is empty 182 * @return OFTrue if sequence is empty, OFFalse otherwise 183 */ 184 OFBool isEmpty(); 185 186 /** check if sequence is valid, i.e.\ not the empty default sequence 187 * @return OFTrue if sequence is valid, OFFalse otherwise 188 */ 189 OFBool isValid() const; 190 191 /** get number of items in the sequence 192 * @return number of items 193 */ 194 size_t getNumberOfItems() const; 195 196 /** goto first item in the sequence 197 * @return status, EC_Normal if successful, an error code otherwise 198 */ 199 OFCondition gotoFirstItem(); 200 201 /** goto next item in the sequence 202 * @return status, EC_Normal if successful, an error code otherwise 203 */ 204 OFCondition gotoNextItem(); 205 206 /** goto particular item in the sequence 207 * @param num number of the item to be selected (0..num-1) 208 * @return status, EC_Normal if successful, an error code otherwise 209 */ 210 OFCondition gotoItem(const size_t num); 211 212 /** get current item in the sequence 213 * @param item reference to item pointer (result variable) 214 * @return status, EC_Normal if successful, an error code otherwise 215 */ 216 OFCondition getCurrentItem(Item *&item) const; 217 218 /** get current item in the sequence 219 * @return reference to specified item if successful, empty default item otherwise 220 */ 221 Item &getCurrentItem(); 222 223 /** get current item in the sequence 224 * @return const reference to specified item if successful, empty default item otherwise 225 */ 226 const Item &getCurrentItem() const; 227 228 /** get particular item in the sequence 229 * @param num number of the item to be retrieved (0..num-1) 230 * @param item reference to item pointer (result variable) 231 * @return status, EC_Normal if successful, an error code otherwise 232 */ 233 OFCondition getItem(const size_t num, Item *&item); 234 235 /** get particular item in the sequence 236 * @param num number of the item to be retrieved (0..num-1) 237 * @return reference to specified item if successful, empty default item otherwise 238 */ 239 Item &getItem(const size_t num); 240 241 /** get particular item in the sequence 242 * @param num number of the item to be retrieved (0..num-1) 243 * @return const reference to specified item if successful, empty default item otherwise 244 */ 245 const Item &getItem(const size_t num) const; 246 247 /** get particular item in the sequence 248 * @param num number of the item to be retrieved (0..num-1) 249 * @return reference to specified item if successful, empty default item otherwise 250 */ 251 Item &operator[](const size_t num); 252 253 /** get particular item in the sequence 254 * @param num number of the item to be retrieved (0..num-1) 255 * @return const reference to specified item if successful, empty default item otherwise 256 */ 257 const Item &operator[](const size_t num) const; 258 259 /** add new item to the end of this sequence 260 * @param item reference to new item pointer (result variable) 261 * @return status, EC_Normal if successful, an error code otherwise 262 */ 263 OFCondition addItem(Item *&item); 264 265 /** insert new item into the sequence 266 * @param pos position where the new item is to be inserted (0..num) 267 * @param item reference to new item pointer (result variable) 268 * @return status, EC_Normal if successful, an error code otherwise 269 */ 270 OFCondition insertItem(const size_t pos, Item *&item); 271 272 /** remove particular item from the sequence 273 * @param pos position of the item to be removed (0..num-1) 274 * @return status, EC_Normal if successful, an error code otherwise 275 */ 276 OFCondition removeItem(const size_t pos); 277 278 // --- input/output methods --- 279 280 /** read sequence of items from dataset 281 * @param dataset reference to DICOM dataset from which the sequence should be read 282 * @param card cardinality (valid range for number of items) 283 * @param type value type (valid value: "1", "1C", "2" or something else which is not checked) 284 * @param moduleName optional module/sequence name to be printed (default: "RT object" if NULL) 285 * @return status, EC_Normal if successful, an error code otherwise 286 */ 287 OFCondition read(DcmItem &dataset, 288 const OFString &card, 289 const OFString &type, 290 const char *moduleName = NULL); 291 292 /** write sequence of items to dataset 293 * @param dataset reference to DICOM dataset to which the sequence should be written 294 * @param card cardinality (valid range for number of items) 295 * @param type value type (valid value: "1", "2" or something else which is not checked) 296 * @param moduleName optional module/sequence name to be printed (default: "RT object" if NULL) 297 * @return status, EC_Normal if successful, an error code otherwise 298 */ 299 OFCondition write(DcmItem &dataset, 300 const OFString &card, 301 const OFString &type, 302 const char *moduleName = NULL); 303 304 protected: 305 306 /** goto particular item in the sequence 307 * @param num number of the item to be selected (0..num-1) 308 * @param iterator list iterator storing the position of the item 309 * @return status, EC_Normal if successful, an error code otherwise 310 */ 311 OFCondition gotoItem(const size_t num, 312 OFListIterator(Item *) &iterator); 313 314 /** goto particular item in the sequence 315 * @param num number of the item to be selected (0..num-1) 316 * @param iterator list iterator storing the position of the item 317 * @return status, EC_Normal if successful, an error code otherwise 318 */ 319 OFCondition gotoItem(const size_t num, 320 OFListConstIterator(Item *) &iterator) const; 321 322 private: 323 324 /// internal flag used to mark the empty default sequence 325 /*const*/ OFBool EmptyDefaultSequence; 326 327 /// list of items in this sequence 328 OFList<Item *> SequenceOfItems; 329 /// currently selected item 330 OFListIterator(Item *) CurrentItem; 331 /// empty default item 332 Item EmptyItem; 333 334 }; 335 336 337 #endif 338