vitrio 0.3.1
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
image_metadata.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2
3#pragma once
4
5#include <vitrio/export.hpp>
6#include <vitrio/image_metadata_value.hpp>
7#include <vitrio/span.hpp>
8
9#include <string>
10#include <utility>
11#include <vector>
12
13namespace vitrio
14{
15
35{
36public:
38 using entry_type = std::pair<std::string, image_metadata_value>;
39
43 VITRIO_API
44 image_metadata() noexcept;
45
46 VITRIO_API
47 image_metadata(const image_metadata &other);
48 VITRIO_API
49 image_metadata(image_metadata &&other) noexcept;
50 VITRIO_API
52
53 VITRIO_API
54 image_metadata& operator=(const image_metadata &other);
55 VITRIO_API
56 image_metadata& operator=(image_metadata &&other) noexcept;
57
73 VITRIO_API
74 void set(std::string label, image_metadata_value value);
75
84 VITRIO_API
86 find(const std::string &label) const noexcept;
87
97 VITRIO_API
98 const image_metadata_value& get(const std::string &label) const;
99
107 VITRIO_API
108 bool erase(const std::string &label) noexcept;
109
117 VITRIO_API
118 span<const entry_type> get_entries() const noexcept;
119
120 friend bool operator==(
121 const image_metadata &lhs,
122 const image_metadata &rhs
123 ) noexcept
124 {
125 return lhs.m_entries == rhs.m_entries;
126 }
127
128 friend bool operator!=(
129 const image_metadata &lhs,
130 const image_metadata &rhs
131 ) noexcept
132 {
133 return !(lhs == rhs);
134 }
135
136private:
137 std::vector<entry_type> m_entries;
138};
139
140} // namespace vitrio
One value of the metadata of an image file: an integer, a real or a text.
Definition image_metadata_value.hpp:29
What an image file states beyond its shape and data type, such as the distance between its samples.
Definition image_metadata.hpp:35
image_metadata() noexcept
Construct metadata stating nothing.
const image_metadata_value & get(const std::string &label) const
Get the value under a label.
std::pair< std::string, image_metadata_value > entry_type
A label and the value under it.
Definition image_metadata.hpp:38
span< const entry_type > get_entries() const noexcept
Get everything that is stated.
bool erase(const std::string &label) noexcept
Stop stating anything under a label.
void set(std::string label, image_metadata_value value)
State a value under a label.
const image_metadata_value * find(const std::string &label) const noexcept
Find the value under a label.
A view of a contiguous sequence of elements.
Definition span.hpp:29