DcmElement Class Reference

abstract base class for all DICOM elements More...

Inheritance diagram for DcmElement:

DcmObject DcmAttributeTag DcmByteString DcmFloatingPointDouble DcmFloatingPointSingle DcmOtherByteOtherWord DcmSequenceOfItems DcmSignedLong DcmSignedShort DcmUnsignedLong DcmUnsignedShort List of all members.

Public Member Functions

 DcmElement (const DcmTag &tag, const Uint32 len=0)
 constructor.
 DcmElement (const DcmElement &old)
 copy constructor
virtual ~DcmElement ()
 destructor
DcmElementoperator= (const DcmElement &obj)
 assignment operator
virtual OFCondition copyFrom (const DcmObject &rhs)
 Virtual object copying.
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.
virtual Uint32 getLength (const E_TransferSyntax=EXS_LittleEndianImplicit, const E_EncodingType=EET_UndefinedLength)
 calculate the value length (without attribute tag, VR and length field) of this DICOM element when encoded with the given transfer syntax and the given encoding type for sequences.
virtual OFBool isLeaf () const
 check if this element is a leaf node in a dataset tree.
OFBool valueLoaded () const
 check if value of this element is loaded into main memory
virtual void transferInit ()
 initialize the transfer state of this object.
virtual OFBool canWriteXfer (const E_TransferSyntax newXfer, const E_TransferSyntax oldXfer)
 check if this DICOM object can be encoded in the given transfer syntax.
virtual OFCondition read (DcmInputStream &inStream, const E_TransferSyntax ixfer, const E_GrpLenEncoding glenc=EGL_noChange, const Uint32 maxReadLength=DCM_MaxReadLength)
 This function reads the data value of an attribute which is captured in the input stream and captures this information in this.
virtual OFCondition write (DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)
 This function writes this element's value to the outstream which was passed.
virtual OFCondition writeXML (STD_NAMESPACE 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, DcmWriteCache *wcache)
 special write method for creation of digital signatures
virtual OFCondition clear ()
 clear (remove) attribute value
virtual OFCondition checkValue (const OFString &vm="1-n", const OFBool oldFormat=OFFalse)
 check whether stored value conforms to the VR and to the specified VM
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.
virtual OFCondition getUint8 (Uint8 &val, const unsigned long pos=0)
 retrieve a single value of type Uint8.
virtual OFCondition getSint16 (Sint16 &val, const unsigned long pos=0)
 retrieve a single value of type Sint16.
virtual OFCondition getUint16 (Uint16 &val, const unsigned long pos=0)
 retrieve a single value of type Uint16.
virtual OFCondition getSint32 (Sint32 &val, const unsigned long pos=0)
 retrieve a single value of type Sint32.
virtual OFCondition getUint32 (Uint32 &val, const unsigned long pos=0)
 retrieve a single value of type Uint32.
virtual OFCondition getFloat32 (Float32 &val, const unsigned long pos=0)
 retrieve a single value of type Float32.
virtual OFCondition getFloat64 (Float64 &val, const unsigned long pos=0)
 retrieve a single value of type Float64.
virtual OFCondition getTagVal (DcmTagKey &val, const unsigned long pos=0)
 retrieve a single value of type DcmTagKey.
virtual OFCondition getOFString (OFString &str, const unsigned long pos, OFBool normalize=OFTrue)
 retrieve a single value of type string.
virtual OFCondition getOFStringArray (OFString &value, OFBool normalize=OFTrue)
 get entire element value as a character string.
virtual OFCondition getString (char *&val)
 get a pointer to the element value of the current element as type string.
virtual OFCondition getUint8Array (Uint8 *&val)
 get a pointer to the element value of the current element as type string.
virtual OFCondition getSint16Array (Sint16 *&val)
 get a pointer to the element value of the current element as type Sint16.
virtual OFCondition getUint16Array (Uint16 *&val)
 get a pointer to the element value of the current element as type Uint16.
virtual OFCondition getSint32Array (Sint32 *&val)
 get a pointer to the element value of the current element as type Sint32.
virtual OFCondition getUint32Array (Uint32 *&val)
 get a pointer to the element value of the current element as type Uint32.
virtual OFCondition getFloat32Array (Float32 *&val)
 get a pointer to the element value of the current element as type Float32.
virtual OFCondition getFloat64Array (Float64 *&val)
 get a pointer to the element value of the current element as type Float64.
