MeVisLabToolboxReference
DCMTree::StructuredMF Class Reference

Support for structured multi-frame (SMF) DICOM objects. More...

#include <DCMTree_StructuredMF.h>

List of all members.

Public Types

enum  { privateGroupId = 0x0041, dimensionsOffset = 1, dimensionSequenceOffset = 2, frameIndexOffset = 3 }
typedef std::vector< unsigned int > IndexVector
 Index vector type, ordered as (z, t, u1, u2, ...)

Public Member Functions

 StructuredMF (Const_TreePtr tree)
 ctor - gets the tree of the DICOM tags for the SMF Use this constructor to access an existing SMF object.
 StructuredMF (TreePtr tree)
 ctor - gets the tree of the DICOM tags for the SMF Use this constructor to access an existing writable SMF object The DICOM tags in the new object can be freely modified
 StructuredMF (TreePtr sharedTagTree, const IndexVector &gridExtent)
 ctor - create a DICOM SMF object from the tree of common tags, the extent of the logical grid and the tag id's associated with the individual grid dimensions.
 StructuredMF (TreePtr sharedTagTree, unsigned int depth, unsigned int timePoints=0, unsigned int u1Size=0)
Const_TreePtr tagTree () const
 Return a const pointer to the contained tag tree.
TreePtr tagTree ()
 Return a pointer to the contained tag tree.
void setSharedTags (TreePtr tree, bool handleFuncGroups=true)
 Add/replace shared tags with the given tag tree (no copy)
Access shared tags
TagPtr sharedTag_rw (TagId tagId)
 Get a writable pointer to the specified shared tag.
Const_TagPtr sharedTag (TagId tagId) const
 Get a const pointer to the specified shared tag.
Const_TagPtr sharedTag (TagId tagId, const std::string &privateCreator, Vr privateVr=UN) const
 Get a const pointer to the specified shared tag with the given private creator and VR.
TreePtr extractSharedTagTree () const
 Extract all DICOM tags valid for all frames (deep copy)
Relation between logical grid and DICOM multi-frame structure
boost::uint32_t getGridDimension () const
 Get the dimension of the logical grid (i.e. the number of dimensions)
const IndexVectorgetGridExtent () const
 Get the extents of the logical grid (i.e. the size in each dimension)
unsigned int getNumberOfFrames () const
 Get total number of frames.
bool frameExists (const IndexVector &position) const
 Return true if frame at a given grid position exists.
void getEmptyFrames (std::vector< IndexVector > &positions) const
 Fill positions vector with unoccupied logical grid positions, i.e.

Static Public Attributes

static std::string privateCreator
 Private creator string used for storing the StructuredMF info.

Access all tags valid for a given grid position

enum  ExtractMode { ExtractSharedAndSpecific, ExtractSpecific, ExtractSpecificWithSharedParent }
 Constants for extracting DICOM tags for a given index vector. More...
Const_TagPtr tagForGridPosition (TagId tagId, IndexVector gridPosition) const
 Get a pointer to the specified tag for a given grid position.
Const_TagPtr tagForGridPosition (TagId tagId, unsigned int z, unsigned int t=0, unsigned int u1=0) const
Const_TagPtr tagForGridPosition (TagId tagId, IndexVector gridPosition, const std::string &privateCreator, Vr privateVr=UN) const
 Get a pointer to the specified tag for a given index vector or grid position.
Const_TagPtr tagForGridPosition (TagId tagId, const std::string &privateCreator, Vr privateVr, unsigned int z, unsigned int t=0, unsigned int u1=0) const
int frameIndexForGridPosition (const IndexVector &gridPosition) const
 Get the frame index of the original image for a given grid position Returns -1 if the slice does not belong to a multi-frame or if the grid position is out of bounds.
