DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes | List of all members
DcmObject Class Referenceabstract

Abstract base class for most classes in module dcmdata. More...

Inheritance diagram for DcmObject:

## Classes
class | PrintHelper
| helper class to print a DcmObject to an ostream using operator<< More...

## Public Member Functions
| DcmObject (const DcmTag &tag, const Uint32 len=0)
| constructor.
| DcmObject (const DcmObject &obj)
| copy constructor
virtual | ~DcmObject ()
| destructor
virtual DcmObject * | clone () const =0
| clone method
DcmObject & | operator= (const DcmObject &obj)
| copy assignment operator
virtual OFCondition | copyFrom (const DcmObject &rhs)=0
| Virtual object copying.
virtual DcmEVR | ident () const =0
| return identifier for this class.
DcmEVR | getVR () const
| return the value representation assigned to this object.
OFBool | isaString () const
| check if this element is a string type, based on the VR.
virtual OFBool | isLeaf () const =0
| check if this element is a leaf node in a dataset tree.
virtual OFBool | isElement () const
| check if this element can be safely casted to DcmElement
virtual OFBool | isNested () const
| check if this element is nested in a sequence of items, i.e. not a top-level or stand-alone element
virtual void | print (STD_NAMESPACE ostream &out, const size_t flags=0, const int level=0, const char *pixelFileName=NULL, size_t *pixelCounter=NULL)=0
| print object to a stream
E_TransferState | transferState () const
| return the current transfer (read/write) state of this object.
virtual void | transferInit (void)
| initialize the transfer state of this object.
virtual void | transferEnd (void)
| finalize the transfer state of this object.
DcmItem * | getRootItem ()
| get root dataset/item (top-level) that contains this object.
virtual DcmItem * | getParentItem ()
| get parent item of this object.
DcmObject * | getParent ()
| get parent of this object.
const DcmObject * | getParent () const
| get parent of this object.
void | setParent (DcmObject *parent)
| set parent of this object.
Uint16 | getGTag () const
| return the group number of the attribute tag for this object
Uint16 | getETag () const
| return the element number of the attribute tag for this object
const DcmTag & | getTag () const
| return const reference to the attribute tag for this object
void | setGTag (Uint16 gtag)
| assign group tag (but not element tag) of the attribute tag for this object.
virtual OFCondition | setVR (DcmEVR vr)
| assign a new Value Representation (VR) to this object.
virtual unsigned long | getVM ()=0
| get value multiplicity of this object.
virtual unsigned long | getNumberOfValues ()=0
| get number of values stored in this object
virtual Uint32 | calcElementLength (const E_TransferSyntax xfer, const E_EncodingType enctype)=0
| calculate the length of this DICOM element when encoded with the given transfer syntax and the given encoding type for sequences.
virtual Uint32 | getLength (const E_TransferSyntax xfer=EXS_LittleEndianImplicit, const E_EncodingType enctype=EET_UndefinedLength)=0
| calculate the value length (without attribute tag, VR and length field) of this DICOM element when encoded with the given transfer syntax and the given encoding type for sequences.
virtual OFBool | canWriteXfer (const E_TransferSyntax newXfer, const E_TransferSyntax oldXfer)=0
| check if this DICOM object can be encoded in the given transfer syntax.
virtual OFCondition | read (DcmInputStream &inStream, const E_TransferSyntax ixfer, const E_GrpLenEncoding glenc=EGL_noChange, const Uint32 maxReadLength=DCM_MaxReadLength)=0
| read object from a stream.
virtual OFCondition | write (DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)=0
| write object to a stream (abstract)
virtual OFCondition | writeXML (STD_NAMESPACE ostream &out, const size_t flags=0)
| write object in XML format to a stream
virtual OFCondition | writeJson (STD_NAMESPACE ostream &out, DcmJsonFormat &format)
| write object in JSON format to a stream
virtual OFCondition | writeSignatureFormat (DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)=0
| special write method for creation of digital signatures (abstract)
virtual OFBool | isSignable () const
| returns true if the current object may be included in a digital signature
virtual OFBool | containsUnknownVR () const
| returns true if the object contains an element with Unknown VR at any nesting level
virtual OFBool | containsExtendedCharacters (const OFBool checkAllStrings=OFFalse)
| check if this object contains non-ASCII characters
virtual OFBool | isAffectedBySpecificCharacterSet () const
| check if this object is affected by SpecificCharacterSet
virtual OFCondition | convertCharacterSet (DcmSpecificCharacterSet &converter)
| convert this object from the currently selected source character set to the currently selected destination character set (if affected by SpecificCharacterSet)
virtual OFBool | isEmpty (const OFBool normalize=OFTrue)
| check if this object is empty
virtual OFCondition | clear ()=0
| clear (remove) attribute value
virtual OFCondition | verify (const OFBool autocorrect=OFFalse)=0
| check the currently stored element value
virtual DcmObject * | nextInContainer (const DcmObject *obj)
| this method is only used in container classes derived from this class, that is, DcmItem and DcmSequenceOfItems.
virtual OFCondition | nextObject (DcmStack &stack, const OFBool intoSub)
| this method enables a stack based, depth-first traversal of a complete hierarchical DICOM dataset (that is, classes derived from DcmItem or DcmSequenceOfItems).
virtual OFCondition | search (const DcmTagKey &xtag, DcmStack &resultStack, E_SearchMode mode=ESM_fromHere, OFBool searchIntoSub=OFTrue)
| a complex, stack-based, hierarchical search method.
virtual OFCondition | loadAllDataIntoMemory ()=0
| this method loads all attribute values maintained by this object and all sub-objects (in case of a container such as DcmDataset) into memory.
Uint32 | getLengthField () const
| return the current value of the Length field (which is different from the functionality of the public getLength() method).

