vitrio 0.3.1
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
vitrio::image_metadata Class Reference

What an image file states beyond its shape and data type, such as the distance between its samples. More...

#include <vitrio/image_metadata.hpp>

Public Types

using entry_type = std::pair<std::string, image_metadata_value>
 A label and the value under it.

Public Member Functions

 image_metadata () noexcept
 Construct metadata stating nothing.
 image_metadata (const image_metadata &other)
 image_metadata (image_metadata &&other) noexcept
image_metadata & operator= (const image_metadata &other)
image_metadata & operator= (image_metadata &&other) noexcept
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.
const image_metadata_value & get (const std::string &label) const
 Get the value under a label.
bool erase (const std::string &label) noexcept
 Stop stating anything under a label.
span< const entry_type > get_entries () const noexcept
 Get everything that is stated.

Friends

bool operator== (const image_metadata &lhs, const image_metadata &rhs) noexcept
bool operator!= (const image_metadata &lhs, const image_metadata &rhs) noexcept

Detailed Description

What an image file states beyond its shape and data type, such as the distance between its samples.

A dictionary of values, each under a label. Nothing has to be stated: what a file does not carry, or a format does not read, is absent.

Labels
A label with no dot in it names a standard field, one of those of image_metadata_fields, which means the same whatever the format of the file. Any other label has a prefix that ends at its first dot and says whose it is, such as the format that defines it: mrc.labels.
Standard fields
A standard field has one type, and the dictionary holds it as no other.
See also
image_metadata_field

Member Function Documentation

◆ erase()

bool vitrio::image_metadata::erase ( const std::string & label)
noexcept

Stop stating anything under a label.

Parameters
labelThe label.
Returns
true A value was under label and is gone.
false Nothing was stated under label.

◆ find()

const image_metadata_value * vitrio::image_metadata::find ( const std::string & label) const
noexcept

Find the value under a label.

Parameters
labelThe label.
Returns
const image_metadata_value* The value, or nullptr when nothing is stated under label. It refers to storage owned by this metadata, and is valid until the metadata is next modified.

◆ get()

const image_metadata_value & vitrio::image_metadata::get ( const std::string & label) const

Get the value under a label.

Parameters
labelThe label.
Returns
const image_metadata_value& The value. It refers to storage owned by this metadata, and is valid until the metadata is next modified.
Exceptions
std::out_of_rangeIf nothing is stated under label.

◆ get_entries()

span< const entry_type > vitrio::image_metadata::get_entries ( ) const
noexcept

Get everything that is stated.

Returns
span<const entry_type> The entries, sorted by label. It refers to storage owned by this metadata, and is valid until the metadata is next modified.

◆ set()

void vitrio::image_metadata::set ( std::string label,
image_metadata_value value )

State a value under a label.

Replaces the value already under that label, if any.

An integer given for a standard field that is a real is held as the real of the same value.

Parameters
labelThe label.
valueThe value.
Exceptions
std::invalid_argumentIf label is empty, if it has no dot and names no standard field, or if it names a standard field and value is neither of its type nor an integer given for a real. The metadata is left as it was.

The documentation for this class was generated from the following file: