DcmItem Class Reference

a class representing a collection of DICOM elements More...

Inheritance diagram for DcmItem:

DcmObject DcmDataset DcmDirectoryRecord DcmMetaInfo List of all members.

Public Member Functions

 DcmItem ()
 default constructor
 DcmItem (const DcmTag &tag, const Uint32 len=0)
 constructor.
 DcmItem (const DcmItem &old)
 copy constructor
virtual ~DcmItem ()
 destructor
virtual DcmObjectclone () const
 clone method
virtual DcmEVR ident () const
 get type identifier
virtual unsigned long getVM ()
 get value multiplicity
virtual unsigned long card () const
virtual OFBool isLeaf () const
virtual void print (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
virtual Uint32 calcElementLength (const E_TransferSyntax xfer, const E_EncodingType enctype)
virtual Uint32 getLength (const E_TransferSyntax xfer=EXS_LittleEndianImplicit, const E_EncodingType enctype=EET_UndefinedLength)
virtual void transferInit ()
virtual void transferEnd ()
virtual OFBool canWriteXfer (const E_TransferSyntax newXfer, const E_TransferSyntax oldXfer)
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.
virtual OFCondition write (DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype=EET_UndefinedLength)
 write object to a stream
virtual OFCondition writeXML (ostream &out, const size_t flags=0)
 write object in XML format
virtual OFCondition writeSignatureFormat (DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype=EET_UndefinedLength)
 special write method for creation of digital signatures
virtual OFBool containsUnknownVR () const
 returns true if the object contains an element with Unknown VR at any nesting level
virtual OFCondition insert (DcmElement *elem, OFBool replaceOld=OFFalse, OFBool checkInsertOrder=OFFalse)
 insert a new element into the list of elements maintained by this item.
virtual DcmElementgetElement (const unsigned long num)
virtual OFCondition nextObject (DcmStack &stack, const OFBool intoSub)
virtual DcmObjectnextInContainer (const DcmObject *obj)
virtual DcmElementremove (const unsigned long num)
virtual DcmElementremove (DcmObject *elem)
virtual DcmElementremove (const DcmTagKey &tag)
virtual OFCondition clear ()
virtual OFCondition verify (const OFBool autocorrect=OFFalse)
virtual OFCondition search (const DcmTagKey &xtag, DcmStack &resultStack, E_SearchMode mode=ESM_fromHere, OFBool searchIntoSub=OFTrue)
virtual OFCondition searchErrors (DcmStack &resultStack)
virtual OFCondition loadAllDataIntoMemory ()
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.
OFBool tagExists (const DcmTagKey &key, OFBool searchIntoSub=OFFalse)
OFBool tagExistsWithValue (const DcmTagKey &key, OFBool searchIntoSub=OFFalse)
OFCondition findAndGetElement (const DcmTagKey &tagKey, DcmElement *&element, const OFBool searchIntoSub=OFFalse)
 find element and get a pointer to it.
OFCondition findAndGetElements (const DcmTagKey &tagKey, DcmStack &resultStack)
 find all elements matching a particular tag and return references to them on a stack.
OFCondition findAndGetString (const DcmTagKey &tagKey, const char *&value, const OFBool searchIntoSub=OFFalse)
 find element and get value as a reference to a C string.
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).
OFCondition findAndGetOFStringArray (const DcmTagKey &tagKey, OFString &value, const OFBool searchIntoSub=OFFalse)
 find element and get value as a C++ string (all components).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
OFCondition findAndGetSequence (const DcmTagKey &seqTagKey, DcmSequenceOfItems *&sequence, const OFBool searchIntoSub=OFFalse)
 looks up and returns a given sequence.
OFCondition findAndGetSequenceItem (const DcmTagKey &seqTagKey, DcmItem *&item, const signed long itemNum=0)
 looks up and returns a given sequence item, if it exists.
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.
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.
OFCondition findAndCopyElement (const DcmTagKey &tagKey, DcmElement *&newElement, const OFBool searchIntoSub=OFFalse)
 find element, and create a copy of it.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
OFCondition insertEmptyElement (const DcmTag &tag, const OFBool replaceOld=OFTrue)
 create a new element (with no value) and insert it into the dataset/item.

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

Protected Attributes

DcmListelementList
 the list of elements maintained by this object
OFBool lastElementComplete
 flag used during suspended I/O.
Uint32 fStartPosition
 used during reading.

Private Member Functions

DcmItemoperator= (const DcmItem &)
 private unimplemented copy assignment operator