## Protected Member Functions
void | printNestingLevel (STD_NAMESPACE ostream &out, const size_t flags, const int level)
| print line indentation, e.g. a couple of spaces for each nesting level.
void | printInfoLineStart (STD_NAMESPACE ostream &out, const size_t flags, const int level, DcmTag *tag=NULL)
| print beginning of the info line.
void | printInfoLineEnd (STD_NAMESPACE ostream &out, const size_t flags, const unsigned long printedLength=0xffffffff, DcmTag *tag=NULL)
| print end of the info line.
virtual void | printInfoLine (STD_NAMESPACE ostream &out, const size_t flags, const int level=0, const char *info=NULL, DcmTag *tag=NULL, const OFBool isInfo=OFTrue)
| print given text with element information.
virtual OFCondition | writeTagAndLength (DcmOutputStream &outStream, const E_TransferSyntax oxfer, Uint32 &writtenBytes) const
| write tag, VR and length field to the given output stream
virtual Uint32 | getTagAndLengthSize (const E_TransferSyntax oxfer) const
| return the number of bytes needed to serialize the tag, VR and length information of the current object using the given transfer syntax.
const char * | getTagName ()
| return the DICOM attribute tag name for this object.
void | setTagVR (DcmEVR vr)
| set the VR for this attribute
E_TransferState | getTransferState () const
| return the current transfer state of this object during serialization/deserialization
void | setTransferState (E_TransferState newState)
| set the current transfer state of this object during serialization/deserialization
Uint32 | getTransferredBytes () const
| return the number of transferred bytes for this object during serialization/deserialization
void | setTransferredBytes (Uint32 val)
| set the number of transferred bytes for this object during serialization/deserialization
void | incTransferredBytes (Uint32 val)
| add to the number of transferred bytes for this object during serialization/deserialization
void | setLengthField (Uint32 val)
| set the current value of the Length field

## Static Protected Member Functions
static OFCondition | writeTag (DcmOutputStream &outStream, const DcmTag &tag, const E_TransferSyntax oxfer)
| static helper function that writes a given attribute tag to a binary output stream using the byte order indicated by the transfer syntax.

## Protected Attributes
OFCondition | errorFlag
| error flag for this object.

## Private Attributes
DcmTag | Tag
| the DICOM attribute tag and VR for this object
Uint32 | Length
| the length of this attribute as read from stream, may be undefined length
E_TransferState | fTransferState
| transfer state during read and write operations
Uint32 | fTransferredBytes
| number of bytes already read/written during transfer
DcmObject * | Parent
| pointer to parent object if contained in a dataset/item (might be NULL)

## Detailed Description

Abstract base class for most classes in module dcmdata.

As a rule of thumb, everything that is either a dataset or that can be identified with a DICOM attribute tag is derived from class DcmObject.

## Constructor & Destructor Documentation

## ◆ DcmObject() [1/2]

DcmObject::DcmObject | ( | const DcmTag & | tag,
|  | const Uint32 | len = 0 )

constructor.

Create new object from given tag and length.

Parameters

  tag | DICOM tag for the new element
  len | value length for the new element

Referenced by DcmObject(), DcmObject::PrintHelper::PrintHelper(), DcmFileFormat::checkMetaHeaderValue(), DcmAgeString::clone(), DcmApplicationEntity::clone(), DcmAttributeTag::clone(), DcmByteString::clone(), DcmCharString::clone(), DcmCodeString::clone(), DcmDataset::clone(), DcmDate::clone(), DcmDateTime::clone(), DcmDecimalString::clone(), DcmDirectoryRecord::clone(), DcmFileFormat::clone(), DcmFloatingPointDouble::clone(), DcmFloatingPointSingle::clone(), DcmIntegerString::clone(), DcmItem::clone(), DcmMetaInfo::clone(), clone(), DcmOther64bitVeryLong::clone(), DcmOtherByteOtherWord::clone(), DcmOtherDouble::clone(), DcmOtherFloat::clone(), DcmOtherLong::clone(), DcmPixelItem::clone(), DcmPixelSequence::clone(), DcmPolymorphOBOW::clone(), DcmSequenceOfItems::clone(), DcmSigned64bitVeryLong::clone(), DcmSignedLong::clone(), DcmSignedShort::clone(), DcmTime::clone(), DcmUniqueIdentifier::clone(), DcmUniversalResourceIdentifierOrLocator::clone(), DcmUnsigned64bitVeryLong::clone(), DcmUnsignedLong::clone(), DcmUnsignedLongOffset::clone(), DcmUnsignedShort::clone(), DcmAgeString::copyFrom(), DcmApplicationEntity::copyFrom(), DcmAttributeTag::copyFrom(), DcmByteString::copyFrom(), DcmCharString::copyFrom(), DcmCodeString::copyFrom(), DcmDataset::copyFrom(), DcmDate::copyFrom(), DcmDateTime::copyFrom(), DcmDecimalString::copyFrom(), DcmDirectoryRecord::copyFrom(), DcmElement::copyFrom(), DcmFileFormat::copyFrom(), DcmFloatingPointDouble::copyFrom(), DcmFloatingPointSingle::copyFrom(), DcmIntegerString::copyFrom(), DcmItem::copyFrom(), DcmMetaInfo::copyFrom(), copyFrom(), DcmOther64bitVeryLong::copyFrom(), DcmOtherByteOtherWord::copyFrom(), DcmOtherDouble::copyFrom(), DcmOtherFloat::copyFrom(), DcmOtherLong::copyFrom(), DcmPixelItem::copyFrom(), DcmPixelSequence::copyFrom(), DcmPolymorphOBOW::copyFrom(), DcmSequenceOfItems::copyFrom(), DcmSigned64bitVeryLong::copyFrom(), DcmSignedLong::copyFrom(), DcmSignedShort::copyFrom(), DcmTime::copyFrom(), DcmUniqueIdentifier::copyFrom(), DcmUniversalResourceIdentifierOrLocator::copyFrom(), DcmUnsigned64bitVeryLong::copyFrom(), DcmUnsignedLong::copyFrom(), DcmUnsignedLongOffset::copyFrom(), DcmUnsignedShort::copyFrom(), DcmUnsignedLongOffset::getNextRecord(), getParent(), getParent(), DcmPixelSequence::makeSubObject(), DcmSequenceOfItems::makeSubObject(), DcmItem::nextInContainer(), nextInContainer(), DcmSequenceOfItems::nextInContainer(), operator=(), DcmItem::remove(), DcmUnsignedLongOffset::setNextRecord(), and setParent().

## ◆ DcmObject() [2/2]

DcmObject::DcmObject | ( | const DcmObject & | obj | ) |

copy constructor

Parameters

  obj | item to be copied

References DcmObject().

## Member Function Documentation

## ◆ calcElementLength()

virtual Uint32 DcmObject::calcElementLength | ( | const E_TransferSyntax | xfer,
|  | const E_EncodingType | enctype )
| pure virtual

calculate the length of this DICOM element when encoded with the given transfer syntax and the given encoding type for sequences.

For elements, the length includes the length of the tag, length field, VR field and the value itself, for items and sequences it returns the length of the complete item or sequence including delimitation tags if applicable.

Warning
  Since calcElementLength() returns a 32 bit integer, an overflow during calculation is possible for some derived classes that actually represent a compound value (e.g. items like DcmPixelItem). Such overflows will be detected, in which case the maximum possible value will be returned instead, coinciding with DCM_UndefinedLength.
  The implementation in DcmPixelData may return zero if no conforming representation exists and set the EC_RepresentationNotFound error flag to indicated it.
  When calculation the length of a sequence or an item containing multiple attributes, the implementation may return DCM_UndefinedLength to indicate a value that can not be encoded as a 32 bit length field. It will even do so if "dcmWriteOversizedSeqsAndItemsUndefined" is disabled, but then also set the EC_SeqOrItemContentOverflow error flag (inside getLength()) to indicated it.

Note
  Just check for zero or DCM_UndefinedLength return value and then have a look at the error flag in either case.

Parameters

  xfer | transfer syntax for length calculation
  enctype | sequence encoding type for length calculation

Returns
  length of DICOM element

Implemented in DcmDataset, DcmElement, DcmFileFormat, DcmItem, DcmMetaInfo, DcmPixelData, DcmPixelItem, DcmPixelSequence, and DcmSequenceOfItems.

## ◆ canWriteXfer()

virtual OFBool DcmObject::canWriteXfer | ( | const E_TransferSyntax | newXfer,
|  | const E_TransferSyntax | oldXfer )
| pure virtual

check if this DICOM object can be encoded in the given transfer syntax.

Parameters

  newXfer | transfer syntax in which the DICOM object is to be encoded
  oldXfer | transfer syntax in which the DICOM object was read or created.

Returns
  true if object can be encoded in desired transfer syntax, false otherwise.

Implemented in DcmDataset, DcmElement, DcmFileFormat, DcmItem, DcmOtherByteOtherWord, DcmPixelData, DcmPixelSequence, and DcmSequenceOfItems.

## ◆ clear()

virtual OFCondition DcmObject::clear | ( |  | ) |
| pure virtual

clear (remove) attribute value

Returns
  EC_Normal if successful, an error code otherwise

Implemented in DcmByteString, DcmDataset, DcmElement, DcmFileFormat, DcmItem, DcmSequenceOfItems, and DcmUnsignedLongOffset.

## ◆ clone()

virtual DcmObject * DcmObject::clone | ( |  | ) | const
| pure virtual

clone method

Returns
  deep copy of this object

Implemented in DcmAgeString, DcmApplicationEntity, DcmAttributeTag, DcmByteString, DcmCharString, DcmCodeString, DcmDataset, DcmDate, DcmDateTime, DcmDecimalString, DcmDirectoryRecord, DcmFileFormat, DcmFloatingPointDouble, DcmFloatingPointSingle, DcmIntegerString, DcmItem, DcmLongString, DcmLongText, DcmMetaInfo, DcmOther64bitVeryLong, DcmOtherByteOtherWord, DcmOtherDouble, DcmOtherFloat, DcmOtherLong, DcmOverlayData, DcmPersonName, DcmPixelData, DcmPixelItem, DcmPixelSequence, DcmPolymorphOBOW, DcmSequenceOfItems, DcmShortString, DcmShortText, DcmSigned64bitVeryLong, DcmSignedLong, DcmSignedShort, DcmTime, DcmUniqueIdentifier, DcmUniversalResourceIdentifierOrLocator, DcmUnlimitedCharacters, DcmUnlimitedText, DcmUnsigned64bitVeryLong, DcmUnsignedLong, DcmUnsignedLongOffset, and DcmUnsignedShort.

References DcmObject().

## ◆ containsExtendedCharacters()

virtual OFBool DcmObject::containsExtendedCharacters | ( | const OFBool | checkAllStrings = OFFalse | ) |
| virtual

check if this object contains non-ASCII characters

Parameters

  checkAllStrings | not used in this class

Returns
  always returns false, i.e. no extended characters used

Reimplemented in DcmByteString, DcmCharString, DcmItem, and DcmSequenceOfItems.

## ◆ containsUnknownVR()

virtual OFBool DcmObject::containsUnknownVR | ( |  | ) | const
| virtual

returns true if the object contains an element with Unknown VR at any nesting level

Returns
  true if the object contains an element with Unknown VR, false otherwise

Reimplemented in DcmItem, and DcmSequenceOfItems.

## ◆ convertCharacterSet()

virtual OFCondition DcmObject::convertCharacterSet | ( | DcmSpecificCharacterSet & | converter | ) |
| virtual

convert this object from the currently selected source character set to the currently selected destination character set (if affected by SpecificCharacterSet)

