DCMTK  Version 3.6.5
OFFIS DICOM Toolkit
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
DcmElement Class Referenceabstract

abstract base class for all DICOM elements More...

+ Inheritance diagram for DcmElement:

Public Member Functions

 DcmElement (const DcmTag &tag, const Uint32 len=0)
 constructor. More...
 
 DcmElement (const DcmElement &old)
 copy constructor More...
 
virtual ~DcmElement ()
 destructor
 
DcmElementoperator= (const DcmElement &obj)
 assignment operator More...
 
virtual int compare (const DcmElement &rhs) const =0
 comparison operator that compares the normalized value of this element with a given element of the same type (e.g. More...
 
virtual OFCondition copyFrom (const DcmObject &rhs)
 Virtual object copying. More...
 
virtual Uint32 calcElementLength (const E_TransferSyntax xfer, const E_EncodingType enctype)
 calculate the length of this DICOM element when encoded with the given transfer syntax and the given encoding type for sequences. More...
 
virtual Uint32 getLength (const E_TransferSyntax=EXS_LittleEndianImplicit, const E_EncodingType=EET_UndefinedLength)
 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. More...
 
virtual OFBool isLeaf () const
 check if this element is a leaf node in a dataset tree. More...
 
OFBool valueLoaded () const
 check if value of this element is loaded into main memory More...
 
virtual void transferInit ()
 initialize the transfer state of this object. More...
 
virtual OFBool canWriteXfer (const E_TransferSyntax newXfer, const E_TransferSyntax oldXfer)
 check if this DICOM object can be encoded in the given transfer syntax. More...
 
virtual OFCondition read (DcmInputStream &inStream, const E_TransferSyntax ixfer, const E_GrpLenEncoding glenc=EGL_noChange, const Uint32 maxReadLength=DCM_MaxReadLength)
 This function reads the data value of an attribute which is captured in the input stream and captures this information in this. More...
 
virtual OFCondition write (DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)
 This function writes this element's value to the outstream which was passed. More...
 
virtual OFCondition writeXML (STD_NAMESPACE ostream &out, const size_t flags=0)
 write object in XML format More...
 
virtual OFCondition writeJson (STD_NAMESPACE ostream &out, DcmJsonFormat &format)
 write object in JSON format More...
 
virtual OFCondition writeSignatureFormat (DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)
 special write method for creation of digital signatures More...
 
virtual OFCondition clear ()
 clear (remove) attribute value More...
 
virtual OFCondition checkValue (const OFString &vm="1-n", const OFBool oldFormat=OFFalse)
 check whether stored value conforms to the VR and to the specified VM More...
 
virtual OFCondition loadAllDataIntoMemory ()
 this method loads all attribute values maintained by this object and all sub-objects (in case of a container such as DcmDataset) into memory. More...
 
virtual OFCondition getUint8 (Uint8 &val, const unsigned long pos=0)
 retrieve a single value of type Uint8. More...
 
virtual OFCondition getSint16 (Sint16 &val, const unsigned long pos=0)
 retrieve a single value of type Sint16. More...
 
virtual OFCondition getUint16 (Uint16 &val, const unsigned long pos=0)
 retrieve a single value of type Uint16. More...
 
virtual OFCondition getSint32 (Sint32 &val, const unsigned long pos=0)
 retrieve a single value of type Sint32. More...
 
virtual OFCondition getUint32 (Uint32 &val, const unsigned long pos=0)
 retrieve a single value of type Uint32. More...
 
virtual OFCondition getFloat32 (Float32 &val, const unsigned long pos=0)
 retrieve a single value of type Float32. More...
 
virtual OFCondition getSint64 (Sint64 &val, const unsigned long pos=0)
 retrieve a single value of type Sint64. More...
 
virtual OFCondition getUint64 (Uint64 &val, const unsigned long pos=0)
 retrieve a single value of type Uint64. More...
 
virtual OFCondition getFloat64 (Float64 &val, const unsigned long pos=0)
 retrieve a single value of type Float64. More...
 
virtual OFCondition getTagVal (DcmTagKey &val, const unsigned long pos=0)
 retrieve a single value of type DcmTagKey. More...
 
virtual OFCondition getOFString (OFString &str, const unsigned long pos, OFBool normalize=OFTrue)
 retrieve a single value of type string. More...
 
virtual OFCondition getOFStringArray (OFString &value, OFBool normalize=OFTrue)
 get entire element value as a character string. More...
 
virtual OFCondition getString (char *&val)
 get a pointer to the element value of the current element as type string. More...
 
virtual OFCondition getString (char *&val, Uint32 &len)
 get a pointer to the element value of the current element as type string. More...
 
virtual OFCondition getUint8Array (Uint8 *&val)
 get a pointer to the element value of the current element as type string. More...
 
virtual OFCondition getSint16Array (Sint16 *&val)
 get a pointer to the element value of the current element as type Sint16. More...
 
virtual OFCondition getUint16Array (Uint16 *&val)
 get a pointer to the element value of the current element as type Uint16. More...
 
virtual OFCondition getSint32Array (Sint32 *&val)
 get a pointer to the element value of the current element as type Sint32. More...
 
virtual OFCondition getUint32Array (Uint32 *&val)
 get a pointer to the element value of the current element as type Uint32. More...
 
virtual OFCondition getFloat32Array (Float32 *&val)
 get a pointer to the element value of the current element as type Float32. More...
 
virtual OFCondition getSint64Array (Sint64 *&val)
 get a pointer to the element value of the current element as type Sint64. More...
 
virtual OFCondition getUint64Array (Uint64 *&val)
 get a pointer to the element value of the current element as type Uint64. More...
 
virtual OFCondition getFloat64Array (Float64 *&val)
 get a pointer to the element value of the current element as type Float64. More...
 
OFCondition detachValueField (OFBool copy=OFFalse)
 detach the value field from the DICOM element (i.e., this object). More...
 
virtual OFCondition putOFStringArray (const OFString &val)
 replace the element value by a copy of the given string (which is possibly multi-valued). More...
 
virtual OFCondition putString (const char *val)
 replace the element value by a copy of the given string (which is possibly multi-valued). More...
 
virtual OFCondition putString (const char *val, const Uint32 len)
 replace the element value by a copy of the given string (which is possibly multi-valued). More...
 
virtual OFCondition putSint16 (const Sint16 val, const unsigned long pos=0)
 insert into the element value a copy of the given Sint16 value. More...
 
virtual OFCondition putUint16 (const Uint16 val, const unsigned long pos=0)
 insert into the element value a copy of the given Uint16 value. More...
 
virtual OFCondition putSint32 (const Sint32 val, const unsigned long pos=0)
 insert into the element value a copy of the given Sint32 value. More...
 
virtual OFCondition putUint32 (const Uint32 val, const unsigned long pos=0)
 insert into the element value a copy of the given Uint32 value. More...
 
virtual OFCondition putFloat32 (const Float32 val, const unsigned long pos=0)
 insert into the element value a copy of the given Float32 value. More...
 
virtual OFCondition putFloat64 (const Float64 val, const unsigned long pos=0)
 insert into the element value a copy of the given Float64 value. More...
 
virtual OFCondition putTagVal (const DcmTagKey &attrTag, const unsigned long pos=0)
 insert into the element value a copy of the given DcmTagKey value. More...
 
virtual OFCondition putUint8Array (const Uint8 *vals, const unsigned long num)
 replace the element value by a copy of the given Uint8 array (which is possibly multi-valued). More...
 
virtual OFCondition putSint16Array (const Sint16 *vals, const unsigned long num)
 replace the element value by a copy of the given Sint16 array (which is possibly multi-valued). More...
 
virtual OFCondition putUint16Array (const Uint16 *vals, const unsigned long num)
 replace the element value by a copy of the given Uint16 array (which is possibly multi-valued). More...
 
virtual OFCondition putSint32Array (const Sint32 *vals, const unsigned long num)
 replace the element value by a copy of the given Sint32 array (which is possibly multi-valued). More...
 
virtual OFCondition putUint32Array (const Uint32 *vals, const unsigned long num)
 replace the element value by a copy of the given Uint32 array (which is possibly multi-valued). More...
 
virtual OFCondition putFloat32Array (const Float32 *vals, const unsigned long num)
 replace the element value by a copy of the given Float32 array (which is possibly multi-valued). More...
 
virtual OFCondition putFloat64Array (const Float64 *vals, const unsigned long num)
 replace the element value by a copy of the given Float64 array (which is possibly multi-valued). More...
 
virtual OFCondition getPartialValue (void *targetBuffer, const Uint32 offset, Uint32 numBytes, DcmFileCache *cache=NULL, E_ByteOrder byteOrder=gLocalByteOrder)
 Copy numBytes bytes of data from the attribute value in byteOrder byte order to targetBuffer, starting at byte offset offset of the attribute value. More...
 
virtual OFCondition createUint8Array (const Uint32 numBytes, Uint8 *&bytes)
 create an empty Uint8 array of given number of bytes and set it. More...
 
virtual OFCondition createUint16Array (const Uint32 numWords, Uint16 *&words)
 create an empty Uint16 array of given number of words and set it. More...
 
virtual OFCondition createValueFromTempFile (DcmInputStreamFactory *factory, const Uint32 length, const E_ByteOrder byteOrder)
 replace the attribute value with the content of the given temporary file. More...
 
virtual void compact ()
 remove the attribute value from memory if the attribute value can be loaded from file when needed again. More...
 
virtual OFCondition getUncompressedFrameSize (DcmItem *dataset, Uint32 &frameSize) const
 compute uncompressed frame size of a single frame of this image. More...
 
virtual OFCondition getUncompressedFrame (DcmItem *dataset, Uint32 frameNo, Uint32 &startFragment, void *buffer, Uint32 bufSize, OFString &decompressedColorModel, DcmFileCache *cache=NULL)
 access single frame without decompressing or loading a complete multi-frame object. More...
 
virtual OFCondition getDecompressedColorModel (DcmItem *dataset, OFString &decompressedColorModel)
 determine color model of the decompressed image More...
 
virtual OFBool isUniversalMatch (const OFBool normalize=OFTrue, const OFBool enableWildCardMatching=OFTrue)
 Determine if this element is universal matching. More...
 
virtual OFBool matches (const DcmElement &candidate, const OFBool enableWildCardMatching=OFTrue) const
 perform attribute matching. More...
 
virtual OFBool combinationMatches (const DcmElement &keySecond, const DcmElement &candidateFirst, const DcmElement &candidateSecond) const
 perform combined attribute matching. More...
 
const DcmInputStreamFactorygetInputStream () const
 returns a pointer to the input stream, if available, NULL otherwise. More...
 
- Public Member Functions inherited from DcmObject
 DcmObject (const DcmTag &tag, const Uint32 len=0)
 constructor. More...
 
 DcmObject (const DcmObject &obj)
 copy constructor More...
 
virtual ~DcmObject ()
 destructor
 
virtual DcmObjectclone () const =0
 clone method More...
 
DcmObjectoperator= (const DcmObject &obj)
 copy assignment operator More...
 
virtual DcmEVR ident () const =0
 return identifier for this class. More...
 
DcmEVR getVR () const
 return the value representation assigned to this object. More...
 
OFBool isaString () const
 check if this element is a string type, based on the VR. More...
 
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 More...
 
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 More...
 
E_TransferState transferState () const
 return the current transfer (read/write) state of this object. More...
 
virtual void transferEnd (void)
 finalize the transfer state of this object. More...
 
DcmItemgetRootItem ()
 get root dataset/item (top-level) that contains this object. More...
 
virtual DcmItemgetParentItem ()
 get parent item of this object. More...
 
DcmObjectgetParent ()
 get parent of this object. More...
 
const DcmObjectgetParent () const
 get parent of this object. More...
 
void setParent (DcmObject *parent)
 set parent of this object. More...
 
Uint16 getGTag () const
 return the group number of the attribute tag for this object More...
 
Uint16 getETag () const
 return the element number of the attribute tag for this object More...
 
const DcmTaggetTag () const
 return const reference to the attribute tag for this object More...
 
void setGTag (Uint16 gtag)
 assign group tag (but not element tag) of the attribute tag for this object. More...
 
virtual OFCondition setVR (DcmEVR)
 assign a new Value Representation (VR) to this object. More...
 
virtual unsigned long getVM ()=0
 get value multiplicity of this object. More...
 
virtual unsigned long getNumberOfValues ()=0
 get number of values stored in this object More...
 
virtual OFBool isSignable () const
 returns true if the current object may be included in a digital signature More...
 
virtual OFBool containsUnknownVR () const
 returns true if the object contains an element with Unknown VR at any nesting level More...
 
virtual OFBool containsExtendedCharacters (const OFBool checkAllStrings=OFFalse)
 check if this object contains non-ASCII characters More...
 
virtual OFBool isAffectedBySpecificCharacterSet () const
 check if this object is affected by SpecificCharacterSet More...
 
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) More...
 
virtual OFBool isEmpty (const OFBool normalize=OFTrue)
 check if this object is empty More...
 
virtual OFCondition verify (const OFBool autocorrect=OFFalse)=0
 check the currently stored element value More...
 
virtual DcmObjectnextInContainer (const DcmObject *obj)
 this method is only used in container classes derived from this class, that is, DcmItem and DcmSequenceOfItems. More...
 
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). More...
 
virtual OFCondition search (const DcmTagKey &xtag, DcmStack &resultStack, E_SearchMode mode=ESM_fromHere, OFBool searchIntoSub=OFTrue)
 a complex, stack-based, hierarchical search method. More...
 
Uint32 getLengthField () const
 return the current value of the Length field (which is different from the functionality of the public getLength() method). More...
 

Static Public Member Functions

static int scanValue (const OFString &value, const OFString &vr, const size_t pos=0, const size_t num=OFString_npos)
 scan string value for conformance with given value representation (VR) More...
 
static int scanValue (const OFString &vr, const char *const value, const size_t size)
 scan string value for conformance with given value representation (VR) More...
 
static unsigned long determineVM (const char *str, const size_t len)
 determine the number of values stored in a string, i.e. the value multiplicity (VM) More...
 
static size_t getValueFromString (const char *str, const size_t pos, const size_t len, OFString &val)
 get the first value stored in the given string. More...
 
static OFCondition checkVM (const unsigned long vmNum, const OFString &vmStr)
 check for correct value multiplicity (VM) More...
 

Protected Member Functions

void * getValue (const E_ByteOrder newByteOrder=gLocalByteOrder)
 This function returns this element's value. More...
 
OFCondition changeValue (const void *value, const Uint32 position, const Uint32 num)
 insert into the element value a copy of the given raw value. More...
 
OFCondition putValue (const void *value, const Uint32 length)
 replace the element value by a copy of the given raw data block More...
 
OFCondition createEmptyValue (const Uint32 length)
 create a new, empty value field of given size. More...
 
OFCondition loadValue (DcmInputStream *inStream=NULL)
 This function reads the data value of an attribute and stores the information which was read in this. More...
 
virtual void postLoadValue ()
 performs clean-up functions after loading an attribute value into main memory. More...
 
virtual Uint8 * newValueField ()
 This function creates a byte array of Length bytes and returns this array. More...
 
void swapValueField (size_t valueWidth)
 swaps the content of the value field (if loaded) from big-endian to little-endian or back More...
 
