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

The ability of one image file format to be read. More...

#include <vitrio/image_file_read_format.hpp>

Public Member Functions

 image_file_read_format (const image_file_read_format &other)=delete
 image_file_read_format (image_file_read_format &&other)=delete
image_file_read_format & operator= (const image_file_read_format &other)=delete
image_file_read_format & operator= (image_file_read_format &&other)=delete
virtual std::string get_name () const =0
 Get the name of this format.
virtual image_file_format_suitability get_suitability (const image_file_probe &probe) const =0
 Report how well this format fits a file.
virtual std::shared_ptr< image_reader > open (const image_file_probe &probe, const file_transfer_pool &transfers) const =0
 Open a file for reading.
virtual image_metadata read_metadata (const image_file_probe &probe) const =0
 Read what a file states beyond its shape and data type.

Detailed Description

The ability of one image file format to be read.

Judges from an image_file_probe how well it fits a file, opens a file it fits as an image_reader, and reads what such a file states beyond its shape and data type as an image_metadata.

See also
image_file_write_format

Member Function Documentation

◆ get_name()

virtual std::string vitrio::image_file_read_format::get_name ( ) const
pure virtual

Get the name of this format.

Returns
std::string The name, which identifies the format.

◆ get_suitability()

virtual image_file_format_suitability vitrio::image_file_read_format::get_suitability ( const image_file_probe & probe) const
pure virtual

Report how well this format fits a file.

Decide from probe alone, without opening the file: the probe carries its path, its lower case extension and its leading bytes. A format whose files are directories decides from the names of the entries a directory holds instead, and may check whether those it is recognized by are there, without reading them.

Return image_file_format_suitability::unsupported for a file this format does not recognize, and something higher than image_file_format_suitability::normal only to displace another format that recognizes the same file.

Parameters
probeThe file under consideration.
Returns
image_file_format_suitability How well this format fits probe.

◆ open()

virtual std::shared_ptr< image_reader > vitrio::image_file_read_format::open ( const image_file_probe & probe,
const file_transfer_pool & transfers ) const
pure virtual

Open a file for reading.

Precondition
get_suitability does not report probe as image_file_format_suitability::unsupported.
Parameters
probeThe file to open.
transfersThe threads that carry out the transfers of the reader.
Returns
std::shared_ptr<image_reader> The opened reader, never null.
Exceptions
image_file_errorIf the file can not be reached.
image_file_format_errorIf the file is malformed or truncated.

◆ read_metadata()

virtual image_metadata vitrio::image_file_read_format::read_metadata ( const image_file_probe & probe) const
pure virtual

Read what a file states beyond its shape and data type.

What the file does not state is absent from the result, and so is what this format does not read of it: a result that states nothing is a valid one. A standard field means what image_metadata_fields says it does, and whatever else is read is under labels prefixed with a name of this format.

The axes the standard fields name are those of the descriptor a reader from open reports for the same file.

Precondition
get_suitability does not report probe as image_file_format_suitability::unsupported.
Parameters
probeThe file to read.
Returns
image_metadata What the file states.
Exceptions
image_file_errorIf the file can not be reached.
image_file_format_errorIf the file is malformed or truncated.

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