Parameters

  converter | character set converter to be used to convert the element values

Returns
  always returns EC_Normal, since there is nothing to do in this base class

Reimplemented in DcmCharString, DcmDirectoryRecord, DcmFileFormat, DcmItem, and DcmSequenceOfItems.

## ◆ copyFrom()

virtual OFCondition DcmObject::copyFrom | ( | const DcmObject & | rhs | ) |
| pure virtual

Virtual object copying.

This method can be used for DcmObject and derived classes to get a deep copy of an object. Internally the assignment operator is called if the given DcmObject parameter is of the same type as "this" object instance. If not, an error is returned. This function permits copying an object by value in a virtual way which therefore is different to just calling the assignment operator of DcmElement which could result in slicing the object.

Parameters

  rhs | - [in] The instance to copy from. Has to be of the same class type as "this" object

Returns
  EC_Normal if copying was successful, error otherwise

Implemented in DcmAgeString, DcmApplicationEntity, DcmAttributeTag, DcmByteString, DcmCharString, DcmCodeString, DcmDataset, DcmDate, DcmDateTime, DcmDecimalString, DcmDirectoryRecord, DcmElement, DcmFileFormat, DcmFloatingPointDouble, DcmFloatingPointSingle, DcmIntegerString, DcmItem, DcmLongString, DcmLongText, DcmMetaInfo, DcmOther64bitVeryLong, DcmOtherByteOtherWord, DcmOtherDouble, DcmOtherFloat, DcmOtherLong, DcmOverlayData, DcmPersonName, DcmPixelData, DcmPixelItem, DcmPixelSequence, DcmPolymorphOBOW, DcmSequenceOfItems, DcmShortString, DcmShortText, DcmSigned64bitVeryLong, DcmSignedLong, DcmSignedShort, DcmTime, DcmUniqueIdentifier, DcmUniversalResourceIdentifierOrLocator, DcmUnlimitedCharacters, DcmUnlimitedText, DcmUnsigned64bitVeryLong, DcmUnsignedLong, DcmUnsignedLongOffset, and DcmUnsignedShort.

References DcmObject().

## ◆ getETag()

Uint16 DcmObject::getETag | ( |  | ) | const
| inline

return the element number of the attribute tag for this object

Returns
  element number of the attribute tag for this object

References Tag.

## ◆ getGTag()

Uint16 DcmObject::getGTag | ( |  | ) | const
| inline

return the group number of the attribute tag for this object

Returns
  group number of the attribute tag for this object

References Tag.

## ◆ getLength()

virtual Uint32 DcmObject::getLength | ( | const E_TransferSyntax | xfer = EXS_LittleEndianImplicit,
|  | const E_EncodingType | enctype = EET_UndefinedLength )
| pure virtual

calculate the value length (without attribute tag, VR and length field) of this DICOM element when encoded with the given transfer syntax and the given encoding type for sequences.

Never returns undefined length.

Parameters

  xfer | transfer syntax for length calculation
  enctype | sequence encoding type for length calculation

Returns
  value length of DICOM element

Implemented in DcmByteString, DcmElement, DcmItem, DcmPixelData, and DcmSequenceOfItems.

References EET_UndefinedLength, and EXS_LittleEndianImplicit.

## ◆ getLengthField()

Uint32 DcmObject::getLengthField | ( |  | ) | const
| inline

return the current value of the Length field (which is different from the functionality of the public getLength() method).

Only needed for internal purposes and for checker tools that verify values against the length field.

Returns
  current value of length field

References Length.

Referenced by DcmElement::getLength(), and DcmElement::valueLoaded().

## ◆ getNumberOfValues()

virtual unsigned long DcmObject::getNumberOfValues | ( |  | ) |
| pure virtual

get number of values stored in this object

Returns
  number of values in this object

Implemented in DcmAttributeTag, DcmByteString, DcmFloatingPointDouble, DcmFloatingPointSingle, DcmItem, DcmOtherByteOtherWord, DcmSequenceOfItems, DcmSigned64bitVeryLong, DcmSignedLong, DcmSignedShort, DcmUnsigned64bitVeryLong, DcmUnsignedLong, and DcmUnsignedShort.

Referenced by DcmIODUtil::copyFromUint8Array().

## ◆ getParent() [1/2]

DcmObject * DcmObject::getParent | ( |  | ) |
| inline

get parent of this object.

If this object is an element that has been inserted into a dataset/item, the parent is this particular dataset/item. If this object is an item that has been inserted into a sequence, the parent is this particular sequence. If this object has not been inserted into a dataset/item or sequence, NULL is returned.

Returns
  pointer to the parent of this object (might be NULL)

References DcmObject(), and Parent.

## ◆ getParent() [2/2]

const DcmObject * DcmObject::getParent | ( |  | ) | const
| inline

get parent of this object.

If this object is an element that has been inserted into a dataset/item, the parent is this particular dataset/item. If this object is an item that has been inserted into a sequence, the parent is this particular sequence. If this object has not been inserted into a dataset/item or sequence, NULL is returned.

Returns
  pointer to the parent of this object (might be NULL)

References DcmObject(), and Parent.

## ◆ getParentItem()

virtual DcmItem * DcmObject::getParentItem | ( |  | ) |
| virtual

get parent item of this object.

In case of a top-level element, this is either the main dataset or the file meta-information. In case of a nested element, this is the surrounding item.

Returns
  pointer to the parent item of this object (might be NULL)

Reimplemented in DcmItem, and DcmPixelItem.

## ◆ getRootItem()

DcmItem * DcmObject::getRootItem | ( |  | ) |

get root dataset/item (top-level) that contains this object.

Internally, the list of parent pointers is followed in order to find the root. If this object has no parent item, a pointer to this object is returned instead.

Returns
  pointer to the root dataset/item (might be NULL)

## ◆ getTag()

