vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
vitrio::detector_event_position_view Class Reference

A view of the positions of a sequence of events, as a matrix of one row per event and one column per axis. More...

#include <vitrio/detector_event_position_view.hpp>

Public Member Functions

 detector_event_position_view (span< const std::uint32_t > coordinates, std::size_t rank)
 Construct a view of coordinates held row after row.
 
std::size_t get_rank () const noexcept
 Get the number of coordinates each event carries.
 
std::size_t get_event_count () const noexcept
 Get the number of events viewed.
 
bool empty () const noexcept
 Check whether no event is viewed.
 
span< const std::uint32_t > get (std::size_t event) const noexcept
 Get the position of one event.
 
std::uint32_t operator() (std::size_t event, std::size_t axis) const noexcept
 Get one coordinate of one event.
 
detector_event_position_view get_events (std::size_t first, std::size_t count) const noexcept
 Get the positions of a run of the events viewed.
 
span< const std::uint32_t > get_coordinates () const noexcept
 Get every coordinate viewed, row after row.
 

Detailed Description

A view of the positions of a sequence of events, as a matrix of one row per event and one column per axis.

The coordinates are held row after row, those of one event after those of the one before, slowest axis first within a row. Each is counted in the position quanta of a detector_event_timeline_descriptor.

A view is a pointer, a size and a rank, as cheap to copy as a span, and what it views must outlive it. It never owns or changes the coordinates.

See also
detector_event_timeline

Constructor & Destructor Documentation

◆ detector_event_position_view()

vitrio::detector_event_position_view::detector_event_position_view ( span< const std::uint32_t >  coordinates,
std::size_t  rank 
)

Construct a view of coordinates held row after row.

Parameters
coordinatesThe coordinates of every event, those of one event after another.
rankNumber of coordinates each event carries.
Exceptions
std::invalid_argumentIf rank is zero, or if the number of coordinates is not a multiple of it.

Member Function Documentation

◆ empty()

bool vitrio::detector_event_position_view::empty ( ) const
noexcept

Check whether no event is viewed.

Returns
true There are no rows.
false There is at least one.

◆ get()

span< const std::uint32_t > vitrio::detector_event_position_view::get ( std::size_t  event) const
noexcept

Get the position of one event.

Parameters
eventIndex of the event. Must be below get_event_count.
Returns
span<const std::uint32_t> Its coordinates, get_rank of them, slowest axis first.

◆ get_coordinates()

span< const std::uint32_t > vitrio::detector_event_position_view::get_coordinates ( ) const
noexcept

Get every coordinate viewed, row after row.

For walking every event at once, where indexing them one by one would cost more than it says.

Returns
span<const std::uint32_t> get_rank coordinates per event, get_event_count events.

◆ get_event_count()

std::size_t vitrio::detector_event_position_view::get_event_count ( ) const
noexcept

Get the number of events viewed.

Returns
std::size_t The number of rows.

◆ get_events()

detector_event_position_view vitrio::detector_event_position_view::get_events ( std::size_t  first,
std::size_t  count 
) const
noexcept

Get the positions of a run of the events viewed.

Parameters
firstIndex of the first event of the run.
countNumber of events from there. The run must not reach past get_event_count.
Returns
detector_event_position_view A view of the run, of the same rank.

◆ get_rank()

std::size_t vitrio::detector_event_position_view::get_rank ( ) const
noexcept

Get the number of coordinates each event carries.

Returns
std::size_t The rank, the number of columns. Never zero.

◆ operator()()

std::uint32_t vitrio::detector_event_position_view::operator() ( std::size_t  event,
std::size_t  axis 
) const
noexcept

Get one coordinate of one event.

Parameters
eventIndex of the event. Must be below get_event_count.
axisIndex of the axis. Must be below get_rank.
Returns
std::uint32_t The coordinate.

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