int frameIndexForGridPosition (unsigned int z, unsigned int t=0, unsigned int u1=0) const
TreePtr extractTagTreeForGridPosition (IndexVector gridPosition, ExtractMode mode=ExtractSharedAndSpecific) const
 Extract all DICOM tags for a given index vector (deep copy) Returns a null pointer if the grid position is out of bounds.
TreePtr extractTagTreeForGridPosition (unsigned int z, unsigned int t=0, unsigned int u1=0, ExtractMode mode=ExtractSharedAndSpecific) const
void setTagForGridPosition (TagPtr tag, const IndexVector &gridPosition, const std::string &privateCreator="", bool skipInvalidPrivateTags=true)
 Add/replace specified tag for a given grid position (no copy); if skipInvalidPrivateTags is false then private tags without creator will throw exceptions, otherwise (in true case) they will be skipped without exception.
void setTagForGridPosition (TagPtr tag, unsigned int z, unsigned int t=0, unsigned int u1=0, const std::string &privateCreator="")
void setGridPositionSpecificTags (TreePtr tree, const IndexVector &gridPosition, bool skipInvalidPrivateTags=true)
 Add/replace specific tags for a given grid position (no copy); if skipInvalidPrivateTags is false then private tags without creator will throw exceptions, otherwise (in true case) they will be skipped without exception.
void setGridPositionSpecificTags (TreePtr tree, unsigned int z, unsigned int t=0, unsigned int u1=0)
void setFrameIndexForGridPosition (unsigned int frameIndex, const IndexVector &gridPosition)
 Set frame index of original image (for MF data only)
void setFrameIndexForGridPosition (unsigned int frameIndex, unsigned int z, unsigned int t=0, unsigned int u1=0)

Check validity of SMF object

enum  StatusCode {
  OK = 0, NO_PER_FRAME_TAGS, AMBIGUOUS_TAG, INCONSISTENT_PER_FRAME_TAGS,
  NUM_STATUS_CODES
}
 Status code constants. More...
void normalizeTagStructure (double tolerance=0.0, bool compress=true)
 Make sure all grid position specific tags are consistent: each tag shall exist either for each grid position or as shared tag if compress is true, per frame tags that have the same value for all frames will be replaced by a shared tag.

Detailed Description

Support for structured multi-frame (SMF) DICOM objects.

An SMF object contains DICOM tags of multiple images that are organized in a multi-dimensional grid (dimensions are depth, time points, and an arbitrary number of user defined dimensions) The grid is represented by hierarchical sequences (one level for each dimension), the highest dimension being at the root level.

Example: 4D image with 2 time points and 3 slices per time point ---------------------------------------------------------------- Shared tag 1 ... Shared tag N Dimension info tag = 3 \ 2 Dimension sequence -> item 1 - time point 1 specific tags

  • dimension sequence -> item 1 - slice/time spec. tags item 2 - slice/time spec. tags item 3 - slice/time spec. tags item 2 - time point 2 specific tags
  • dimension sequence -> item 1 - slice/time spec. tags item 2 - slice/time spec. tags item 3 - slice/time spec. tags

Definition at line 48 of file DCMTree_StructuredMF.h.


Member Typedef Documentation

typedef std::vector<unsigned int> DCMTree::StructuredMF::IndexVector

Index vector type, ordered as (z, t, u1, u2, ...)

Definition at line 53 of file DCMTree_StructuredMF.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
privateGroupId 

The (fixed) private group in which the StructuredMF info is stored.

dimensionsOffset 

Element offset for number of dimensions.

dimensionSequenceOffset 

Element offset for dimension sequence.

frameIndexOffset 

Element offset for frame index.

Definition at line 59 of file DCMTree_StructuredMF.h.

Constants for extracting DICOM tags for a given index vector.

Enumerator:
ExtractSharedAndSpecific 

Shared and frame-specific tags are copied to new tree.

ExtractSpecific 

Only frame-specific tags are copied to new tree.

ExtractSpecificWithSharedParent 

Frame-specific tags are copied to new tree, shared tags are inherited.