const DcmTag & DcmObject::getTag | ( |  | ) | const
| inline

return const reference to the attribute tag for this object

Returns
  const reference to the attribute tag for this object

References Tag.

Referenced by DcmIODUtil::readSubSequence().

## ◆ getTagAndLengthSize()

virtual Uint32 DcmObject::getTagAndLengthSize | ( | const E_TransferSyntax | oxfer | ) | const
| protected virtual

return the number of bytes needed to serialize the tag, VR and length information of the current object using the given transfer syntax.

Parameters

  oxfer | The transfer syntax used for encoding

Returns
  number of bytes, may be 8 or 12 depending on VR and transfer syntax.

## ◆ getTagName()

const char * DcmObject::getTagName | ( |  | ) |
| inline protected

return the DICOM attribute tag name for this object.

If not known yet, will be looked up in the dictionary and cached. Therefore, method is not const.

Returns
  tag name for this attribute

References Tag.

## ◆ getTransferredBytes()

Uint32 DcmObject::getTransferredBytes | ( |  | ) | const
| inline protected

return the number of transferred bytes for this object during serialization/deserialization

Returns
  number of transferred bytes

References fTransferredBytes.

## ◆ getTransferState()

E_TransferState DcmObject::getTransferState | ( |  | ) | const
| inline protected

return the current transfer state of this object during serialization/deserialization

Returns
  current transfer state of this object

References fTransferState.

## ◆ getVM()

virtual unsigned long DcmObject::getVM | ( |  | ) |
| pure virtual

get value multiplicity of this object.

Please note that depending on the Value Representation (VR), subclasses derived from this class either return the number of currently stored values or the constant value 1 (as defined in the DICOM standard). See getNumberOfValues(), which always returns the number of stored values.

Returns
  value multiplicity of this object

Implemented in DcmAttributeTag, DcmByteString, DcmFloatingPointDouble, DcmFloatingPointSingle, DcmItem, DcmLongText, DcmOther64bitVeryLong, DcmOtherByteOtherWord, DcmOtherDouble, DcmOtherFloat, DcmOtherLong, DcmSequenceOfItems, DcmShortText, DcmSigned64bitVeryLong, DcmSignedLong, DcmSignedShort, DcmUniversalResourceIdentifierOrLocator, DcmUnlimitedText, DcmUnsigned64bitVeryLong, DcmUnsignedLong, and DcmUnsignedShort.

## ◆ getVR()

DcmEVR DcmObject::getVR | ( |  | ) | const
| inline

return the value representation assigned to this object.

If object was read from a stream, this method returns the VR that was defined in the stream for this object. It is, therefore, possible that the VR does not match the one defined in the data dictionary for the tag assigned to this object.

Returns
  VR of this object

References Tag.

## ◆ ident()

virtual DcmEVR DcmObject::ident | ( |  | ) | const
| pure virtual

return identifier for this class.

Every class derived from this class returns a unique value of type enum DcmEVR for this call. This is used as a "poor man's RTTI" to correctly identify instances derived from this class even on compilers not supporting RTTI.

Returns
  type identifier of this class

Implemented in DcmAgeString, DcmApplicationEntity, DcmAttributeTag, DcmByteString, DcmCodeString, DcmDataset, DcmDate, DcmDateTime, DcmDecimalString, DcmDirectoryRecord, DcmFileFormat, DcmFloatingPointDouble, DcmFloatingPointSingle, DcmIntegerString, DcmItem, DcmLongString, DcmLongText, DcmMetaInfo, DcmOther64bitVeryLong, DcmOtherByteOtherWord, DcmOtherDouble, DcmOtherFloat, DcmOtherLong, DcmOverlayData, DcmPersonName, DcmPixelData, DcmPixelItem, DcmPixelSequence, DcmSequenceOfItems, DcmShortString, DcmShortText, DcmSigned64bitVeryLong, DcmSignedLong, DcmSignedShort, DcmTime, DcmUniqueIdentifier, DcmUniversalResourceIdentifierOrLocator, DcmUnlimitedCharacters, DcmUnlimitedText, DcmUnsigned64bitVeryLong, DcmUnsignedLong, DcmUnsignedLongOffset, and DcmUnsignedShort.

Referenced by DcmOverlayData::copyFrom().

## ◆ incTransferredBytes()

void DcmObject::incTransferredBytes | ( | Uint32 | val | ) |
| inline protected

add to the number of transferred bytes for this object during serialization/deserialization

Parameters

  val | number of additional transferred bytes to add to existing value

References fTransferredBytes.

## ◆ isAffectedBySpecificCharacterSet()

virtual OFBool DcmObject::isAffectedBySpecificCharacterSet | ( |  | ) | const
| virtual

check if this object is affected by SpecificCharacterSet

Returns
  always returns false, i.e. not affected by SpecificCharacterSet

Reimplemented in DcmByteString, DcmCharString, DcmItem, and DcmSequenceOfItems.

## ◆ isaString()

OFBool DcmObject::isaString | ( |  | ) | const
| inline

check if this element is a string type, based on the VR.

Since the check is based on the VR and not on the class, the result of this method is not a guarantee that the object can be safely casted to one of the string-VR subclasses.

Returns
  true if this object is a string VR, false otherwise

References Tag.

## ◆ isElement()

virtual OFBool DcmObject::isElement | ( |  | ) | const
| inline virtual

check if this element can be safely casted to DcmElement

Returns
  true if DcmElement, false otherwise

Reimplemented in DcmElement.

## ◆ isEmpty()

virtual OFBool DcmObject::isEmpty | ( | const OFBool | normalize = OFTrue | ) |
| virtual

check if this object is empty

Parameters

  normalize | normalize value before checking (ignore non-significant characters)

Returns
  true if object is empty, i.e. has no value, false otherwise

Reimplemented in DcmByteString, DcmItem, and DcmSequenceOfItems.

