tttrlib
A library for time-tagged time resolved data
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
TTTRRange Class Reference

Represents a range of TTTR indices. More...

#include <TTTRRange.h>

Inheritance diagram for TTTRRange:
CLSMPixel TTTRSelection CLSMFrame CLSMLine

Public Member Functions

 TTTRRange (int start, int stop)
 Constructs a TTTRRange with the specified start and stop indices.
 
 TTTRRange (int start=-1, int stop=-1, TTTRRange *other=nullptr)
 Constructs a TTTRRange.
 
virtual size_t size ()
 Gets the number of TTTR indices in the range.
 
 TTTRRange (const TTTRRange &p2)
 Copy constructor.
 
std::vector< int > get_tttr_indices ()
 Gets the vector of TTTR indices assigned to the range.
 
int get_start () const
 Gets the start index of the TTTR range.
 
int get_stop () const
 Gets the stop index of the TTTR range.
 
std::vector< int > get_start_stop ()
 Gets a vector of the start and stop TTTR indices of the range.
 
unsigned long get_stop_time (TTTR *tttr) const
 Gets the stop time of the TTTR range.
 
unsigned long get_start_time (TTTR *tttr) const
 Gets the start time of the TTTR range.
 
std::vector< unsigned long > get_start_stop_time (TTTR *tttr)
 Gets a vector of the start and stop times of the TTTR range.
 
unsigned int get_duration (TTTR *tttr)
 Gets the duration between the start and stop times of the TTTR range.
 
void insert (int idx)
 Inserts an index into the TTTR index vector.
 
void clear ()
 Clears the TTTR index set.
 
int strip (const std::vector< int > &tttr_indices, int offset=0)
 Strips TTTR indices from a range starting at tttr_indices[offset].
 
double get_mean_microtime (TTTR *tttr_data, double microtime_resolution=-1.0, int minimum_number_of_photons=1)
 Computes the mean microtime in units of the microtime resolution.
 
void get_microtime_histogram (std::shared_ptr< TTTR > tttr, double **histogram, int *n_histogram, double **time, int *n_time, unsigned short micro_time_coarsening)
 Gets the microtime histogram for the TTTRRange.
 
double get_mean_lifetime (TTTR *tttr_data, int minimum_number_of_photons=3, TTTR *tttr_irf=nullptr, double m0_irf=1.0, double m1_irf=1.0, double dt=1.0, std::vector< double > *background=nullptr, double m0_bg=0.0, double m1_bg=0.0, double background_fraction=-1.0)
 Computes the mean lifetime for the TTTRRange.
 
bool operator== (const TTTRRange &other) const
 Equality operator.
 
bool operator!= (const TTTRRange &other) const
 Inequality operator.
 
TTTRRangeoperator+= (const TTTRRange &rhs)
 Compound assignment addition operator.
 

Static Public Member Functions

static double compute_mean_lifetime (std::vector< int > &tttr_indices, TTTR *tttr_data, int minimum_number_of_photons=3, TTTR *tttr_irf=nullptr, double m0_irf=1.0, double m1_irf=1.0, double dt=1.0, std::vector< double > *background=nullptr, double m0_bg=0.0, double m1_bg=0.0, double background_fraction=-1.0)
 Computes the mean lifetime for a set of TTTR indices.
 

Protected Attributes

itlib::flat_set< int > _tttr_indices {}
 Set of TTTR indices in the range.
 

Detailed Description

Represents a range of TTTR indices.

Constructor & Destructor Documentation

◆ TTTRRange() [1/3]

TTTRRange::TTTRRange ( int start,
int stop )

Constructs a TTTRRange with the specified start and stop indices.

Parameters
startThe start index of the range.
stopThe stop index of the range.

◆ TTTRRange() [2/3]

TTTRRange::TTTRRange ( int start = -1,
int stop = -1,
TTTRRange * other = nullptr )
inline

Constructs a TTTRRange.

If both start and stop are non-negative, inserts them into the _tttr_indices set. If other is not nullptr, inserts its start and stop indices into the set.

Parameters
startThe start index of the range.
stopThe stop index of the range.
otherPointer to another TTTRRange (optional).

◆ TTTRRange() [3/3]

TTTRRange::TTTRRange ( const TTTRRange & p2)

Copy constructor.

Parameters
p2Reference to another TTTRRange to copy.

Member Function Documentation

◆ clear()

void TTTRRange::clear ( )
inline

Clears the TTTR index set.

◆ compute_mean_lifetime()

static double TTTRRange::compute_mean_lifetime ( std::vector< int > & tttr_indices,
TTTR * tttr_data,
int minimum_number_of_photons = 3,
TTTR * tttr_irf = nullptr,
double m0_irf = 1.0,
double m1_irf = 1.0,
double dt = 1.0,
std::vector< double > * background = nullptr,
double m0_bg = 0.0,
double m1_bg = 0.0,
double background_fraction = -1.0 )
static

Computes the mean lifetime for a set of TTTR indices.

The average lifetimes are computed (not fitted) by the methods of moments (Irvin Isenberg, 1973, Biophysical journal).

If a TTTRRange has not enough photons, it is filled with zeros.

By default, fluorescence lifetimes are computed in units of the micro time if no dt is provided.

Parameters
tttr_indicesVector of TTTR indices.
tttr_dataPointer to a TTTR object.
minimum_number_of_photonsMinimum number of photons in a micro time.
tttr_irfPointer to a TTTR object of the IRF.
m0_irfZero moment of the IRF (optional, default=1).
m1_irfFirst moment of the IRF (optional, default=1).
dtTime resolution of the micro time.
backgroundVector of background values (optional).
m0_bgZero moment of the background (optional, default=0).
m1_bgFirst moment of the background (optional, default=0).
background_fractionFraction of background pattern in data (if negative, no background).
Returns
The mean lifetime.

