13 #ifndef DCM_TREE_TAG_H
14 #define DCM_TREE_TAG_H
25 #pragma warning (push)
26 #pragma warning (disable : 4350 4365 4548)
60 Tag(
const Tag &other,
unsigned short slot);
82 bool isEqual(
const Tag& other,
double tolerance = 0 )
const;
209 void setValue (std::string value,
unsigned int idx=0);
322 int toInt (
unsigned int idx=0)
const;
342 unsigned int toUInt (
unsigned int idx=0)
const;
349 void setValue (
unsigned int value,
unsigned int idx=0);
369 void setValue (
short int value,
unsigned int idx=0);
382 unsigned short toUShort (
unsigned int idx=0)
const;
389 void setValue (
unsigned short int value,
unsigned int idx=0);
440 virtual void toStream (std::ostream &out,
bool writeName)
const;
450 int compare(
const Tag& tag,
double tolerance = 0.0001)
const;
474 int compareNumerical(
const Tag& tag,
int nMin,
double tolerance)
const;
482 int compareBytes(
const Tag& tag,
int nMin)
const;
487 void typeAndRangeChecking (
const VRCType &vrctype,
const unsigned int &idx)
const;
492 void typeChecking (
const VRCType &vrctype)
const;
497 bool isOfType(
const VRCType &vrctype)
const;
502 void rangeChecking (
const unsigned int &idx)
const;
507 void sequenceRangeChecking (
const unsigned int &idx)
const;
Class to carry meta-information about a specific tag.
Class to represent one dicom tag.
double toDouble(unsigned int idx=0) const
get the value of tag-value idx as double throws if type-checking failed throws if the index is out of...
virtual Value & addValue()
add a value and return a reference for further processing be careful - no type checking !
bool isEqual(const Tag &other, double tolerance=0) const
compare the tag with all contained values for equality; use tolerance for float value comparison
int toInt(unsigned int idx=0) const
get the value of tag-value idx as int throws if type-checking failed throws if the index is out of ra...
DateTime toDateTime(unsigned int idx=0) const
get the value of tag-value idx as datetime throws if type-checking failed throws if the index is out ...
bool operator==(const Tag &other) const
compare the tag with all contained values for equality
void setValue(std::string value, unsigned int idx=0)
set the value of tag-value idx as string throws if type-checking failed throws if the index is out of...
void serializeX(DCMTree_Serialization::Sink &sink) const override
Writes data of this object to Sink.
bool operator!=(const Tag &other) const
void addValue(float value)
add a value of this tag as float throws if type-checking failed
virtual boost::uint32_t numberOfValues() const
get the number of values of this tag
void addValue(std::string value)
convert string to one or more values and add them to this tag throws if not convertible
void addValue(Date value)
add a value of this tag as date throws if type-checking failed
Tag(const Tag &other)
copy ctor - uses operator=
void addSequenceItem(const TreePtr &sequence)
add the given TreePtr as sequence to this tag the referenced Tree remains valid tag stores only the r...
void addValue(DateTime value)
add a value of this tag as datetime throws if type-checking failed
virtual void fromStream(std::istream &in, bool readName)
extract this instance from the given stream readName = true reads tag name(s) from stream,...
void addValue(Time value)
add a value of this tag as time throws if type-checking failed
bool isEmpty() const
return true if this tag has no sequences and no values
unsigned short toUShort(unsigned int idx=0) const
get the value of tag-value idx as unsigned short throws if type-checking failed throws if the index i...
void deserializeX(DCMTree_Serialization::Source &source) override
Overwrites data of this object with data from Source.
void setSequenceItem(const TreePtr &sequence, unsigned idx=0)
set the sequence with index idx same as addSequenceItem throws if the index is out of range
virtual TagPtr copy() const
make a deep-copy of this
void setValue(short int value, unsigned int idx=0)
set the value of tag-value idx as short throws if type-checking failed throws if the index is out of ...
void addValue(short int value)
add a value of this tag as short throws if type-checking failed
void addValue(double value)
add a value of this tag as double throws if type-checking failed
bool isSequence() const
return true if the vr of this tag is SQ
void setValue(DateTime value, unsigned int idx=0)
set the value of tag-value idx as datetime throws if type-checking failed throws if the index is out ...
int compare(const Tag &tag, double tolerance=0.0001) const
Copied from DicomTags (Marcus Barann).
virtual void toStream(std::ostream &out, bool writeName) const
copy this instance recursively into the given stream writeName = true writes tag name(s) to stream,...
void dropValues()
drop all values of this tag does not drop sequences! these are handled differently!
Tag(const Tag &other, unsigned short slot)
copy ctor for private tags with a given private slot
TagInfo const & tagInfo() const
short int toShort(unsigned int idx=0) const
get the value of tag-value idx as short throws if type-checking failed throws if the index is out of ...
unsigned int toUInt(unsigned int idx=0) const
get the value of tag-value idx as unsigned int throws if type-checking failed throws if the index is ...
void dropSequenceItem(unsigned idx)
drop the idx sequences of this tag throws if this tag tag is not of type SQ or the index is out of ra...
const TagInfo & info() const
get the tag-info (type etc.) of this tag
const Value & getValue(unsigned int idx=0) const
get the value-object with index idx throws if the index is out of range be careful - no type checking...
TreePtrVector & sequenceItems()
access the probably embedded sequences of this tag throws if this tag is not of type SQ!
void setValue(int value, unsigned int idx=0)
set the value of tag-value idx as int throws if type-checking failed throws if the index is out of ra...
boost::uint32_t numberOfSequenceItems() const
get the number of embedded sequence items of this tag does not check for SQ
void setValue(double value, unsigned int idx=0)
set the value of tag-value idx as double throws if type-checking failed throws if the index is out of...
void setValue(unsigned short int value, unsigned int idx=0)
set the value of tag-value idx as unsigned short throws if type-checking failed throws if the index i...
Tag & operator=(const Tag &other)
deep copy all values from other to this handles self-assignment well
void addValue(int value)
add a value of this tag as int throws if type-checking failed
void setInfo(const TagInfo &info)
set the tag-info for this tag be careful if changing vr!
const TreePtrVector & sequenceItems() const
access the probably embedded sequences of this tag throws if this tag is not of type SQ!
std::string toString(unsigned int idx, StringTrimMode trimMode=DO_NOT_TRIM) const
get the value of tag-value idx as string throws if type-checking failed throws if the index is out of...
Tag(const TagInfo &info)
ctor info defines the datatype, name etc.
void setValue(const Value &value, unsigned int idx=0)
set the value-object with index idx throws if the index is out of range be careful - no type checking...
float toFloat(unsigned int idx=0) const
get the value of tag-value idx as float throws if type-checking failed throws if the index is out of ...
void setValue(Date value, unsigned int idx=0)
set the value of tag-value idx as date throws if type-checking failed throws if the index is out of r...
void setValue(Time value, unsigned int idx=0)
set the value of tag-value idx as time throws if type-checking failed throws if the index is out of r...
void addValue(unsigned int value)
add a value of this tag as unsigned int throws if type-checking failed
Date toDate(unsigned int idx=0) const
get the value of tag-value idx as date throws if type-checking failed throws if the index is out of r...
void setVr(Vr vr)
Set a new value representation if the VR is unknown.
void setValue(float value, unsigned int idx=0)
set the value of tag-value idx as float throws if type-checking failed throws if the index is out of ...
Time toTime(unsigned int idx=0) const
get the value of tag-value idx as time throws if type-checking failed throws if the index is out of r...
void setValue(unsigned int value, unsigned int idx=0)
set the value of tag-value idx as unsigned int throws if type-checking failed throws if the index is ...
bool isNull(unsigned idx) const
check if the values with index idx is null throws if the index is out of range
virtual boost::uint32_t getValueSize(unsigned int idx) const
get the size in bytes of the data of the value-object with index idx throws if the index is out of ra...
virtual boost::uint32_t getValueSize() const
get the total size in bytes of the data of the values
TreePtr & addSequenceItem()
add a sequence to this tag and return a reference to it for further processing
bool isSequenceItemNull(unsigned idx) const
checks if the sequence with index idx is null throws if the index is out of range
void addValue(unsigned short int value)
add a value of this tag as unsigned short throws if type-checking failed
void dropSequenceItems()
drop all sequences of this tag does not check for SQ (if not SQ you just drop nothing)
std::string toString(StringTrimMode trimMode=DO_NOT_TRIM) const
convert the complete tag to a string that means, all values are concatenated by a backslash and conve...
Class to store tag-values.
Interface which provides a method to deserialize an object.
Interface which provides a method to serialize an object.
Interface of a data sink for the serialization of objects.
Interface of a data source for the deserialization of objects.
class to dump a DCMTree dicom message into a human readable file this class could be used as a starte...
std::pair< Date, Time > DateTime
DateTime.
std::istream & operator>>(std::istream &in, Message &m)
VRCType
vr interpretation in C++
boost::shared_ptr< Tag > TagPtr
shared-pointer to tag
std::vector< TreePtr > TreePtrVector
a vector of TreePtr - used for sequences
std::vector< Value > ValueVector
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
std::ostream & operator<<(std::ostream &out, const Message &m)
boost::graph_traits< ml_graph_ptr >::vertex_descriptor source(graph_traits< ml_graph_ptr >::edge_descriptor e, const ml_graph_ptr)
Returns the vertex descriptor for u of the edge (u,v) represented by e.
Date class for DCMTree library.
Time class for DCMTree library.