STIR  6.2.0
Public Member Functions | List of all members
stir::TimeFrameDefinitions Class Reference

Class used for storing time frame durations. More...

#include "stir/TimeFrameDefinitions.h"

Public Member Functions

 TimeFrameDefinitions ()
 Default constructor: no time frames at all.
 
 TimeFrameDefinitions (const std::string &fdef_filename)
 Read the frame definitions from a file. More...
 
 TimeFrameDefinitions (const std::vector< std::pair< double, double >> &)
 Construct from a list of time frames. More...
 
 TimeFrameDefinitions (const std::vector< double > &start_times, const std::vector< double > &durations)
 Construct from a list of start times and durations. More...
 
 TimeFrameDefinitions (const TimeFrameDefinitions &, unsigned int frame_num)
 Construct from a single time frame of an existing object.
 
double get_start_time () const
 Get start time of first frame.
 
double get_end_time () const
 Get end time of last frame.
 
unsigned int get_num_frames () const
 Get number of frames.
 
unsigned int get_num_time_frames () const
 Get number of frames.
 
unsigned int get_time_frame_num (const double start_time, const double end_time) const
 Get the frame number associated with a frame starting and start_time and ending at end_time. More...
 
void set_num_time_frames (int num_time_frames)
 Set number of time frames.
 
void set_time_frame (const int frame_num, const double start, const double end)
 Set time frame.
 
bool operator== (const TimeFrameDefinitions &t) const
 
get info for 1 frame (frame_num is 1 based)
double get_start_time (unsigned int frame_num) const
 
double get_end_time (unsigned int frame_num) const
 
double get_duration (unsigned int frame_num) const
 

Detailed Description

Class used for storing time frame durations.

All times are in seconds as per standard STIR conventions.

Times are supposed to be relative to the exam start time.

Currently this class can read frame info from an ECAT6, ECAT7 and a 'frame definition' file. See the documentation for the constructor.

Constructor & Destructor Documentation

◆ TimeFrameDefinitions() [1/3]

stir::TimeFrameDefinitions::TimeFrameDefinitions ( const std::string &  fdef_filename)
explicit

Read the frame definitions from a file.

Deprecated:
The filename can point to an ECAT6 file, and ECAT7 file (if you have installed the LLN library), an Interfile file, or a simple ASCII text file.

This latter uses the '.fdef' format used by Peter Bloomfield's software. The format is a number of lines, each existing of 2 numbers

  num_frames_of_this_duration   duration_in_secs

This duration is a double number.

This class in fact allows an extension of the above. Setting num_frames_of_this_duration to 0 allows skipping a time period of the corresponding duration_in_secs.

References stir::error(), stir::MinimalInterfileHeader::get_exam_info(), stir::FileSignature::get_signature(), stir::info(), stir::ecat::ecat6::is_ECAT6_file(), stir::ecat::ecat7::is_ECAT7_file(), stir::is_interfile_signature(), stir::KeyParser::parse(), and stir::ecat::ecat7::read_ECAT7_exam_info().

◆ TimeFrameDefinitions() [2/3]

stir::TimeFrameDefinitions::TimeFrameDefinitions ( const std::vector< std::pair< double, double >> &  )

Construct from a list of time frames.

Each frame is specified as a std::pair with start and end time (in seconds). Start times have to be in increasing order

◆ TimeFrameDefinitions() [3/3]

stir::TimeFrameDefinitions::TimeFrameDefinitions ( const std::vector< double > &  start_times,
const std::vector< double > &  durations 
)

Construct from a list of start times and durations.

start times have to be in increasing order

References stir::error().

Member Function Documentation

◆ get_time_frame_num()

unsigned int stir::TimeFrameDefinitions::get_time_frame_num ( const double  start_time,
const double  end_time 
) const

Get the frame number associated with a frame starting and start_time and ending at end_time.

Returns
frame number (between 1 and get_num_time_frames()) or 0 if frame not found.

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