## ◆ isLeaf()

virtual OFBool DcmObject::isLeaf | ( |  | ) | const
| pure virtual

check if this element is a leaf node in a dataset tree.

All subclasses of DcmElement except for DcmSequenceOfItems are leaf nodes, while DcmSequenceOfItems, DcmItem, DcmDataset etc. are not.

Returns
  true if leaf node, false otherwise

Implemented in DcmElement, DcmItem, and DcmSequenceOfItems.

## ◆ isNested()

virtual OFBool DcmObject::isNested | ( |  | ) | const
| virtual

check if this element is nested in a sequence of items, i.e. not a top-level or stand-alone element

Returns
  true if this element is nested, false otherwise

Reimplemented in DcmItem, and DcmPixelItem.

## ◆ isSignable()

virtual OFBool DcmObject::isSignable | ( |  | ) | const
| virtual

returns true if the current object may be included in a digital signature

Returns
  true if signable, false otherwise

Reimplemented in DcmSequenceOfItems.

## ◆ loadAllDataIntoMemory()

virtual OFCondition DcmObject::loadAllDataIntoMemory | ( |  | ) |
| pure virtual

this method loads all attribute values maintained by this object and all sub-objects (in case of a container such as DcmDataset) into memory.

After a call to this method, the file from which a dataset was read may safely be deleted or replaced. For large files, this method may obviously allocate large amounts of memory.

Returns
  EC_Normal if successful, an error code otherwise

Implemented in DcmElement, DcmItem, DcmPixelData, and DcmSequenceOfItems.

## ◆ nextInContainer()

virtual DcmObject * DcmObject::nextInContainer | ( | const DcmObject * | obj | ) |
| virtual

this method is only used in container classes derived from this class, that is, DcmItem and DcmSequenceOfItems.

It returns a pointer to the next object in the list AFTER the given object. If the caller passes NULL, a pointer to the first object in the list is returned. If the given object is not found, the given object is the last one in the list or the list is empty, NULL is returned.

Parameters

  obj | pointer to one object in the container; we are looking for the next entry after this one. NULL if looking for the first entry.

Returns
  pointer to next object in container or NULL if not found

Reimplemented in DcmItem, and DcmSequenceOfItems.

References DcmObject().

## ◆ nextObject()

virtual OFCondition DcmObject::nextObject | ( | DcmStack & | stack,
|  | const OFBool | intoSub )
| virtual

this method enables a stack based, depth-first traversal of a complete hierarchical DICOM dataset (that is, classes derived from DcmItem or DcmSequenceOfItems).

With each call of this method, the next object in the tree is located and marked on the stack.

Parameters

  stack | "cursor" for current position in the dataset. The stack will contain a pointer to each dataset, sequence, item and element from the main dataset down to the current element, and is updated upon each call to this method. An empty stack is equivalent to a stack containing a pointer to this object only.
  intoSub | if true, the nextObject method will perform a hierarchical search through the dataset (depth-first), if false, only the current container object will be traversed (e.g., all elements of an item or all items of a sequence).

Returns
  EC_Normal if value length is correct, an error code otherwise

Reimplemented in DcmItem, and DcmSequenceOfItems.

## ◆ operator=()

DcmObject & DcmObject::operator= | ( | const DcmObject & | obj | ) |

copy assignment operator

Parameters

  obj | object to be copied

Returns
  reference to this object

References DcmObject().

## ◆ print()

virtual void DcmObject::print | ( | STD_NAMESPACE ostream & | out,
|  | const size_t | flags = 0,
|  | const int | level = 0,
|  | const char * | pixelFileName = NULL,
|  | size_t * | pixelCounter = NULL )
| pure virtual

print object to a stream

Parameters

  out | output stream
  flags | optional flag used to customize the output (see DCMTypes::PF_xxx)
  level | current level of nested items. Used for indentation.
  pixelFileName | not used (used in certain sub-classes of this class)
  pixelCounter | not used (used in certain sub-classes of this class)

Implemented in DcmAttributeTag, DcmByteString, DcmDataset, DcmDirectoryRecord, DcmFileFormat, DcmFloatingPointDouble, DcmFloatingPointSingle, DcmItem, DcmMetaInfo, DcmOtherByteOtherWord, DcmPixelData, DcmPixelItem, DcmPixelSequence, DcmSequenceOfItems, DcmSigned64bitVeryLong, DcmSignedLong, DcmSignedShort, DcmUniqueIdentifier, DcmUnsigned64bitVeryLong, DcmUnsignedLong, and DcmUnsignedShort.

Referenced by operator<<().

## ◆ printInfoLine()

virtual void DcmObject::printInfoLine | ( | STD_NAMESPACE ostream & | out,
|  | const size_t | flags,
|  | const int | level = 0,
|  | const char * | info = NULL,
|  | DcmTag * | tag = NULL,
|  | const OFBool | isInfo = OFTrue )
| protected virtual

print given text with element information.

Calls printInfoLineStart() and printInfoLineEnd() to frame the 'info' text.

Parameters

  out | output stream
  flags | used to customize the output (see DCMTypes::PF_xxx)
  level | current level of nested items. Used for indentation.
  info | text to be printed
  tag | optional tag used to print the data element information
  isInfo | optional flag indicating whether this text is really given for informational purposes only. Used to choose the correct output color.

## ◆ printInfoLineEnd()

void DcmObject::printInfoLineEnd | ( | STD_NAMESPACE ostream & | out,
|  | const size_t | flags,
|  | const unsigned long | printedLength = 0xffffffff,
|  | DcmTag * | tag = NULL )
| protected

print end of the info line.

The default output is length, value multiplicity and tag name, though other visualizations are possible depending on the value of 'flags'.

Parameters

  out | output stream
  flags | used to customize the output (see DCMTypes::PF_xxx)
  printedLength | number of characters printed after line start. Used for padding purposes.
  tag | optional tag used to print the data element information

