17#ifndef __file_dicom_element_h__ 
   18#define __file_dicom_element_h__ 
   20#include <unordered_map> 
   48          Date (
const std::string& entry) :
 
   50            if (entry.size() >= 8) {
 
   51              year = to<uint32_t> (entry.substr (0, 4));
 
   52              month = to<uint32_t> (entry.substr (4, 2));
 
   53              day = to<uint32_t> (entry.substr (6, 2));
 
   55            if (year < 1000 || month > 12 || 
day > 31)
 
   56              throw Exception (
"Error converting string \"" + entry + 
"\" to date");
 
   66              throw Exception (
"field \"" + entry + 
"\" is too short to be interpreted as a time");
 
   67            hour  = to<uint32_t> (entry.substr (0, 2));
 
   68            minute = to<uint32_t> (entry.substr (2, 2));
 
   69            second = to<uint32_t> (entry.substr (4, 2));
 
   70            fraction = entry.size() > 6 ? to<default_type> (entry.substr (6)) : 0.0;
 
   75              throw Exception (
"Error converting negative floating-point number to a time");
 
   78              throw Exception (
"Error converting floating-point number to a time: Beyond 24 hours");
 
  116          void set (
const std::string& filename, 
bool force_read = 
false, 
bool read_write = 
false);
 
  132            union __DICOM_group_element_pair__ { uint16_t s[2]; uint32_t i; } val = { {
 
  133#if MRTRIX_BYTE_ORDER_BIG_ENDIAN 
  144            return address - 
fmap->address();
 
  165          int32_t     
get_int (
size_t idx, int32_t default_value = 0)
                    const { 
auto v (
get_int());    
return check_get (idx, v.size()) ? v[idx] : default_value; }
 
  166          uint32_t    
get_uint (
size_t idx, uint32_t default_value = 0)
                  const { 
auto v (
get_uint());   
return check_get (idx, v.size()) ? v[idx] : default_value; }
 
  167          double      get_float (
size_t idx, 
double default_value = 0.0)
                 const { 
auto v (
get_float());  
return check_get (idx, v.size()) ? v[idx] : default_value; }
 
  168          std::string 
get_string (
size_t idx, std::string default_value = std::string())
 const { 
auto v (
get_string()); 
return check_get (idx, v.size()) ? v[idx] : default_value; }
 
  176             return "TYPE  GRP  ELEM VR     SIZE   OFFSET   NAME                                   CONTENTS\n" 
  177                    "----- ---- ---- --  -------  -------   -------------------------------------  ---------------------------------------\n";
 
  181          template <
typename VectorType>
 
  183              if (v.size() < min_size)
 
  189          std::unique_ptr<File::MMap> 
fmap;
 
  208          static std::unordered_map<uint32_t, const char*> 
dict;
 
Date(const std::string &entry)
 
friend std::ostream & operator<<(std::ostream &stream, const Date &item)
 
double get_float(size_t idx, double default_value=0.0) const
 
bool is_new_sequence() const
 
enum MR::File::Dicom::Element::_Type Type
 
void set_explicit_encoding()
 
int32_t get_int(size_t idx, int32_t default_value=0) const
 
vector< Sequence > parents
 
static std::string print_header()
 
FORCE_INLINE void check_size(const VectorType v, size_t min_size=1)
 
friend std::ostream & operator<<(std::ostream &stream, const Element &item)
 
bool check_get(size_t idx, size_t size) const
 
std::string get_string(size_t idx, std::string default_value=std::string()) const
 
void report_unknown_tag_with_implicit_syntax() const
 
static std::unordered_map< uint32_t, const char * > dict
 
bool transfer_syntax_supported
 
vector< uint8_t * > end_seq
 
void error_in_get(size_t idx) const
 
bool ignore_when_parsing() const
 
bool is_big_endian() const
 
bool is_transfer_syntax_BE
 
std::pair< Date, Time > get_datetime() const
 
vector< uint32_t > get_uint() const
 
void error_in_check_size(size_t min_size, size_t actual_size) const
 
bool is(uint16_t Group, uint16_t Element) const
 
vector< default_type > get_float() const
 
bool is_in_series_ref_sequence() const
 
uint32_t get_uint(size_t idx, uint32_t default_value=0) const
 
vector< std::string > get_string() const
 
static const char * type_as_str[]
 
vector< int32_t > get_int() const
 
size_t offset(uint8_t *address) const
 
std::string tag_name() const
 
std::string as_string() const
 
std::unique_ptr< File::MMap > fmap
 
uint16_t get_VR_from_tag_name(const std::string &name)
 
void set(const std::string &filename, bool force_read=false, bool read_write=false)
 
bool is(uint16_t Group, uint16_t Element) const
 
Sequence(uint16_t group, uint16_t element, uint8_t *end)
 
friend std::ostream & operator<<(std::ostream &stream, const Time &item)
 
Time(const std::string &entry)
 
Time operator-(const Time &t) const
 
constexpr I floor(const T x)
template function with cast to different type
 
ValueType BE(ValueType v)
 
double default_type
the default type used throughout MRtrix