OFCondition searchSubFromHere (const DcmTagKey &tag, DcmStack &resultStack, OFBool searchIntoSub)
OFBool foundVR (char *atposition)

Private Attributes

DcmPrivateTagCache privateCreatorCache
 cache for private creator tags and names

Detailed Description

a class representing a collection of DICOM elements

Definition at line 54 of file dcitem.h.


Constructor & Destructor Documentation

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::DcmItem const DcmItem old  ) 
 

copy constructor

Parameters:
old item to be copied


Member Function Documentation

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.

virtual DcmObject* DcmItem::clone  )  const [inline, virtual]
 

clone method

Returns:
deep copy of this object

Implements DcmObject.

Reimplemented in DcmDataset, DcmDirectoryRecord, and DcmMetaInfo.

Definition at line 84 of file dcitem.h.

References DcmItem().

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 (ie 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

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.

OFCondition DcmItem::findAndCopyElement const DcmTagKey tagKey,
DcmElement *&  newElement,
const OFBool  searchIntoSub = OFFalse
 

find element, and create a copy of it.

Applicable to all DICOM value representations (VR).

Parameters:
tagKey DICOM tag specifying the attribute to be searched for
newElement stores pointer to the new element copy (NULL in case of error). This element is not inserted into the dataset/item and must, therefore, be deleted by the caller.
searchIntoSub flag indicating whether to search into sequences or not
Returns:
EC_Normal upon success, an error code otherwise.

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.

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.

OFCondition DcmItem::findAndGetElement const DcmTagKey tagKey,
DcmElement *&  element,
const OFBool  searchIntoSub = OFFalse
 

find element and get a pointer to it.

Applicable to all DICOM value representations (VR). The result variable 'element' is automatically set to NULL if an error occurs.

Parameters:
tagKey DICOM tag specifying the attribute to be searched for
element variable in which the reference to the element is stored
searchIntoSub flag indicating whether to search into sequences or not
Returns:
EC_Normal upon success, an error code otherwise.

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).

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.

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.

Applicable to the following VRs: FL, OF The result variable 'value' is automatically set to zero if an error occurs.

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.

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.

Applicable to the following VRs: FL, OF The result variable 'value' is automatically set to NULL if an error occurs.

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.

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.

Applicable to the following VRs: DS, FD The result variable 'value' is automatically set to zero if an error occurs.

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.

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.

Applicable to the following VRs: FD The result variable 'value' is automatically set to NULL if an error occurs.

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.

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.

Applicable to the following VRs: IS, SL, SS, UL, US The result variable 'value' is automatically set to zero if an error occurs.

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.

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).

Applicable to the following VRs: AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OF, OW, PN, SH, SL, SS, ST, TM, UI, UL, US, UT 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.

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.

OFCondition DcmItem::findAndGetOFStringArray const DcmTagKey tagKey,
OFString value,
const OFBool  searchIntoSub = OFFalse
 

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

Applicable to the following VRs: AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OF, OW, PN, SH, SL, SS, ST, TM, UI, UL, US, UT 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.

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.

OFCondition DcmItem::findAndGetSequence const DcmTagKey seqTagKey,
DcmSequenceOfItems *&  sequence,
const OFBool  searchIntoSub = OFFalse
 

looks up and returns a given sequence.

Applicable to the following VRs: SQ, (pixelSQ) The result variable 'sequence' is automatically set to NULL if an error occurs (e.g. if 'seqTagKey' does not refer to a sequence attribute).

Parameters:
seqTagKey DICOM tag specifying the sequence attribute to be searched for
sequence variable in which the reference to the sequence element is stored
searchIntoSub flag indicating whether to search into sub-sequences or not
Returns:
EC_Normal upon success, an error otherwise.

OFCondition DcmItem::findAndGetSequenceItem const DcmTagKey seqTagKey,
DcmItem *&  item,
const signed long  itemNum = 0
 

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). 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 the sequence item is stored
itemNum number of the item to be searched for (0..n-1, -1 for last)
Returns:
EC_Normal upon success, an error otherwise.

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.

Applicable to the following VRs: SS The result variable 'value' is automatically set to zero if an error occurs.

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.

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.

Applicable to the following VRs: SS The result variable 'value' is automatically set to NULL if an error occurs.

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.

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.

Applicable to the following VRs: IS, SL The result variable 'value' is automatically set to zero if an error occurs.

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.

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.

Applicable to the following VRs: SL The result variable 'value' is automatically set to NULL if an error occurs.

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.

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.

