DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
DcmItem Class Reference

a class representing a list of DICOM elements in which each element has a different tag and elements are maintained in increasing order of tags. More...

Inheritance diagram for DcmItem:

## Public Member Functions
| DcmItem ()
| default constructor
| DcmItem (const DcmTag &tag, const Uint32 len=0)
| constructor. More...
| DcmItem (const DcmItem &old)
| copy constructor More...
DcmItem & | operator= (const DcmItem &obj)
| assignment operator. More...
virtual int | compare (const DcmItem &rhs) const
| comparison operator that compares the value of this object with a given object of the same type. More...
virtual | ~DcmItem ()
| destructor
virtual DcmObject * | clone () const
| clone method More...
virtual OFCondition | copyFrom (const DcmObject &rhs)
| Virtual object copying. More...
virtual DcmEVR | ident () const
| get type identifier More...
virtual unsigned long | getVM ()
| get value multiplicity More...
virtual unsigned long | getNumberOfValues ()
| get number of values (elements) stored in this item. More...
virtual unsigned long | card () const
| get cardinality of this item More...
virtual OFBool | isLeaf () const
| check if this element is a leaf node in a dataset tree. More...
virtual OFBool | isNested () const
| check if this item is nested in a sequence of items, i.e. not a top-level or stand-alone item/dataset 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)
| print all elements of the item to a stream 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 xfer=EXS_LittleEndianImplicit, const E_EncodingType enctype=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 void | transferInit ()
| initialize the transfer state of this object. More...
virtual void | transferEnd ()
| finalize the transfer state of this object. More...
virtual DcmItem * | getParentItem ()
| get parent item of this object, i.e. the item/dataset in which the surrounding sequence element is stored. 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 information of all attributes which are captured in the input stream and captures this information in elementList. More...
virtual OFCondition | readUntilTag (DcmInputStream &inStream, const E_TransferSyntax ixfer, const E_GrpLenEncoding glenc=EGL_noChange, const Uint32 maxReadLength=DCM_MaxReadLength, const DcmTagKey &stopParsingAtElement=DCM_UndefinedTagKey)
| This function reads the information of all attributes which are captured in the input stream and captures this information in elementList, up to the attribute tag stopParsingAtElement. More...
virtual OFCondition | write (DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)
| write object to a stream 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 | writeJsonExt (STD_NAMESPACE ostream &out, DcmJsonFormat &format, OFBool printBraces, OFBool printNewline)
| write object in JSON format and control whether the output is encapsulated in braces 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 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 at any nesting level. More...
virtual OFBool | isAffectedBySpecificCharacterSet () const
| check if this object is affected by SpecificCharacterSet at any nesting level. More...
virtual OFBool | checkForSpecificCharacterSet () const
| mode specifying whether the SpecificCharacterSet (0008,0005) element should be checked by convertCharacterSet() or not, i.e. whether this element might be present on this dataset-level. More...
virtual OFCondition | convertCharacterSet (const OFString &fromCharset, const OFString &toCharset, const size_t flags=0, const OFBool updateCharset=OFFalse)
| convert all element values that are contained in this item and that are affected by SpecificCharacterSet from the given source character set to the given destination character set. More...
virtual OFCondition | convertCharacterSet (const OFString &toCharset, const size_t flags=0, const OFBool ignoreCharset=OFFalse)
| convert all element values that are contained in this item and that are affected by SpecificCharacterSet to the given destination character set. More...
virtual OFCondition | convertCharacterSet (DcmSpecificCharacterSet &converter)
| convert all element values that are contained in this item and that are affected by SpecificCharacterSet from the currently selected source character set to the currently selected destination character set. More...
virtual OFCondition | convertToUTF8 ()
| convert all element values that are contained in this item and that are affected by SpecificCharacterSet to UTF-8 (Unicode). More...
virtual void | updateSpecificCharacterSet (OFCondition &status, const DcmSpecificCharacterSet &converter)
| update the SpecificCharacterSet (0008,0005) element depending on the given parameters. More...
virtual OFCondition | insert (DcmElement *elem, OFBool replaceOld=OFFalse, OFBool checkInsertOrder=OFFalse)
| insert a new element into the list of elements maintained by this item. More...
virtual DcmElement * | getElement (const unsigned long num)
| access an element from the item. 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 DcmObject * | nextInContainer (const DcmObject *obj)
| this method is only used in container classes, that is, DcmItem and DcmSequenceOfItems. More...
virtual DcmElement * | remove (const unsigned long num)
| remove element from list. More...
virtual DcmElement * | remove (DcmObject *elem)
| remove element from list. More...
virtual DcmElement * | remove (const DcmTagKey &tag)
| remove element from list. More...
virtual OFBool | isEmpty (const OFBool normalize=OFTrue)
| check if this item is empty More...
virtual OFCondition | clear ()
| clear (remove) all attributes from item and delete them from memory. More...
virtual OFCondition | verify (const OFBool autocorrect=OFFalse)
| check the currently stored element value 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...
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 void | compactElements (const Uint32 maxLength)
| iterate over all elements and remove those element values from memory which exceed a given length and which can be loaded from file when needed again. More...
virtual OFCondition | computeGroupLengthAndPadding (const E_GrpLenEncoding glenc, const E_PaddingEncoding padenc=EPD_noChange, const E_TransferSyntax xfer=EXS_Unknown, const E_EncodingType enctype=EET_ExplicitLength, const Uint32 padlen=0, const Uint32 subPadlen=0, Uint32 instanceLength=0)
| This function takes care of group length and padding elements in the current element list according to what is specified in glenc and padenc. More...
OFBool | tagExists (const DcmTagKey &key, OFBool searchIntoSub=OFFalse)
| check if an element with the given attribute tag exists in the dataset More...
OFBool | tagExistsWithValue (const DcmTagKey &key, OFBool searchIntoSub=OFFalse)
| check if an element with the given attribute tag exists in the dataset and has a non-empty value More...
OFCondition | findAndGetElement (const DcmTagKey &tagKey, DcmElement *&element, const OFBool searchIntoSub=OFFalse, const OFBool createCopy=OFFalse)
| find element and get a pointer to it (or copy it). More...
OFCondition | findAndGetElements (const DcmTagKey &tagKey, DcmStack &resultStack)
| find all elements matching a particular tag and return references to them on a stack. More...
OFCondition | findAndGetString (const DcmTagKey &tagKey, const char *&value, const OFBool searchIntoSub=OFFalse)
| find element and get value as a reference to a C string. More...
OFCondition | findAndGetString (const DcmTagKey &tagKey, const char *&value, Uint32 &length, const OFBool searchIntoSub=OFFalse)
| find element and get value as a reference to a C string. More...
OFCondition | findAndGetOFString (const DcmTagKey &tagKey, OFString &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as a C++ string (only one component). More...
OFCondition | findAndGetOFStringArray (const DcmTagKey &tagKey, OFString &value, const OFBool searchIntoSub=OFFalse)
| find element and get value as a C++ string (all components). More...
OFCondition | findAndGetUint8 (const DcmTagKey &tagKey, Uint8 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as an unsigned 8-bit integer. More...
OFCondition | findAndGetUint8Array (const DcmTagKey &tagKey, const Uint8 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
| find element and get value as an array of unsigned 8-bit integers. More...
OFCondition | findAndGetUint16 (const DcmTagKey &tagKey, Uint16 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as an unsigned 16-bit integer. More...
OFCondition | findAndGetUint16Array (const DcmTagKey &tagKey, const Uint16 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
| find element and get value as an array of unsigned 16-bit integers. More...
OFCondition | findAndGetSint16 (const DcmTagKey &tagKey, Sint16 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as a signed 16-bit integer. More...
OFCondition | findAndGetSint16Array (const DcmTagKey &tagKey, const Sint16 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
| find element and get value as an array of signed 16-bit integers. More...
OFCondition | findAndGetUint32 (const DcmTagKey &tagKey, Uint32 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as an unsigned 32-bit integer. More...
OFCondition | findAndGetUint32Array (const DcmTagKey &tagKey, const Uint32 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
| find element and get value as an array of unsigned 32-bit integers. More...
OFCondition | findAndGetSint32 (const DcmTagKey &tagKey, Sint32 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as a signed 32-bit integer. More...
OFCondition | findAndGetSint32Array (const DcmTagKey &tagKey, const Sint32 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
| find element and get value as an array of signed 32-bit integers. More...
OFCondition | findAndGetUint64 (const DcmTagKey &tagKey, Uint64 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as an unsigned 64-bit integer. More...
OFCondition | findAndGetUint64Array (const DcmTagKey &tagKey, const Uint64 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
| find element and get value as an array of unsigned 64-bit integers. More...
OFCondition | findAndGetSint64 (const DcmTagKey &tagKey, Sint64 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as a signed 64-bit integer. More...
OFCondition | findAndGetSint64Array (const DcmTagKey &tagKey, const Sint64 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
| find element and get value as an array of signed 64-bit integers. More...
OFCondition | findAndGetLongInt (const DcmTagKey &tagKey, long int &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as a (signed) long integer. More...
OFCondition | findAndGetFloat32 (const DcmTagKey &tagKey, Float32 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as a 32-bit floating point. More...
OFCondition | findAndGetFloat32Array (const DcmTagKey &tagKey, const Float32 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
| find element and get value as an array of 32-bit floating point values. More...
OFCondition | findAndGetFloat64 (const DcmTagKey &tagKey, Float64 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
| find element and get value as a 64-bit floating point. More...
OFCondition | findAndGetFloat64Array (const DcmTagKey &tagKey, const Float64 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
| find element and get value as an array of 64-bit floating point values. More...
OFCondition | findAndGetSequence (const DcmTagKey &seqTagKey, DcmSequenceOfItems *&sequence, const OFBool searchIntoSub=OFFalse, const OFBool createCopy=OFFalse)
| looks up and returns a given sequence. More...
OFCondition | findAndGetSequenceItem (const DcmTagKey &seqTagKey, DcmItem *&item, const signed long itemNum=0, const OFBool createCopy=OFFalse)
| looks up and returns a given sequence item, if it exists. More...
OFCondition | findOrCreateSequenceItem (const DcmTag &seqTag, DcmItem *&item, const signed long itemNum=0)
| looks up the given sequence in the current dataset and returns the given item. More...
OFCondition | findAndInsertCopyOfElement (const DcmTagKey &tagKey, DcmItem *destItem, const OFBool replaceOld=OFTrue)
| find element, create a copy and insert it into the given destination dataset. More...
OFCondition | findAndDeleteElement (const DcmTagKey &tagKey, const OFBool allOccurrences=OFFalse, const OFBool searchIntoSub=OFFalse)
| find element, remove it from the dataset and free the associated memory. More...
OFCondition | findAndDeleteSequenceItem (const DcmTagKey &seqTagKey, const signed long itemNum)
| looks up the given sequence in the current dataset and deletes the given item. More...
OFCondition | putAndInsertString (const DcmTag &tag, const char *value, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertString (const DcmTag &tag, const char *value, const Uint32 length, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertOFStringArray (const DcmTag &tag, const OFString &value, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertUint8Array (const DcmTag &tag, const Uint8 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertUint16 (const DcmTag &tag, const Uint16 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertUint16Array (const DcmTag &tag, const Uint16 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertSint16 (const DcmTag &tag, const Sint16 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertSint16Array (const DcmTag &tag, const Sint16 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertUint32 (const DcmTag &tag, const Uint32 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertUint32Array (const DcmTag &tag, const Uint32 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertSint32 (const DcmTag &tag, const Sint32 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertSint32Array (const DcmTag &tag, const Sint32 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertUint64 (const DcmTag &tag, const Uint64 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertUint64Array (const DcmTag &tag, const Uint64 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertSint64 (const DcmTag &tag, const Sint64 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertSint64Array (const DcmTag &tag, const Sint64 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertFloat32 (const DcmTag &tag, const Float32 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertFloat32Array (const DcmTag &tag, const Float32 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertFloat64 (const DcmTag &tag, const Float64 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertFloat64Array (const DcmTag &tag, const Float64 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | putAndInsertTagKey (const DcmTag &tag, const DcmTagKey &value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
| create a new element, put specified value to it and insert the element into the dataset/item. More...
OFCondition | insertEmptyElement (const DcmTag &tag, const OFBool replaceOld=OFTrue)
| create a new element (with no value) and insert it into the dataset/item. More...
OFCondition | insertSequenceItem (const DcmTag &seqTag, DcmItem *item, const signed long itemNum=-2)
| looks up the given sequence in the current dataset and inserts the given item. 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
DcmObject & | operator= (const DcmObject &obj)
| copy assignment operator 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 | isElement () const
| check if this element can be safely casted to DcmElement More...
E_TransferState | transferState () const
| return the current transfer (read/write) state of this object. More...
DcmItem * | getRootItem ()
| get root dataset/item (top-level) that contains this object. More...
DcmObject * | getParent ()
| get parent of this object. More...
const DcmObject * | getParent () 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 DcmTag & | getTag () 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 vr)
| assign a new Value Representation (VR) to this object. More...
virtual OFBool | isSignable () const
| returns true if the current object may be included in a digital signature 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 DcmElement * | newDicomElement (const DcmTagKey &tag, const char *privateCreator=NULL)
| creates new DICOM element from given attribute tag. More...
static OFCondition | newDicomElement (DcmElement *&newElement, const DcmTagKey &tag, const char *privateCreator=NULL)
| creates new DICOM element from given attribute tag. More...
static OFCondition | newDicomElementWithVR (DcmElement *&newElement, const DcmTag &tag)
| creates new DICOM element from given attribute tag and VR. More...

## Protected Member Functions
OFCondition | readTagAndLength (DcmInputStream &inStream, const E_TransferSyntax xfer, DcmTag &tag, Uint32 &length, Uint32 &bytesRead)
| This function reads tag and length information from inStream and returns this information to the caller. More...
OFCondition | readSubElement (DcmInputStream &inStream, DcmTag &newTag, const Uint32 newLength, const E_TransferSyntax xfer, const E_GrpLenEncoding glenc, const Uint32 maxReadLength=DCM_MaxReadLength)
| This function creates a new DcmElement object on the basis of the newTag and newLength information which was passed, inserts this new element into elementList, reads the actual data value which belongs to this element (attribute) from the inStream and also assigns this information to the object which was created at the beginning. More...
E_TransferSyntax | checkTransferSyntax (DcmInputStream &inStream)
| This function reads the first 6 bytes from the input stream and determines the transfer syntax which was used to code the information in the stream. More...
OFBool | checkAndUpdateVR (DcmItem &item, DcmTag &tag)
| check whether the given tag requires some special handling regarding the VR (i.e. in case it is undefined and multiple values are possible). 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...

## Static Protected Member Functions
static OFCondition | newDicomElement (DcmElement *&newElement, DcmTag &tag, const Uint32 length, DcmPrivateTagCache *privateCreatorCache, OFBool &readAsUN)
| creates new DICOM element from given attribute tag. More...
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
DcmList * | elementList
| the list of elements maintained by this object
OFBool | lastElementComplete
| flag used during suspended I/O. More...
offile_off_t | fStartPosition
| used during reading. More...
Protected Attributes inherited from DcmObject
OFCondition | errorFlag
| error flag for this object.

## Private Member Functions
OFCondition | searchSubFromHere (const DcmTagKey &tag, DcmStack &resultStack, OFBool searchIntoSub)
| helper function for search(). More...

## Static Private Member Functions
static OFBool | foundVR (const Uint8 *atposition)
| helper function that interprets the given pointer as a pointer to an array of two characters and checks whether these two characters form a valid standard DICOM VR. More...

## Private Attributes
DcmPrivateTagCache | privateCreatorCache
| cache for private creator tags and identifiers

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

## Detailed Description

a class representing a list of DICOM elements in which each element has a different tag and elements are maintained in increasing order of tags.

In particular, a sequence item.

## Constructor & Destructor Documentation

## ◆ DcmItem() [1/2]

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

constructor.

Create new item from given tag and length.

Parameters

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

## ◆ DcmItem() [2/2]

DcmItem::DcmItem | ( | const DcmItem & | old | ) |

copy constructor

Parameters

  old | item to be copied

## Member Function Documentation

## ◆ calcElementLength()

virtual Uint32 DcmItem::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.
  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

Implements DcmObject.

Reimplemented in DcmMetaInfo, and DcmDataset.

## ◆ canWriteXfer()

virtual OFBool DcmItem::canWriteXfer | ( | const E_TransferSyntax | newXfer,
|  | const E_TransferSyntax | oldXfer
| ) |  |
| 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.

Implements DcmObject.

Reimplemented in DcmDataset.

## ◆ card()

virtual unsigned long DcmItem::card | ( |  | ) | const
| virtual

get cardinality of this item

Returns
  number of elements in this item

## ◆ checkAndUpdateVR()

OFBool DcmItem::checkAndUpdateVR | ( | DcmItem & | item,
|  | DcmTag & | tag
| ) |  |
| protected

check whether the given tag requires some special handling regarding the VR (i.e. in case it is undefined and multiple values are possible).

If required, the VR of the given element tag is then updated according to the DICOM standard, e.g. the VR of PixelPaddingValue (if undefined) is set to 'SS' or 'US' depending on the value of PixelRepresentation.

Parameters

  item | dataset or item that can be used to lookup other element values
  tag | tag of the element to be checked and updated (if required)

Returns
  OFTrue if the VR has changed, OFFalse otherwise

## ◆ checkForSpecificCharacterSet()

virtual OFBool DcmItem::checkForSpecificCharacterSet | ( |  | ) | const
| inline virtual

mode specifying whether the SpecificCharacterSet (0008,0005) element should be checked by convertCharacterSet() or not, i.e. whether this element might be present on this dataset-level.

This method is reimplemented in derived classes.

Returns
  always returns OFFalse, i.e. SpecificCharacterSet should not be checked

Reimplemented in DcmDirectoryRecord, and DcmDataset.

## ◆ checkTransferSyntax()

E_TransferSyntax DcmItem::checkTransferSyntax | ( | DcmInputStream & | inStream | ) |
| protected

This function reads the first 6 bytes from the input stream and determines the transfer syntax which was used to code the information in the stream.

The decision is based on two questions: a) Did we encounter a valid tag? and b) Do the last 2 bytes which were read from the stream represent a valid VR? In certain special cases, where the transfer syntax cannot be determined without doubt, we want to guess the most likely transfer syntax (see code).

Parameters

  inStream | The stream which contains the coded information.

Returns
  The transfer syntax which was determined.

## ◆ clear()

virtual OFCondition DcmItem::clear | ( |  | ) |
| virtual

clear (remove) all attributes from item and delete them from memory.

Returns
  EC_Normal if successful, an error code otherwise

Implements DcmObject.

Reimplemented in DcmDataset.

## ◆ clone()

virtual DcmObject* DcmItem::clone | ( |  | ) | const
| inline virtual

clone method

Returns
  deep copy of this object

Implements DcmObject.

Reimplemented in DcmMetaInfo, DcmDirectoryRecord, and DcmDataset.

## ◆ compactElements()

virtual void DcmItem::compactElements | ( | const Uint32 | maxLength | ) |
| virtual

iterate over all elements and remove those element values from memory which exceed a given length and which can be loaded from file when needed again.

For all other elements, nothing is done.

Parameters

  maxLength | maximum length (number of bytes) allowed without removing the value

## ◆ compare()

virtual int DcmItem::compare | ( | const DcmItem & | rhs | ) | const
| virtual

comparison operator that compares the value of this object with a given object of the same type.

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) and the comparison of all value components of the object, preferably in the order declared in the object (if applicable). For item values that means that all elements within the items are compared to each other in ascending tag order. This may be an expensive operation.

Parameters

  rhs | the 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.

## ◆ computeGroupLengthAndPadding()

virtual OFCondition DcmItem::computeGroupLengthAndPadding | ( | const E_GrpLenEncoding | glenc,
|  | const E_PaddingEncoding | padenc = `EPD_noChange`,
|  | const E_TransferSyntax | xfer = `EXS_Unknown`,
|  | const E_EncodingType | enctype = `EET_ExplicitLength`,
|  | const Uint32 | padlen = `0`,
|  | const Uint32 | subPadlen = `0`,
|  | Uint32 | instanceLength = `0`
| ) |  |
| virtual

This function takes care of group length and padding elements in the current element list according to what is specified in glenc and padenc.

If required, this function does the following two things: a) it calculates the group length of all groups which are contained in this item and sets the calculated values in the corresponding group length elements and b) it inserts a corresponding padding element (or, in case of sequences: padding elements) with a corresponding correct size into the element list.

Parameters

  glenc | Encoding type for group length; specifies what shall be done with group length tags.
  padenc | Encoding type for padding; specifies what shall be done with padding tags.
  xfer | The transfer syntax that shall be used.
  enctype | Encoding type for sequences; specifies how sequences will be handled.
  padlen | The length up to which the dataset shall be padded, if padding is desired.
  subPadlen | For sequences (i.e. sub elements), the length up to which item shall be padded, if padding is desired.
  instanceLength | Number of extra bytes added to the item/dataset length used when computing the padding; this parameter is for instance used to pass the length of the file meta header from the DcmFileFormat to the DcmDataset object.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ containsExtendedCharacters()

virtual OFBool DcmItem::containsExtendedCharacters | ( | const OFBool | checkAllStrings = `OFFalse` | ) |
| virtual

check if this object contains non-ASCII characters at any nesting level.

Please note that this check is pretty simple and only works for single-byte character sets that do include the 7-bit ASCII codes, e.g. for the ISO 8859 family. In other words: All character codes below 128 are considered to be ASCII codes and all others are considered to be non-ASCII.

Parameters

  checkAllStrings | if true, also check elements with string values not affected by SpecificCharacterSet (0008,0005). By default, only check PN, LO, LT, SH, ST, UC and UT.

Returns
  true if object contains non-ASCII characters, false otherwise

Reimplemented from DcmObject.

## ◆ containsUnknownVR()

virtual OFBool DcmItem::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 from DcmObject.

## ◆ convertCharacterSet() [1/3]

virtual OFCondition DcmItem::convertCharacterSet | ( | const OFString & | fromCharset,
|  | const OFString & | toCharset,
|  | const size_t | flags = `0`,
|  | const OFBool | updateCharset = `OFFalse`
| ) |  |
| virtual

convert all element values that are contained in this item and that are affected by SpecificCharacterSet from the given source character set to the given destination character set.

The defined terms for a particular character set can be found in the DICOM standard, e.g. "ISO_IR 100" for ISO 8859-1 (Latin 1) or "ISO_IR 192" for Unicode in UTF-8. An empty string denotes the default character repertoire, which is ASCII (7-bit). If multiple values are given for 'fromCharset' (separated by a backslash) code extension techniques are used and escape sequences may be encountered in the source string to switch between the specified character sets.

Note
  The conversion code does not perform a thorough validation of the strings to be converted. For example, characters that are permitted in the source character set but forbidden in DICOM (such as byte positions 0x80-0x9F in ISO_IR 100) may be converted without warning or error.

Parameters

  fromCharset | name of the source character set(s) used for the conversion
  toCharset | name of the destination character set used for the conversion. Only a single value is permitted (i.e. no code extensions).
  flags | optional flag used to customize the conversion (see DCMTypes::CF_xxx)
  updateCharset | if OFTrue, the SpecificCharacterSet (0008,0005) element is updated, i.e. the current value is either replaced or a new element is inserted or the existing element is deleted. If OFFalse the SpecificCharacterSet element remains unchanged.

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented in DcmDirectoryRecord.

## ◆ convertCharacterSet() [2/3]

virtual OFCondition DcmItem::convertCharacterSet | ( | const OFString & | toCharset,
|  | const size_t | flags = `0`,
|  | const OFBool | ignoreCharset = `OFFalse`
| ) |  |
| virtual

convert all element values that are contained in this item and that are affected by SpecificCharacterSet to the given destination character set.

If not disabled, the source character set is determined automatically from the value of the SpecificCharacterSet (0008,0005) element. The defined terms for the destination character set can be found in the DICOM standard, e.g. "ISO_IR 100" for ISO 8859-1 (Latin 1) or "ISO_IR 192" for Unicode in UTF-8. An empty string denotes the default character repertoire, which is ASCII (7-bit).

Note
  The conversion code does not perform a thorough validation of the strings to be converted. For example, characters that are permitted in the source character set but forbidden in DICOM (such as byte positions 0x80-0x9F in ISO_IR 100) may be converted without warning or error.

Parameters

  toCharset | name of the destination character set used for the conversion. Only a single value is permitted (i.e. no code extensions).
  flags | optional flag used to customize the conversion (see DCMTypes::CF_xxx)
  ignoreCharset | if OFTrue, the value of SpecificCharacterSet is ignored, otherwise the element value is updated. Also see checkForSpecificCharacterSet().

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented in DcmDirectoryRecord.

## ◆ convertCharacterSet() [3/3]

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

convert all element values that are contained in this item and that are affected by SpecificCharacterSet from the currently selected source character set to the currently selected destination character set.

Note
  The conversion code does not perform a thorough validation of the strings to be converted. For example, characters that are permitted in the source character set but forbidden in DICOM (such as byte positions 0x80-0x9F in ISO_IR 100) may be converted without warning or error.

Parameters

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

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmObject.

Reimplemented in DcmDirectoryRecord.

## ◆ convertToUTF8()

virtual OFCondition DcmItem::convertToUTF8 | ( |  | ) |
| virtual

convert all element values that are contained in this item and that are affected by SpecificCharacterSet to UTF-8 (Unicode).

The value of the SpecificCharacterSet (0008,0005) element is updated, set or deleted automatically if needed. The transliteration mode is disabled, i.e. the conversion flags are explicitly set to 0 - see convertCharacterSet().

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ copyFrom()

virtual OFCondition DcmItem::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 DcmMetaInfo, DcmDirectoryRecord, and DcmDataset.

## ◆ findAndDeleteElement()

OFCondition DcmItem::findAndDeleteElement | ( | const DcmTagKey & | tagKey,
|  | const OFBool | allOccurrences = `OFFalse`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element, remove it from the dataset and free the associated memory.

Note
  Applicable to all DICOM value representations (VR).

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  allOccurrences | flag indicating whether to delete all occurrences of the attribute tag or the first one only (implies 'searchIntoSub' to be true)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

Referenced by DcmIODUtil::writeSingleItem(), and DcmIODUtil::writeSubSequence().

## ◆ findAndDeleteSequenceItem()

OFCondition DcmItem::findAndDeleteSequenceItem | ( | const DcmTagKey & | seqTagKey,
|  | const signed long | itemNum
| ) |  |

looks up the given sequence in the current dataset and deletes the given item.

Note
  Applicable to the following VRs: SQ, (pixelSQ).

Parameters

  seqTagKey | DICOM tag specifying the sequence attribute to be searched for
  itemNum | number of the item to be deleted (0..n-1, -1 for last)

Returns
  EC_Normal upon success, an error otherwise.

Referenced by DcmIODUtil::writeSubSequence().

## ◆ findAndGetElement()

OFCondition DcmItem::findAndGetElement | ( | const DcmTagKey & | tagKey,
|  | DcmElement *& | element,
|  | const OFBool | searchIntoSub = `OFFalse`,
|  | const OFBool | createCopy = `OFFalse`
| ) |  |

find element and get a pointer to it (or copy it).

The result variable 'element' is automatically set to NULL if an error occurs.

Note
  Applicable to all DICOM value representations (VR).

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  element | variable in which the reference to (or copy of) the element is stored
  searchIntoSub | flag indicating whether to search into sequences or not
  createCopy | create a copy of the element if true, return a reference otherwise

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetElements()

OFCondition DcmItem::findAndGetElements | ( | const DcmTagKey & | tagKey,
|  | DcmStack & | resultStack
| ) |  |

find all elements matching a particular tag and return references to them on a stack.

This functions always performs a deep search (i.e. searches into sequence of items).

Note
  Applicable to all DICOM value representations (VR).

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  resultStack | stack where references to the elements are stored (added to). If no element is found, the stack is not modified (e.g. cleared).

Returns
  EC_Normal if at least one matching tag is found, an error code otherwise.

## ◆ findAndGetFloat32()

OFCondition DcmItem::findAndGetFloat32 | ( | const DcmTagKey & | tagKey,
|  | Float32 & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as a 32-bit floating point.

The result variable 'value' is automatically set to zero if an error occurs.

Note
  Applicable to the following VRs: FL, OF.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetFloat32Array()

OFCondition DcmItem::findAndGetFloat32Array | ( | const DcmTagKey & | tagKey,
|  | const Float32 *& | value,
|  | unsigned long * | count = `NULL`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an array of 32-bit floating point values.

The result variable 'value' is automatically set to NULL if an error occurs.

Note
  Applicable to the following VRs: FL, OF.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored
  count | stores number of items in the result array (if not NULL)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetFloat64()

OFCondition DcmItem::findAndGetFloat64 | ( | const DcmTagKey & | tagKey,
|  | Float64 & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as a 64-bit floating point.

The result variable 'value' is automatically set to zero if an error occurs.

Note
  Applicable to the following VRs: DS, FD, OD.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetFloat64Array()

OFCondition DcmItem::findAndGetFloat64Array | ( | const DcmTagKey & | tagKey,
|  | const Float64 *& | value,
|  | unsigned long * | count = `NULL`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an array of 64-bit floating point values.

The result variable 'value' is automatically set to NULL if an error occurs.

Note
  Applicable to the following VRs: FD, OD.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored
  count | stores number of items in the result array (if not NULL)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetLongInt()

OFCondition DcmItem::findAndGetLongInt | ( | const DcmTagKey & | tagKey,
|  | long int & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as a (signed) long integer.

The result variable 'value' is automatically set to zero if an error occurs.

Note
  Applicable to the following VRs: IS, OL, SL, SS, UL, US.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetOFString()

OFCondition DcmItem::findAndGetOFString | ( | const DcmTagKey & | tagKey,
|  | OFString & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as a C++ string (only one component).

Since the getOFString() routine is called internally the resulting string is normalized, i.e. leading and/or trailing spaces are removed according to the associated value representation, or the element value is converted to a character string (for non-string VRs) - see documentation in the corresponding header file. In contrast to the above and below function only the specified component (see parameter 'pos') is returned. The result variable 'value' is automatically set to an empty string if an error occurs.

Note
  Applicable to the following VRs: AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OD, OF, OL, OV, OW, PN, SH, SL, SS, ST, SV, TM, UC, UI, UL, UR, US, UT, UV.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetOFStringArray()

OFCondition DcmItem::findAndGetOFStringArray | ( | const DcmTagKey & | tagKey,
|  | OFString & | value,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as a C++ string (all components).

Since the getOFStringArray() routine is called internally the resulting string is normalized, i.e. leading and/or trailing spaces are removed according to the associated value representation or the element values are converted to character strings (for non-string VRs) - see documentation in the corresponding header file. The result variable 'value' is automatically set to an empty string if an error occurs.

Note
  Applicable to the following VRs: AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OD, OF, OL, OV, OW, PN, SH, SL, SS, ST, SV, TM, UC, UI, UL, UR, US, UT, UV.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetSequence()

OFCondition DcmItem::findAndGetSequence | ( | const DcmTagKey & | seqTagKey,
|  | DcmSequenceOfItems *& | sequence,
|  | const OFBool | searchIntoSub = `OFFalse`,
|  | const OFBool | createCopy = `OFFalse`
| ) |  |

looks up and returns a given sequence.

The result variable 'sequence' is automatically set to NULL if an error occurs (e.g. if 'seqTagKey' does not refer to a sequence attribute).

Note
  Applicable to the following VRs: SQ, (pixelSQ).

Parameters

  seqTagKey | DICOM tag specifying the sequence attribute to be searched for
  sequence | variable in which the reference to (or copy of) the sequence is stored
  searchIntoSub | flag indicating whether to search into sub-sequences or not
  createCopy | create a copy of the sequence if true, return a reference otherwise

Returns
  EC_Normal upon success, an error otherwise.

Referenced by DcmIODUtil::readSubSequence().

## ◆ findAndGetSequenceItem()

OFCondition DcmItem::findAndGetSequenceItem | ( | const DcmTagKey & | seqTagKey,
|  | DcmItem *& | item,
|  | const signed long | itemNum = `0`,
|  | const OFBool | createCopy = `OFFalse`
| ) |  |

looks up and returns a given sequence item, if it exists.

Otherwise sets 'item' to NULL and returns EC_TagNotFound (specified sequence does not exist) or EC_IllegalParameter (specified item does not exist). Only the top-most level of the dataset/item is examined (i.e. no deep-search is performed). Please note that an instance of the DcmPixelItem class cannot be retrieved.

Note
  Applicable to the following VRs: SQ, (pixelSQ).

Parameters

  seqTagKey | DICOM tag specifying the sequence attribute to be searched for
  item | variable in which the reference to (or copy of) the item is stored
  itemNum | number of the item to be searched for (0..n-1, -1 for last)
  createCopy | create a copy of the item if true, return a reference otherwise

Returns
  EC_Normal upon success, an error otherwise.

Referenced by DcmIODUtil::readSingleItem().

## ◆ findAndGetSint16()

OFCondition DcmItem::findAndGetSint16 | ( | const DcmTagKey & | tagKey,
|  | Sint16 & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as a signed 16-bit integer.

The result variable 'value' is automatically set to zero if an error occurs.

Note
  Applicable to the following VRs: SS.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetSint16Array()

OFCondition DcmItem::findAndGetSint16Array | ( | const DcmTagKey & | tagKey,
|  | const Sint16 *& | value,
|  | unsigned long * | count = `NULL`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an array of signed 16-bit integers.

The result variable 'value' is automatically set to NULL if an error occurs.

Note
  Applicable to the following VRs: SS.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored
  count | stores number of items in the result array (if not NULL)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetSint32()

OFCondition DcmItem::findAndGetSint32 | ( | const DcmTagKey & | tagKey,
|  | Sint32 & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as a signed 32-bit integer.

The result variable 'value' is automatically set to zero if an error occurs.

Note
  Applicable to the following VRs: IS, SL.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetSint32Array()

OFCondition DcmItem::findAndGetSint32Array | ( | const DcmTagKey & | tagKey,
|  | const Sint32 *& | value,
|  | unsigned long * | count = `NULL`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an array of signed 32-bit integers.

The result variable 'value' is automatically set to NULL if an error occurs.

Note
  Applicable to the following VRs: SL.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored
  count | stores number of items in the result array (if not NULL)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetSint64()

OFCondition DcmItem::findAndGetSint64 | ( | const DcmTagKey & | tagKey,
|  | Sint64 & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as a signed 64-bit integer.

The result variable 'value' is automatically set to zero if an error occurs.

Note
  Applicable to the following VRs: SV.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetSint64Array()

OFCondition DcmItem::findAndGetSint64Array | ( | const DcmTagKey & | tagKey,
|  | const Sint64 *& | value,
|  | unsigned long * | count = `NULL`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an array of signed 64-bit integers.

The result variable 'value' is automatically set to NULL if an error occurs.

Note
  Applicable to the following VRs: SV.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored
  count | stores number of items in the result array (if not NULL)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetString() [1/2]

OFCondition DcmItem::findAndGetString | ( | const DcmTagKey & | tagKey,
|  | const char *& | value,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as a reference to a C string.

NB: The string is not copied! Since the getString() routine is called internally the resulting string reference represents the (possibly multi-valued) value as stored in the dataset, i.e. no normalization is performed. The result variable 'value' is automatically set to NULL if an error occurs.

Note
  Applicable to the following VRs: AE, AS, CS, DA, DS, DT, IS, LO, LT, PN, SH, ST, TM, UC, UI, UR, UT.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored (might be NULL)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetString() [2/2]

OFCondition DcmItem::findAndGetString | ( | const DcmTagKey & | tagKey,
|  | const char *& | value,
|  | Uint32 & | length,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as a reference to a C string.

NB: The string is not copied! Since the getString() routine is called internally the resulting string reference represents the (possibly multi-valued) value as stored in the dataset, i.e. no normalization is performed. The result variable 'value' is automatically set to NULL and 'length' is set to 0 if an error occurs. Please note that since the length is returned separately, the string value can contain more than one NULL byte.

Note
  Applicable to the following VRs: AE, AS, CS, DA, DS, DT, IS, LO, LT, PN, SH, ST, TM, UC, UI, UR, UT.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored (might be NULL)
  length | length of the string (number of characters without the trailing NULL byte)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetUint16()

OFCondition DcmItem::findAndGetUint16 | ( | const DcmTagKey & | tagKey,
|  | Uint16 & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an unsigned 16-bit integer.

The result variable 'value' is automatically set to zero if an error occurs.

Note
  Applicable to the following VRs: OW, US.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetUint16Array()

OFCondition DcmItem::findAndGetUint16Array | ( | const DcmTagKey & | tagKey,
|  | const Uint16 *& | value,
|  | unsigned long * | count = `NULL`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an array of unsigned 16-bit integers.

The result variable 'value' is automatically set to NULL if an error occurs.

Note
  Applicable to the following VRs: AT, OW, US.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored
  count | stores number of items in the result array (if not NULL)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetUint32()

OFCondition DcmItem::findAndGetUint32 | ( | const DcmTagKey & | tagKey,
|  | Uint32 & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an unsigned 32-bit integer.

The result variable 'value' is automatically set to zero if an error occurs.

Note
  Applicable to the following VRs: OL, UL.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetUint32Array()

OFCondition DcmItem::findAndGetUint32Array | ( | const DcmTagKey & | tagKey,
|  | const Uint32 *& | value,
|  | unsigned long * | count = `NULL`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an array of unsigned 32-bit integers.

The result variable 'value' is automatically set to NULL if an error occurs.

Note
  Applicable to the following VRs: OL, UL.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored
  count | stores number of items in the result array (if not NULL)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetUint64()

OFCondition DcmItem::findAndGetUint64 | ( | const DcmTagKey & | tagKey,
|  | Uint64 & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an unsigned 64-bit integer.

The result variable 'value' is automatically set to zero if an error occurs.

Note
  Applicable to the following VRs: OV, UV.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetUint64Array()

OFCondition DcmItem::findAndGetUint64Array | ( | const DcmTagKey & | tagKey,
|  | const Uint64 *& | value,
|  | unsigned long * | count = `NULL`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an array of unsigned 64-bit integers.

The result variable 'value' is automatically set to NULL if an error occurs.

Note
  Applicable to the following VRs: OV, UV.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored
  count | stores number of items in the result array (if not NULL)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetUint8()

OFCondition DcmItem::findAndGetUint8 | ( | const DcmTagKey & | tagKey,
|  | Uint8 & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an unsigned 8-bit integer.

The result variable 'value' is automatically set to zero if an error occurs.

Note
  Applicable to the following VRs: OB.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the element value is stored
  pos | index of the value in case of multi-valued elements (0..vm-1)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndGetUint8Array()

OFCondition DcmItem::findAndGetUint8Array | ( | const DcmTagKey & | tagKey,
|  | const Uint8 *& | value,
|  | unsigned long * | count = `NULL`,
|  | const OFBool | searchIntoSub = `OFFalse`
| ) |  |

find element and get value as an array of unsigned 8-bit integers.

The result variable 'value' is automatically set to NULL if an error occurs.

Note
  Applicable to the following VRs: OB.

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  value | variable in which the reference to the element value is stored
  count | stores number of items in the result array (if not NULL)
  searchIntoSub | flag indicating whether to search into sequences or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ findAndInsertCopyOfElement()

OFCondition DcmItem::findAndInsertCopyOfElement | ( | const DcmTagKey & | tagKey,
|  | DcmItem * | destItem,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

find element, create a copy and insert it into the given destination dataset.

This functions never performs a deep search (i.e. does not search into sequence of items). Empty elements are also copied. However, if the given tag is not found in the current dataset, EC_TagNotFound is returned and the destination dataset remains unchanged.

Note
  Applicable to all DICOM value representations (VR).

Parameters

  tagKey | DICOM tag specifying the attribute to be searched for
  destItem | destination dataset to which the copied element is inserted
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise

## ◆ findOrCreateSequenceItem()

OFCondition DcmItem::findOrCreateSequenceItem | ( | const DcmTag & | seqTag,
|  | DcmItem *& | item,
|  | const signed long | itemNum = `0`
| ) |  |

looks up the given sequence in the current dataset and returns the given item.

If either the sequence or the item do not exist, they are created. If necessary, multiple empty items are inserted. Only the top-most level of the dataset/item is examined (i.e. no deep-search is performed). Please note that an instance of the DcmPixelItem class cannot be retrieved or created.

Note
  Applicable to the following VRs: SQ, (pixelSQ).

Parameters

  seqTag | DICOM tag specifying the sequence attribute to be searched for (or to be created)
  item | variable in which the reference to the sequence item is stored
  itemNum | number of the item to be searched for (0..n-1, -1 for last, -2 for append new)

Returns
  EC_Normal upon success, an error otherwise.

Referenced by DcmIODUtil::writeSubSequence().

## ◆ foundVR()

static OFBool DcmItem::foundVR | ( | const Uint8 * | atposition | ) |
| static private

helper function that interprets the given pointer as a pointer to an array of two characters and checks whether these two characters form a valid standard DICOM VR.

Parameters

  atposition | pointer to array of (at least) two bytes interpreted as VR

Returns
  true if standard VR, false otherwise

## ◆ getElement()

virtual DcmElement* DcmItem::getElement | ( | const unsigned long | num | ) |
| virtual

access an element from the item.

This method returns a pointer to one of the elements in the item, and not a copy.

Parameters

  num | index number of element, must be < card()

Returns
  pointer to element if found, NULL if num >= card()

## ◆ getLength()

virtual Uint32 DcmItem::getLength | ( | const E_TransferSyntax | xfer = `EXS_LittleEndianImplicit`,
|  | const E_EncodingType | enctype = `EET_UndefinedLength`
| ) |  |
| 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.

If length encoding is set to be explicit and the item content is larger than the available 32-bit length field, then undefined length is returned. If "dcmWriteOversizedSeqsAndItemsUndefined" is disabled, also the internal DcmObject errorFlag is set to EC_SeqOrItemContentOverflow.

Parameters

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

Returns
  value length of DICOM element

Implements DcmObject.

## ◆ getNumberOfValues()

virtual unsigned long DcmItem::getNumberOfValues | ( |  | ) |
| virtual

get number of values (elements) stored in this item.

The result is the same as card() unless overwritten in a derived class.

Returns
  number of elements in this item

Implements DcmObject.

## ◆ getParentItem()

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

get parent item of this object, i.e. the item/dataset in which the surrounding sequence element is stored.

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

Reimplemented from DcmObject.

## ◆ getVM()

virtual unsigned long DcmItem::getVM | ( |  | ) |
| virtual

get value multiplicity

Returns
  always returns 1 (according to the DICOM standard)

Implements DcmObject.

## ◆ ident()

virtual DcmEVR DcmItem::ident | ( |  | ) | const
| virtual

get type identifier

Returns
  type identifier of this class (EVR_item)

Implements DcmObject.

Reimplemented in DcmMetaInfo, DcmDirectoryRecord, and DcmDataset.

## ◆ insert()

virtual OFCondition DcmItem::insert | ( | DcmElement * | elem,
|  | OFBool | replaceOld = `OFFalse`,
|  | OFBool | checkInsertOrder = `OFFalse`
| ) |  |
| virtual

insert a new element into the list of elements maintained by this item.

The list of elements is always kept in ascending tag order.

Parameters

  elem | element to be inserted, must not be contained in this or any other item. Will be deleted upon destruction of this item object.
  replaceOld | if true, this element replaces any other element with the same tag which may already be contained in the item. If false, insert fails if another element with the same tag is already present.
  checkInsertOrder | if true, a warning message is sent to the console if the element is not inserted at the end of the list. This is used in the read() method to detect datasets with out-of-order elements.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ insertEmptyElement()

OFCondition DcmItem::insertEmptyElement | ( | const DcmTag & | tag,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element (with no value) and insert it into the dataset/item.

Note
  Applicable to the following VRs: AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OD, OF, OL, OV, OW, PN, SH, SL, SQ, SS, ST, SV, TM, UC, UI, UL, UR, US, UT, UV.

Parameters

  tag | DICOM tag specifying the attribute to be created
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

Referenced by DcmIODUtil::writeSubSequence().

## ◆ insertSequenceItem()

OFCondition DcmItem::insertSequenceItem | ( | const DcmTag & | seqTag,
|  | DcmItem * | item,
|  | const signed long | itemNum = `-2`
| ) |  |

looks up the given sequence in the current dataset and inserts the given item.

If the sequence does not exist, it is created. If necessary, multiple empty items are inserted before the specified item position. Only the top-most level of the dataset/item is examined (i.e. no deep-search is performed). Please note that an instance of the DcmPixelItem class cannot be inserted.

Note
  Applicable to the following VRs: SQ, (pixelSQ).

Parameters

  seqTag | DICOM tag specifying the sequence attribute to be searched for (or to be created)
  item | item to be inserted into the sequence, must not be contained in this or any other sequence. Will be deleted upon destruction of the sequence object.
  itemNum | position of the item (0..n-1, -1 = before last, -2 = after last)

Returns
  EC_Normal upon success, an error otherwise (delete 'item' manually!).

## ◆ isAffectedBySpecificCharacterSet()

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

check if this object is affected by SpecificCharacterSet at any nesting level.

In detail, it is checked whether this object contains any data elements that according to their VR are affected by the SpecificCharacterSet (0008,0005) element. This is true for the following VRs: PN, LO, LT, SH, ST, UC and UT

Returns
  true if object is affected by SpecificCharacterSet, false otherwise

Reimplemented from DcmObject.

## ◆ isEmpty()

virtual OFBool DcmItem::isEmpty | ( | const OFBool | normalize = `OFTrue` | ) |
| virtual

check if this item is empty

Parameters

  normalize | not used for this class

Returns
  true if item is empty, i.e. has no elements, false otherwise

Reimplemented from DcmObject.

## ◆ isLeaf()

virtual OFBool DcmItem::isLeaf | ( |  | ) | const
| inline 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.

Implements DcmObject.

## ◆ isNested()

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

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

Returns
  true if this item is nested, false otherwise

Reimplemented from DcmObject.

## ◆ loadAllDataIntoMemory()

virtual OFCondition DcmItem::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.

## ◆ newDicomElement() [1/3]

static DcmElement* DcmItem::newDicomElement | ( | const DcmTagKey & | tag,
|  | const char * | privateCreator = `NULL`
| ) |  |
| static

creates new DICOM element from given attribute tag.

Creation of unknown attributes (e.g. private tag not being registered in the dictionary) will result in a DcmElement instance of derived type DcmOtherByteOtherWord.

Parameters

  tag | attribute tag of the element to be created
  privateCreator | private creator identifier of the element, if element tag is private (default: NULL, i.e. non-private DICOM standard tag)

Returns
  pointer to newly created element upon success, NULL pointer otherwise

## ◆ newDicomElement() [2/3]

static OFCondition DcmItem::newDicomElement | ( | DcmElement *& | newElement,
|  | const DcmTagKey & | tag,
|  | const char * | privateCreator = `NULL`
| ) |  |
| static

creates new DICOM element from given attribute tag.

Creation of unknown attributes (e.g. private tag not being registered in the dictionary) will result in a DcmElement instance of derived type DcmOtherByteOtherWord.

Parameters

  newElement | pointer to newly created element returned in this parameter upon success, NULL pointer otherwise
  tag | attribute tag of the element to be created
  privateCreator | private creator identifier of the element, if element tag is private (default: NULL, i.e. non-private DICOM standard tag)

Returns
  EC_Normal upon success, an error code otherwise

## ◆ newDicomElement() [3/3]

static OFCondition DcmItem::newDicomElement | ( | DcmElement *& | newElement,
|  | DcmTag & | tag,
|  | const Uint32 | length,
|  | DcmPrivateTagCache * | privateCreatorCache,
|  | OFBool & | readAsUN
| ) |  |
| static protected

creates new DICOM element from given attribute tag.

Helper function used by DICOM parser (friend of this class) and thus hidden from the public interface. DcmItem's readSubElement() uses this function when reading new elements from input data. This method internally sets the length of the new element, but does not allocate any memory for the element's value. Thus subsequent access to an element created by this method can lead to crashes. DcmItem instead initializes the value itself a bit later during the read process.

Parameters

  newElement | pointer to newly created element returned in this parameter upon success, NULL pointer otherwise
  tag | attribute tag of the element to be created. VR of tag may be updated within the method.
  length | attribute value length of the element to be created
  privateCreatorCache | cache object for private creator elements in the current dataset
  readAsUN | flag indicating whether parser is currently handling UN element that must be read in implicit VR little endian; updated upon return

Returns
  EC_Normal upon success, an error code otherwise

## ◆ newDicomElementWithVR()

static OFCondition DcmItem::newDicomElementWithVR | ( | DcmElement *& | newElement,
|  | const DcmTag & | tag
| ) |  |
| static

creates new DICOM element from given attribute tag and VR.

Creation of unknown attributes (e.g. private tag not being registered in the dictionary) will result in a DcmElement instance of derived type DcmOtherByteOtherWord.

Parameters

  newElement | pointer to newly created element returned in this parameter upon success, NULL pointer otherwise
  tag | attribute tag and VR of the element to be created

Returns
  EC_Normal upon success, an error code otherwise

## ◆ nextInContainer()

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

this method is only used in container classes, 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 from DcmObject.

## ◆ nextObject()

virtual OFCondition DcmItem::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 from DcmObject.

## ◆ operator=()

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

assignment operator.

Private creator cache is not copied as it is also the case for clone().

Parameters

  obj | the item to be copied

Returns
  Reference to this object after assignment

## ◆ print()

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

print all elements of the item 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
  pixelCounter | not used

Implements DcmObject.

Reimplemented in DcmMetaInfo, DcmDirectoryRecord, and DcmDataset.

## ◆ putAndInsertFloat32()

OFCondition DcmItem::putAndInsertFloat32 | ( | const DcmTag & | tag,
|  | const Float32 | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: FL, OF.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  pos | index of the value to be set (0..vm). A value can be appended to the end of or inserted within the existing value field.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertFloat32Array()

OFCondition DcmItem::putAndInsertFloat32Array | ( | const DcmTag & | tag,
|  | const Float32 * | value,
|  | const unsigned long | count,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: FL, OF.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  count | number of values (not bytes!) to be copied from 'value'
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertFloat64()

OFCondition DcmItem::putAndInsertFloat64 | ( | const DcmTag & | tag,
|  | const Float64 | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: DS, FD, OD

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  pos | index of the value to be set (0..vm). A value can be appended to the end of or inserted within the existing value field.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertFloat64Array()

OFCondition DcmItem::putAndInsertFloat64Array | ( | const DcmTag & | tag,
|  | const Float64 * | value,
|  | const unsigned long | count,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: FD, OD.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  count | number of values (not bytes!) to be copied from 'value'
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertOFStringArray()

OFCondition DcmItem::putAndInsertOFStringArray | ( | const DcmTag & | tag,
|  | const OFString & | value,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OD, OF, OL, OV, OW, PN, SH, SL, SS, ST, SV, TM, UC, UI, UL, UR, US, UT, UV.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | string value to be set for the new element (might be empty). The format of the string value is specified by the putOFStringArray() method of the corresponding VR class.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertSint16()

OFCondition DcmItem::putAndInsertSint16 | ( | const DcmTag & | tag,
|  | const Sint16 | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: SS, xs (US or SS).

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  pos | index of the value to be set (0..vm). A value can be appended to the end of or inserted within the existing value field.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertSint16Array()

OFCondition DcmItem::putAndInsertSint16Array | ( | const DcmTag & | tag,
|  | const Sint16 * | value,
|  | const unsigned long | count,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: SS, xs (US or SS).

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  count | number of values (not bytes!) to be copied from 'value'
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertSint32()

OFCondition DcmItem::putAndInsertSint32 | ( | const DcmTag & | tag,
|  | const Sint32 | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: SL.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  pos | index of the value to be set (0..vm). A value can be appended to the end of or inserted within the existing value field.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertSint32Array()

OFCondition DcmItem::putAndInsertSint32Array | ( | const DcmTag & | tag,
|  | const Sint32 * | value,
|  | const unsigned long | count,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: SL.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  count | number of values (not bytes!) to be copied from 'value'
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertSint64()

OFCondition DcmItem::putAndInsertSint64 | ( | const DcmTag & | tag,
|  | const Sint64 | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: SV.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  pos | index of the value to be set (0..vm). A value can be appended to the end of or inserted within the existing value field.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertSint64Array()

OFCondition DcmItem::putAndInsertSint64Array | ( | const DcmTag & | tag,
|  | const Sint64 * | value,
|  | const unsigned long | count,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: SV.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  count | number of values (not bytes!) to be copied from 'value'
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertString() [1/2]

OFCondition DcmItem::putAndInsertString | ( | const DcmTag & | tag,
|  | const char * | value,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OD, OF, OL, OV, OW, PN, SH, SL, SS, ST, SV, TM, UC, UI, UL, UR, US, UT, UV.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | string value to be set for the new element (might be empty or NULL). The format of the string value is specified by the putString() method of the corresponding VR class.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertString() [2/2]

OFCondition DcmItem::putAndInsertString | ( | const DcmTag & | tag,
|  | const char * | value,
|  | const Uint32 | length,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Please note that since the length of the string has to be specified explicitly, the string can contain more than one NULL byte.

Note
  Applicable to the following VRs: AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OD, OF, OL, OV, OW, PN, SH, SL, SS, ST, SV, TM, UC, UI, UL, UR, US, UT, UV.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | string value to be set for the new element (might be empty or NULL). The format of the string value is specified by the putString() method of the corresponding VR class.
  length | length of the string (number of characters without the trailing NULL byte)
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertTagKey()

OFCondition DcmItem::putAndInsertTagKey | ( | const DcmTag & | tag,
|  | const DcmTagKey & | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: AT.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  pos | index of the value to be set (0..vm). A value can be appended to the end of or inserted within the existing value field.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertUint16()

OFCondition DcmItem::putAndInsertUint16 | ( | const DcmTag & | tag,
|  | const Uint16 | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: US, xs (US or SS).

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  pos | index of the value to be set (0..vm). A value can be appended to the end of or inserted within the existing value field.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertUint16Array()

OFCondition DcmItem::putAndInsertUint16Array | ( | const DcmTag & | tag,
|  | const Uint16 * | value,
|  | const unsigned long | count,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: AT, OW, US, ox (polymorph OB/OW), px (pixel data), xs (US or SS).

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element (might be NULL)
  count | number of values (not bytes!) to be copied from 'value'
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertUint32()

OFCondition DcmItem::putAndInsertUint32 | ( | const DcmTag & | tag,
|  | const Uint32 | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: OL, UL.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  pos | index of the value to be set (0..vm). A value can be appended to the end of or inserted within the existing value field.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertUint32Array()

OFCondition DcmItem::putAndInsertUint32Array | ( | const DcmTag & | tag,
|  | const Uint32 * | value,
|  | const unsigned long | count,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: OL, UL.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  count | number of values (not bytes!) to be copied from 'value'
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertUint64()

OFCondition DcmItem::putAndInsertUint64 | ( | const DcmTag & | tag,
|  | const Uint64 | value,
|  | const unsigned long | pos = `0`,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: OV, UV.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  pos | index of the value to be set (0..vm). A value can be appended to the end of or inserted within the existing value field.
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertUint64Array()

OFCondition DcmItem::putAndInsertUint64Array | ( | const DcmTag & | tag,
|  | const Uint64 * | value,
|  | const unsigned long | count,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: OV, UV.

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element
  count | number of values (not bytes!) to be copied from 'value'
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ putAndInsertUint8Array()

OFCondition DcmItem::putAndInsertUint8Array | ( | const DcmTag & | tag,
|  | const Uint8 * | value,
|  | const unsigned long | count,
|  | const OFBool | replaceOld = `OFTrue`
| ) |  |

create a new element, put specified value to it and insert the element into the dataset/item.

Note
  Applicable to the following VRs: OB, ox (polymorph OB/OW), px (pixel data).

Parameters

  tag | DICOM tag specifying the attribute to be created
  value | value to be set for the new element (might be NULL)
  count | number of values (= bytes in this case) to be copied from 'value'
  replaceOld | flag indicating whether to replace an existing element or not

Returns
  EC_Normal upon success, an error code otherwise.

## ◆ read()

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

This function reads the information of all attributes which are captured in the input stream and captures this information in elementList.

Each attribute is represented as an element in this list. If not all information for an attribute could be read from the stream, the function returns EC_StreamNotifyClient.

Parameters

  inStream | The stream which contains the information.
  ixfer | The transfer syntax which was used to encode the information in inStream.
  glenc | Encoding type for group length; specifies what will be done with group length tags.
  maxReadLength | Maximum read length for reading an attribute value.

Returns
  status, EC_Normal if successful, an error code otherwise

Implements DcmObject.

Reimplemented in DcmMetaInfo, DcmDataset, and DcmDirectoryRecord.

## ◆ readSubElement()

OFCondition DcmItem::readSubElement | ( | DcmInputStream & | inStream,
|  | DcmTag & | newTag,
|  | const Uint32 | newLength,
|  | const E_TransferSyntax | xfer,
|  | const E_GrpLenEncoding | glenc,
|  | const Uint32 | maxReadLength = `DCM_MaxReadLength`
| ) |  |
| protected

This function creates a new DcmElement object on the basis of the newTag and newLength information which was passed, inserts this new element into elementList, reads the actual data value which belongs to this element (attribute) from the inStream and also assigns this information to the object which was created at the beginning.

Parameters

  inStream | The stream which contains the information.
  newTag | The tag of the element of which the information is being read.
  newLength | The length of the information which is being read.
  xfer | The transfer syntax which was used to encode the information in inStream.
  glenc | Encoding type for group length. Specifies what will be done with group length tags.
  maxReadLength | Maximum read length for reading the attribute value.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ readTagAndLength()

OFCondition DcmItem::readTagAndLength | ( | DcmInputStream & | inStream,
|  | const E_TransferSyntax | xfer,
|  | DcmTag & | tag,
|  | Uint32 & | length,
|  | Uint32 & | bytesRead
| ) |  |
| protected

This function reads tag and length information from inStream and returns this information to the caller.

When reading information, the transfer syntax which was passed is accounted for. If the transfer syntax shows an explicit value representation, the data type of this object is also read from the stream. In general, this function follows the rules which are specified in the DICOM standard (see DICOM standard (year 2000) part 5, section 7) (or the corresponding section in a later version of the standard) concerning the encoding of a dataset.

Parameters

  inStream | The stream which contains the information.
  xfer | The transfer syntax which was used to encode the information in inStream.
  tag | Contains in the end the tag that was read.
  length | Contains in the end the length value that was read.
  bytesRead | Contains in the end the amount of bytes which were read from inStream.

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ readUntilTag()

virtual OFCondition DcmItem::readUntilTag | ( | DcmInputStream & | inStream,
|  | const E_TransferSyntax | ixfer,
|  | const E_GrpLenEncoding | glenc = `EGL_noChange`,
|  | const Uint32 | maxReadLength = `DCM_MaxReadLength`,
|  | const DcmTagKey & | stopParsingAtElement = `DCM_UndefinedTagKey`
| ) |  |
| virtual

This function reads the information of all attributes which are captured in the input stream and captures this information in elementList, up to the attribute tag stopParsingAtElement.

Each attribute is represented as an element in this list. If not all information for an attribute could be read from the stream, the function returns EC_StreamNotifyClient.

Parameters

  inStream | The stream which contains the information.
  ixfer | The transfer syntax which was used to encode the information in inStream.
  glenc | Encoding type for group length; specifies what will be done with group length tags.
  maxReadLength | Maximum read length for reading an attribute value.
  stopParsingAtElement | parsing of the input stream is stopped when this tag key or any higher tag is encountered.

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented in DcmDataset.

## ◆ remove() [1/3]

virtual DcmElement* DcmItem::remove | ( | const DcmTagKey & | tag | ) |
| virtual

remove element from list.

If found, the element is not deleted but returned to the caller who is responsible for further management of the DcmElement object.

Parameters

  tag | attribute tag of element to be removed

Returns
  pointer to DcmElement if found, NULL otherwise

## ◆ remove() [2/3]

virtual DcmElement* DcmItem::remove | ( | const unsigned long | num | ) |
| virtual

remove element from list.

If found, the element is not deleted but returned to the caller who is responsible for further management of the DcmElement object.

Parameters

  num | index number of element, must be < card()

Returns
  pointer to DcmElement if found, NULL otherwise

## ◆ remove() [3/3]

virtual DcmElement* DcmItem::remove | ( | DcmObject * | elem | ) |
| virtual

remove element from list.

If found, the element is not deleted but returned to the caller who is responsible for further management of the DcmElement object.

Parameters

  elem | pointer to element (as type DcmObject *) to be removed from list

Returns
  pointer to element (as type DcmElement *) if found, NULL otherwise

## ◆ search()

virtual OFCondition DcmItem::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 from DcmObject.

Reimplemented in DcmDirectoryRecord.

## ◆ searchSubFromHere()

OFCondition DcmItem::searchSubFromHere | ( | const DcmTagKey & | tag,
|  | DcmStack & | resultStack,
|  | OFBool | searchIntoSub
| ) |  |
| private

helper function for search().

May only be called if elementList is non-empty. Performs hierarchical search for given tag and pushes pointer of sub-element on result stack if found

Parameters

  tag | tag key to be searched
  resultStack | upon successful return, pointer to element pushed onto this stack
  searchIntoSub | flag indicating whether recursive search is desired

Returns
  EC_Normal if tag found and stack modified, EC_TagNotFound if tag not found and stack unmodified

## ◆ tagExists()

OFBool DcmItem::tagExists | ( | const DcmTagKey & | key,
|  | OFBool | searchIntoSub = `OFFalse`
| ) |  |

check if an element with the given attribute tag exists in the dataset

Parameters

  key | tag key to be searched
  searchIntoSub | if true, do hierarchical search within sequences, if false only search through this dataset

Returns
  true if tag found, false otherwise

## ◆ tagExistsWithValue()

OFBool DcmItem::tagExistsWithValue | ( | const DcmTagKey & | key,
|  | OFBool | searchIntoSub = `OFFalse`
| ) |  |

check if an element with the given attribute tag exists in the dataset and has a non-empty value

Parameters

  key | tag key to be searched
  searchIntoSub | if true, do hierarchical search within sequences, if false only search through this dataset

Returns
  true if tag found and element non-empty, false otherwise

## ◆ transferEnd()

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

Reimplemented in DcmMetaInfo.

## ◆ transferInit()

virtual void DcmItem::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 DcmMetaInfo.

## ◆ updateSpecificCharacterSet()

virtual void DcmItem::updateSpecificCharacterSet | ( | OFCondition & | status,
|  | const DcmSpecificCharacterSet & | converter
| ) |  |
| virtual

update the SpecificCharacterSet (0008,0005) element depending on the given parameters.

The current value of this element is either replaced or a new element is inserted or the existing element is deleted.

Note
  This method is called by convertCharacterSet() and convertToUTF8() when needed, so there is usually no reason to call it directly.

Parameters

  status | error status of previous operations (might also be updated)
  converter | character set converter used to convert element values

## ◆ verify()

virtual OFCondition DcmItem::verify | ( | const OFBool | autocorrect = `OFFalse` | ) |
| 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

Implements DcmObject.

Reimplemented in DcmDirectoryRecord.

## ◆ write()

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

write object to a stream

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

Implements DcmObject.

Reimplemented in DcmMetaInfo, and DcmDataset.

## ◆ writeJson()

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

write object in JSON format

Parameters

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

Returns
  status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmObject.

Reimplemented in DcmMetaInfo, and DcmDataset.

## ◆ writeJsonExt()

virtual OFCondition DcmItem::writeJsonExt | ( | STD_NAMESPACE ostream & | out,
|  | DcmJsonFormat & | format,
|  | OFBool | printBraces,
|  | OFBool | printNewline
| ) |  |
| virtual

write object in JSON format and control whether the output is encapsulated in braces

Parameters

  out | output stream to which the JSON document is written
  format | used to format and customize the output
  printBraces | true if output should be encapsulated in braces
  printNewline | true if a newline should be printed after a closing brace

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ writeSignatureFormat()

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

special write method for creation of digital signatures

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

Implements DcmObject.

Reimplemented in DcmDataset.

## ◆ writeXML()

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

write object in XML format

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, EC_Normal if successful, an error code otherwise

Reimplemented from DcmObject.

Reimplemented in DcmMetaInfo, DcmDirectoryRecord, and DcmDataset.

## Related Definitions

## ◆ operator<

OFBool operator< | ( | const DcmItem & | lhs,
|  | const DcmItem & | rhs
| ) |  |
| friend

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

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

Parameters

  lhs | left hand side of the comparison
  rhs | right hand side of the comparison

Returns
  OFTrue if lhs is smaller than rhs, OFFalse otherwise

## ◆ operator<=

OFBool operator<= | ( | const DcmItem & | lhs,
|  | const DcmItem & | rhs
| ) |  |
| friend

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

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

Parameters

  lhs | left hand side of the comparison
  rhs | right hand side of the comparison

Returns
  OFTrue if lhs is smaller than rhs or both are equal, OFFalse otherwise

## ◆ operator>

OFBool operator> | ( | const DcmItem & | lhs,
|  | const DcmItem & | rhs
| ) |  |
| friend

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

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

Parameters

  lhs | left hand side of the comparison
  rhs | right hand side of the comparison

Returns
  OFTrue if lhs is greater than rhs, OFFalse otherwise

## ◆ operator>=

OFBool operator>= | ( | const DcmItem & | lhs,
|  | const DcmItem & | 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

  lhs | left hand side of the comparison
  rhs | right hand side of the comparison

Returns
  OFTrue if lhs is greater than rhs or both are equal, OFFalse otherwise

## Member Data Documentation

## ◆ fStartPosition

offile_off_t DcmItem::fStartPosition
| protected

used during reading.

Contains the position in the stream where the item started (needed for calculating the remaining number of bytes available for a fixed-length item).

## ◆ lastElementComplete

OFBool DcmItem::lastElementComplete
| protected

flag used during suspended I/O.

Indicates whether the last element was completely or only partially read/written during the last call to read/write.

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

- dcmdata/include/dcmtk/dcmdata/dcitem.h

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1