15 #include <gdcmGlobal.h> 16 #include <gdcmDicts.h> 18 #include <boost/algorithm/string.hpp> 21 #include "dcmtk/ofstd/ofstd.h" 32 :m_Group(other.m_Group)
33 ,m_Element(other.m_Element)
42 m_Group == other.m_Group &&
43 m_Element == other.m_Element
54 m_Group = other.m_Group;
55 m_Element = other.m_Element;
79 ( this->m_Group < other.m_Group )
81 ( ( this->m_Group == other.m_Group )
83 ( this->m_Element < other.m_Element )
91 gdcm::Tag t(m_Group, m_Element);
93 const gdcm::Global& g = gdcm::Global::GetInstance();
94 const gdcm::Dicts& dicts = g.GetDicts();
95 const gdcm::Dict& pub = dicts.GetPublicDict();
97 const gdcm::DictEntry& entry = pub.GetDictEntry(t);
98 std::string name = entry.GetName();
101 name =
"Unknown Tag";
109 ::toHexString(
unsigned int i)
const 111 std::stringstream ss;
112 ss << std::setfill (
'0') << std::setw(4) << std::hex << i;
120 os <<
"(" << toHexString(m_Group) <<
"," << toHexString(m_Element) <<
") " << this->
GetName();
132 std::vector<std::string> strs;
133 boost::split( strs, s, boost::is_any_of(
"\\" ) );
134 if ( strs.size() == 6 )
139 right[i] = OFStandard::atof( strs[i].c_str() );
143 up[i - 3] = OFStandard::atof( strs[i].c_str() );
148 catch (
const std::exception& )
164 bool successful =
false;
168 std::vector<std::string> strs;
169 boost::split( strs, s, boost::is_any_of(
"\\" ) );
170 if ( strs.size() > 1 )
172 spacingY = OFStandard::atof( strs[0].c_str() );
173 spacingX = OFStandard::atof( strs[1].c_str() );
177 catch (
const std::exception& )
192 std::vector<std::string> strs;
193 boost::split( strs, s, boost::is_any_of(
"\\" ) );
194 if ( strs.size() == 3 )
196 for (
int i = 0; i < 3; ++i )
198 p[i] = OFStandard::atof( strs[i].c_str() );
202 catch (
const std::exception& )
unsigned int GetElement() const
void Print(std::ostream &os) const
add "(group-id,element-id) name" to given stream
bool DICOMStringToSpacing(const std::string &s, ScalarType &spacingX, ScalarType &spacingY)
void DICOMStringToOrientationVectors(const std::string &s, Vector3D &right, Vector3D &up, bool &successful)
Convert DICOM string describing a point two Vector3D.
Representation of a DICOM tag.
DICOMTag(unsigned int group, unsigned int element)
bool operator==(const DICOMTag &other) const
DICOMTag & operator=(const DICOMTag &other)
std::string GetName() const
Return the name of this tag (e.g. "SeriesDescription" instead of "(0008,103e)")
bool operator<(const DICOMTag &other) const
Point3D DICOMStringToPoint3D(const std::string &s, bool &successful)
Convert DICOM string describing a point to Point3D.
unsigned int GetGroup() const