DcmDataset Class Reference

a class handling the DICOM dataset format (files without meta header) More...

Inheritance diagram for DcmDataset:

DcmItem DcmObject List of all members.

Public Member Functions

 DcmDataset ()
 default constructor
 DcmDataset (const DcmDataset &old)
 copy constructor
virtual ~DcmDataset ()
 destructor
DcmDatasetoperator= (const DcmDataset &obj)
 assignment operator
virtual DcmObjectclone () const
 clone method
virtual OFCondition copyFrom (const DcmObject &rhs)
 Virtual object copying.
virtual DcmEVR ident () const
 get type identifier
virtual OFCondition clear ()
 clear (remove) attribute value
virtual void removeInvalidGroups ()
 remove all elements with an invalid group number, i.e.
E_TransferSyntax getOriginalXfer () const
 return the transfer syntax in which this dataset was originally read.
virtual void print (STD_NAMESPACE ostream &out, const size_t flags=0, const int level=0, const char *pixelFileName=NULL, size_t *pixelCounter=NULL)
 print all elements of the dataset to a stream
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 OFBool canWriteXfer (const E_TransferSyntax newXfer, const E_TransferSyntax oldXfer=EXS_Unknown)
 check if this DICOM object can be encoded in the given transfer syntax.
virtual OFCondition read (DcmInputStream &inStream, const E_TransferSyntax xfer=EXS_Unknown, 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 this->elementList.
virtual OFCondition write (DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)
 write dataset to a stream
virtual OFCondition write (DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache, const E_GrpLenEncoding glenc, const E_PaddingEncoding padenc=EPD_noChange, const Uint32 padlen=0, const Uint32 subPadlen=0, Uint32 instanceLength=0)
 This function writes data values which are contained in this DcmDataset object to the stream which is passed as first argument.
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 writeXML (STD_NAMESPACE ostream &out, const size_t flags=0)
 write object in XML format.
virtual OFCondition loadFile (const char *fileName, const E_TransferSyntax readXfer=EXS_Unknown, const E_GrpLenEncoding groupLength=EGL_noChange, const Uint32 maxReadLength=DCM_MaxReadLength)
 load object from a DICOM file.
virtual OFCondition saveFile (const char *fileName, const E_TransferSyntax writeXfer=EXS_Unknown, const E_EncodingType encodingType=EET_UndefinedLength, const E_GrpLenEncoding groupLength=EGL_recalcGL, const E_PaddingEncoding padEncoding=EPD_noChange, const Uint32 padLength=0, const Uint32 subPadLength=0)
 save object to a DICOM file.
OFCondition chooseRepresentation (const E_TransferSyntax repType, const DcmRepresentationParameter *repParam)
 select a specific representation (compressed or uncompressed) of the dataset and create the representation if needed.
OFBool hasRepresentation (const E_TransferSyntax repType, const DcmRepresentationParameter *repParam)
 check if all PixelData elements in this dataset have a representation conforming to the given transfer syntax and representation parameters (see dcpixel.h for definition of "conforming").
void removeAllButOriginalRepresentations ()
 removes all but the original representation in all pixel data elements
void removeAllButCurrentRepresentations ()
 removes all but the current representation and sets the original representation to current

Private Attributes

E_TransferSyntax Xfer
 current transfer syntax of the dataset

Detailed Description

a class handling the DICOM dataset format (files without meta header)

Definition at line 46 of file dcdatset.h.


Constructor & Destructor Documentation

DcmDataset::DcmDataset ( const DcmDataset old  ) 

copy constructor

Parameters:
old dataset to be copied


Member Function Documentation

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

assignment operator

Parameters:
obj the dataset to be copied

virtual DcmObject* DcmDataset::clone (  )  const [inline, virtual]

clone method

Returns:
deep copy of this object

Reimplemented from DcmItem.

Definition at line 73 of file dcdatset.h.

References DcmDataset().

virtual OFCondition DcmDataset::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

Reimplemented from DcmItem.

virtual DcmEVR DcmDataset::ident (  )  const [virtual]

get type identifier

Returns:
type identifier of this class (EVR_dataset)

Reimplemented from DcmItem.

virtual OFCondition DcmDataset::clear (  )  [virtual]

clear (remove) attribute value

Returns:
EC_Normal if successful, an error code otherwise

Reimplemented from DcmItem.

virtual void DcmDataset::removeInvalidGroups (  )  [virtual]

remove all elements with an invalid group number, i.e.

0x0000 to 0x0003, 0x0005, 0x0007 and 0xFFFF

E_TransferSyntax DcmDataset::getOriginalXfer (  )  const

return the transfer syntax in which this dataset was originally read.

Returns:
transfer syntax in which this dataset was originally read, EXS_Unknown if the dataset was created in memory

virtual void DcmDataset::print ( STD_NAMESPACE ostream &  out,
const size_t  flags = 0,
const int  level = 0,
const char *  pixelFileName = NULL,
size_t *  pixelCounter = NULL 
) [virtual]

print all elements of the dataset 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 optional filename used to write the raw pixel data file
pixelCounter optional counter used for automatic pixel data filename creation

Reimplemented from DcmItem.

Uint32 DcmDataset::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

Reimplemented from DcmItem.

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

Reimplemented from DcmItem.

virtual OFCondition DcmDataset::read ( DcmInputStream inStream,
const E_TransferSyntax  xfer = EXS_Unknown,
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 this->elementList.

Each attribute is represented as an element in this list. Having read all information for this particular data set or command, this function will also take care of group length (according to what is specified in glenc) and padding elements (don't change anything).

Parameters:
inStream The stream which contains the information.
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 an attribute value.
Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmItem.

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

write dataset to a stream

Parameters:
outStream DICOM output stream
oxfer output transfer syntax
enctype encoding types (undefined or explicit length)
wcache pointer to write cache object, may be NULL
Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmItem.

virtual OFCondition DcmDataset::write ( DcmOutputStream outStream,
const E_TransferSyntax  oxfer,
const E_EncodingType  enctype,
DcmWriteCache wcache,
const E_GrpLenEncoding  glenc,
const E_PaddingEncoding  padenc = EPD_noChange,
const Uint32  padlen = 0,
const Uint32  subPadlen = 0,
Uint32  instanceLength = 0 
) [virtual]

This function writes data values which are contained in this DcmDataset object to the stream which is passed as first argument.

With regard to the writing of information, the other parameters which are passed are accounted for. The function will return EC_Normal, if the information from all elements of this data set has been written to the buffer, it will return EC_StreamNotifyClient, if there is no more space in the buffer and _not_ all elements have been written to it, and it will return some other (error) value if there was an error.

Parameters:
outStream The stream that the information will be written to.
oxfer The transfer syntax which shall be used.
enctype Encoding type for sequences; specifies how sequences will be handled.
wcache pointer to write cache object, may be NULL
glenc Encoding type for group length; specifies what will be done with group length tags.
padenc Encoding type for padding. Specifies what will be done with padding tags.
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 OFCondition DcmDataset::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

Reimplemented from DcmItem.

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

write object in XML format.

The XML declaration (e.g. <?xml version="1.0"?>) is not written by this function.

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

virtual OFCondition DcmDataset::loadFile ( const char *  fileName,
const E_TransferSyntax  readXfer = EXS_Unknown,
const E_GrpLenEncoding  groupLength = EGL_noChange,
const Uint32  maxReadLength = DCM_MaxReadLength 
) [virtual]

load object from a DICOM file.

This method only supports DICOM objects stored as a dataset, i.e. without meta header. Use DcmFileFormat::loadFile() to load files with meta header.

Parameters:
fileName name of the file to load
readXfer transfer syntax used to read the data (auto detection if EXS_Unknown)
groupLength flag, specifying how to handle the group length tags
maxReadLength maximum number of bytes to be read for an element value. Element values with a larger size are not loaded until their value is retrieved (with getXXX()) or loadAllDataElements() is called.
Returns:
status, EC_Normal if successful, an error code otherwise

virtual OFCondition DcmDataset::saveFile ( const char *  fileName,
const E_TransferSyntax  writeXfer = EXS_Unknown,
const E_EncodingType  encodingType = EET_UndefinedLength,
const E_GrpLenEncoding  groupLength = EGL_recalcGL,
const E_PaddingEncoding  padEncoding = EPD_noChange,
const Uint32  padLength = 0,
const Uint32  subPadLength = 0 
) [virtual]

save object to a DICOM file.

This method only supports DICOM objects stored as a dataset, i.e. without meta header. Use DcmFileFormat::saveFile() to save files with meta header.

Parameters:
fileName name of the file to save
writeXfer transfer syntax used to write the data (EXS_Unknown means use current)
encodingType flag, specifying the encoding with undefined or explicit length
groupLength flag, specifying how to handle the group length tags
padEncoding flag, specifying how to handle the padding tags
padLength number of bytes used for the dataset padding (has to be an even number)
subPadLength number of bytes used for the item padding (has to be an even number)
Returns:
status, EC_Normal if successful, an error code otherwise

OFCondition DcmDataset::chooseRepresentation ( const E_TransferSyntax  repType,
const DcmRepresentationParameter repParam 
)

select a specific representation (compressed or uncompressed) of the dataset and create the representation if needed.

This may cause compression or decompression to be applied to the pixel data in the dataset.

Parameters:
repType desired transfer syntax
repParam desired representation parameter (e.g. quality factor for lossy compression)
Returns:
EC_Normal upon success, an error code otherwise.

Referenced by DcmFileFormat::chooseRepresentation().

OFBool DcmDataset::hasRepresentation ( const E_TransferSyntax  repType,
const DcmRepresentationParameter repParam 
)

check if all PixelData elements in this dataset have a representation conforming to the given transfer syntax and representation parameters (see dcpixel.h for definition of "conforming").

Parameters:
repType desired transfer syntax
repParam desired representation parameter (e.g. quality factor for lossy compression)
Returns:
true if all pixel elements have the desired representation, false otherwise

Referenced by DcmFileFormat::hasRepresentation().


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