virtual void writeXMLStartTag (STD_NAMESPACE ostream &out, const size_t flags, const char *attrText=NULL)
 write element start tag in XML format More...
 
virtual void writeXMLEndTag (STD_NAMESPACE ostream &out, const size_t flags)
 write element end tag in XML format More...
 
virtual void writeJsonOpener (STD_NAMESPACE ostream &out, DcmJsonFormat &format)
 write element start tag in JSON format More...
 
virtual void writeJsonCloser (STD_NAMESPACE ostream &out, DcmJsonFormat &format)
 write element end tag in JSON format More...
 
E_ByteOrder getByteOrder () const
 return the current byte order of the value field More...
 
void setByteOrder (E_ByteOrder val)
 set the current byte order of the value field More...
 
- Protected Member Functions inherited from DcmObject
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. More...
 
void printInfoLineStart (STD_NAMESPACE ostream &out, const size_t flags, const int level, DcmTag *tag=NULL)
 print beginning of the info line. More...
 
void printInfoLineEnd (STD_NAMESPACE ostream &out, const size_t flags, const unsigned long printedLength=0xffffffff, DcmTag *tag=NULL)
 print end of the info line. More...
 
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. More...
 
virtual OFCondition writeTagAndLength (DcmOutputStream &outStream, const E_TransferSyntax oxfer, Uint32 &writtenBytes) const
 write tag, VR and length field to the given output stream More...
 
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. More...
 
const char * getTagName ()
 return the DICOM attribute tag name for this object. More...
 
void setTagVR (DcmEVR vr)
 set the VR for this attribute More...
 
E_TransferState getTransferState () const
 return the current transfer state of this object during serialization/deserialization More...
 
void setTransferState (E_TransferState newState)
 set the current transfer state of this object during serialization/deserialization More...
 
Uint32 getTransferredBytes () const
 return the number of transferred bytes for this object during serialization/deserialization More...
 
void setTransferredBytes (Uint32 val)
 set the number of transferred bytes for this object during serialization/deserialization More...
 
void incTransferredBytes (Uint32 val)
 add to the number of transferred bytes for this object during serialization/deserialization More...
 
void setLengthField (Uint32 val)
 set the current value of the Length field More...
 

Private Attributes

E_ByteOrder fByteOrder
 current byte order of attribute value in memory
 
DcmInputStreamFactoryfLoadValue
 required information to load value later
 
Uint8 * fValue
 value of the element
 

Friends

OFBool operator< (const DcmElement &lhs, const DcmElement &rhs)
 Checks whether left hand side element is smaller than right hand side element. More...
 
OFBool operator> (const DcmElement &lhs, const DcmElement &rhs)
 Checks whether left hand side element is greater than right hand side element. More...
 
OFBool operator<= (const DcmElement &lhs, const DcmElement &rhs)
 Checks whether left hand side element is smaller than or equal to right hand side element. More...
 
OFBool operator>= (const DcmElement &lhs, const DcmElement &rhs)
 Checks whether left hand side element is greater than or equal to right hand side element. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from DcmObject
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. More...
 
- Protected Attributes inherited from DcmObject
OFCondition errorFlag
 error flag for this object.
 

Detailed Description

abstract base class for all DICOM elements

Constructor & Destructor Documentation

◆ DcmElement() [1/2]

DcmElement::DcmElement ( const DcmTag tag,
const Uint32  len = 0 
)

constructor.

Create new element from given tag and length.

Parameters
tagDICOM tag for the new element
lenvalue length for the new element

◆ DcmElement() [2/2]

DcmElement::DcmElement ( const DcmElement old)

copy constructor

Parameters
oldelement to be copied

Member Function Documentation

◆ calcElementLength()

virtual Uint32 DcmElement::calcElementLength ( const E_TransferSyntax  xfer,
const E_EncodingType  enctype 
)
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.
Parameters
xfertransfer syntax for length calculation
enctypesequence encoding type for length calculation
Returns
length of DICOM element

Implements DcmObject.

Reimplemented in DcmPixelData, DcmSequenceOfItems, DcmFileFormat, DcmPixelItem, and DcmPixelSequence.

◆ canWriteXfer()

virtual OFBool DcmElement::canWriteXfer ( const E_TransferSyntax  newXfer,
const E_TransferSyntax  oldXfer 
)
virtual

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

Parameters
newXfertransfer syntax in which the DICOM object is to be encoded
oldXfertransfer syntax in which the DICOM object was read or created.
Returns
true if object can be encoded in desired transfer syntax, false otherwise.

Implements DcmObject.

Reimplemented in DcmPixelData, DcmSequenceOfItems, DcmPixelSequence, DcmFileFormat, and DcmOtherByteOtherWord.

◆ changeValue()

OFCondition DcmElement::changeValue ( const void *  value,
const Uint32  position,
const Uint32  num 
)
protected

insert into the element value a copy of the given raw value.

If the attribute is multi-valued, all other values remain untouched. Only works for fixed-size VRs, not for strings.

Parameters
valuenew value to be inserted
positionposition for insert operation. Value: pos <= getVM(), i.e. a value can be appended to the end of the current element or inserted within the existing value field.
numnumber of bytes for each value in the value field.
Returns
EC_Normal upon success, an error code otherwise

◆ checkValue()

virtual OFCondition DcmElement::checkValue ( const OFString vm = "1-n",
const OFBool  oldFormat = OFFalse 
)
virtual

check whether stored value conforms to the VR and to the specified VM

Parameters
vmvalue multiplicity (according to the data dictionary) to be checked for. (See DcmElement::checkVM() for a list of valid values.) Interpreted as cardinality (number of items) for sequence attributes.
oldFormatsupport old ACR/NEMA format for certain VRs (DA, TM, PN) if OFTrue
Returns
status of the check, EC_Normal if value is correct, an error code otherwise

Reimplemented in DcmSequenceOfItems, DcmOtherByteOtherWord, DcmAttributeTag, DcmFloatingPointSingle, DcmSignedLong, DcmSignedShort, DcmSigned64bitVeryLong, DcmUnsignedLong, DcmUnsignedShort, DcmUnlimitedText, DcmUnsigned64bitVeryLong, DcmUniversalResourceIdentifierOrLocator, DcmFloatingPointDouble, DcmShortText, DcmLongText, DcmShortString, DcmLongString, DcmOtherLong, DcmOther64bitVeryLong, DcmPersonName, DcmDecimalString, DcmIntegerString, DcmOtherDouble, DcmOtherFloat, DcmUnlimitedCharacters, DcmTime, DcmApplicationEntity, DcmAgeString, DcmCodeString, DcmDate, DcmDateTime, and DcmUniqueIdentifier.

◆ checkVM()

static OFCondition DcmElement::checkVM ( const unsigned long  vmNum,
const OFString vmStr 
)
static

check for correct value multiplicity (VM)

Parameters
vmNumvalue multiplicity of the value to be checked. For empty values (vmNum=0), the status of the check is always EC_Normal (i.e. no error).
vmStrvalue multiplicity (according to the data dictionary) to be checked for. (valid values: "1", "1-2", "1-3", "1-8", "1-99", "1-n", "2", "2-n", "2-2n", "3", "3-n", "3-3n", "4", "5", "5-n", "6", "7", "7-7n", "8", "9", "16", "24", "32", "256")
Returns
status of the check, EC_ValueMultiplicityViolated in case of error

◆ clear()

virtual OFCondition DcmElement::clear ( )
virtual

clear (remove) attribute value

Returns
EC_Normal if successful, an error code otherwise

Implements DcmObject.

Reimplemented in DcmSequenceOfItems, DcmByteString, DcmFileFormat, and DcmUnsignedLongOffset.