OFCondition detachValueField (OFBool copy=OFFalse)
 detach the value field from the DICOM element (i.e., this object).
virtual OFCondition putOFStringArray (const OFString &stringValue)
 replace the element value by a copy of the given string (which is possibly multi-valued).
virtual OFCondition putString (const char *val)
 replace the element value by a copy of the given string (which is possibly multi-valued).
virtual OFCondition putSint16 (const Sint16 val, const unsigned long pos=0)
 insert into the element value a copy of the given Sint16 value.
virtual OFCondition putUint16 (const Uint16 val, const unsigned long pos=0)
 insert into the element value a copy of the given Uint16 value.
virtual OFCondition putSint32 (const Sint32 val, const unsigned long pos=0)
 insert into the element value a copy of the given Sint32 value.
virtual OFCondition putUint32 (const Uint32 val, const unsigned long pos=0)
 insert into the element value a copy of the given Uint32 value.
virtual OFCondition putFloat32 (const Float32 val, const unsigned long pos=0)
 insert into the element value a copy of the given Float32 value.
virtual OFCondition putFloat64 (const Float64 val, const unsigned long pos=0)
 insert into the element value a copy of the given Float64 value.
virtual OFCondition putTagVal (const DcmTagKey &attrTag, const unsigned long pos=0)
 insert into the element value a copy of the given DcmTagKey value.
virtual OFCondition putUint8Array (const Uint8 *vals, const unsigned long num)
 replace the element value by a copy of the given Uint8 array (which is possibly multi-valued).
virtual OFCondition putSint16Array (const Sint16 *vals, const unsigned long num)
 replace the element value by a copy of the given Sint16 array (which is possibly multi-valued).
virtual OFCondition putUint16Array (const Uint16 *vals, const unsigned long num)
 replace the element value by a copy of the given Uint16 array (which is possibly multi-valued).
virtual OFCondition putSint32Array (const Sint32 *vals, const unsigned long num)
 replace the element value by a copy of the given Sint32 array (which is possibly multi-valued).
virtual OFCondition putUint32Array (const Uint32 *vals, const unsigned long num)
 replace the element value by a copy of the given Uint32 array (which is possibly multi-valued).
virtual OFCondition putFloat32Array (const Float32 *vals, const unsigned long num)
 replace the element value by a copy of the given Float32 array (which is possibly multi-valued).
virtual OFCondition putFloat64Array (const Float64 *vals, const unsigned long num)
 replace the element value by a copy of the given Float64 array (which is possibly multi-valued).
virtual OFCondition getPartialValue (void *targetBuffer, const Uint32 offset, Uint32 numBytes, DcmFileCache *cache=NULL, E_ByteOrder byteOrder=gLocalByteOrder)
 Copy numBytes bytes of data from the attribute value in byteOrder byte order to targetBuffer, starting at byte offset offset of the attribute value.
virtual OFCondition createUint8Array (const Uint32 numBytes, Uint8 *&bytes)
 create an empty Uint8 array of given number of bytes and set it.
virtual OFCondition createUint16Array (const Uint32 numWords, Uint16 *&words)
 create an empty Uint16 array of given number of words and set it.
virtual OFCondition createValueFromTempFile (DcmInputStreamFactory *factory, const Uint32 length, const E_ByteOrder byteOrder)
 replace the attribute value with the content of the given temporary file.
virtual void compact ()
 remove the attribute value from memory if the attribute value can be loaded from file when needed again.
virtual OFCondition getUncompressedFrameSize (DcmItem *dataset, Uint32 &frameSize) const
 compute uncompressed frame size of a single frame of this image.
virtual OFCondition getUncompressedFrame (DcmItem *dataset, Uint32 frameNo, Uint32 &startFragment, void *buffer, Uint32 bufSize, OFString &decompressedColorModel, DcmFileCache *cache=NULL)
 access single frame without decompressing or loading a complete multi-frame object.
virtual OFCondition getDecompressedColorModel (DcmItem *dataset, OFString &decompressedColorModel)
 determine color model of the decompressed image

Static Public Member Functions

static int scanValue (const OFString &value, const OFString &vr, const size_t pos=0, const size_t num=OFString_npos)
 scan string value for conformance with given value representation (VR)

Protected Member Functions

void * getValue (const E_ByteOrder newByteOrder=gLocalByteOrder)
 This function returns this element's value.
