Tatooine
image_data.h
Go to the documentation of this file.
1#ifndef TATOOINE_GEOMETRY_VTK_XML_IMAGE_DATA_H
2#define TATOOINE_GEOMETRY_VTK_XML_IMAGE_DATA_H
3//==============================================================================
5
6#include <array>
7#include <rapidxml.hpp>
8//==============================================================================
9namespace tatooine::vtk::xml {
10//==============================================================================
11struct reader;
13 std::array<std::size_t, 3> whole_extent1;
14 std::array<std::size_t, 3> whole_extent2;
15 std::array<double, 3> origin;
16 std::array<double, 3> spacing;
17 explicit image_data(reader& r, rapidxml::xml_node<>* node)
18 : piece_set{r, node} {
19 if (auto const attr = node->first_attribute("WholeExtent");
20 attr != nullptr) {
21 auto ss = std::stringstream{attr->value()};
22 ss >> whole_extent1[0] >> whole_extent2[0] >> whole_extent1[1] >>
24 }
25 if (auto const attr = node->first_attribute("Origin"); attr != nullptr) {
26 auto ss = std::stringstream{attr->value()};
27 ss >> origin[0] >> origin[0] >> origin[1];
28 }
29 if (auto const attr = node->first_attribute("Spacing"); attr != nullptr) {
30 auto ss = std::stringstream{attr->value()};
31 ss >> spacing[0] >> spacing[0] >> spacing[1];
32 }
33 }
34};
35//==============================================================================
36} // namespace tatooine::vtk::xml
37//==============================================================================
38#endif
Definition: byte_order.h:6
Definition: image_data.h:12
std::array< double, 3 > spacing
Definition: image_data.h:16
std::array< std::size_t, 3 > whole_extent1
Definition: image_data.h:13
std::array< std::size_t, 3 > whole_extent2
Definition: image_data.h:14
std::array< double, 3 > origin
Definition: image_data.h:15
image_data(reader &r, rapidxml::xml_node<> *node)
Definition: image_data.h:17
Definition: piece_set.h:12
Definition: reader.h:25