## ◆ printInfoLineStart()

void DcmObject::printInfoLineStart | ( | STD_NAMESPACE ostream & | out,
|  | const size_t | flags,
|  | const int | level,
|  | DcmTag * | tag = NULL )
| protected

print beginning of the info line.

The default output is tag and value representation, though other visualizations are possible depending on the value of 'flags'.

Parameters

  out | output stream
  flags | used to customize the output (see DCMTypes::PF_xxx)
  level | current level of nested items. Used for indentation.
  tag | optional tag used to print the data element information

## ◆ printNestingLevel()

void DcmObject::printNestingLevel | ( | STD_NAMESPACE ostream & | out,
|  | const size_t | flags,
|  | const int | level )
| protected

print line indentation, e.g. a couple of spaces for each nesting level.

Depending on the value of 'flags' other visualizations are also possible.

Parameters

  out | output stream
  flags | used to customize the output (see DCMTypes::PF_xxx)
  level | current level of nested items. Used for indentation.

## ◆ read()

virtual OFCondition DcmObject::read | ( | DcmInputStream & | inStream,
|  | const E_TransferSyntax | ixfer,
|  | const E_GrpLenEncoding | glenc = EGL_noChange,
|  | const Uint32 | maxReadLength = DCM_MaxReadLength )
| pure virtual

read object from a stream.

Parameters

  inStream | DICOM input stream
  ixfer | transfer syntax to use when parsing
  glenc | handling of group length parameters
  maxReadLength | attribute values larger than this value are skipped while parsing and read later upon first access if the stream type supports this.

Returns
  EC_Normal if successful, an error code otherwise

Implemented in DcmDataset, DcmDirectoryRecord, DcmElement, DcmFileFormat, DcmItem, DcmMetaInfo, DcmPixelData, DcmPixelSequence, DcmPolymorphOBOW, and DcmSequenceOfItems.

References EGL_noChange.

## ◆ search()

virtual OFCondition DcmObject::search | ( | const DcmTagKey & | xtag,
|  | DcmStack & | resultStack,
|  | E_SearchMode | mode = ESM_fromHere,
|  | OFBool | searchIntoSub = OFTrue )
| virtual

a complex, stack-based, hierarchical search method.

It allows for a search for a DICOM object with a given attribute within a given container, hierarchically, from a starting position identified through a cursor stack.

Parameters

  xtag | the DICOM attribute tag we are searching for
  resultStack | Depending on the search mode (see below), this parameter either serves as an input and output parameter, or as an output parameter only (the latter being the default). When used as an input parameter, the cursor stack defines the start position for the search within a hierarchical DICOM dataset. Upon successful return, the stack contains the position of the element found, in the form of a pointer to each dataset, sequence, item and element from the main dataset down to the found element.
  mode | search mode, controls how the search stack is handled. In the default mode, ESM_fromHere, the stack is ignored on input, and the search starts in the object for which this method is called. In the other modes, the stack is used both as an input and an output parameter and defines the starting point for the search.
  searchIntoSub | if true, the search will be performed hierarchically descending into the sequences and items of the dataset. If false, only the current container (sequence or item) will be traversed.

Returns
  EC_Normal if found, EC_TagNotFound if not found, an error code is something went wrong.

Reimplemented in DcmDirectoryRecord, DcmItem, and DcmSequenceOfItems.

References ESM_fromHere.

## ◆ setGTag()

void DcmObject::setGTag | ( | Uint16 | gtag | ) |
| inline

assign group tag (but not element tag) of the attribute tag for this object.

This is sometimes useful when creating repeating group elements.

Parameters

  gtag | new attribute group tag

References Tag.

## ◆ setLengthField()

void DcmObject::setLengthField | ( | Uint32 | val | ) |
| inline protected

set the current value of the Length field

Parameters

  val | new value of the Length field

References Length.

## ◆ setParent()

void DcmObject::setParent | ( | DcmObject * | parent | ) |
| inline

set parent of this object.

NULL means no parent. NB: This method is used by derived classes for internal purposes only.

Parameters

  parent | pointer to the parent of this object

References DcmObject(), and Parent.

## ◆ setTagVR()

void DcmObject::setTagVR | ( | DcmEVR | vr | ) |
| inline protected

set the VR for this attribute

Parameters

  vr | new VR for this attribute.

References Tag.

Referenced by DcmPixelData::recalcVR().

## ◆ setTransferredBytes()

void DcmObject::setTransferredBytes | ( | Uint32 | val | ) |
| inline protected

set the number of transferred bytes for this object during serialization/deserialization

Parameters

  val | number of transferred bytes

References fTransferredBytes.

## ◆ setTransferState()

void DcmObject::setTransferState | ( | E_TransferState | newState | ) |
| inline protected

set the current transfer state of this object during serialization/deserialization

Parameters

  newState | new transfer state of this object

References fTransferState.

## ◆ setVR()

virtual OFCondition DcmObject::setVR | ( | DcmEVR | vr | ) |
| inline virtual

assign a new Value Representation (VR) to this object.

This operation is only supported for very few subclasses derived from this class, in particular for classes handling pixel data which may either be of OB or OW value representation.

Parameters

  vr | value representation

Returns
  EC_Normal if successful, an error code otherwise

Reimplemented in DcmOtherByteOtherWord, and DcmPixelData.

References EC_IllegalCall, and setVR().

Referenced by setVR().

## ◆ transferEnd()

virtual void DcmObject::transferEnd | ( | void |  | ) |
| virtual

finalize the transfer state of this object.

This method must be called when reading/writing this object from/to a stream has been completed.

Reimplemented in DcmItem, DcmMetaInfo, DcmPixelData, DcmPolymorphOBOW, and DcmSequenceOfItems.

## ◆ transferInit()