OFCondition changeValue (const void *value, const Uint32 position, const Uint32 num)
 insert into the element value a copy of the given raw value.
OFCondition putValue (const void *value, const Uint32 length)
 replace the element value by a copy of the given raw data block
OFCondition createEmptyValue (const Uint32 length)
 create a new, empty value field of given size.
OFCondition loadValue (DcmInputStream *inStream=NULL)
 This function reads the data value of an attribute and stores the information which was read in this.
virtual void postLoadValue ()
 performs clean-up functions after loading an attribute value into main memory.
virtual Uint8 * newValueField ()
 This function creates a byte array of Length bytes and returns this array.
void swapValueField (size_t valueWidth)
 swaps the content of the value field (if loaded) from big-endian to little-endian or back
virtual void writeXMLStartTag (STD_NAMESPACE ostream &out, const size_t flags, const char *attrText=NULL)
 write element start tag in XML format
virtual void writeXMLEndTag (STD_NAMESPACE ostream &out, const size_t flags)
 write element end tag in XML format
E_ByteOrder getByteOrder () const
 return the current byte order of the value field
void setByteOrder (E_ByteOrder val)
 set the current byte order of the value field

Static Protected Member Functions

static OFCondition checkVM (const unsigned long vmNum, const OFString &vmStr)
 check for correct value multiplicity (VM)

Private Attributes

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

Detailed Description

abstract base class for all DICOM elements

Definition at line 45 of file dcelem.h.


Constructor & Destructor Documentation

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

constructor.

Create new element from given tag and length.

Parameters:
tag DICOM tag for the new element
len value length for the new element

DcmElement::DcmElement ( const DcmElement old  ) 

copy constructor

Parameters:
old element to be copied


Member Function Documentation

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

assignment operator

Parameters:
obj element to be assigned/copied
Returns:
reference to this object

virtual OFCondition DcmElement::copyFrom ( const DcmObject rhs  )  [virtual]

Virtual object copying.

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

Parameters:
rhs - [in] The instance to copy from. Has to be of the same class type as "this" object
Returns:
EC_Normal if copying was successful, error otherwise

Implements DcmObject.

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

virtual Uint32 DcmElement::calcElementLength ( const E_TransferSyntax  xfer,
const E_EncodingType  enctype 
) [virtual]

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

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

Parameters:
xfer transfer syntax for length calculation
enctype sequence encoding type for length calculation
Returns:
length of DICOM element

Implements DcmObject.

Reimplemented in DcmFileFormat, DcmPixelData, DcmPixelSequence, and DcmSequenceOfItems.

virtual Uint32 DcmElement::getLength ( const   E_TransferSyntax = EXS_LittleEndianImplicit,
const   E_EncodingType = EET_UndefinedLength 
) [inline, virtual]

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

Never returns undefined length.

Parameters:
xfer transfer syntax for length calculation
enctype sequence encoding type for length calculation
Returns:
value length of DICOM element

Implements DcmObject.

Reimplemented in DcmByteString, DcmPixelData, and DcmSequenceOfItems.

Definition at line 108 of file dcelem.h.

References DcmObject::getLengthField().

Referenced by I2DOutputPlug::checkAndInventType1Attrib().

virtual OFBool DcmElement::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.

Reimplemented in DcmSequenceOfItems.

Definition at line 120 of file dcelem.h.

OFBool DcmElement::valueLoaded (  )  const [inline]

check if value of this element is loaded into main memory

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

Definition at line 125 of file dcelem.h.

References fValue, and DcmObject::getLengthField().

Referenced by DiInputPixelTemplate< T1, T2 >::convert().

virtual void DcmElement::transferInit (  )  [virtual]

initialize the transfer state of this object.

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

Reimplemented from DcmObject.

Reimplemented in DcmPixelData, DcmSequenceOfItems, and DcmPolymorphOBOW.

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

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

Parameters:
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 DcmFileFormat, DcmPixelData, DcmPixelSequence, DcmSequenceOfItems, and DcmOtherByteOtherWord.

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

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

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

Parameters:
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 DcmFileFormat, DcmPixelData, DcmPixelSequence, DcmSequenceOfItems, and DcmPolymorphOBOW.

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

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

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

Parameters:
outStream The stream the information will be written to.
oxfer The transfer syntax which shall be used.
enctype encoding types (undefined or explicit length) (actually unused)
wcache pointer to write cache object, may be NULL
Returns:
status, EC_Normal if successful, an error code otherwise

