/usr/include/dcmtk/dcmsr/dsrcitem.h is in libdcmtk-dev 3.6.2-3build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | /*
*
* Copyright (C) 2000-2016, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmsr
*
* Author: Joerg Riesmeier
*
* Purpose:
* classes: DSRContentItem
*
*/
#ifndef DSRCITEM_H
#define DSRCITEM_H
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmsr/dsrtypes.h"
#include "dcmtk/dcmsr/dsrdoctn.h"
#include "dcmtk/dcmsr/dsrcodvl.h"
#include "dcmtk/dcmsr/dsrnumvl.h"
#include "dcmtk/dcmsr/dsrscovl.h"
#include "dcmtk/dcmsr/dsrsc3vl.h"
#include "dcmtk/dcmsr/dsrtcovl.h"
#include "dcmtk/dcmsr/dsrcomvl.h"
#include "dcmtk/dcmsr/dsrimgvl.h"
#include "dcmtk/dcmsr/dsrwavvl.h"
/*---------------------*
* class declaration *
*---------------------*/
/** Interface class for content items.
* This class allows to access the document tree nodes without using any pointers.
*/
class DCMTK_DCMSR_EXPORT DSRContentItem
: protected DSRTypes
{
// allow DSRDocumentSubTree to access protected method setTreeNode()
friend class DSRDocumentSubTree;
public:
/** copy constructor.
* Internally, the copy constructor of the respective tree node class is used, so the
* corresponding comments apply. This also means that the copy describes a separate
* content item, i.e. without relationships to other content items.
** @param item content item to be copied
*/
DSRContentItem(const DSRContentItem &item);
/** destructor
*/
virtual ~DSRContentItem();
/** check for validity/completeness.
* Applicable to all content items.
** @return OFTrue if current content item is valid, OFFalse otherwise
*/
OFBool isValid() const;
/** check for mark flag.
* Applicable to all content items.
** @return OFTrue if current content item is marked, OFFalse otherwise
*/
OFBool isMarked() const;
/** mark/unmark item.
* Applicable to all content items.
** @param flag mark item if OFTrue, unmark otherwise
*/
void setMark(const OFBool flag);
/** get value type.
* Applicable to all content items.
** @return value type of current content item if valid, DSRTypes::VT_invalid otherwise
*/
E_ValueType getValueType() const;
/** get relationship type.
* Applicable to all content items.
** @return relationship type of current content item if valid, DSRTypes::RT_invalid
* otherwise
*/
E_RelationshipType getRelationshipType() const;
/** get ID of the referenced node.
* Applicable to: by-reference relationships
** @return ID of the referenced node if valid, 0 otherwise
*/
size_t getReferencedNodeID() const;
/** get string value.
* Applicable to: TEXT, DATETIME, DATE, TIME, UIDREF, PNAME
** @return string value of current content item if valid, EmptyString otherwise
*/
const OFString &getStringValue() const;
/** set string value.
* Please use the correct format for the string value depending on the corresponding
* content item (value type).
*
* Applicable to: TEXT, DATETIME, DATE, TIME, UIDREF, PNAME
** @param stringValue value to be set
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setStringValue(const OFString &stringValue,
const OFBool check = OFTrue);
/** get pointer to code value.
* Applicable to: CODE
** @return pointer to code value of current content item if valid, NULL otherwise
*/
DSRCodedEntryValue *getCodeValuePtr();
/** get code value.
* Applicable to: CODE
** @return coded entry value of current content item if valid, EmptyCodedEntry otherwise
*/
const DSRCodedEntryValue &getCodeValue() const;
/** get copy of code value.
* Applicable to: CODE
** @param codeValue variable where the copy should be stored
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getCodeValue(DSRCodedEntryValue &codeValue) const;
/** set code value.
* Applicable to: CODE
** @param codeValue value to be set
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setCodeValue(const DSRCodedEntryValue &codeValue,
const OFBool check = OFTrue);
/** get pointer to numeric value.
* Applicable to: NUM
** @return pointer to numeric value of current content item if valid, NULL otherwise
*/
DSRNumericMeasurementValue *getNumericValuePtr();
/** get numeric value.
* Applicable to: NUM
** @return numeric measurement value of current content item if valid,
* EmptyNumericMeasurement otherwise
*/
const DSRNumericMeasurementValue &getNumericValue() const;
/** get copy of numeric value.
* Applicable to: NUM
** @param numericValue variable where the copy should be stored
* (cleared if an error occurs)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getNumericValue(DSRNumericMeasurementValue &numericValue) const;
/** set numeric value.
* Applicable to: NUM
** @param numericValue value to be set
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setNumericValue(const DSRNumericMeasurementValue &numericValue,
const OFBool check = OFTrue);
/** get pointer to spatial coordinates.
* Applicable to: SCOORD
** @return pointer to spatial coordinates value of current content item if valid,
* NULL otherwise
*/
DSRSpatialCoordinatesValue *getSpatialCoordinatesPtr();
/** get spatial coordinates.
* Applicable to: SCOORD
** @return spatial coordinates value of current content item if valid,
* EmptySpatialCoordinates otherwise
*/
const DSRSpatialCoordinatesValue &getSpatialCoordinates() const;
/** get copy of spatial coordinates.
* Applicable to: SCOORD
** @param coordinatesValue variable where the copy should be stored
* (cleared if an error occurs)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getSpatialCoordinates(DSRSpatialCoordinatesValue &coordinatesValue) const;
/** set spatial coordinates.
* Applicable to: SCOORD
** @param coordinatesValue value to be set
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setSpatialCoordinates(const DSRSpatialCoordinatesValue &coordinatesValue,
const OFBool check = OFTrue);
/** get pointer to spatial coordinates 3D.
* Applicable to: SCOORD3D
** @return pointer to spatial coordinates 3D value of current content item if valid,
* NULL otherwise
*/
DSRSpatialCoordinates3DValue *getSpatialCoordinates3DPtr();
/** get spatial coordinates 3D.
* Applicable to: SCOORD3D
** @return spatial coordinates 3D value of current content item if valid,
* EmptySpatialCoordinates3D otherwise
*/
const DSRSpatialCoordinates3DValue &getSpatialCoordinates3D() const;
/** get copy of spatial coordinates 3D.
* Applicable to: SCOORD3D
** @param coordinatesValue variable where the copy should be stored
* (cleared if an error occurs)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getSpatialCoordinates3D(DSRSpatialCoordinates3DValue &coordinatesValue) const;
/** set spatial coordinates 3D.
* Applicable to: SCOORD3D
** @param coordinatesValue value to be set
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setSpatialCoordinates3D(const DSRSpatialCoordinates3DValue &coordinatesValue,
const OFBool check = OFTrue);
/** get pointer to temporal coordinates.
* Applicable to: TCOORD
** @return pointer to temporal coordinates value of current content item if valid,
* NULL otherwise
*/
DSRTemporalCoordinatesValue *getTemporalCoordinatesPtr();
/** get temporal coordinates.
* Applicable to: TCOORD
** @return temporal coordinates value of current content item if valid,
* EmptyTemporalCoordinates otherwise
*/
const DSRTemporalCoordinatesValue &getTemporalCoordinates() const;
/** get copy of temporal coordinates.
* Applicable to: TCOORD
** @param coordinatesValue variable where the copy should be stored
* (cleared if an error occurs)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getTemporalCoordinates(DSRTemporalCoordinatesValue &coordinatesValue) const;
/** set temporal coordinates.
* Applicable to: TCOORD
** @param coordinatesValue value to be set
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setTemporalCoordinates(const DSRTemporalCoordinatesValue &coordinatesValue,
const OFBool check = OFTrue);
/** get pointer to composite reference.
* Applicable to: COMPOSITE
** @return pointer to reference value of current content item if valid, NULL otherwise
*/
DSRCompositeReferenceValue *getCompositeReferencePtr();
/** get composite reference.
* Applicable to: COMPOSITE
** @return reference value of current content item if valid, EmptyReference otherwise
*/
const DSRCompositeReferenceValue &getCompositeReference() const;
/** get copy of composite reference.
* Applicable to: COMPOSITE
** @param referenceValue variable where the copy should be stored
* (cleared if an error occurs)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getCompositeReference(DSRCompositeReferenceValue &referenceValue) const;
/** set composite reference.
* Applicable to: COMPOSITE
** @param referenceValue value to be set
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setCompositeReference(const DSRCompositeReferenceValue &referenceValue,
const OFBool check = OFTrue);
/** get pointer to image reference.
* Applicable to: IMAGE
** @return pointer to image reference value of current content item if valid,
* NULL otherwise
*/
DSRImageReferenceValue *getImageReferencePtr();
/** get image reference.
* Applicable to: IMAGE
** @return image reference value of current content item if valid,
* EmptyImageReference otherwise
*/
const DSRImageReferenceValue &getImageReference() const;
/** get copy of image reference.
* Applicable to: IMAGE
** @param referenceValue variable where the copy should be stored
* (cleared if an error occurs)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getImageReference(DSRImageReferenceValue &referenceValue) const;
/** set image reference.
* Applicable to: IMAGE
** @param referenceValue value to be set
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setImageReference(const DSRImageReferenceValue &referenceValue,
const OFBool check = OFTrue);
/** get pointer to waveform reference.
* Applicable to: WAVEFORM
** @return pointer to waveform reference value of current content item if valid,
* NULL otherwise
*/
DSRWaveformReferenceValue *getWaveformReferencePtr();
/** get waveform reference.
* Applicable to: WAVEFORM
** @return waveform reference value of current content item if valid,
* EmptyWaveformReference otherwise
*/
const DSRWaveformReferenceValue &getWaveformReference() const;
/** get copy of waveform reference.
* Applicable to: WAVEFORM
** @param referenceValue variable where the copy should be stored
* (cleared if an error occurs)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getWaveformReference(DSRWaveformReferenceValue &referenceValue) const;
/** set waveform reference.
* Applicable to: WAVEFORM
** @param referenceValue value to be set
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setWaveformReference(const DSRWaveformReferenceValue &referenceValue,
const OFBool check = OFTrue);
/** get continuity of content flag.
* This flag specifies whether or not its contained content items (child nodes) are
* logically linked in a continuous textual flow, or are separate items.
*
* Applicable to: CONTAINER
** @return continuity of content flag if successful, DSRTypes::COC_invalid otherwise
*/
E_ContinuityOfContent getContinuityOfContent() const;
/** set continuity of content flag.
* This flag specifies whether or not its contained content items (child nodes) are
* logically linked in a continuous textual flow, or are separate items.
*
* Applicable to: CONTAINER
** @param continuityOfContent value to be set
* (should be different from DSRTypes::COC_invalid)
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setContinuityOfContent(const E_ContinuityOfContent continuityOfContent,
const OFBool check = OFTrue);
/** get template identifier and mapping resource.
* This value pair identifies the template that was used to create this content item
* (and its children). According to the DICOM standard this is "required if a template
* was used to define the content of this Item, and the template consists of a single
* CONTAINER with nested content, and it is the outermost invocation of a set of
* nested templates that start with the same CONTAINER."
* The identification is valid if both values are either present (non-empty) or absent
* (empty).
*
* Applicable to: CONTAINER
** @param templateIdentifier identifier of the template (might be empty)
* @param mappingResource mapping resource that defines the template
* (might be empty)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getTemplateIdentification(OFString &templateIdentifier,
OFString &mappingResource) const;
/** get template identifier and mapping resource and optional mapping resource UID.
* This value triple identifies the template that was used to create this content item
* (and its children). According to the DICOM standard, this is "required if a template
* was used to define the content of this Item, and the template consists of a single
* CONTAINER with nested content, and it is the outermost invocation of a set of
* nested templates that start with the same CONTAINER."
* The identification is valid if the first two values are either present (non-empty) or
* all three are absent (empty).
*
* Applicable to: CONTAINER
** @param templateIdentifier identifier of the template (might be empty)
* @param mappingResource mapping resource that defines the template
* (might be empty)
* @param mappingResourceUID uniquely identifies the mapping resource
* (might be empty)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getTemplateIdentification(OFString &templateIdentifier,
OFString &mappingResource,
OFString &mappingResourceUID) const;
/** set template identifier and mapping resource.
* The identification is valid if the first two values are either present (non-empty)
* or all three values are absent (empty). See getTemplateIdentification() for details.
* Please use the correct DICOM format for all values (VR=CS,CS,UI).
*
* Applicable to: CONTAINER
** @param templateIdentifier identifier of the template to be set
* @param mappingResource mapping resource that defines the template
* @param mappingResourceUID uniquely identifies the mapping resource (optional)
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setTemplateIdentification(const OFString &templateIdentifier,
const OFString &mappingResource,
const OFString &mappingResourceUID = "",
const OFBool check = OFTrue);
/** get pointer to concept name.
* Code describing the concept represented by this content item. Also conveys the value
* of document title and section headings in documents.
* Applicable to all content items (by-value only).
** @return pointer to concept name value of current content item if valid, NULL otherwise
*/
DSRCodedEntryValue *getConceptNamePtr();
/** get concept name.
* Code describing the concept represented by this content item. Also conveys the value
* of document title and section headings in documents.
*
* Applicable to all content items (by-value only).
** @return concept name value of current content item if valid, EmptyCodedEntry otherwise
*/
const DSRCodedEntryValue &getConceptName() const;
/** get copy of concept name.
* Code describing the concept represented by this content item. Also conveys the value
* of document title and section headings in documents.
*
* Applicable to all content items (by-value only).
** @param conceptName variable where the copy should be stored
* (cleared if an error occurs)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition getConceptName(DSRCodedEntryValue &conceptName) const;
/** set concept name.
* Code describing the concept represented by this content item. Also conveys the value
* of document title and section headings in documents.
*
* Applicable to all content items (by-value only, optional/conditional for some value
* types).
** @param conceptName value to be set
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setConceptName(const DSRCodedEntryValue &conceptName,
const OFBool check = OFTrue);
/** get observation date/time.
* This is the date and time on which this content item was completed. Might be empty
* if the date and time do not differ from the content date and time, see DSRDocument.
*
* Applicable to all content items (by-value only, optional attribute).
** @return observation date/time of current content item if valid, EmptyString otherwise
*/
const OFString &getObservationDateTime() const;
/** set observation date/time.
* This is the date and time on which this content item was completed. Might be empty
* if the date and time do not differ from the content date and time, see DSRDocument.
* Please use the correct DICOM format (VR=DT).
*
* Applicable to all content items (by-value only).
** @param observationDateTime value to be set (might be an empty string)
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setObservationDateTime(const OFString &observationDateTime,
const OFBool check = OFTrue);
/** get observation unique identifier.
* The UID represents the semantic content of the observation; an encoding of the same
* observation with the same context into another representation may use the same UID.
*
* Applicable to all content items (by-value only, optional attribute).
** @return observation unique identifier of current content item if valid,
* EmptyString otherwise
*/
const OFString &getObservationUID() const;
/** set observation unique identifier.
* The UID represents the semantic content of the observation; an encoding of the same
* observation with the same context into another representation may use the same UID.
* Please use the correct DICOM format (VR=UI).
*
* Applicable to all content items (by-value only).
** @param observationUID value to be set (might be an empty string)
* @param check if enabled, check value for validity before setting it
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setObservationUID(const OFString &observationUID,
const OFBool check = OFTrue);
/** get annotation text.
* The optional annotation text allows for labeling a content item with an arbitrary
* character string. This might be useful to navigate more easily within the document
* tree.
*
* Applicable to all content items (optional).
** @return annotation text of current content item if valid, EmptyString otherwise
*/
const OFString &getAnnotationText() const;
/** set annotation text.
* The optional annotation text allows for labeling a content item with an arbitrary
* character string. This might be useful to navigate more easily within the document
* tree.
*
* Applicable to all content items (optional).
** @param annotationText value to be set (might be an empty string)
** @return status, EC_Normal if successful, an error code otherwise
*/
OFCondition setAnnotationText(const OFString &annotationText) const;
protected:
/** default constructor (protected)
*/
DSRContentItem();
/** set internal tree node pointer (protected)
** @param node pointer to the document tree node (content item)
*/
inline void setTreeNode(DSRDocumentTreeNode *node)
{
TreeNode = node;
}
/** fast, non-throwing swap function.
* The time complexity of this function is constant.
** @param item content item to swap with
*/
void swap(DSRContentItem &item);
private:
/// internal tree node pointer to current content item
DSRDocumentTreeNode *TreeNode;
/// flag indicating whether to delete the 'TreeNode' during destruction (or not)
/*const*/ OFBool DeleteTreeNode; // removed "const" to support swap() method
/// empty numeric measurement value. Used as default return value for getNumericValue().
/// A static member variable (as for the other values below) cannot be used because this
/// class contains members that again contain OFCondition instances that cannot be defined
/// before the main() function starts.
const DSRNumericMeasurementValue EmptyNumericMeasurement;
/// empty string value.
/// Used as default return value for getStringValue()
static const OFString EmptyString;
/// empty coded entry value.
/// Used as default return value for getCodeValue() and getConceptName()
static const DSRCodedEntryValue EmptyCodedEntry;
/// empty spatial coordinates value.
/// Used as default return value for getSpatialCoordinates()
static const DSRSpatialCoordinatesValue EmptySpatialCoordinates;
/// empty spatial coordinates 3D value.
/// Used as default return value for getSpatialCoordinates3D()
static const DSRSpatialCoordinates3DValue EmptySpatialCoordinates3D;
/// empty temporal coordinates value.
/// Used as default return value for getTemporalCoordinates()
static const DSRTemporalCoordinatesValue EmptyTemporalCoordinates;
/// empty composite reference value.
/// Used as default return value for getCompositeReference()
static const DSRCompositeReferenceValue EmptyCompositeReference;
/// empty image reference value.
/// Used as default return value for getImageReference()
static const DSRImageReferenceValue EmptyImageReference;
/// empty waveform reference value.
/// Used as default return value for getWaveformReference()
static const DSRWaveformReferenceValue EmptyWaveformReference;
// --- declaration of assignment operator
DSRContentItem &operator=(const DSRContentItem &);
};
#endif
|