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 DRTPatientBreedCodeSequence 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 DRTPBCS_H 16 #define DRTPBCS_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/drtecs.h" // for EquivalentCodeSequence 23 24 25 /** Interface class for PatientBreedCodeSequence (0010,2293) 26 */ 27 class DCMTK_DCMRT_EXPORT DRTPatientBreedCodeSequence 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 CodeMeaning (0008,0104) 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 getCodeMeaning(OFString &value, const signed long pos = 0) const; 101 102 /** get CodeValue (0008,0100) 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 getCodeValue(OFString &value, const signed long pos = 0) const; 108 109 /** get CodingSchemeDesignator (0008,0102) 110 * @param value reference to variable in which the value should be stored 111 * @param pos index of the value to get (0..vm-1), -1 for all components 112 * @return status, EC_Normal if successful, an error code otherwise 113 */ 114 OFCondition getCodingSchemeDesignator(OFString &value, const signed long pos = 0) const; 115 116 /** get CodingSchemeVersion (0008,0103) 117 * @param value reference to variable in which the value should be stored 118 * @param pos index of the value to get (0..vm-1), -1 for all components 119 * @return status, EC_Normal if successful, an error code otherwise 120 */ 121 OFCondition getCodingSchemeVersion(OFString &value, const signed long pos = 0) const; 122 123 /** get ContextGroupExtensionCreatorUID (0008,010d) 124 * @param value reference to variable in which the value should be stored 125 * @param pos index of the value to get (0..vm-1), -1 for all components 126 * @return status, EC_Normal if successful, an error code otherwise 127 */ 128 OFCondition getContextGroupExtensionCreatorUID(OFString &value, const signed long pos = 0) const; 129 130 /** get ContextGroupExtensionFlag (0008,010b) 131 * @param value reference to variable in which the value should be stored 132 * @param pos index of the value to get (0..vm-1), -1 for all components 133 * @return status, EC_Normal if successful, an error code otherwise 134 */ 135 OFCondition getContextGroupExtensionFlag(OFString &value, const signed long pos = 0) const; 136 137 /** get ContextGroupLocalVersion (0008,0107) 138 * @param value reference to variable in which the value should be stored 139 * @param pos index of the value to get (0..vm-1), -1 for all components 140 * @return status, EC_Normal if successful, an error code otherwise 141 */ 142 OFCondition getContextGroupLocalVersion(OFString &value, const signed long pos = 0) const; 143 144 /** get ContextGroupVersion (0008,0106) 145 * @param value reference to variable in which the value should be stored 146 * @param pos index of the value to get (0..vm-1), -1 for all components 147 * @return status, EC_Normal if successful, an error code otherwise 148 */ 149 OFCondition getContextGroupVersion(OFString &value, const signed long pos = 0) const; 150 151 /** get ContextIdentifier (0008,010f) 152 * @param value reference to variable in which the value should be stored 153 * @param pos index of the value to get (0..vm-1), -1 for all components 154 * @return status, EC_Normal if successful, an error code otherwise 155 */ 156 OFCondition getContextIdentifier(OFString &value, const signed long pos = 0) const; 157 158 /** get ContextUID (0008,0117) 159 * @param value reference to variable in which the value should be stored 160 * @param pos index of the value to get (0..vm-1), -1 for all components 161 * @return status, EC_Normal if successful, an error code otherwise 162 */ 163 OFCondition getContextUID(OFString &value, const signed long pos = 0) const; 164 165 /** get LongCodeValue (0008,0119) 166 * @param value reference to variable in which the value should be stored 167 * @param pos index of the value to get (0..vm-1), -1 for all components 168 * @return status, EC_Normal if successful, an error code otherwise 169 */ 170 OFCondition getLongCodeValue(OFString &value, const signed long pos = 0) const; 171 172 /** get MappingResource (0008,0105) 173 * @param value reference to variable in which the value should be stored 174 * @param pos index of the value to get (0..vm-1), -1 for all components 175 * @return status, EC_Normal if successful, an error code otherwise 176 */ 177 OFCondition getMappingResource(OFString &value, const signed long pos = 0) const; 178 179 /** get MappingResourceName (0008,0122) 180 * @param value reference to variable in which the value should be stored 181 * @param pos index of the value to get (0..vm-1), -1 for all components 182 * @return status, EC_Normal if successful, an error code otherwise 183 */ 184 OFCondition getMappingResourceName(OFString &value, const signed long pos = 0) const; 185 186 /** get MappingResourceUID (0008,0118) 187 * @param value reference to variable in which the value should be stored 188 * @param pos index of the value to get (0..vm-1), -1 for all components 189 * @return status, EC_Normal if successful, an error code otherwise 190 */ 191 OFCondition getMappingResourceUID(OFString &value, const signed long pos = 0) const; 192 193 /** get URNCodeValue (0008,0120) 194 * @param value reference to variable in which the value should be stored 195 * @param pos index of the value to get (0..vm-1), -1 for all components 196 * @return status, EC_Normal if successful, an error code otherwise 197 */ 198 OFCondition getURNCodeValue(OFString &value, const signed long pos = 0) const; 199 200 // --- get DICOM sequence attributes --- 201 202 /** get EquivalentCodeSequence (0008,0121) 203 * @return reference to sequence element 204 */ getEquivalentCodeSequence()205 DRTEquivalentCodeSequence &getEquivalentCodeSequence() 206 { return EquivalentCodeSequence; } 207 208 /** get EquivalentCodeSequence (0008,0121) 209 * @return const reference to sequence element 210 */ getEquivalentCodeSequence()211 const DRTEquivalentCodeSequence &getEquivalentCodeSequence() const 212 { return EquivalentCodeSequence; } 213 214 // --- set DICOM attribute values --- 215 216 /** set CodeMeaning (0008,0104) 217 * @param value value to be set (single value only) or "" for no value 218 * @param check check 'value' for conformance with VR (LO) and VM (1) if enabled 219 * @return status, EC_Normal if successful, an error code otherwise 220 */ 221 OFCondition setCodeMeaning(const OFString &value, const OFBool check = OFTrue); 222 223 /** set CodeValue (0008,0100) 224 * @param value value to be set (single value only) or "" for no value 225 * @param check check 'value' for conformance with VR (SH) and VM (1) if enabled 226 * @return status, EC_Normal if successful, an error code otherwise 227 */ 228 OFCondition setCodeValue(const OFString &value, const OFBool check = OFTrue); 229 230 /** set CodingSchemeDesignator (0008,0102) 231 * @param value value to be set (single value only) or "" for no value 232 * @param check check 'value' for conformance with VR (SH) and VM (1) if enabled 233 * @return status, EC_Normal if successful, an error code otherwise 234 */ 235 OFCondition setCodingSchemeDesignator(const OFString &value, const OFBool check = OFTrue); 236 237 /** set CodingSchemeVersion (0008,0103) 238 * @param value value to be set (single value only) or "" for no value 239 * @param check check 'value' for conformance with VR (SH) and VM (1) if enabled 240 * @return status, EC_Normal if successful, an error code otherwise 241 */ 242 OFCondition setCodingSchemeVersion(const OFString &value, const OFBool check = OFTrue); 243 244 /** set ContextGroupExtensionCreatorUID (0008,010d) 245 * @param value value to be set (single value only) or "" for no value 246 * @param check check 'value' for conformance with VR (UI) and VM (1) if enabled 247 * @return status, EC_Normal if successful, an error code otherwise 248 */ 249 OFCondition setContextGroupExtensionCreatorUID(const OFString &value, const OFBool check = OFTrue); 250 251 /** set ContextGroupExtensionFlag (0008,010b) 252 * @param value value to be set (single value only) or "" for no value 253 * @param check check 'value' for conformance with VR (CS) and VM (1) if enabled 254 * @return status, EC_Normal if successful, an error code otherwise 255 */ 256 OFCondition setContextGroupExtensionFlag(const OFString &value, const OFBool check = OFTrue); 257 258 /** set ContextGroupLocalVersion (0008,0107) 259 * @param value value to be set (single value only) or "" for no value 260 * @param check check 'value' for conformance with VR (DT) and VM (1) if enabled 261 * @return status, EC_Normal if successful, an error code otherwise 262 */ 263 OFCondition setContextGroupLocalVersion(const OFString &value, const OFBool check = OFTrue); 264 265 /** set ContextGroupVersion (0008,0106) 266 * @param value value to be set (single value only) or "" for no value 267 * @param check check 'value' for conformance with VR (DT) and VM (1) if enabled 268 * @return status, EC_Normal if successful, an error code otherwise 269 */ 270 OFCondition setContextGroupVersion(const OFString &value, const OFBool check = OFTrue); 271 272 /** set ContextIdentifier (0008,010f) 273 * @param value value to be set (single value only) or "" for no value 274 * @param check check 'value' for conformance with VR (CS) and VM (1) if enabled 275 * @return status, EC_Normal if successful, an error code otherwise 276 */ 277 OFCondition setContextIdentifier(const OFString &value, const OFBool check = OFTrue); 278 279 /** set ContextUID (0008,0117) 280 * @param value value to be set (single value only) or "" for no value 281 * @param check check 'value' for conformance with VR (UI) and VM (1) if enabled 282 * @return status, EC_Normal if successful, an error code otherwise 283 */ 284 OFCondition setContextUID(const OFString &value, const OFBool check = OFTrue); 285 286 /** set LongCodeValue (0008,0119) 287 * @param value value to be set (single value only) or "" for no value 288 * @param check check 'value' for conformance with VR (UC) and VM (1) if enabled 289 * @return status, EC_Normal if successful, an error code otherwise 290 */ 291 OFCondition setLongCodeValue(const OFString &value, const OFBool check = OFTrue); 292 293 /** set MappingResource (0008,0105) 294 * @param value value to be set (single value only) or "" for no value 295 * @param check check 'value' for conformance with VR (CS) and VM (1) if enabled 296 * @return status, EC_Normal if successful, an error code otherwise 297 */ 298 OFCondition setMappingResource(const OFString &value, const OFBool check = OFTrue); 299 300 /** set MappingResourceName (0008,0122) 301 * @param value value to be set (single value only) or "" for no value 302 * @param check check 'value' for conformance with VR (LO) and VM (1) if enabled 303 * @return status, EC_Normal if successful, an error code otherwise 304 */ 305 OFCondition setMappingResourceName(const OFString &value, const OFBool check = OFTrue); 306 307 /** set MappingResourceUID (0008,0118) 308 * @param value value to be set (single value only) or "" for no value 309 * @param check check 'value' for conformance with VR (UI) and VM (1) if enabled 310 * @return status, EC_Normal if successful, an error code otherwise 311 */ 312 OFCondition setMappingResourceUID(const OFString &value, const OFBool check = OFTrue); 313 314 /** set URNCodeValue (0008,0120) 315 * @param value value to be set (single value only) or "" for no value 316 * @param check check 'value' for conformance with VR (UR) and VM (1) if enabled 317 * @return status, EC_Normal if successful, an error code otherwise 318 */ 319 OFCondition setURNCodeValue(const OFString &value, const OFBool check = OFTrue); 320 321 private: 322 323 /// internal flag used to mark the empty default item 324 /*const*/ OFBool EmptyDefaultItem; 325 326 /// CodeMeaning (0008,0104) vr=LO, vm=1, type=1 327 DcmLongString CodeMeaning; 328 /// CodeValue (0008,0100) vr=SH, vm=1, type=1C 329 DcmShortString CodeValue; 330 /// CodingSchemeDesignator (0008,0102) vr=SH, vm=1, type=1C 331 DcmShortString CodingSchemeDesignator; 332 /// CodingSchemeVersion (0008,0103) vr=SH, vm=1, type=1C 333 DcmShortString CodingSchemeVersion; 334 /// ContextGroupExtensionCreatorUID (0008,010d) vr=UI, vm=1, type=1C 335 DcmUniqueIdentifier ContextGroupExtensionCreatorUID; 336 /// ContextGroupExtensionFlag (0008,010b) vr=CS, vm=1, type=3 337 DcmCodeString ContextGroupExtensionFlag; 338 /// ContextGroupLocalVersion (0008,0107) vr=DT, vm=1, type=1C 339 DcmDateTime ContextGroupLocalVersion; 340 /// ContextGroupVersion (0008,0106) vr=DT, vm=1, type=1C 341 DcmDateTime ContextGroupVersion; 342 /// ContextIdentifier (0008,010f) vr=CS, vm=1, type=3 343 DcmCodeString ContextIdentifier; 344 /// ContextUID (0008,0117) vr=UI, vm=1, type=3 345 DcmUniqueIdentifier ContextUID; 346 /// EquivalentCodeSequence (0008,0121) vr=SQ, vm=1, type=3 347 DRTEquivalentCodeSequence EquivalentCodeSequence; 348 /// LongCodeValue (0008,0119) vr=UC, vm=1, type=1C 349 DcmUnlimitedCharacters LongCodeValue; 350 /// MappingResource (0008,0105) vr=CS, vm=1, type=1C 351 DcmCodeString MappingResource; 352 /// MappingResourceName (0008,0122) vr=LO, vm=1, type=3 353 DcmLongString MappingResourceName; 354 /// MappingResourceUID (0008,0118) vr=UI, vm=1, type=3 355 DcmUniqueIdentifier MappingResourceUID; 356 /// URNCodeValue (0008,0120) vr=UR, vm=1, type=1C 357 DcmUniversalResourceIdentifierOrLocator URNCodeValue; 358 359 }; 360 361 // --- constructors, destructor and operators --- 362 363 /** (default) constructor 364 * @param emptyDefaultSequence internal flag used to mark the empty default sequence 365 */ 366 DRTPatientBreedCodeSequence(const OFBool emptyDefaultSequence = OFFalse); 367 368 /** copy constructor 369 * @param copy sequence object to be copied 370 */ 371 DRTPatientBreedCodeSequence(const DRTPatientBreedCodeSequence ©); 372 373 /** destructor 374 */ 375 virtual ~DRTPatientBreedCodeSequence(); 376 377 /** assigment operator 378 * @param copy sequence object to be copied 379 * @return reference to this object 380 */ 381 DRTPatientBreedCodeSequence &operator=(const DRTPatientBreedCodeSequence ©); 382 383 // --- general methods --- 384 385 /** clear all internal member variables 386 */ 387 void clear(); 388 389 /** check if sequence is empty 390 * @return OFTrue if sequence is empty, OFFalse otherwise 391 */ 392 OFBool isEmpty(); 393 394 /** check if sequence is valid, i.e.\ not the empty default sequence 395 * @return OFTrue if sequence is valid, OFFalse otherwise 396 */ 397 OFBool isValid() const; 398 399 /** get number of items in the sequence 400 * @return number of items 401 */ 402 size_t getNumberOfItems() const; 403 404 /** goto first item in the sequence 405 * @return status, EC_Normal if successful, an error code otherwise 406 */ 407 OFCondition gotoFirstItem(); 408 409 /** goto next item in the sequence 410 * @return status, EC_Normal if successful, an error code otherwise 411 */ 412 OFCondition gotoNextItem(); 413 414 /** goto particular item in the sequence 415 * @param num number of the item to be selected (0..num-1) 416 * @return status, EC_Normal if successful, an error code otherwise 417 */ 418 OFCondition gotoItem(const size_t num); 419 420 /** get current item in the sequence 421 * @param item reference to item pointer (result variable) 422 * @return status, EC_Normal if successful, an error code otherwise 423 */ 424 OFCondition getCurrentItem(Item *&item) const; 425 426 /** get current item in the sequence 427 * @return reference to specified item if successful, empty default item otherwise 428 */ 429 Item &getCurrentItem(); 430 431 /** get current item in the sequence 432 * @return const reference to specified item if successful, empty default item otherwise 433 */ 434 const Item &getCurrentItem() const; 435 436 /** get particular item in the sequence 437 * @param num number of the item to be retrieved (0..num-1) 438 * @param item reference to item pointer (result variable) 439 * @return status, EC_Normal if successful, an error code otherwise 440 */ 441 OFCondition getItem(const size_t num, Item *&item); 442 443 /** get particular item in the sequence 444 * @param num number of the item to be retrieved (0..num-1) 445 * @return reference to specified item if successful, empty default item otherwise 446 */ 447 Item &getItem(const size_t num); 448 449 /** get particular item in the sequence 450 * @param num number of the item to be retrieved (0..num-1) 451 * @return const reference to specified item if successful, empty default item otherwise 452 */ 453 const Item &getItem(const size_t num) const; 454 455 /** get particular item in the sequence 456 * @param num number of the item to be retrieved (0..num-1) 457 * @return reference to specified item if successful, empty default item otherwise 458 */ 459 Item &operator[](const size_t num); 460 461 /** get particular item in the sequence 462 * @param num number of the item to be retrieved (0..num-1) 463 * @return const reference to specified item if successful, empty default item otherwise 464 */ 465 const Item &operator[](const size_t num) const; 466 467 /** add new item to the end of this sequence 468 * @param item reference to new item pointer (result variable) 469 * @return status, EC_Normal if successful, an error code otherwise 470 */ 471 OFCondition addItem(Item *&item); 472 473 /** insert new item into the sequence 474 * @param pos position where the new item is to be inserted (0..num) 475 * @param item reference to new item pointer (result variable) 476 * @return status, EC_Normal if successful, an error code otherwise 477 */ 478 OFCondition insertItem(const size_t pos, Item *&item); 479 480 /** remove particular item from the sequence 481 * @param pos position of the item to be removed (0..num-1) 482 * @return status, EC_Normal if successful, an error code otherwise 483 */ 484 OFCondition removeItem(const size_t pos); 485 486 // --- input/output methods --- 487 488 /** read sequence of items from dataset 489 * @param dataset reference to DICOM dataset from which the sequence should be read 490 * @param card cardinality (valid range for number of items) 491 * @param type value type (valid value: "1", "1C", "2" or something else which is not checked) 492 * @param moduleName optional module/sequence name to be printed (default: "RT object" if NULL) 493 * @return status, EC_Normal if successful, an error code otherwise 494 */ 495 OFCondition read(DcmItem &dataset, 496 const OFString &card, 497 const OFString &type, 498 const char *moduleName = NULL); 499 500 /** write sequence of items to dataset 501 * @param dataset reference to DICOM dataset to which the sequence should be written 502 * @param card cardinality (valid range for number of items) 503 * @param type value type (valid value: "1", "2" or something else which is not checked) 504 * @param moduleName optional module/sequence name to be printed (default: "RT object" if NULL) 505 * @return status, EC_Normal if successful, an error code otherwise 506 */ 507 OFCondition write(DcmItem &dataset, 508 const OFString &card, 509 const OFString &type, 510 const char *moduleName = NULL); 511 512 protected: 513 514 /** goto particular item in the sequence 515 * @param num number of the item to be selected (0..num-1) 516 * @param iterator list iterator storing the position of the item 517 * @return status, EC_Normal if successful, an error code otherwise 518 */ 519 OFCondition gotoItem(const size_t num, 520 OFListIterator(Item *) &iterator); 521 522 /** goto particular item in the sequence 523 * @param num number of the item to be selected (0..num-1) 524 * @param iterator list iterator storing the position of the item 525 * @return status, EC_Normal if successful, an error code otherwise 526 */ 527 OFCondition gotoItem(const size_t num, 528 OFListConstIterator(Item *) &iterator) const; 529 530 private: 531 532 /// internal flag used to mark the empty default sequence 533 /*const*/ OFBool EmptyDefaultSequence; 534 535 /// list of items in this sequence 536 OFList<Item *> SequenceOfItems; 537 /// currently selected item 538 OFListIterator(Item *) CurrentItem; 539 /// empty default item 540 Item EmptyItem; 541 542 }; 543 544 545 #endif 546