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);
434 virtual void fromStream (std::istream &in,
bool readName,
size_t maxSize = 0);
441 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
Returns the value of tag value idx as double.
virtual Value & addValue()
Adds a value and return a reference for further processing.
bool isEqual(const Tag &other, double tolerance=0) const
Compares the tag with all contained values for equality; use tolerance for float value comparison.
int toInt(unsigned int idx=0) const
Returns the value of tag value idx as int.
DateTime toDateTime(unsigned int idx=0) const
Returns the value of tag value idx as datetime.
bool operator==(const Tag &other) const
Compares the tag with all contained values for equality.
void setValue(std::string value, unsigned int idx=0)
Sets the value of tag value idx as string.
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)
Adds a value of this tag as float.
virtual boost::uint32_t numberOfValues() const
Returns the number of values of this tag.
void addValue(std::string value)
Converts string to one or more values and add them to this tag.
~Tag() override
Destructor.
void addValue(Date value)
Adds a value of this tag as date.
Tag(const Tag &other)
Copy constructor that uses operator=.
void addSequenceItem(const TreePtr &sequence)
Adds the given TreePtr as a sequence to this tag.
void addValue(DateTime value)
Adds a value of this tag as datetime.
void addValue(Time value)
Adds a value of this tag as time.
bool isEmpty() const
Returns true if this tag has no sequences and no values.
unsigned short toUShort(unsigned int idx=0) const
Returns the value of tag value idx as unsigned short.
void deserializeX(DCMTree_Serialization::Source &source) override
Overwrites data of this object with data from source.
void setSequenceItem(const TreePtr &sequence, unsigned idx=0)
Sets the sequence with index idx.
virtual TagPtr copy() const
Makes a deep copy of this.
void setValue(short int value, unsigned int idx=0)
Sets the value of tag value idx as short.
void addValue(short int value)
Adds a value of this tag as short.
void addValue(double value)
Adds a value of this tag as double.
bool isSequence() const
Returns true if the VR of this tag is SQ.
void setValue(DateTime value, unsigned int idx=0)
Sets the value of tag value idx as datetime.
int compare(const Tag &tag, double tolerance=0.0001) const
Compares this to tag and returns -1 if this < tag, 0 if this == tag, and 1 if this > tag.
virtual void toStream(std::ostream &out, bool writeName) const
Copies this instance recursively into the given stream.
void dropValues()
Drop all values of this tag.
Tag(const Tag &other, unsigned short slot)
Copy constructor for private tags with a given private slot.
TagInfo const & tagInfo() const
short int toShort(unsigned int idx=0) const
Returns the value of tag value idx as short.
unsigned int toUInt(unsigned int idx=0) const
Returns the value of tag-value idx as unsigned int.
void dropSequenceItem(unsigned idx)
Drop the idx sequences of this tag.
const TagInfo & info() const
Returns the tag information (type, etc.) of this tag.
const Value & getValue(unsigned int idx=0) const
Returns the value object with index idx.
TreePtrVector & sequenceItems()
Accesses the probably embedded sequences of this tag.
void setValue(int value, unsigned int idx=0)
Sets the value of tag value idx as int.
boost::uint32_t numberOfSequenceItems() const
Returns the number of embedded sequence items of this tag.
void setValue(double value, unsigned int idx=0)
Sets the value of tag value idx as double.
void setValue(unsigned short int value, unsigned int idx=0)
Sets the value of tag value idx as unsigned short.
Tag & operator=(const Tag &other)
Deep copies all values from other to this.
void addValue(int value)
Adds a value of this tag as int.
void setInfo(const TagInfo &info)
Sets the tag info for this tag.
const TreePtrVector & sequenceItems() const
Accesses the probably embedded sequences of this tag.
std::string toString(unsigned int idx, StringTrimMode trimMode=DO_NOT_TRIM) const
Returns the value of tag value idx as a string.
Tag(const TagInfo &info)
Constructor info defines the data type, name, etc., of this tag.
void setValue(const Value &value, unsigned int idx=0)
Sets the value object with index idx.
float toFloat(unsigned int idx=0) const
Returns the value of tag value idx as float.
void setValue(Date value, unsigned int idx=0)
Sets the value of tag value idx as date.
void setValue(Time value, unsigned int idx=0)
Sets thevalue of tag value idx as time.
void addValue(unsigned int value)
Adds a value of this tag as unsigned int.
Date toDate(unsigned int idx=0) const
Returns the value of tag value idx as date.
void setVr(Vr vr)
Sets a new value representation if the VR is unknown.
void setValue(float value, unsigned int idx=0)
Sets the value of tag value idx as float.
Time toTime(unsigned int idx=0) const
Returns the value of tag value idx as time.
void setValue(unsigned int value, unsigned int idx=0)
Sets the value of tag value idx as unsigned int.
bool isNull(unsigned idx) const
Checks whether the values with index idx is null.
virtual boost::uint32_t getValueSize(unsigned int idx) const
Returns the size in bytes of the data of the value-object with index idx.
virtual void fromStream(std::istream &in, bool readName, size_t maxSize=0)
Extracts this instance from the given stream.
virtual boost::uint32_t getValueSize() const
Returns the total size in bytes of the data of the values.
TreePtr & addSequenceItem()
Adds a sequence to this tag and returns a reference to it for further processing.
bool isSequenceItemNull(unsigned idx) const
Checks whether the sequence with index idx is null.
void addValue(unsigned short int value)
Adds a value of this tag as unsigned short.
void dropSequenceItems()
Drops all sequences of this tag.
std::string toString(StringTrimMode trimMode=DO_NOT_TRIM) const
Converts the complete tag to a string.
Class to store tag values.
Interface that provides a method to deserialize an object.
Interface that 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.
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.