22 #include <gdcmGlobal.h>
23 #include <gdcmDicts.h>
25 #include <boost/algorithm/string.hpp>
39 :m_Group(other.m_Group)
40 ,m_Element(other.m_Element)
49 m_Group == other.m_Group &&
50 m_Element == other.m_Element
61 m_Group = other.m_Group;
62 m_Element = other.m_Element;
86 ( this->m_Group < other.m_Group )
88 ( ( this->m_Group == other.m_Group )
90 ( this->m_Element < other.m_Element )
98 gdcm::Tag t(m_Group, m_Element);
100 const gdcm::Global& g = gdcm::Global::GetInstance();
101 const gdcm::Dicts& dicts = g.GetDicts();
102 const gdcm::Dict& pub = dicts.GetPublicDict();
104 const gdcm::DictEntry& entry = pub.GetDictEntry(t);
105 std::string name = entry.GetName();
108 name =
"Unknown Tag";
116 ::toHexString(
unsigned int i)
const
118 std::stringstream ss;
119 ss << std::setfill (
'0') << std::setw(4) << std::hex << i;
127 os <<
"(" << toHexString(m_Group) <<
"," << toHexString(m_Element) <<
") " << this->
GetName();
139 std::vector<std::string> strs;
141 if ( strs.size() == 6 )
146 right[i] = OFStandard::atof( strs[i].c_str() );
150 up[i - 3] = OFStandard::atof( strs[i].c_str() );
155 catch (
const std::exception& )
171 bool successful =
false;
175 std::vector<std::string> strs;
177 if ( strs.size() > 1 )
179 spacingY = OFStandard::atof( strs[0].c_str() );
180 spacingX = OFStandard::atof( strs[1].c_str() );
184 catch (
const std::exception& )
199 std::vector<std::string> strs;
201 if ( strs.size() == 3 )
203 for (
int i = 0; i < 3; ++i )
205 p[i] = OFStandard::atof( strs[i].c_str() );
209 catch (
const std::exception& )
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.
unsigned int GetGroup() const
DICOMTag(unsigned int group, unsigned int element)
bool operator<(const DICOMTag &other) const
unsigned int GetElement() const
DICOMTag & operator=(const DICOMTag &other)
bool operator==(const DICOMTag &other) const
static std::string GetName(std::string fileName, std::string suffix)
Point3D DICOMStringToPoint3D(const std::string &s, bool &successful)
Convert DICOM string describing a point to Point3D.
std::string GetName() const
Return the name of this tag (e.g. "SeriesDescription" instead of "(0008,103e)")
void Print(std::ostream &os) const
add "(group-id,element-id) name" to given stream
static std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)