◆ combinationMatches()

virtual OFBool DcmElement::combinationMatches ( const DcmElement keySecond,
const DcmElement candidateFirst,
const DcmElement candidateSecond 
) const
virtual

perform combined attribute matching.

Combine the given Attributes to one pair of matching key and candidate respectively and perform attribute matching on the result.

Note
The DICOM standard currently defines combined attribute matching for the VR DA in combination with TM, such that two attributes can be combined into a single attribute with VR=DT before matching against another pair of attributes with VR DA and TM. The method will return OFFalse if this element's VR is not DA or the given attributes are not of VR TM, DA and TM respectively.
Parameters
keySecondthe second part of the matching key that will be combined with this element.
candidateFirstthe first part of the candidate that will be matched against this this element + keySecond.
candidateSecondthe second part of the candidate that will be combined with candidateFirst for matching against this elemement + keySecond.
Returns
OFTrue if the combination of this elemement and keySecond match with the combination of candidateFirst and candidateSecond. OFFalse otherwise.

Reimplemented in DcmDate.

◆ compact()

virtual void DcmElement::compact ( )
virtual

remove the attribute value from memory if the attribute value can be loaded from file when needed again.

Otherwise do nothing.

◆ compare()

virtual int DcmElement::compare ( const DcmElement rhs) const
pure virtual

