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

The events a detector counted over a stretch of time. More...

#include <vitrio/detector_event_timeline.hpp>

Public Member Functions

 detector_event_timeline (std::size_t rank)
 Construct an empty timeline of a given rank.
 
 detector_event_timeline (const detector_event_timeline &other)
 
 detector_event_timeline (detector_event_timeline &&other) noexcept
 
detector_event_timeline & operator= (const detector_event_timeline &other)
 
detector_event_timeline & operator= (detector_event_timeline &&other) noexcept
 
void add_group (std::uint64_t timestamp, detector_event_position_view positions)
 Append the events of one timestamp.
 
void clear () noexcept
 Drop the events held, keeping the rank and the capacity.
 
void reserve (std::size_t group_count, std::size_t event_count)
 Make room for a number of groups and events without allocating later.
 
std::size_t get_rank () const noexcept
 Get the number of coordinates each event carries.
 
std::size_t get_group_count () const noexcept
 Get how many groups are held.
 
std::size_t get_event_count () const noexcept
 Get how many events are held, in every group.
 
std::uint64_t get_timestamp (std::size_t group) const noexcept
 Get the timestamp of one group.
 
detector_event_position_view get_positions (std::size_t group) const noexcept
 Get the positions of the events of one group.
 
detector_event_position_view get_positions () const noexcept
 Get the positions of every event held.
 

Detailed Description

The events a detector counted over a stretch of time.

Events are held in groups of one timestamp each, the groups in strictly ascending order of their timestamps. A detector that reads out frames gives a group per frame, its timestamp the index of the frame. One that stamps each event with its own time gives a group per distinct time, so that the events of an instant still share one timestamp. A time at which nothing was counted needs no group.

An event is its position: one coordinate per axis, slowest first. Times and positions are counted in the quanta a detector_event_timeline_descriptor states, which the timeline itself does not carry.

The positions of every event are held as one matrix, a row per event and a column per axis, and each group is a run of its rows, so a timeline of any length costs a bounded number of allocations. clear keeps the capacity: a timeline refilled after clearing allocates nothing until it outgrows what it held before.

The rank is stated when a timeline is constructed and never changes.

Constructor & Destructor Documentation

◆ detector_event_timeline()

vitrio::detector_event_timeline::detector_event_timeline ( std::size_t  rank)
explicit

Construct an empty timeline of a given rank.

Parameters
rankNumber of coordinates each event carries.
Exceptions
std::invalid_argumentIf rank is zero.

Member Function Documentation

◆ add_group()

void vitrio::detector_event_timeline::add_group ( std::uint64_t  timestamp,
detector_event_position_view  positions 
)

Append the events of one timestamp.

Parameters
timestampTime of the events. Must be later than that of the group appended last.
positionsThe positions of the events, which are copied. Must have the rank of this timeline.
Exceptions
std::invalid_argumentIf timestamp is not later than that of the last group, or if positions does not have the rank of this timeline.

◆ get_event_count()

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

Get how many events are held, in every group.

Returns
std::size_t The number of events.

◆ get_group_count()

std::size_t vitrio::detector_event_timeline::get_group_count ( ) const
noexcept

Get how many groups are held.

Returns
std::size_t The number of groups.

◆ get_positions() [1/2]

detector_event_position_view vitrio::detector_event_timeline::get_positions ( ) const
noexcept

Get the positions of every event held.

Returns
detector_event_position_view The positions, one row per event, group after group. It refers to storage owned by this timeline, which adding to, assigning to or destroying it invalidates.

◆ get_positions() [2/2]

detector_event_position_view vitrio::detector_event_timeline::get_positions ( std::size_t  group) const
noexcept

Get the positions of the events of one group.

Parameters
groupPosition of the group. Must be below get_group_count.
Returns
detector_event_position_view The positions, one row per event. It refers to storage owned by this timeline, which adding to, assigning to or destroying it invalidates.

◆ get_rank()

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

Get the number of coordinates each event carries.

Returns
std::size_t The rank. Never zero.

◆ get_timestamp()

std::uint64_t vitrio::detector_event_timeline::get_timestamp ( std::size_t  group) const
noexcept

Get the timestamp of one group.

Parameters
groupPosition of the group. Must be below get_group_count.
Returns
std::uint64_t The timestamp, which ascends with group.

◆ reserve()

void vitrio::detector_event_timeline::reserve ( std::size_t  group_count,
std::size_t  event_count 
)

Make room for a number of groups and events without allocating later.

Parameters
group_countNumber of groups to make room for.
event_countNumber of events to make room for.

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