20 explicit TagMask(
const std::string& group_,
const std::string& element_)
25 if (group_.size() != 4 || element_.size() != 4) {
26 throw vega::Exception(
"Invalid group/element in TagMask: " + group_ +
", " + element_);
29 std::string group(group_);
30 std::transform(group.begin(), group.end(), group.begin(), ::tolower);
31 std::string element(element_);
32 std::transform(element.begin(), element.end(), element.begin(), ::tolower);
38 for (
int i = 0; i < 4; ++i) {
41 m_mask_tag.
group() |= (0xF << 4*i);
43 if (c >=
'0' && c <=
'9') {
47 digit = 10 + (c -
'a');
50 m_value_tag.
group() |= (digit << 4*i);
55 for (
int i = 0; i < 4; ++i) {
58 m_mask_tag.
element() |= (0xF << 4*i);
60 if (c >=
'0' && c <=
'9') {
64 digit = 10 + (c -
'a');
67 m_value_tag.
element() |= (digit << 4*i);
74 m_value_tag(group_value, element_value),
75 m_mask_tag(group_mask, element_mask)
uint16_t element_type
Definition: tag.h:18
bool operator!=(const TagMask &other) const
Definition: tag_mask.h:90
const Tag & value_tag() const
Definition: tag_mask.h:78
bool operator==(const TagMask &other) const
Definition: tag_mask.h:89
bool is_single() const
Definition: tag_mask.h:81
bool operator<(const TagMask &other) const
Definition: tag_mask.h:91
constexpr TagMask(const Tag::group_type &group_value, const Tag::group_type &group_mask, const Tag::element_type &element_value, const Tag::element_type &element_mask)
Definition: tag_mask.h:72
const group_type & group() const
const Tag & singular_tag() const
Definition: tag_mask.h:82
The base class for exceptions that are raised by the vega library.
Definition: vega.h:11
bool contains(const Tag &tag) const
Definition: tag_mask.h:109
TagMask(const std::string &group_, const std::string &element_)
Definition: tag_mask.h:20
unsigned popcount(uint64_t x)
Definition: tag_mask.h:11
const element_type & element() const
uint16_t group_type
Definition: tag.h:17
Class for working with DICOM data element tags.
Definition: tag.h:15
const Tag & mask_tag() const
Definition: tag_mask.h:79
unsigned mask_popcount() const
Definition: tag_mask.h:87