Implements DcmObject.

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

virtual OFCondition DcmElement::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 DcmFileFormat, DcmPixelData, DcmPixelItem, DcmSequenceOfItems, DcmDecimalString, and DcmOtherByteOtherWord.

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

special write method for creation of digital signatures

Parameters:
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 DcmByteString, DcmPixelData, DcmPixelSequence, DcmPixelItem, DcmSequenceOfItems, DcmOtherByteOtherWord, and DcmPolymorphOBOW.

virtual OFCondition DcmElement::clear (  )  [virtual]

clear (remove) attribute value

Returns:
EC_Normal if successful, an error code otherwise

Implements DcmObject.

Reimplemented in DcmByteString, DcmFileFormat, DcmSequenceOfItems, and DcmUnsignedLongOffset.

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

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

Parameters:
vm value multiplicity (according to the data dictionary) to be checked for. (valid values: "1", "1-2", "1-3", "1-8", "1-99", "1-n", "2", "2-n", "2-2n", "3", "3-n", "3-3n", "4", "6", "9", "16", "32"), interpreted as cardinality (number of items) for sequence attributes
oldFormat support old ACR/NEMA format for certain VRs (DA, TM, PN) if OFTrue
Returns:
status of the check, EC_Normal if value is correct, an error code otherwise

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

virtual OFCondition DcmElement::loadAllDataIntoMemory (  )  [virtual]

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

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

Returns:
EC_Normal if successful, an error code otherwise

Implements DcmObject.

Reimplemented in DcmPixelData, and DcmSequenceOfItems.

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

retrieve a single value of type Uint8.

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

Parameters:
val value returned in this parameter upon success
pos position in multi-valued attribute, default 0
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmOtherByteOtherWord.

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

retrieve a single value of type Sint16.

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

Parameters:
val value returned in this parameter upon success
pos position in multi-valued attribute, default 0
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedShort.

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

retrieve a single value of type Uint16.

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

Parameters:
val value returned in this parameter upon success
pos position in multi-valued attribute, default 0
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmOtherByteOtherWord, and DcmUnsignedShort.

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

retrieve a single value of type Sint32.

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

Parameters:
val value returned in this parameter upon success
pos position in multi-valued attribute, default 0
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmIntegerString, and DcmSignedLong.

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

retrieve a single value of type Uint32.

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

Parameters:
val value returned in this parameter upon success
pos position in multi-valued attribute, default 0
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmUnsignedLong.

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

retrieve a single value of type Float32.

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

Parameters:
val value returned in this parameter upon success
pos position in multi-valued attribute, default 0
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointSingle.

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

retrieve a single value of type Float64.

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

Parameters:
val value returned in this parameter upon success
pos position in multi-valued attribute, default 0
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmDecimalString, and DcmFloatingPointDouble.

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

retrieve a single value of type DcmTagKey.

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

Parameters:
val value returned in this parameter upon success
pos position in multi-valued attribute, default 0
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmAttributeTag.

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

retrieve a single value of type string.

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

Parameters:
str value returned in this parameter upon success
pos position in multi-valued attribute
normalize true if string is to be normalized (e.g. trailing space characters to be trimmed)
Returns:
EC_Normal upon success, an error code otherwise

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

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

get entire element value as a character string.

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

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

Reimplemented in DcmLongText, DcmOtherByteOtherWord, DcmShortText, and DcmUnlimitedText.

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

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

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

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

Reimplemented in DcmByteString.

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

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

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

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

Reimplemented in DcmOtherByteOtherWord, and DcmPolymorphOBOW.

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

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

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

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

Reimplemented in DcmSignedShort.

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

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

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

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

Reimplemented in DcmAttributeTag, DcmOtherByteOtherWord, DcmPolymorphOBOW, and DcmUnsignedShort.

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

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

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

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

Reimplemented in DcmSignedLong.

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

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

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

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

Reimplemented in DcmUnsignedLong.

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

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

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

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

Reimplemented in DcmFloatingPointSingle.

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

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

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

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

Reimplemented in DcmFloatingPointDouble.

OFCondition DcmElement::detachValueField ( OFBool  copy = OFFalse  ) 

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

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

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

virtual OFCondition DcmElement::putOFStringArray ( const OFString stringValue  )  [virtual]

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

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