◆ get_duration()

unsigned int TTTRRange::get_duration ( TTTR * tttr)
inline

Gets the duration between the start and stop times of the TTTR range.

Parameters
tttrPointer to a TTTR object.
Returns
The duration or 0 if tttr is nullptr or the set is empty.

◆ get_mean_lifetime()

double TTTRRange::get_mean_lifetime ( TTTR * tttr_data,
int minimum_number_of_photons = 3,
TTTR * tttr_irf = nullptr,
double m0_irf = 1.0,
double m1_irf = 1.0,
double dt = 1.0,
std::vector< double > * background = nullptr,
double m0_bg = 0.0,
double m1_bg = 0.0,
double background_fraction = -1.0 )

Computes the mean lifetime for the TTTRRange.

If a TTTRRange has not enough photons, returns -1.

By default, fluorescence lifetimes are computed in units of the micro time if no dt is provided.

Parameters
tttr_dataPointer to a TTTR object.
minimum_number_of_photonsMinimum number of photons in a micro time.
tttr_irfPointer to a TTTR object of the IRF.
m0_irfZero moment of the IRF (optional, default=1).
m1_irfFirst moment of the IRF (optional, default=1).
dtTime resolution of the micro time.
backgroundVector of background values (optional).
m0_bgZero moment of the background (optional, default=0).
m1_bgFirst moment of the background (optional, default=0).
background_fractionFraction of background pattern in data (if negative, no background).
Returns
The mean lifetime.

◆ get_mean_microtime()

double TTTRRange::get_mean_microtime ( TTTR * tttr_data,
double microtime_resolution = -1.0,
int minimum_number_of_photons = 1 )
inline

Computes the mean microtime in units of the microtime resolution.

If there are fewer than the minimum number of photons in a TTTRRange, the function returns zero.

Parameters
tttr_dataPointer to a TTTR object.
microtime_resolutionMicrotime resolution.
minimum_number_of_photonsMinimum number of photons in a micro time.
Returns
The mean microtime.

◆ get_microtime_histogram()

void TTTRRange::get_microtime_histogram ( std::shared_ptr< TTTR > tttr,
double ** histogram,
int * n_histogram,
double ** time,
int * n_time,
unsigned short micro_time_coarsening )
inline

Gets the microtime histogram for the TTTRRange.

Parameters
tttrPointer to a TTTR object.
histogramPointer to the histogram array.
n_histogramPointer to the size of the histogram array.
timePointer to the time array.
n_timePointer to the size of the time array.
micro_time_coarseningMicrotime coarsening factor.

◆ get_start()

int TTTRRange::get_start ( ) const
inline

Gets the start index of the TTTR range.

Returns
The start index or -1 if the set is empty.

◆ get_start_stop()

std::vector< int > TTTRRange::get_start_stop ( )
inline

Gets a vector of the start and stop TTTR indices of the range.

Returns
A vector containing the start and stop indices.

◆ get_start_stop_time()

std::vector< unsigned long > TTTRRange::get_start_stop_time ( TTTR * tttr)
inline

Gets a vector of the start and stop times of the TTTR range.

Parameters
tttrPointer to a TTTR object.
Returns
A vector containing the start and stop times.

◆ get_start_time()

unsigned long TTTRRange::get_start_time ( TTTR * tttr) const
inline

Gets the start time of the TTTR range.

Parameters
tttrPointer to a TTTR object.
Returns
The start time or 0 if tttr is nullptr or the set is empty.

◆ get_stop()

int TTTRRange::get_stop ( ) const
inline

Gets the stop index of the TTTR range.

Returns
The stop index or -1 if the set is empty.

◆ get_stop_time()

unsigned long TTTRRange::get_stop_time ( TTTR * tttr) const
inline

Gets the stop time of the TTTR range.

Parameters
tttrPointer to a TTTR object.
Returns
The stop time or 0 if tttr is nullptr or the set is empty.

◆ get_tttr_indices()

std::vector< int > TTTRRange::get_tttr_indices ( )
inline

Gets the vector of TTTR indices assigned to the range.

Returns
A vector containing the TTTR indices in the set.

◆ insert()

void TTTRRange::insert ( int idx)
inline

Inserts an index into the TTTR index vector.

Parameters
idxThe index to insert.

◆ operator!=()

bool TTTRRange::operator!= ( const TTTRRange & other) const
inline

Inequality operator.

Parameters
otherAnother TTTRRange to compare.
Returns
True if the two TTTRRanges are not equal, false otherwise.

◆ operator+=()

TTTRRange & TTTRRange::operator+= ( const TTTRRange & rhs)
inline

Compound assignment addition operator.

Parameters
rhsAnother TTTRRange to add.
Returns
Reference to the modified TTTRRange.

◆ operator==()

bool TTTRRange::operator== ( const TTTRRange & other) const
inline

Equality operator.

Parameters
otherAnother TTTRRange to compare.
Returns
True if the two TTTRRanges are equal, false otherwise.

◆ size()

virtual size_t TTTRRange::size ( )
inlinevirtual

Gets the number of TTTR indices in the range.

Returns
The size of the tttr_indices set.

Reimplemented in CLSMFrame, and CLSMLine.

◆ strip()

int TTTRRange::strip ( const std::vector< int > & tttr_indices,
int offset = 0 )
inline

Strips TTTR indices from a range starting at tttr_indices[offset].

The tttr_indices need to be sorted in ascending size.

Parameters
tttr_indicesVector of TTTR indices.
offsetOffset index.
Returns
Updated offset index.

Member Data Documentation

◆ _tttr_indices

itlib::flat_set<int> TTTRRange::_tttr_indices {}
protected

Set of TTTR indices in the range.


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