comparison operator that compares the normalized value of this element with a given element of the same type (e.g.

an DcmUnsignedShort with a DcmUnsignedShort). The tag of the element is also considered as the first component that is compared, followed by the object types (VR, i.e. DCMTK'S EVR). DcmElement's default implementation does only compare the tag and EVR while the derived classes implement the value comparisons by comparing all the components that make up the value, preferably in the order declared in the object (if applicable).

Parameters
rhsthe right hand side of the comparison
Returns
0 if the object values are equal. -1 if this element has fewer components than the rhs element. Also -1 if the value of the first component that does not match is lower in this object than in rhs. Also returned if rhs cannot be casted to this object type or both objects are of different VR (i.e. the DcmEVR returned by the element's ident() call are different). 1 if either this element has more components than the rhs element, or if the first component that does not match is greater in this object than in rhs object. If the function is overwritten by derived classes, the behaviour might slightly change but all methods will return 0 on equality, and 1 or -1 if different.

Implemented in DcmPixelData, DcmByteString, DcmSequenceOfItems, DcmPolymorphOBOW, DcmAttributeTag, DcmFloatingPointSingle, DcmSignedLong, DcmSigned64bitVeryLong, DcmUnsignedLong, DcmUniversalResourceIdentifierOrLocator, DcmUnsigned64bitVeryLong, DcmUnlimitedText, DcmFloatingPointDouble, DcmShortText, DcmLongText, DcmOtherByteOtherWord, DcmSignedShort, and DcmUnsignedShort.

◆ copyFrom()

virtual OFCondition DcmElement::copyFrom ( const DcmObject rhs)
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

Implements DcmObject.

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

◆ createEmptyValue()

OFCondition DcmElement::createEmptyValue ( const Uint32  length)
protected

create a new, empty value field of given size.

Parameters
lengthsize of new value field in bytes
Returns
EC_Normal if successful, an error code otherwise.

◆ createUint16Array()

virtual OFCondition DcmElement::createUint16Array ( const Uint32  numWords,
Uint16 *&  words 
)
virtual

create an empty Uint16 array of given number of words and set it.

All array elements are initialized with a value of 0 (using 'memzero'). This method is only applicable to OW data.

Parameters
numWordsnumber of words (16 bit) to be created
wordsstores the pointer to the resulting buffer
Returns
status, EC_Normal if successful, an error code otherwise

Reimplemented in DcmPixelData, DcmOtherByteOtherWord, and DcmPolymorphOBOW.

◆ createUint8Array()

virtual OFCondition DcmElement::createUint8Array ( const Uint32  numBytes,
Uint8 *&  bytes 
)
virtual

create an empty Uint8 array of given number of bytes and set it.

All array elements are initialized with a value of 0 (using 'memzero'). This method is only applicable to certain VRs, e.g. OB.

Parameters
numBytesnumber of bytes (8 bit) to be created
bytesstores the pointer to the resulting buffer
Returns
status, EC_Normal if successful, an error code otherwise

Reimplemented in DcmPixelData, DcmOtherByteOtherWord, and DcmPolymorphOBOW.

◆ createValueFromTempFile()

virtual OFCondition DcmElement::createValueFromTempFile ( DcmInputStreamFactory factory,
const Uint32  length,
const E_ByteOrder  byteOrder 
)
virtual

replace the attribute value with the content of the given temporary file.

The temporary file is not opened/loaded until the attribute value is accessed, very much like large attributes that remain in file during a read operation.

Parameters
factorya factory object that is able to create an input stream to the temporary file at the right location.
lengthattribute value length, in bytes. Must be even length. The length is not checked against the real length of the temporary file, which might be written or completed after the call to this method.
byteOrderbyte order in the temporary file
Returns
EC_Normal upon success, an error code otherwise.

Reimplemented in DcmPixelData.

◆ detachValueField()

OFCondition DcmElement::detachValueField ( OFBool  copy = OFFalse)

detach the value field from the DICOM element (i.e., this object).

After detaching the calling part of the application has total control over the element value, especially the value must be deleted from the heap after use. The DICOM element remains a copy of the value if the copy parameter is OFTrue; otherwise the value is erased in the DICOM element.

Parameters
copyif true, copy value field before detaching; if false, do not retain a copy.
Returns
EC_Normal upon success, an error code otherwise

◆ determineVM()

static unsigned long DcmElement::determineVM ( const char *  str,
const size_t  len 
)
static

determine the number of values stored in a string, i.e. the value multiplicity (VM)

Parameters
strcharacter string
lenlength of the string (number of characters without the trailing NULL byte)
Returns
number of values separated by backslash characters in the given string

◆ getByteOrder()

E_ByteOrder DcmElement::getByteOrder ( ) const
inlineprotected

return the current byte order of the value field

Returns
current byte order of the value field

◆ getDecompressedColorModel()

virtual OFCondition DcmElement::getDecompressedColorModel ( DcmItem dataset,
OFString decompressedColorModel 
)
virtual

determine color model of the decompressed image

Parameters
datasetpointer to DICOM dataset in which this pixel data object is located. Used to access photometric interpretation.
decompressedColorModelupon successful return, the color model of the decompressed image (which may be different from the one used in the compressed images) is returned in this parameter
Returns
EC_Normal if successful, an error code otherwise

Reimplemented in DcmPixelData.

◆ getFloat32()

virtual OFCondition DcmElement::getFloat32 ( Float32 &  val,
const unsigned long  pos = 0 
)
virtual

retrieve a single value of type Float32.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valvalue returned in this parameter upon success
posposition in multi-valued attribute, default 0
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointSingle.

◆ getFloat32Array()

virtual OFCondition DcmElement::getFloat32Array ( Float32 *&  val)
virtual

get a pointer to the element value of the current element as type Float32.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointSingle.

◆ getFloat64()

virtual OFCondition DcmElement::getFloat64 ( Float64 &  val,
const unsigned long  pos = 0 
)
virtual

retrieve a single value of type Float64.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valvalue returned in this parameter upon success
posposition in multi-valued attribute, default 0
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointDouble, and DcmDecimalString.

◆ getFloat64Array()

virtual OFCondition DcmElement::getFloat64Array ( Float64 *&  val)
virtual

get a pointer to the element value of the current element as type Float64.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointDouble.

◆ getInputStream()

const DcmInputStreamFactory* DcmElement::getInputStream ( ) const
inline

returns a pointer to the input stream, if available, NULL otherwise.

In general, this pointer is available when the element is part of a dataset that has been read from a DICOM file, the file is not encoded in deflate transfer syntax, and the element value is large enough that loading the value has been postponed to the first read access. The DcmInputStreamFactory object can create an instance of a file stream seeked to the right position within the DICOM file from where the element value can be read.

Returns
pointer to the input stream factory of the element, null if no object is available

◆ getLength()

virtual Uint32 DcmElement::getLength ( const E_TransferSyntax  = EXS_LittleEndianImplicit,
const E_EncodingType  = EET_UndefinedLength 
)
inlinevirtual

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
xfertransfer syntax for length calculation
enctypesequence encoding type for length calculation
Returns
value length of DICOM element

Implements DcmObject.

Reimplemented in DcmPixelData, DcmSequenceOfItems, and DcmByteString.

References DcmObject::getLengthField().

Referenced by I2DOutputPlug::checkAndInventType1Attrib().

◆ getOFString()

virtual OFCondition DcmElement::getOFString ( OFString str,
const unsigned long  pos,
OFBool  normalize = OFTrue 
)
virtual

retrieve a single value of type string.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
strvalue returned in this parameter upon success
posposition in multi-valued attribute
normalizetrue if string is to be normalized (e.g. trailing space characters to be trimmed)
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmOtherByteOtherWord, DcmByteString, DcmAttributeTag, DcmFloatingPointSingle, DcmFloatingPointDouble, DcmSignedLong, DcmSigned64bitVeryLong, DcmUnsignedLong, DcmUnsignedShort, DcmUnsigned64bitVeryLong, DcmSignedShort, DcmUnlimitedText, DcmUniversalResourceIdentifierOrLocator, DcmShortText, DcmLongText, DcmDecimalString, DcmUniqueIdentifier, DcmIntegerString, DcmShortString, DcmLongString, DcmPersonName, DcmUnlimitedCharacters, DcmTime, DcmApplicationEntity, DcmCodeString, DcmDate, and DcmDateTime.

◆ getOFStringArray()

virtual OFCondition DcmElement::getOFStringArray ( OFString value,
OFBool  normalize = OFTrue 
)
virtual

get entire element value as a character string.

In case of VM > 1 the individual values are separated by a backslash ('\'). This method implements a general approach by concatenating the results of getOFString() for each value component. Derived class may implement more sophisticated methods.

Parameters
valuevariable in which the result value is stored
normalizenormalize each element value prior to concatenation
Returns
status, EC_Normal if successful, an error code otherwise

Reimplemented in DcmOtherByteOtherWord, DcmByteString, DcmUnlimitedText, DcmUniversalResourceIdentifierOrLocator, DcmShortText, and DcmLongText.

◆ getPartialValue()

virtual OFCondition DcmElement::getPartialValue ( void *  targetBuffer,
const Uint32  offset,
Uint32  numBytes,
DcmFileCache cache = NULL,
E_ByteOrder  byteOrder = gLocalByteOrder 
)
virtual

Copy numBytes bytes of data from the attribute value in byteOrder byte order to targetBuffer, starting at byte offset offset of the attribute value.

This method does not cause the complete attribute value to be read into main memory. Subsequent calls for the same partial value may cause repeated access to file if the attribute value is kept in file.

Parameters
targetBufferpointer to target buffer, must not be NULL. Buffer size must be at least numBytes bytes.
offsetbyte offset within the attribute value from where to start copying
numBytesnumber of bytes to copy.
cachefile cache object that may be passed to multiple subsequent calls to this method for the same file; the file cache will then keep a file handle open, thus improving performance. Optional, may be NULL
byteOrderbyte order desired byte order of attribute value in memory buffer. Default is the local byte order of the machine.
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSequenceOfItems.

◆ getSint16()

virtual OFCondition DcmElement::getSint16 ( Sint16 &  val,
const unsigned long  pos = 0 
)
virtual

retrieve a single value of type Sint16.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valvalue returned in this parameter upon success
posposition in multi-valued attribute, default 0
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedShort.

◆ getSint16Array()

virtual OFCondition DcmElement::getSint16Array ( Sint16 *&  val)
virtual

get a pointer to the element value of the current element as type Sint16.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedShort.

◆ getSint32()

virtual OFCondition DcmElement::getSint32 ( Sint32 &  val,
const unsigned long  pos = 0 
)
virtual

retrieve a single value of type Sint32.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valvalue returned in this parameter upon success
posposition in multi-valued attribute, default 0
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedLong, and DcmIntegerString.

◆ getSint32Array()

virtual OFCondition DcmElement::getSint32Array ( Sint32 *&  val)
virtual

get a pointer to the element value of the current element as type Sint32.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedLong.

◆ getSint64()

virtual OFCondition DcmElement::getSint64 ( Sint64 &  val,
const unsigned long  pos = 0 
)
virtual

retrieve a single value of type Sint64.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valvalue returned in this parameter upon success
posposition in multi-valued attribute, default 0
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSigned64bitVeryLong.

◆ getSint64Array()

virtual OFCondition DcmElement::getSint64Array ( Sint64 *&  val)
virtual

get a pointer to the element value of the current element as type Sint64.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSigned64bitVeryLong.

◆ getString() [1/2]

virtual OFCondition DcmElement::getString ( char *&  val)
virtual

get a pointer to the element value of the current element as type string.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmByteString.

◆ getString() [2/2]

virtual OFCondition DcmElement::getString ( char *&  val,
Uint32 &  len 
)
virtual

get a pointer to the element value of the current element as type string.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
lenlength of the returned value (number of characters)
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmByteString.

◆ getTagVal()

virtual OFCondition DcmElement::getTagVal ( DcmTagKey val,
const unsigned long  pos = 0 
)
virtual

retrieve a single value of type DcmTagKey.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valvalue returned in this parameter upon success
posposition in multi-valued attribute, default 0
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmAttributeTag.

◆ getUint16()

virtual OFCondition DcmElement::getUint16 ( Uint16 &  val,
const unsigned long  pos = 0 
)
virtual

retrieve a single value of type Uint16.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valvalue returned in this parameter upon success
posposition in multi-valued attribute, default 0
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmOtherByteOtherWord, and DcmUnsignedShort.

◆ getUint16Array()

virtual OFCondition DcmElement::getUint16Array ( Uint16 *&  val)
virtual

get a pointer to the element value of the current element as type Uint16.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmOtherByteOtherWord, DcmPolymorphOBOW, DcmAttributeTag, and DcmUnsignedShort.

◆ getUint32()

virtual OFCondition DcmElement::getUint32 ( Uint32 &  val,
const unsigned long  pos = 0 
)
virtual

retrieve a single value of type Uint32.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valvalue returned in this parameter upon success
posposition in multi-valued attribute, default 0
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmUnsignedLong.

◆ getUint32Array()

virtual OFCondition DcmElement::getUint32Array ( Uint32 *&  val)
virtual

get a pointer to the element value of the current element as type Uint32.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmUnsignedLong.

◆ getUint64()

virtual OFCondition DcmElement::getUint64 ( Uint64 &  val,
const unsigned long  pos = 0 
)
virtual

retrieve a single value of type Uint64.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valvalue returned in this parameter upon success
posposition in multi-valued attribute, default 0
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmUnsigned64bitVeryLong.

◆ getUint64Array()

virtual OFCondition DcmElement::getUint64Array ( Uint64 *&  val)
virtual

get a pointer to the element value of the current element as type Uint64.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmUnsigned64bitVeryLong.

◆ getUint8()

virtual OFCondition DcmElement::getUint8 ( Uint8 &  val,
const unsigned long  pos = 0 
)
virtual

retrieve a single value of type Uint8.

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valvalue returned in this parameter upon success
posposition in multi-valued attribute, default 0
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmOtherByteOtherWord.

Referenced by DcmIODUtil::copyFromUint8Array().

◆ getUint8Array()

virtual OFCondition DcmElement::getUint8Array ( Uint8 *&  val)
virtual

get a pointer to the element value of the current element as type string.

Requires element to be of corresponding VR, otherwise an error is returned. This method does not copy, but returns a pointer to the element value, which remains under control of this object and is valid only until the next read, write or put operation.

Parameters
valpointer to value returned in this parameter upon success
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmOtherByteOtherWord, and DcmPolymorphOBOW.

◆ getUncompressedFrame()

virtual OFCondition DcmElement::getUncompressedFrame ( DcmItem dataset,
Uint32  frameNo,
Uint32 &  startFragment,
void *  buffer,
Uint32  bufSize,
OFString decompressedColorModel,
DcmFileCache cache = NULL 
)
virtual

access single frame without decompressing or loading a complete multi-frame object.

The frame is copied into the buffer passed by the caller which must be large enough to contain a complete frame.

Parameters
datasetpointer to DICOM dataset in which this pixel data object is located. Used to access rows, columns, samples per pixel etc.
frameNonumer of frame, starting with 0 for the first frame.
startFragmentindex of the compressed fragment that contains all or the first part of the compressed bitstream for the given frameNo. Upon successful return this parameter is updated to contain the index of the first compressed fragment of the next frame. When unknown, zero should be passed. In this case the decompression algorithm will try to determine the index by itself, which will always work if frames are decompressed in increasing order from first to last, but may fail if frames are decompressed in random order, multiple fragments per frame and multiple frames are present in the dataset, and the offset table is empty.
bufferpointer to buffer allocated by the caller. The buffer must be large enough for one frame of this image.
bufSizesize of buffer, in bytes
decompressedColorModelupon successful return, the color model of the decompressed image (which may be different from the one used in the compressed images) is returned in this parameter.
cachefile cache object that may be passed to multiple subsequent calls to this method for the same file; the file cache will then keep a file handle open, thus improving performance. Optional, may be NULL
Returns
EC_Normal if successful, an error code otherwise

Reimplemented in DcmPixelData.

◆ getUncompressedFrameSize()

virtual OFCondition DcmElement::getUncompressedFrameSize ( DcmItem dataset,
Uint32 &  frameSize 
) const
virtual

compute uncompressed frame size of a single frame of this image.

Note that the value returned by this method does not include the pad byte to even size needed for a buffer into which a frame is to be loaded.

Parameters
datasetdataset in which this pixel data element is contained
frameSizeframe size in bytes (without padding) returned in this parameter upon success, otherwise set to 0
Returns
EC_Normal if successful, an error code otherwise

◆ getValue()

void* DcmElement::getValue ( const E_ByteOrder  newByteOrder = gLocalByteOrder)
protected

This function returns this element's value.

The returned value corresponds to the byte ordering (little or big endian) that was passed.

Parameters
newByteOrderThe byte ordering that shall be accounted for (little or big endian).

◆ getValueFromString()

static size_t DcmElement::getValueFromString ( const char *  str,
const size_t  pos,
const size_t  len,
OFString val 
)
static

get the first value stored in the given string.

The individual values are separated by a backslash. Successive calls of this function allow for extracting all stored values.

Parameters
strcharacter string
posposition of the first character in the string to search from
lenlength of the string (number of characters without the trailing NULL byte)
valvariable in which the result is stored (empty string in case of error)
Returns
position to be used for the next search, identical to 'pos' in case of error

◆ isLeaf()

virtual OFBool DcmElement::isLeaf ( ) const
inlinevirtual

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.

Implements DcmObject.

Reimplemented in DcmSequenceOfItems.

◆ isUniversalMatch()

virtual OFBool DcmElement::isUniversalMatch ( const OFBool  normalize = OFTrue,
const OFBool  enableWildCardMatching = OFTrue 
)
virtual

Determine if this element is universal matching.

Parameters
normalizenormalize each element value. Defaults to OFTrue.
enableWildCardMatchingenable or disable wild card matching. Defaults to OFTrue, which means wild card matching is performed if the element's VR supports it. Set to OFFalse to force single value matching instead.
Returns
returns OFTrue if element is empty or if enableWildCardMatching is enabled and the element contains only wildcard characters. Returns OFFalse otherwise.

Reimplemented in DcmAttributeTag, DcmUniversalResourceIdentifierOrLocator, DcmCharString, DcmApplicationEntity, and DcmCodeString.

◆ loadAllDataIntoMemory()

virtual OFCondition DcmElement::loadAllDataIntoMemory ( )
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

Implements DcmObject.

Reimplemented in DcmSequenceOfItems, and DcmPixelData.

◆ loadValue()

OFCondition DcmElement::loadValue ( DcmInputStream inStream = NULL)
protected

This function reads the data value of an attribute and stores the information which was read in this.

The information is either read from the inStream or (if inStream is NULL) from a different stream which was created earlier and which is accessible through the fLoadValue member variable. Note that if not all information for an attribute could be read from the stream, the function returns EC_StreamNotifyClient.

Parameters
inStreamThe stream which contains the information.
Returns
status, EC_Normal if successful, an error code otherwise

◆ matches()

virtual OFBool DcmElement::matches ( const DcmElement candidate,
const OFBool  enableWildCardMatching = OFTrue 
) const
virtual

perform attribute matching.

Perform attribute matching on a candidate element using this element as the matching key.

Note
The given candidate element must refer to the same attribute kind, i.e. have the same tag and VR. The method will return OFFalse if it doesn't.
Parameters
candidatethe candidate element to compare this element with.
enableWildCardMatchingenable or disable wild card matching. Defaults to OFTrue, which means wild card matching is performed if the element's VR supports it. Set to OFFalse to force single value matching instead.
Returns
OFTrue if the candidate matches this element, OFFalse otherwise.

Reimplemented in DcmByteString, DcmFloatingPointSingle, DcmFloatingPointDouble, DcmSignedLong, DcmUnsignedLong, DcmUnsignedShort, and DcmSignedShort.

◆ newValueField()

virtual Uint8* DcmElement::newValueField ( )
protectedvirtual

This function creates a byte array of Length bytes and returns this array.

In case Length is odd, an array of Length+1 bytes will be created and Length will be increased by 1.

Returns
pointer to created byte array

Reimplemented in DcmByteString.

◆ operator=()

DcmElement& DcmElement::operator= ( const DcmElement obj)

assignment operator

Parameters
objelement to be assigned/copied
Returns
reference to this object

◆ postLoadValue()

virtual void DcmElement::postLoadValue ( )
protectedvirtual

performs clean-up functions after loading an attribute value into main memory.

In particular, if dcmEnableAutomaticInputDataCorrection is enabled, silently fixes odd length elements.

Reimplemented in DcmByteString, and DcmOtherByteOtherWord.

◆ putFloat32()

virtual OFCondition DcmElement::putFloat32 ( const Float32  val,
const unsigned long  pos = 0 
)
virtual

insert into the element value a copy of the given Float32 value.

If the attribute is multi-valued, all other values remain untouched. Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valnew value to be inserted
posposition for insert operation. Value: pos <= getVM(), i.e. a value can be appended to the end of the current element or inserted within the existing value field.
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointSingle.

◆ putFloat32Array()

virtual OFCondition DcmElement::putFloat32Array ( const Float32 *  vals,
const unsigned long  num 
)
virtual

replace the element value by a copy of the given Float32 array (which is possibly multi-valued).

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valsnew attribute value
numnumber of values in array vals
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointSingle.

◆ putFloat64()

virtual OFCondition DcmElement::putFloat64 ( const Float64  val,
const unsigned long  pos = 0 
)
virtual

insert into the element value a copy of the given Float64 value.

If the attribute is multi-valued, all other values remain untouched. Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valnew value to be inserted
posposition for insert operation. Value: pos <= getVM(), i.e. a value can be appended to the end of the current element or inserted within the existing value field.
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointDouble.

◆ putFloat64Array()

virtual OFCondition DcmElement::putFloat64Array ( const Float64 *  vals,
const unsigned long  num 
)
virtual

replace the element value by a copy of the given Float64 array (which is possibly multi-valued).

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valsnew attribute value
numnumber of values in array vals
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointDouble.

◆ putOFStringArray()

virtual OFCondition DcmElement::putOFStringArray ( const OFString val)
virtual

replace the element value by a copy of the given string (which is possibly multi-valued).

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valnew attribute value
Returns
EC_Normal upon success, an error code otherwise

◆ putSint16()

virtual OFCondition DcmElement::putSint16 ( const Sint16  val,
const unsigned long  pos = 0 
)
virtual

insert into the element value a copy of the given Sint16 value.

If the attribute is multi-valued, all other values remain untouched. Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valnew value to be inserted
posposition for insert operation. Value: pos <= getVM(), i.e. a value can be appended to the end of the current element or inserted within the existing value field.
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedShort.

◆ putSint16Array()

virtual OFCondition DcmElement::putSint16Array ( const Sint16 *  vals,
const unsigned long  num 
)
virtual

replace the element value by a copy of the given Sint16 array (which is possibly multi-valued).

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valsnew attribute value
numnumber of values in array vals
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedShort.

◆ putSint32()

virtual OFCondition DcmElement::putSint32 ( const Sint32  val,
const unsigned long  pos = 0 
)
virtual

insert into the element value a copy of the given Sint32 value.

If the attribute is multi-valued, all other values remain untouched. Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valnew value to be inserted
posposition for insert operation. Value: pos <= getVM(), i.e. a value can be appended to the end of the current element or inserted within the existing value field.
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedLong.

◆ putSint32Array()

virtual OFCondition DcmElement::putSint32Array ( const Sint32 *  vals,
const unsigned long  num 
)
virtual

replace the element value by a copy of the given Sint32 array (which is possibly multi-valued).

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valsnew attribute value
numnumber of values in array vals
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedLong.

◆ putString() [1/2]

virtual OFCondition DcmElement::putString ( const char *  val)
virtual

replace the element value by a copy of the given string (which is possibly multi-valued).

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valnew attribute value
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmOtherByteOtherWord, DcmByteString, DcmAttributeTag, DcmFloatingPointSingle, DcmFloatingPointDouble, DcmSignedLong, DcmSigned64bitVeryLong, DcmUnsignedLong, DcmUnsignedShort, DcmUnsigned64bitVeryLong, DcmSignedShort, and DcmUniqueIdentifier.

◆ putString() [2/2]

virtual OFCondition DcmElement::putString ( const char *  val,
const Uint32  len 
)
virtual

replace the element value by a copy of the given string (which is possibly multi-valued).

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valnew attribute value
lenlength of the new attribute value (number of characters)
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmOtherByteOtherWord, DcmByteString, DcmAttributeTag, DcmFloatingPointSingle, DcmFloatingPointDouble, DcmSignedLong, DcmSigned64bitVeryLong, DcmUnsignedLong, DcmUnsignedShort, DcmUnsigned64bitVeryLong, DcmSignedShort, and DcmUniqueIdentifier.

◆ putTagVal()

virtual OFCondition DcmElement::putTagVal ( const DcmTagKey attrTag,
const unsigned long  pos = 0 
)
virtual

insert into the element value a copy of the given DcmTagKey value.

If the attribute is multi-valued, all other values remain untouched. Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
attrTagnew value to be inserted
posposition for insert operation. Value: pos <= getVM(), i.e. a value can be appended to the end of the current element or inserted within the existing value field.
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmAttributeTag.

◆ putUint16()

virtual OFCondition DcmElement::putUint16 ( const Uint16  val,
const unsigned long  pos = 0 
)
virtual

insert into the element value a copy of the given Uint16 value.

If the attribute is multi-valued, all other values remain untouched. Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valnew value to be inserted
posposition for insert operation. Value: pos <= getVM(), i.e. a value can be appended to the end of the current element or inserted within the existing value field.
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmUnsignedShort.

◆ putUint16Array()

virtual OFCondition DcmElement::putUint16Array ( const Uint16 *  vals,
const unsigned long  num 
)
virtual

replace the element value by a copy of the given Uint16 array (which is possibly multi-valued).

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valsnew attribute value
numnumber of values in array vals
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmPixelData, DcmOtherByteOtherWord, DcmAttributeTag, DcmPolymorphOBOW, and DcmUnsignedShort.

◆ putUint32()

virtual OFCondition DcmElement::putUint32 ( const Uint32  val,
const unsigned long  pos = 0 
)
virtual

insert into the element value a copy of the given Uint32 value.

If the attribute is multi-valued, all other values remain untouched. Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valnew value to be inserted
posposition for insert operation. Value: pos <= getVM(), i.e. a value can be appended to the end of the current element or inserted within the existing value field.
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmUnsignedLong.

◆ putUint32Array()

virtual OFCondition DcmElement::putUint32Array ( const Uint32 *  vals,
const unsigned long  num 
)
virtual

replace the element value by a copy of the given Uint32 array (which is possibly multi-valued).

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valsnew attribute value
numnumber of values in array vals
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmUnsignedLong.

◆ putUint8Array()

virtual OFCondition DcmElement::putUint8Array ( const Uint8 *  vals,
const unsigned long  num 
)
virtual

replace the element value by a copy of the given Uint8 array (which is possibly multi-valued).

Requires element to be of corresponding VR, otherwise an error is returned.

Parameters
valsnew attribute value
numnumber of values in array vals
Returns
EC_Normal upon success, an error code otherwise

Reimplemented in DcmPixelData, DcmOtherByteOtherWord, and DcmPolymorphOBOW.

◆ putValue()

OFCondition DcmElement::putValue ( const void *  value,
const Uint32  length 
)
protected

replace the element value by a copy of the given raw data block

Parameters
valuenew attribute value
lengthlength of new attribute value in bytes
Returns
EC_Normal upon success, an error code otherwise

◆ read()

virtual OFCondition DcmElement::read ( DcmInputStream inStream,
const E_TransferSyntax  ixfer,
const E_GrpLenEncoding  glenc = EGL_noChange,
const Uint32  maxReadLength = DCM_MaxReadLength 
)
virtual

This function reads the data value of an attribute which is captured in the input stream and captures this information in this.

If not all information for an attribute could be read from the stream, the function returns EC_StreamNotifyClient. Note that if certain conditions are met, this function does not actually load the data value but creates and stores an object that enables us to load this information later.

Parameters
inStreamThe stream which contains the information.
ixferThe transfer syntax which was used to encode the information in inStream.
glencEncoding type for group length; specifies what will be done with group length tags.
maxReadLengthMaximum read length for reading an attribute value.
Returns
status, EC_Normal if successful, an error code otherwise

Implements DcmObject.

Reimplemented in DcmPixelData, DcmSequenceOfItems, DcmPixelSequence, DcmFileFormat, and DcmPolymorphOBOW.

◆ scanValue() [1/2]

static int DcmElement::scanValue ( const OFString value,
const OFString vr,
const size_t  pos = 0,
const size_t  num = OFString_npos 
)
static

scan string value for conformance with given value representation (VR)

Parameters
valuestring value to be scanned
vrtwo-character identifier of the VR to be checked (lower case)
posposition of the first character to be scanned in 'value'
numnumber of characters to be scanned in 'value' (default: all)
Returns
numeric identifier of the VR found, 16 in case of unknown VR

◆ scanValue() [2/2]

static int DcmElement::scanValue ( const OFString vr,
const char *const  value,
const size_t  size 
)
static

scan string value for conformance with given value representation (VR)

Parameters
vrtwo-character identifier of the VR to be checked (lower case)
valuestring value to be scanned
sizenumber of characters to be scanned in 'value'
Returns
numeric identifier of the VR found, 16 in case of unknown VR

◆ setByteOrder()

void DcmElement::setByteOrder ( E_ByteOrder  val)
inlineprotected

set the current byte order of the value field

Parameters
valbyte order of the value field

◆ swapValueField()

void DcmElement::swapValueField ( size_t  valueWidth)
protected

swaps the content of the value field (if loaded) from big-endian to little-endian or back

Parameters
valueWidthwidth (in bytes) of each element value

◆ transferInit()

virtual void DcmElement::transferInit ( )
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 from DcmObject.

Reimplemented in DcmPixelData, DcmSequenceOfItems, and DcmPolymorphOBOW.

◆ valueLoaded()

OFBool DcmElement::valueLoaded ( ) const
inline

check if value of this element is loaded into main memory

Returns
true if value is present in memory, false if value still resides in file

References DcmObject::getLengthField().

◆ write()

virtual OFCondition DcmElement::write ( DcmOutputStream outStream,
const E_TransferSyntax  oxfer,
const E_EncodingType  enctype,
DcmWriteCache wcache 
)
virtual

This function writes this element's value to the outstream which was passed.

When writing information, the byte ordering (little or big endian) of the transfer syntax which was passed will be accounted for. In case the outstream does not provide enough space for all bytes of the current element's value, only a certain part of the value will be written to the stream. This element's transfer state indicates if the all bytes of value have already been written to the stream (ERW_ready), if the writing is still in progress and more bytes need to be written to the stream (ERW_inWork) or if the writing of the bytes of this element's value has not even begun yet (ERW_init). The member variable fTransferredBytes indicates how many bytes (starting from byte 0) of this element's value have already been written to the stream. This function will return EC_Normal, if the entire value of this element has been written to the stream, it will return EC_StreamNotifyClient, if there is no more space in the buffer and not all bytes of this element's value have been written, and it will return some other (error) value if there was an error.

Parameters
outStreamThe stream the information will be written to.
oxferThe transfer syntax which shall be used.
enctypeencoding types (undefined or explicit length) (actually unused)
wcachepointer to write cache object, may be NULL
Returns
status, EC_Normal if successful, an error code otherwise

Implements DcmObject.

Reimplemented in DcmPixelData, DcmSequenceOfItems, DcmFileFormat, DcmPixelSequence, DcmByteString, DcmOtherByteOtherWord, and DcmPolymorphOBOW.

◆ writeJson()

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

write object in JSON format

Parameters
outoutput stream to which the JSON document is written
formatused to format and customize the output
Returns
status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmObject.

Reimplemented in DcmSequenceOfItems, DcmByteString, DcmFileFormat, DcmOtherByteOtherWord, DcmPersonName, DcmAttributeTag, DcmDecimalString, DcmCharString, DcmIntegerString, DcmOtherLong, DcmOther64bitVeryLong, DcmOtherDouble, DcmOtherFloat, DcmShortString, and DcmLongString.

◆ writeJsonCloser()

virtual void DcmElement::writeJsonCloser ( STD_NAMESPACE ostream &  out,
DcmJsonFormat format 
)
protectedvirtual

write element end tag in JSON format

Parameters
outoutput stream to which the JSON document is written
formatused to format the output

◆ writeJsonOpener()

virtual void DcmElement::writeJsonOpener ( STD_NAMESPACE ostream &  out,
DcmJsonFormat format 
)
protectedvirtual

write element start tag in JSON format

Parameters
outoutput stream to which the JSON document is written
formatused to format the output

◆ writeSignatureFormat()

virtual OFCondition DcmElement::writeSignatureFormat ( DcmOutputStream outStream,
const E_TransferSyntax  oxfer,
const E_EncodingType  enctype,
DcmWriteCache wcache 
)
virtual

special write method for creation of digital signatures

Parameters
outStreamDICOM output stream
oxferoutput transfer syntax
enctypeencoding types (undefined or explicit length)
wcachepointer to write cache object, may be NULL
Returns
status, EC_Normal if successful, an error code otherwise

Implements DcmObject.

Reimplemented in DcmPixelData, DcmSequenceOfItems, DcmPixelSequence, DcmOtherByteOtherWord, DcmByteString, DcmPolymorphOBOW, and DcmPixelItem.

◆ writeXML()

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

write object in XML format

Parameters
outoutput stream to which the XML document is written
flagsoptional flag used to customize the output (see DCMTypes::XF_xxx)
Returns
status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmObject.

Reimplemented in DcmPixelData, DcmSequenceOfItems, DcmFileFormat, DcmPixelSequence, DcmOtherByteOtherWord, DcmPersonName, DcmAttributeTag, DcmPixelItem, DcmDecimalString, DcmOtherLong, DcmOther64bitVeryLong, DcmOtherDouble, and DcmOtherFloat.

◆ writeXMLEndTag()

virtual void DcmElement::writeXMLEndTag ( STD_NAMESPACE ostream &  out,
const size_t  flags 
)
protectedvirtual

write element end tag in XML format

Parameters
outoutput stream to which the XML end tag is written
flagsflag used to customize the output (not yet used)

◆ writeXMLStartTag()

virtual void DcmElement::writeXMLStartTag ( STD_NAMESPACE ostream &  out,
const size_t  flags,
const char *  attrText = NULL 
)
protectedvirtual

write element start tag in XML format

Parameters
outoutput stream to which the XML start tag is written
flagsflag used to customize the output (not yet used)
attrTextextra attribute text to be added to the element tag

Related Definitions

◆ operator<

OFBool operator< ( const DcmElement lhs,
const DcmElement rhs 
)
friend

Checks whether left hand side element is smaller than right hand side element.

Uses DcmElement's compare() method in order to perform the comparison. See DcmElement::compare() for details.

Parameters
lhsleft hand side of the comparison
rhsright hand side of the comparison
Returns
OFTrue if lhs is smaller than rhs, OFFalse otherwise

◆ operator<=

OFBool operator<= ( const DcmElement lhs,
const DcmElement rhs 
)
friend

Checks whether left hand side element is smaller than or equal to right hand side element.

Uses DcmElement's compare() method in order to perform the comparison. See DcmElement::compare() for details.

Parameters
lhsleft hand side of the comparison
rhsright hand side of the comparison
Returns
OFTrue if lhs is smaller than rhs or both are equal, OFFalse otherwise

◆ operator>

OFBool operator> ( const DcmElement lhs,
const DcmElement rhs 
)
friend

Checks whether left hand side element is greater than right hand side element.

Uses DcmElement's compare() method in order to perform the comparison. See DcmElement::compare() for details.

Parameters
lhsleft hand side of the comparison
rhsright hand side of the comparison
Returns
OFTrue if lhs is greater than rhs, OFFalse otherwise

◆ operator>=

OFBool operator>= ( const DcmElement lhs,
const DcmElement rhs 
)
friend

Checks whether left hand side element is greater than or equal to right hand side element.

Uses DcmElement's compare() method in order to perform the comparison. See DcmElement::compare() for details.

Parameters
lhsleft hand side of the comparison
rhsright hand side of the comparison
Returns
OFTrue if lhs is greater than rhs or both are equal, OFFalse otherwise

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


Generated on Mon Oct 28 2019 for DCMTK Version 3.6.5 by Doxygen 1.8.15