Parameters:
stringValue new attribute value
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmByteString.

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

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

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

Parameters:
val new attribute value
Returns:
EC_Normal upon success, an error code otherwise

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

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

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

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

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

Reimplemented in DcmSignedShort.

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

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

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

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

Reimplemented in DcmUnsignedShort.

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

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

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

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

Reimplemented in DcmSignedLong.

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

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

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

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

Reimplemented in DcmUnsignedLong.

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

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

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

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

Reimplemented in DcmFloatingPointSingle.

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

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

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

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

Reimplemented in DcmFloatingPointDouble.

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

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

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

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

Reimplemented in DcmAttributeTag.

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

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

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

Parameters:
vals new attribute value
num number of values in array vals
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmPixelData, DcmOtherByteOtherWord, and DcmPolymorphOBOW.

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

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

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

Parameters:
vals new attribute value
num number of values in array vals
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedShort.

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

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

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

Parameters:
vals new attribute value
num number of values in array vals
Returns:
EC_Normal upon success, an error code otherwise

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

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

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

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

Parameters:
vals new attribute value
num number of values in array vals
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmSignedLong.

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

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

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

Parameters:
vals new attribute value
num number of values in array vals
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmUnsignedLong.

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

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

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

Parameters:
vals new attribute value
num number of values in array vals
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointSingle.

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

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

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

Parameters:
vals new attribute value
num number of values in array vals
Returns:
EC_Normal upon success, an error code otherwise

Reimplemented in DcmFloatingPointDouble.

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

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

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

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

Reimplemented in DcmSequenceOfItems.

Referenced by DiInputPixelTemplate< T1, T2 >::convert().

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

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

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

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

Reimplemented in DcmPixelData, DcmOtherByteOtherWord, and DcmPolymorphOBOW.

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

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

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

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

Reimplemented in DcmPixelData, DcmOtherByteOtherWord, and DcmPolymorphOBOW.

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

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

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

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

Reimplemented in DcmPixelData.

virtual void DcmElement::compact (  )  [virtual]

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

Otherwise do nothing.

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

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

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

Parameters:
dataset dataset in which this pixel data element is contained
frameSize frame size in bytes (without padding) returned in this parameter upon success
Returns:
EC_Normal if successful, an error code otherwise

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

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

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

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

Reimplemented in DcmPixelData.

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

determine color model of the decompressed image

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

Reimplemented in DcmPixelData.

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

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

Parameters:
value string value to be scanned
vr two-character identifier of the VR to be checked (lower case)
pos position of the first character to be scanned in 'value'
num number of characters to be scanned in 'value' (default: all)
Returns:
numeric identifier of the VR found, 16 in case of unknown VR

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

This function returns this element's value.

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

Parameters:
newByteOrder The byte ordering that shall be accounted for (little or big endian).

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

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

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

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

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

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

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

OFCondition DcmElement::createEmptyValue ( const Uint32  length  )  [protected]

create a new, empty value field of given size.

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

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

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

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

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

virtual void DcmElement::postLoadValue (  )  [protected, virtual]

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

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

Reimplemented in DcmByteString, and DcmOtherByteOtherWord.

virtual Uint8* DcmElement::newValueField (  )  [protected, virtual]

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

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

Reimplemented in DcmByteString.

void DcmElement::swapValueField ( size_t  valueWidth  )  [protected]

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

Parameters:
valueWidth width (in bytes) of each element value

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

write element start tag in XML format

Parameters:
out output stream to which the XML start tag is written
flags flag used to customize the output (not yet used)
attrText extra attribute text to be added to the element tag

virtual void DcmElement::writeXMLEndTag ( STD_NAMESPACE ostream &  out,
const size_t  flags 
) [protected, virtual]

write element end tag in XML format

Parameters:
out output stream to which the XML end tag is written
flags flag used to customize the output (not yet used)

E_ByteOrder DcmElement::getByteOrder (  )  const [inline, protected]

return the current byte order of the value field

Returns:
current byte order of the value field

Definition at line 777 of file dcelem.h.

References fByteOrder.

void DcmElement::setByteOrder ( E_ByteOrder  val  )  [inline, protected]

set the current byte order of the value field

Parameters:
val byte order of the value field

Definition at line 782 of file dcelem.h.

References fByteOrder.

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

check for correct value multiplicity (VM)

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


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


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1