Definition at line 130 of file DCMTree_StructuredMF.h.

Status code constants.

Enumerator:
OK 

Object valid.

NO_PER_FRAME_TAGS 

A per-frame tag list is empty.

AMBIGUOUS_TAG 

A per-frame tag list contains a tag already defined by the shared tag list.

INCONSISTENT_PER_FRAME_TAGS 

The per-frame tag lists define different sets of tags.

NUM_STATUS_CODES 

Definition at line 165 of file DCMTree_StructuredMF.h.


Constructor & Destructor Documentation

DCMTree::StructuredMF::StructuredMF ( Const_TreePtr  tree)

ctor - gets the tree of the DICOM tags for the SMF Use this constructor to access an existing SMF object.

Make sure that the DICOM tags defining the SMF structure are not modified during the lifetime of this object.

DCMTree::StructuredMF::StructuredMF ( TreePtr  tree)

ctor - gets the tree of the DICOM tags for the SMF Use this constructor to access an existing writable SMF object The DICOM tags in the new object can be freely modified

DCMTree::StructuredMF::StructuredMF ( TreePtr  sharedTagTree,
const IndexVector gridExtent 
)

ctor - create a DICOM SMF object from the tree of common tags, the extent of the logical grid and the tag id's associated with the individual grid dimensions.

DCMTree::StructuredMF::StructuredMF ( TreePtr  sharedTagTree,
unsigned int  depth,
unsigned int  timePoints = 0,
unsigned int  u1Size = 0 
)

Member Function Documentation

TreePtr DCMTree::StructuredMF::extractSharedTagTree ( ) const

Extract all DICOM tags valid for all frames (deep copy)

TreePtr DCMTree::StructuredMF::extractTagTreeForGridPosition ( IndexVector  gridPosition,
ExtractMode  mode = ExtractSharedAndSpecific 
) const

Extract all DICOM tags for a given index vector (deep copy) Returns a null pointer if the grid position is out of bounds.

TreePtr DCMTree::StructuredMF::extractTagTreeForGridPosition ( unsigned int  z,
unsigned int  t = 0,
unsigned int  u1 = 0,
ExtractMode  mode = ExtractSharedAndSpecific 
) const
bool DCMTree::StructuredMF::frameExists ( const IndexVector position) const

Return true if frame at a given grid position exists.

int DCMTree::StructuredMF::frameIndexForGridPosition ( unsigned int  z,
unsigned int  t = 0,
unsigned int  u1 = 0 
) const
int DCMTree::StructuredMF::frameIndexForGridPosition ( const IndexVector gridPosition) const

Get the frame index of the original image for a given grid position Returns -1 if the slice does not belong to a multi-frame or if the grid position is out of bounds.

void DCMTree::StructuredMF::getEmptyFrames ( std::vector< IndexVector > &  positions) const

Fill positions vector with unoccupied logical grid positions, i.e.

positions for which no frame data has been set.

boost::uint32_t DCMTree::StructuredMF::getGridDimension ( ) const

Get the dimension of the logical grid (i.e. the number of dimensions)

All frames in a structured multi-frame (SMF) object are located at different positions in a logical, multi-dimensional grid. By convention, this grid has a spatial dimension (z), a time dimension (t), and optionally additional user dimensions (u1, u2, ...).

const IndexVector& DCMTree::StructuredMF::getGridExtent ( ) const

Get the extents of the logical grid (i.e. the size in each dimension)

unsigned int DCMTree::StructuredMF::getNumberOfFrames ( ) const

Get total number of frames.

void DCMTree::StructuredMF::normalizeTagStructure ( double  tolerance = 0.0,
bool  compress = true 
)

Make sure all grid position specific tags are consistent: each tag shall exist either for each grid position or as shared tag if compress is true, per frame tags that have the same value for all frames will be replaced by a shared tag.

void DCMTree::StructuredMF::setFrameIndexForGridPosition ( unsigned int  frameIndex,
const IndexVector gridPosition 
)