virtual void DcmObject::transferInit | ( | void |  | ) |
| virtual

initialize the transfer state of this object.

This method must be called before this object is written to a stream or read (parsed) from a stream.

Reimplemented in DcmElement, DcmItem, DcmMetaInfo, DcmPixelData, DcmPolymorphOBOW, and DcmSequenceOfItems.

## ◆ transferState()

E_TransferState DcmObject::transferState | ( |  | ) | const
| inline

return the current transfer (read/write) state of this object.

Returns
  transfer state of this object

References fTransferState.

## ◆ verify()

virtual OFCondition DcmObject::verify | ( | const OFBool | autocorrect = OFFalse | ) |
| pure virtual

check the currently stored element value

Parameters

  autocorrect | correct value length if OFTrue

Returns
  status, EC_Normal if value length is correct, an error code otherwise

Implemented in DcmAttributeTag, DcmByteString, DcmCharString, DcmDirectoryRecord, DcmFloatingPointDouble, DcmFloatingPointSingle, DcmItem, DcmOtherByteOtherWord, DcmSequenceOfItems, DcmSigned64bitVeryLong, DcmSignedLong, DcmSignedShort, DcmUnsigned64bitVeryLong, DcmUnsignedLong, DcmUnsignedLongOffset, and DcmUnsignedShort.

## ◆ write()

virtual OFCondition DcmObject::write | ( | DcmOutputStream & | outStream,
|  | const E_TransferSyntax | oxfer,
|  | const E_EncodingType | enctype,
|  | DcmWriteCache * | wcache )
| pure virtual

write object to a stream (abstract)

Parameters

  outStream | DICOM output stream
  oxfer | output transfer syntax
  enctype | encoding types (undefined or explicit length)
  wcache | pointer to write cache object, may be NULL

Returns
  status, EC_Normal if successful, an error code otherwise

Implemented in DcmByteString, DcmDataset, DcmElement, DcmFileFormat, DcmItem, DcmMetaInfo, DcmOtherByteOtherWord, DcmPixelData, DcmPixelSequence, DcmPolymorphOBOW, and DcmSequenceOfItems.

## ◆ writeJson()

virtual OFCondition DcmObject::writeJson | ( | STD_NAMESPACE ostream & | out,
|  | DcmJsonFormat & | format )
| virtual

write object in JSON format to a stream

Parameters

  out | output stream to which the JSON document is written
  format | used to format and customize the output

Returns
  status, always returns EC_Illegal Call

Reimplemented in DcmAttributeTag, DcmByteString, DcmCharString, DcmDataset, DcmDecimalString, DcmElement, DcmFileFormat, DcmFloatingPointDouble, DcmFloatingPointSingle, DcmIntegerString, DcmItem, DcmLongString, DcmMetaInfo, DcmOther64bitVeryLong, DcmOtherByteOtherWord, DcmOtherDouble, DcmOtherFloat, DcmOtherLong, DcmPersonName, DcmPixelData, DcmSequenceOfItems, DcmShortString, DcmSigned64bitVeryLong, and DcmUnsigned64bitVeryLong.

## ◆ writeSignatureFormat()

virtual OFCondition DcmObject::writeSignatureFormat | ( | DcmOutputStream & | outStream,
|  | const E_TransferSyntax | oxfer,
|  | const E_EncodingType | enctype,
|  | DcmWriteCache * | wcache )
| pure virtual

special write method for creation of digital signatures (abstract)

Parameters

  outStream | DICOM output stream
  oxfer | output transfer syntax
  enctype | encoding types (undefined or explicit length)
  wcache | pointer to write cache object, may be NULL

Returns
  status, EC_Normal if successful, an error code otherwise

Implemented in DcmByteString, DcmDataset, DcmElement, DcmItem, DcmOtherByteOtherWord, DcmPixelData, DcmPixelItem, DcmPixelSequence, DcmPolymorphOBOW, and DcmSequenceOfItems.

## ◆ writeTag()

static OFCondition DcmObject::writeTag | ( | DcmOutputStream & | outStream,
|  | const DcmTag & | tag,
|  | const E_TransferSyntax | oxfer )
| static protected

static helper function that writes a given attribute tag to a binary output stream using the byte order indicated by the transfer syntax.

Parameters

  outStream | output stream
  tag | tag to write to the stream
  oxfer | transfer syntax defining the byte order

Returns
  EC_Normal if successful, an error code otherwise

## ◆ writeTagAndLength()

virtual OFCondition DcmObject::writeTagAndLength | ( | DcmOutputStream & | outStream,
|  | const E_TransferSyntax | oxfer,
|  | Uint32 & | writtenBytes ) const
| protected virtual

write tag, VR and length field to the given output stream

Parameters

  outStream | output stream
  oxfer | transfer syntax for writing
  writtenBytes | number of bytes written to stream returned in this parameter

Returns
  EC_Normal if successful, an error code otherwise

Reimplemented in DcmPixelItem.

## ◆ writeXML()

virtual OFCondition DcmObject::writeXML | ( | STD_NAMESPACE ostream & | out,
|  | const size_t | flags = 0 )
| virtual

write object in XML format to a stream

Parameters

  out | output stream to which the XML document is written
  flags | optional flag used to customize the output (see DCMTypes::XF_xxx)

Returns
  status, always returns EC_Illegal Call

Reimplemented in DcmAttributeTag, DcmDataset, DcmDecimalString, DcmDirectoryRecord, DcmElement, DcmFileFormat, DcmItem, DcmMetaInfo, DcmOther64bitVeryLong, DcmOtherByteOtherWord, DcmOtherDouble, DcmOtherFloat, DcmOtherLong, DcmPersonName, DcmPixelData, DcmPixelItem, DcmPixelSequence, and DcmSequenceOfItems.

The documentation for this class was generated from the following file:

- dcmdata/include/dcmtk/dcmdata/dcobject.h

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2