MeVisLab Scripting Reference
MLABDicomTag Class Reference

#include <mlabDicomTag.h>

Inherits QObject.

Inherited by MLABMutableDicomTag.

Public Slots

Scripting access.


int groupId () const
 
int elementId () const
 
QString id () const
 
QString vr () const
 
QString tagName () const
 
int compare (const MLABDicomTag *tag, double tolerance=0) const
 
QList< MLABDicomTree * > sequenceItems () const
 
MLABDicomTree * getSequenceItem (int index) const
 
int numberOfValues () const
 
int numberOfSequenceItems () const
 
bool isNull (int idx) const
 
bool isSequenceItemNull (int idx) const
 
bool isEmpty () const
 
bool isSequence () const
 
bool isInteger () const
 
bool isFloat () const
 
bool isDate () const
 
bool isTime () const
 
bool isDateTime () const
 
bool isBinary () const
 
bool isTagId () const
 
QString toString (int idx) const
 
QString toString () const
 
QVariant toNumPyArray () const
 
QVariant value (int idx=0) const
 
QVariantList values () const
 
unsigned int getValueSize (int idx=0) const
 
bool isEqual (MLABDicomTag *other, double tolerance=0.)
 

Detailed Description

This class wraps a DCMTree::Const_TagPtr for scripting use.

Objects of this class are handed to the scripting API and deleted when not referenced anymore.

Member Function Documentation

◆ compare

int MLABDicomTag::compare ( const MLABDicomTag *  tag,
double  tolerance = 0 
) const
slot

Compares this to tag and returns -1 if this < tag, 0 if this == tag, and 1 if this > tag.

Comparison is performed value by value if both tags are numeric; otherwise, byte by byte. If one tag is numeric and the other is a string, this results in nonsense. tolerance specifies the relative difference that is still accepted for 'equal' result.

◆ elementId

int MLABDicomTag::elementId ( ) const
slot

Returns the element ID of this tag as decimal integer.

◆ getSequenceItem

MLABDicomTree * MLABDicomTag::getSequenceItem ( int  index) const
slot

Returns a mutable sequence tree, returns NULL if index is invalid.

◆ getValueSize

unsigned int MLABDicomTag::getValueSize ( int  idx = 0) const
slot

Returns the size of value with given index idx (especially important for binary data).

◆ groupId

int MLABDicomTag::groupId ( ) const
slot

Returns the group ID of this tag as decimal integer.

(Remember that DICOM IDs are normally shown with hexadecimal notation!) Private tags have an odd group ID.

◆ id

QString MLABDicomTag::id ( ) const
slot

Returns the ID of this tag as a string with format "(xxxx,yyyy)", where xxxx is the group ID and yyyy is the element ID in hexadecimal notation.

◆ isBinary

bool MLABDicomTag::isBinary ( ) const
slot

Returns whether this tag contains binary data.

The value() method will return a string object containing the bytes if this returns true. Since the whole value will be copied, value() should only be used with care in this case.

◆ isDate

bool MLABDicomTag::isDate ( ) const
slot

Returns whether this tag contains date values (only).

The value() method will return a date object if this returns true.

◆ isDateTime

bool MLABDicomTag::isDateTime ( ) const
slot

Returns whether this tag contains date+time values.

The value() method will return a date/time object if this returns true.

◆ isEmpty

bool MLABDicomTag::isEmpty ( ) const
slot

Returns whether this tag has no sequences and no values.

◆ isEqual

bool MLABDicomTag::isEqual ( MLABDicomTag *  other,
double  tolerance = 0. 
)
slot

Compares this with another tag other with a given tolerance.

◆ isFloat

bool MLABDicomTag::isFloat ( ) const
slot

Returns whether this tag contains float values, including double precision and integer values.

The value() method will return a floating point number if this returns true.

◆ isInteger

bool MLABDicomTag::isInteger ( ) const
slot

Returns whether this tag contains integer values, including unsigned and short integers and tag IDs.

The value() method will return an integer number if this returns true.

◆ isNull

bool MLABDicomTag::isNull ( int  idx) const
slot

Returns whether the value with index idx is null. Returns false if index is out of range.

◆ isSequence

bool MLABDicomTag::isSequence ( ) const
slot

Returns whether this tag contains embedded DICOM trees.

◆ isSequenceItemNull

bool MLABDicomTag::isSequenceItemNull ( int  idx) const
slot

Returns whether the sequence with index idx is null. Returns false if index is out of range.

◆ isTagId

bool MLABDicomTag::isTagId ( ) const
slot

Returns whether this tag contains tag IDs.

The value() method will return an unsigned integer, where the upper 16-bit contain the group ID and the lower 16 bit contain the element ID. To receive a string containing a tag ID in the format as described in the id() method, use the toString() method.

◆ isTime

bool MLABDicomTag::isTime ( ) const
slot

Returns whether this tag contains time values (only).

The value() method will return a time object if this returns true.

◆ numberOfSequenceItems

int MLABDicomTag::numberOfSequenceItems ( ) const
slot

Returns the number of sequence items of this tag.

◆ numberOfValues

int MLABDicomTag::numberOfValues ( ) const
slot

Returns the number of values of this tag.

◆ sequenceItems

QList< MLABDicomTree * > MLABDicomTag::sequenceItems ( ) const
slot

Accesses the embedded DICOM trees of this tag.

Returns empty list if this tag is not of type SQ.

◆ tagName

QString MLABDicomTag::tagName ( ) const
slot

Returns the name of this tag (if known)

◆ toNumPyArray

QVariant MLABDicomTag::toNumPyArray ( ) const
slot

Returns the contained data as one-dimensional NumPy array.

◆ toString [1/2]

QString MLABDicomTag::toString ( ) const
slot

Converts the complete tag to a string, values concatenated by a backslash.

◆ toString [2/2]

QString MLABDicomTag::toString ( int  idx) const
slot

Returns the value of tag value idx as a string. Returns the empty string if failed.

◆ value

QVariant MLABDicomTag::value ( int  idx = 0) const
slot

Returns the value at the given index idx.

Returns integer, double, date, time, date/time, or string objects as appropriate.

◆ values

QVariantList MLABDicomTag::values ( ) const
slot

Returns a list of contained values. See value() for detail.

◆ vr

QString MLABDicomTag::vr ( ) const
slot

Returns the VR of this tag as a two-letter string.