Set frame index of original image (for MF data only)

Exceptions:
DCMTree::Exceptionif the grid position is out of bounds
void DCMTree::StructuredMF::setFrameIndexForGridPosition ( unsigned int  frameIndex,
unsigned int  z,
unsigned int  t = 0,
unsigned int  u1 = 0 
)
void DCMTree::StructuredMF::setGridPositionSpecificTags ( TreePtr  tree,
unsigned int  z,
unsigned int  t = 0,
unsigned int  u1 = 0 
)
void DCMTree::StructuredMF::setGridPositionSpecificTags ( TreePtr  tree,
const IndexVector gridPosition,
bool  skipInvalidPrivateTags = true 
)

Add/replace specific tags for a given grid position (no copy); if skipInvalidPrivateTags is false then private tags without creator will throw exceptions, otherwise (in true case) they will be skipped without exception.

Exceptions:
DCMTree::Exceptionif the grid position is out of bounds
void DCMTree::StructuredMF::setSharedTags ( TreePtr  tree,
bool  handleFuncGroups = true 
)

Add/replace shared tags with the given tag tree (no copy)

void DCMTree::StructuredMF::setTagForGridPosition ( TagPtr  tag,
const IndexVector gridPosition,
const std::string &  privateCreator = "",
bool  skipInvalidPrivateTags = true 
)

Add/replace specified tag for a given grid position (no copy); if skipInvalidPrivateTags is false then private tags without creator will throw exceptions, otherwise (in true case) they will be skipped without exception.

Exceptions:
DCMTree::Exceptionif the grid position is out of bounds
void DCMTree::StructuredMF::setTagForGridPosition ( TagPtr  tag,
unsigned int  z,
unsigned int  t = 0,
unsigned int  u1 = 0,
const std::string &  privateCreator = "" 
)
Const_TagPtr DCMTree::StructuredMF::sharedTag ( TagId  tagId) const

Get a const pointer to the specified shared tag.

Const_TagPtr DCMTree::StructuredMF::sharedTag ( TagId  tagId,
const std::string &  privateCreator,
Vr  privateVr = UN 
) const

Get a const pointer to the specified shared tag with the given private creator and VR.

TagPtr DCMTree::StructuredMF::sharedTag_rw ( TagId  tagId)

Get a writable pointer to the specified shared tag.

Returns only tags which are found by using the TagSelector "Owned". Parent tags are omitted.

Const_TagPtr DCMTree::StructuredMF::tagForGridPosition ( TagId  tagId,
IndexVector  gridPosition,
const std::string &  privateCreator,
Vr  privateVr = UN 
) const

Get a pointer to the specified tag for a given index vector or grid position.

If the tag is a private tag, the private creator is used for the lookup, and the vr is set if not known. Returns a null pointer if no tag is found or the grid position is out of bounds

Const_TagPtr DCMTree::StructuredMF::tagForGridPosition ( TagId  tagId,
unsigned int  z,
unsigned int  t = 0,
unsigned int  u1 = 0 
) const
Const_TagPtr DCMTree::StructuredMF::tagForGridPosition ( TagId  tagId,
IndexVector  gridPosition 
) const

Get a pointer to the specified tag for a given grid position.

Returns a null pointer if no tag is found or the grid position is out of bounds

Const_TagPtr DCMTree::StructuredMF::tagForGridPosition ( TagId  tagId,
const std::string &  privateCreator,
Vr  privateVr,
unsigned int  z,
unsigned int  t = 0,
unsigned int  u1 = 0 
) const
TreePtr DCMTree::StructuredMF::tagTree ( )

Return a pointer to the contained tag tree.

Const_TreePtr DCMTree::StructuredMF::tagTree ( ) const

Return a const pointer to the contained tag tree.


Member Data Documentation

Private creator string used for storing the StructuredMF info.

Definition at line 56 of file DCMTree_StructuredMF.h.


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