Applicable to the following VRs: AE, AS, CS, DA, DS, DT, IS, LO, LT, PN, SH, ST, TM, UI, UT 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.

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.

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.

Applicable to the following VRs: OW, US The result variable 'value' is automatically set to zero if an error occurs.

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.

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.

Applicable to the following VRs: AT, OW, US The result variable 'value' is automatically set to NULL if an error occurs.

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.

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.

Applicable to the following VRs: UL The result variable 'value' is automatically set to zero if an error occurs.

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.

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.

Applicable to the following VRs: UL The result variable 'value' is automatically set to NULL if an error occurs.

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.

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.

Applicable to the following VRs: OB The result variable 'value' is automatically set to zero if an error occurs.

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.

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.

Applicable to the following VRs: OB The result variable 'value' is automatically set to NULL if an error occurs.

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.

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). Applicable to the following VRs: SQ, (pixelSQ)

Parameters:
seqTag DICOM tag specifying the sequence attribute to be searched for or to be create respectively
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.

virtual unsigned long DcmItem::getVM  )  [virtual]
 

get value multiplicity

Returns:
always returns 1 (according to the DICOM standard)

Implements DcmObject.

virtual DcmEVR DcmItem::ident  )  const [virtual]
 

get type identifier

Returns:
type identifier of this class (EVR_item)

Implements DcmObject.

Reimplemented in DcmDataset, and DcmMetaInfo.

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

OFCondition DcmItem::insertEmptyElement const DcmTag tag,
const OFBool  replaceOld = OFTrue
 

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

Applicable to the following VRs: AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, OB, OF, OW, LT, PN, SH, SQ, ST, TM, UI, UT

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.

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

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.

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-1)
replaceOld flag indicating whether to replace an existing element or not
Returns:
EC_Normal upon success, an error code otherwise.

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.

Applicable to the following VRs: FD

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-1)
replaceOld flag indicating whether to replace an existing element or not
Returns:
EC_Normal upon success, an error code otherwise.

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.

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

Parameters:
tag DICOM tag specifying the attribute to be created
value value to be set for the new element (might be empty)
replaceOld flag indicating whether to replace an existing element or not
Returns:
EC_Normal upon success, an error code otherwise.

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.

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-1)
replaceOld flag indicating whether to replace an existing element or not
Returns:
EC_Normal upon success, an error code otherwise.

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.

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.

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.

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-1)
replaceOld flag indicating whether to replace an existing element or not
Returns:
EC_Normal upon success, an error code otherwise.

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.

Applicable to the following VRs: AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OF, OW, PN, SH, SL, SS, ST, TM, UI, UL, US, UT

Parameters:
tag DICOM tag specifying the attribute to be created
value value to be set for the new element (might be empty or NULL)
replaceOld flag indicating whether to replace an existing element or not
Returns:
EC_Normal upon success, an error code otherwise.

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.

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-1)
replaceOld flag indicating whether to replace an existing element or not
Returns:
EC_Normal upon success, an error code otherwise.

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.

Applicable to the following VRs: AT, OW, US, ox (polymorph OB/OW or 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.

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.

Applicable to the following VRs: 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-1)
replaceOld flag indicating whether to replace an existing element or not
Returns:
EC_Normal upon success, an error code otherwise.

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.

Applicable to the following VRs: OB, ox (polymorph OB/OW or 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.

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 DcmDataset.

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

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

virtual OFCondition DcmItem::write DcmOutputStream outStream,
const E_TransferSyntax  oxfer,
const E_EncodingType  enctype = EET_UndefinedLength
[virtual]
 

write object to a stream

Parameters:
outStream DICOM output stream
oxfer output transfer syntax
enctype encoding types (undefined or explicit length)
Returns:
status, EC_Normal if successful, an error code otherwise

Implements DcmObject.

Reimplemented in DcmDataset, and DcmMetaInfo.

virtual OFCondition DcmItem::writeSignatureFormat DcmOutputStream outStream,
const E_TransferSyntax  oxfer,
const E_EncodingType  enctype = EET_UndefinedLength
[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)
Returns:
status, EC_Normal if successful, an error code otherwise

Implements DcmObject.

Reimplemented in DcmDataset.

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


Member Data Documentation

Uint32 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).

Definition at line 787 of file dcitem.h.

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.

Definition at line 781 of file dcitem.h.


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


Generated on 20 Dec 2005 for OFFIS DCMTK Version 3.5.4 by Doxygen 1.4.5