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

#include <CLSMImage.h>

Public Member Functions

std::shared_ptr< TTTRget_tttr ()
 
void set_tttr (std::shared_ptr< TTTR > v)
 
const CLSMSettingsget_settings ()
 
size_t size ()
 Get the number of frames in the CLSMImage.
 
void fill (TTTR *tttr_data=nullptr, std::vector< int > channels=std::vector< int >(), bool clear=true, const std::vector< std::pair< int, int > > &micro_time_ranges=std::vector< std::pair< int, int > >())
 Fills the time-tagged time-resolved (TTTR) indices of the pixels with the indices of the photons that fall within each pixel.
 
void fill_pixels (TTTR *tttr_data, std::vector< int > channels, bool clear_pixel=true, std::vector< std::pair< int, int > > micro_time_ranges=std::vector< std::pair< int, int > >())
 Fills the time-tagged time-resolved (TTTR) indices of the pixels with the indices of the channels that fall within each pixel.
 
void clear ()
 Clears the time-tagged time-resolved (TTTR) indices stored in the pixels.
 
void clear_pixels ()
 Clears the time-tagged time-resolved (TTTR) indices stored in the pixels.
 
void strip (const std::vector< int > &tttr_indices, int offset=0)
 Strips time-tagged time-resolved (TTTR) indices from all pixels in the image.
 
void get_fcs_image (float **output, int *dim1, int *dim2, int *dim3, int *dim4, std::shared_ptr< TTTR > tttr, CLSMImage *clsm_other=nullptr, std::string correlation_method="default", int n_bins=50, int n_casc=1, bool stack_frames=false, bool normalized_correlation=false, int min_photons=2)
 Computes an image where pixels represent correlation curves.
 
std::vector< CLSMFrame * > get_frames ()
 Retrieves the frames stored in the CLSMImage.
 
void get_intensity (unsigned short **output, int *dim1, int *dim2, int *dim3)
 Computes an intensity image.
 
void get_fluorescence_decay (TTTR *tttr_data, unsigned char **output, int *dim1, int *dim2, int *dim3, int *dim4, int micro_time_coarsening=1, bool stack_frames=false)
 Computes an image stack where the value of each pixel corresponds to a histogram of micro times in each pixel. The micro times can be coarsened by integer numbers.
 
void get_decay_of_pixels (TTTR *tttr_data, uint8_t *mask, int dmask1, int dmask2, int dmask3, unsigned int **output, int *dim1, int *dim2, int tac_coarsening, bool stack_frames)
 Computes micro time histograms for the stacks of images and a selection of pixels. Photons in pixels that are selected by the selection array contribute to the returned array of micro time histograms.
 
void get_mean_micro_time (TTTR *tttr_data, double **output, int *dim1, int *dim2, int *dim3, double microtime_resolution=-1.0, int minimum_number_of_photons=2, bool stack_frames=false)
 Calculates an image stack where the value of each pixel corresponds to the mean micro time (in units of the micro channel resolution).
 
void get_phasor (float **output, int *dim1, int *dim2, int *dim3, int *dim4, TTTR *tttr_data, TTTR *tttr_irf=nullptr, double frequency=-1, int minimum_number_of_photons=2, bool stack_frames=false)
 Computes the phasor values for every pixel.
 
void get_mean_lifetime (TTTR *tttr_data, double **output, int *dim1, int *dim2, int *dim3, int minimum_number_of_photons=3, TTTR *tttr_irf=nullptr, double m0_irf=1.0, double m1_irf=1.0, bool stack_frames=false, std::vector< double > background=std::vector< double >(), double m0_bg=0.0, double m1_bg=0.0, double background_fraction=-1.0)
 Computes an image of average lifetimes.
 
int to1D (int frame, int line, int pixel)
 Convert three-dimensional coordinates (frame, line, pixel) to a one-dimensional index.
 
std::vector< int > to3D (int idx)
 Convert a one-dimensional index to three-dimensional coordinates (frame, line, pixel).
 
CLSMPixelgetPixel (unsigned int idx)
 Get a pointer to a CLSMPixel object based on a one-dimensional index.
 
int get_n_frames () const
 Get the number of frames in the CLSM image.
 
int get_n_lines () const
 Get the number of lines per frame in the CLSMImage.
 
int get_n_pixel () const
 Get the number of pixels per line in a frame of the CLSMImage.
 
void copy (const CLSMImage &p2, bool fill=false)
 Copy information from another CLSMImage object.
 
void append (CLSMFrame *frame)
 Append a CLSMFrame to the CLSM image.
 
void transform (unsigned int *input, int n_input)
 Move the content of the Pixels based on source and target pixel indices.
 
void rebin (int bin_line, int bin_pixel)
 Rebin a CLSMImage.
 
void distribute (unsigned int pixel_id, CLSMImage *target, std::vector< int > &target_pixel_ids, std::vector< int > &target_probabilities)
 Distribute the photons of a pixel_id to a set of pixel ids in a target image according to provided probabilities.
 
void crop (int frame_start, int frame_stop, int line_start, int line_stop, int pixel_start, int pixel_stop)
 Crop the CLSMImage.
 
void stack_frames ()
 Stack frames in the CLSMImage.
 
 CLSMImage (const CLSMImage &p2, bool fill=false)
 Copy constructor for CLSMImage.
 
 CLSMImage (std::shared_ptr< TTTR > tttr_data=nullptr, CLSMSettings settings=CLSMSettings(), CLSMImage *source=nullptr, bool fill=true, std::vector< int > channels=std::vector< int >(), std::vector< std::pair< int, int > > micro_time_ranges=std::vector< std::pair< int, int > >())
 Constructs a CLSMImage object from TTTR data.
 
virtual ~CLSMImage ()
 Destructor for CLSMImage.
 
CLSMFrameoperator[] (unsigned int i_frame)
 Accessor for CLSMFrame at the specified index in CLSMImage.
 
double get_line_duration (int frame=0, int line=0)
 Obtains the duration of a line (in milliseconds) for a specified frame and line.
 
double get_pixel_duration (int frame=0, int line=0)
 Obtains the duration of a pixel (in milliseconds) for a specified frame and line.
 

Static Public Member Functions

static void compute_ics (double **output, int *dim1, int *dim2, int *dim3, std::shared_ptr< TTTR > tttr_data=nullptr, CLSMImage *clsm=nullptr, double *images=nullptr, int input_frames=-1, int input_lines=-1, int input_pixel=1, std::vector< int > x_range=std::vector< int >({0, -1}), std::vector< int > y_range=std::vector< int >({0, -1}), std::vector< std::pair< int, int > > frames_index_pairs=std::vector< std::pair< int, int > >(), std::string subtract_average="", uint8_t *mask=nullptr, int dmask1=-1, int dmask2=-1, int dmask3=-1)
 Performs an image correlation spectroscopy analysis via FFTs for a set of frames.
 
static void get_roi (double **output, int *dim1, int *dim2, int *dim3, CLSMImage *clsm=nullptr, std::vector< int > x_range=std::vector< int >({0,-1}), std::vector< int > y_range=std::vector< int >({0,-1}), std::string subtract_average="", double background=0.0, bool clip=false, double clip_max=1e6, double clip_min=-1e6, double *images=nullptr, int n_frames=-1, int n_lines=-1, int n_pixels=1, uint8_t *mask=nullptr, int dmask1=-1, int dmask2=-1, int dmask3=-1, std::vector< int > selected_frames=std::vector< int >())
 Copies a region of interest (ROI) from the input images, performs background correction, and stores the result in a new array.
 
static std::vector< int > get_frame_edges (TTTR *tttr=nullptr, int start_event=0, int stop_event=-1, std::vector< int > marker_frame_start=std::vector< int >({4, 6}), int marker_event_type=15, int reading_routine=CLSM_SP8, bool skip_before_first_frame_marker=false, bool skip_after_last_frame_marker=false)
 Retrieves the time-tagged time-resolved (TTTR) indices of frame markers for a Leica SP8 microscope.
 
static std::vector< int > get_line_edges (TTTR *tttr, int start_event, int stop_event, int marker_line_start=1, int marker_line_stop=2, int marker_event_type=15, int reading_routine=CLSM_SP8)
 Identifies line edges by reading start and stop markers in a time-tagged time-resolved (TTTR) dataset.
 
static std::vector< int > get_line_edges_by_duration (TTTR *tttr, int start_event, int stop_event, int marker_line_start=1, int line_duration=2, int marker_event_type=15, int reading_routine=CLSM_SP8)
 Identifies line edges by reading a start marker and using line duration as the stop criterion in a time-tagged time-resolved (TTTR) dataset.
 

Public Attributes

std::vector< int > marker_frame
 Vector containing the tttr indices of the frame markers.
 
int marker_line_start
 Defines the marker for a line start.
 
int marker_line_stop
 Defines the marker for a line stop.
 
int marker_event
 The event type used for the marker.
 
std::string reading_routine = "default"
 
bool skip_before_first_frame_marker = false
 
bool skip_after_last_frame_marker = false
 

Protected Member Functions

void create_frames (bool clear_first=true)
 
void create_lines ()
 
void determine_number_of_lines ()
 

Protected Attributes

size_t n_frames = 0
 The number of frames in an CLSMImage.
 
size_t n_lines = 0
 The number of lines per frames.
 
size_t n_pixel = 0
 The number if pixels per line.
 
std::shared_ptr< TTTRtttr = nullptr
 Pointer to tttr data that used to construct the Image.
 

Friends

class Correlator
 
class CLSMFrame
 
class CLSMLine
 
class CLSMPixel
 

Constructor & Destructor Documentation

◆ CLSMImage() [1/2]

CLSMImage::CLSMImage ( const CLSMImage & p2,
bool fill = false )

Copy constructor for CLSMImage.

Constructs a new CLSMImage by copying the content of another CLSMImage.

Parameters
p2[in] The CLSMImage object from which the content is copied.
fill[in] If set to true (default is false), the time-tagged time-resolved indices of the pixels are copied.

◆ CLSMImage() [2/2]

CLSMImage::CLSMImage ( std::shared_ptr< TTTR > tttr_data = nullptr,
CLSMSettings settings = CLSMSettings(),
CLSMImage * source = nullptr,
bool fill = true,
std::vector< int > channels = std::vector< int >(),
std::vector< std::pair< int, int > > micro_time_ranges = std::vector< std::pair< int, int > >() )
explicit

Constructs a CLSMImage object from TTTR data.

Constructs a CLSMImage object from Time-Tagged Time-Resolved (TTTR) data, using specified markers, settings, and optional source CLSMImage.

Parameters
tttr_data[in] Pointer to TTTR object containing the raw data.
settings[in] CLSMSettings object specifying parameters for image construction.
source[in] A CLSMImage object used as a template. All frames and lines are copied, and empty pixels are created. If fill is set to true (default), the content of the pixels is copied.
fill[in] If set to true (default), the lines are filled with pixels containing either the photons of the specified channels or the photons from the source CLSMImage instance.
channels[in] The channel number of the events used to fill the pixels.
micro_time_ranges[in] Vector of pairs specifying the micro time ranges.
See also
CLSMSettings for more details on available settings.

◆ ~CLSMImage()

virtual CLSMImage::~CLSMImage ( )
inlinevirtual

Destructor for CLSMImage.

Frees memory by deleting dynamically allocated CLSMFrame objects in the frames vector. It ensures proper cleanup of resources when a CLSMImage object is destroyed.

Member Function Documentation

◆ append()

void CLSMImage::append ( CLSMFrame * frame)

Append a CLSMFrame to the CLSM image.

Appends a CLSMFrame to the CLSM image.

Parameters
frameThe CLSMFrame to be appended.

◆ clear()

void CLSMImage::clear ( )

Clears the time-tagged time-resolved (TTTR) indices stored in the pixels.

◆ clear_pixels()

void CLSMImage::clear_pixels ( )
inline

Clears the time-tagged time-resolved (TTTR) indices stored in the pixels.

Deprecated
Use the 'clear' function instead.

This function is deprecated in favor of 'clear'. It removes the stored TTTR indices from the pixels.

◆ compute_ics()

static void CLSMImage::compute_ics ( double ** output,
int * dim1,
int * dim2,
int * dim3,
std::shared_ptr< TTTR > tttr_data = nullptr,
CLSMImage * clsm = nullptr,
double * images = nullptr,
int input_frames = -1,
int input_lines = -1,
int input_pixel = 1,
std::vector< int > x_range = std::vector< int >({0, -1}),
std::vector< int > y_range = std::vector< int >({0, -1}),
std::vector< std::pair< int, int > > frames_index_pairs = std::vector< std::pair< int, int > >(),
std::string subtract_average = "",
uint8_t * mask = nullptr,
int dmask1 = -1,
int dmask2 = -1,
int dmask3 = -1 )
static

Performs an image correlation spectroscopy analysis via FFTs for a set of frames.

This function computes the image correlation for a set of frames, either specified by an array or a CLSMImage object. It can compute image cross-correlation and image auto-correlations based on the type of correlation specified by a vector of pairs.

Parameters
output[out] Array that will contain the Image Correlation Spectrscopy analysis (ICS).
dim1[out] Number of frames in the ICS.
dim2[out] Number of lines (line shifts) in the ICS.
dim3[out] Number of pixels (pixel shifts) in the ICS.
tttr_data[in] Pointer to TTTR object containing the raw data (optional).
clsm[in] Optional pointer to a CLSMImage object.
images[in] Optional pointer to an image array.
input_frames[in] Number of frames in the image array.
input_lines[in] Number of lines in the image array.
input_pixel[in] Number of pixels per line in the image array.
x_range[in] Defines the region of interest (ROI) in the image (pixel).
y_range[in] Defines the ROI in y-direction (lines).
frames_index_pairs[in] Vector of integer pairs corresponding to frame numbers used for cross-correlation (default computes auto-correlation).
subtract_average[in] Specifies background correction: "stack" subtracts the average over all frames, "frame" subtracts the average of each frame. Default is no correction.
mask[in] Stack of images used as a mask to select pixels (optional).
dmask1[in] Number of frames in the mask.
dmask2[in] Number of lines in the mask.
dmask3[in] Number of pixels per line in the mask.

◆ copy()

void CLSMImage::copy ( const CLSMImage & p2,
bool fill = false )

Copy information from another CLSMImage object.

Copies the information from another CLSMImage object, including pixel indices, if the fill parameter is set to true (default is false).

Parameters
p2The CLSMImage object from which information is copied.
fillIf set to true (default is false), the time-tagged time-resolved indices of the pixels are copied.

◆ create_frames()

void CLSMImage::create_frames ( bool clear_first = true)
protected

◆ create_lines()

void CLSMImage::create_lines ( )
protected

◆ crop()

void CLSMImage::crop ( int frame_start,
int frame_stop,
int line_start,
int line_stop,
int pixel_start,
int pixel_stop )

Crop the CLSMImage.

Crop the image by specifying the range of frames, lines, and pixels to keep.

Parameters
frame_start[in] Starting frame index for cropping.
frame_stop[in] Stopping frame index for cropping.
line_start[in] Starting line index for cropping.
line_stop[in] Stopping line index for cropping.
pixel_start[in] Starting pixel index for cropping.
pixel_stop[in] Stopping pixel index for cropping.

◆ determine_number_of_lines()

void CLSMImage::determine_number_of_lines ( )
protected

◆ distribute()

void CLSMImage::distribute ( unsigned int pixel_id,
CLSMImage * target,
std::vector< int > & target_pixel_ids,
std::vector< int > & target_probabilities )

Distribute the photons of a pixel_id to a set of pixel ids in a target image according to provided probabilities.

This function distributes the photons of a specified pixel_id to a set of pixel_ids in a target CLSMImage based on the provided probabilities.

Parameters
pixel_id[in] The source pixel_id whose photons will be distributed.
target[in] Pointer to the target CLSMImage.
target_pixel_ids[in] Vector of target pixel_ids to which photons will be distributed.
target_probabilities[in] Vector of probabilities corresponding to each target pixel_id.

◆ fill()

void CLSMImage::fill ( TTTR * tttr_data = nullptr,
std::vector< int > channels = std::vector< int >(),
bool clear = true,
const std::vector< std::pair< int, int > > & micro_time_ranges = std::vector< std::pair< int, int > >() )

Fills the time-tagged time-resolved (TTTR) indices of the pixels with the indices of the photons that fall within each pixel.

This function processes the TTTR data to associate routing channels with pixels based on specified criteria. The TTTR indices of the channels within each pixel are stored.

Parameters
tttr_dataPointer to the TTTR object containing the data to be processed (default is nullptr).
channelsList of routing channels. Events that have routing channels in this vector are added to pixels of corresponding time.
clearIf set to true (default), the pixels are cleared before being filled. If set to false, new TTTR indices are added to the pixels.
micro_time_rangesList of pairs representing micro-time ranges. If provided, only events within these ranges are considered.

◆ fill_pixels()

void CLSMImage::fill_pixels ( TTTR * tttr_data,
std::vector< int > channels,
bool clear_pixel = true,
std::vector< std::pair< int, int > > micro_time_ranges = std::vector<std::pair<int,int>>() )
inline

Fills the time-tagged time-resolved (TTTR) indices of the pixels with the indices of the channels that fall within each pixel.

Deprecated
Use the 'fill' function instead.

This function is deprecated in favor of 'fill'. It processes the TTTR data to associate routing channels with pixels based on specified criteria. The TTTR indices of the channels within each pixel are stored.

Parameters
tttr_dataPointer to the TTTR object containing the data to be processed.
channelsList of routing channels. Events that have routing channels in this vector are added to pixels of corresponding time.
clear_pixelIf set to true (default), the pixels are cleared before being filled. If set to false, new TTTR indices are added to the pixels.
micro_time_rangesList of pairs representing micro-time ranges. If provided, only events within these ranges are considered.

◆ get_decay_of_pixels()

void CLSMImage::get_decay_of_pixels ( TTTR * tttr_data,
uint8_t * mask,
int dmask1,
int dmask2,
int dmask3,
unsigned int ** output,
int * dim1,
int * dim2,
int tac_coarsening,
bool stack_frames )

Computes micro time histograms for the stacks of images and a selection of pixels. Photons in pixels that are selected by the selection array contribute to the returned array of micro time histograms.

This function calculates micro time histograms for selected pixels in the image stack, based on a provided mask. The resulting micro time histograms are stored in the provided output array, and the dimensions of the output array are returned in the output parameters.

Parameters
tttr_dataPointer to a TTTR object.
maskA stack of images used as a mask to select pixels.
dmask1Number of frames in the mask.
dmask2Number of lines in the mask.
dmask3Number of pixels per line in the mask.
outputPointer to the output array of unsigned int that contains the micro time histograms. The array is allocated by the function.
dim1Dimension of the output array, i.e., the number of stacks.
dim2Dimension of the output array, i.e., the number of micro time channels.
tac_coarseningConstant used to coarsen the micro times.
stack_framesIf true, the frames are stacked.

◆ get_fcs_image()

void CLSMImage::get_fcs_image ( float ** output,
int * dim1,
int * dim2,
int * dim3,
int * dim4,
std::shared_ptr< TTTR > tttr,
CLSMImage * clsm_other = nullptr,
std::string correlation_method = "default",
int n_bins = 50,
int n_casc = 1,
bool stack_frames = false,
bool normalized_correlation = false,
int min_photons = 2 )

Computes an image where pixels represent correlation curves.

This function calculates a correlation image where each pixel corresponds to a correlation curve. The resulting image is determined by the specified parameters and is stored in the provided output array.

Parameters
outputPointer to the array that will contain the correlation image. The array is allocated by the function.
dim1Number of correlation curves in the image (frames or time bins).
dim2Number of lines per frame in the correlation image.
dim3Number of pixels per line in the correlation image.
dim4Number of cascades in the correlation image.
tttrShared pointer to the TTTR object containing the data.
clsm_otherPointer to another CLSMImage object (default is nullptr).
correlation_methodMethod used for correlation computation (default is "default").
n_binsNumber of bins used for correlation computation (default is 50).
n_cascNumber of cascades in the correlation image (default is 1).
stack_framesIf true, correlation curves are stacked into a single image (default is false).
normalized_correlationIf true, correlation curves are normalized (default is false).
min_photonsMinimum number of photons required for correlation computation (default is 2).

◆ get_fluorescence_decay()

void CLSMImage::get_fluorescence_decay ( TTTR * tttr_data,
unsigned char ** output,
int * dim1,
int * dim2,
int * dim3,
int * dim4,
int micro_time_coarsening = 1,
bool stack_frames = false )

Computes an image stack where the value of each pixel corresponds to a histogram of micro times in each pixel. The micro times can be coarsened by integer numbers.

This function calculates an image stack where each pixel represents a histogram of micro times. The resulting image stack is stored in the provided output array, and the dimensions of the image stack are returned in the output parameters.

Parameters
tttr_dataPointer to a TTTR object.
outputPointer to the output array of unsigned chars that will contain the image stack. The array is allocated by the function.
dim1Number of frames in the image stack.
dim2Number of lines per frame in the image stack.
dim3Number of pixels per line in the image stack.
dim4Number of micro time channels in the histogram.
micro_time_coarseningConstant used to coarsen the micro times. The default value is 1, and the micro times are binned without coarsening.
stack_framesIf true, the frames are stacked.

◆ get_frame_edges()

static std::vector< int > CLSMImage::get_frame_edges ( TTTR * tttr = nullptr,
int start_event = 0,
int stop_event = -1,
std::vector< int > marker_frame_start = std::vector< int >({4, 6}),
int marker_event_type = 15,
int reading_routine = CLSM_SP8,
bool skip_before_first_frame_marker = false,
bool skip_after_last_frame_marker = false )
static

Retrieves the time-tagged time-resolved (TTTR) indices of frame markers for a Leica SP8 microscope.

This function analyzes a TTTR object to extract frame marker information. The frame markers are identified by specified parameters, and the corresponding TTTR indices are returned as a vector.

Parameters
tttrPointer to the TTTR object that is inspected (default is nullptr).
start_eventStarting event index for analysis (default is 0).
stop_eventStopping event index for analysis (default is -1, indicating the end of the TTTR data).
marker_frame_startVector specifying the frame markers to consider (default is {4, 6}).
marker_event_typeEvent type associated with frame markers (default is 15).
reading_routineType of reading routine, e.g., CLSM_SP8 (default is CLSM_SP8).
skip_before_first_frame_markerIf true, skip events before the first frame marker (default is false).
skip_after_last_frame_markerIf true, skip events after the last frame marker (default is false).
Returns
Vector of TTTR indices corresponding to frame markers.

◆ get_frames()

std::vector< CLSMFrame * > CLSMImage::get_frames ( )
inline

Retrieves the frames stored in the CLSMImage.

Returns
Vector of CLSMFrame pointers representing the frames in the CLSMImage.

◆ get_intensity()

void CLSMImage::get_intensity ( unsigned short ** output,
int * dim1,
int * dim2,
int * dim3 )

Computes an intensity image.

This function calculates an intensity image and stores it in the provided output array. The dimensions of the intensity image are returned in the output parameters.

Parameters
outputPointer to the array that will contain the intensity image. The array is allocated by the function.
dim1Number of frames in the intensity image.
dim2Number of lines per frame in the intensity image.
dim3Number of pixels per line in the intensity image.

◆ get_line_duration()

double CLSMImage::get_line_duration ( int frame = 0,
int line = 0 )
inline

Obtains the duration of a line (in milliseconds) for a specified frame and line.

This function calculates the duration of a line in milliseconds for a given frame and line based on the time-tagged time-resolved (TTTR) data and header information.

Parameters
frameNumber of the frame in the image (default is 0).
lineNumber of the line in the image (default is 0).
Returns
Duration of the line in the selected frame in milliseconds. Returns -1.0 if the TTTR object is not initialized or if frame and line indices are out of bounds.

◆ get_line_edges()

static std::vector< int > CLSMImage::get_line_edges ( TTTR * tttr,
int start_event,
int stop_event,
int marker_line_start = 1,
int marker_line_stop = 2,
int marker_event_type = 15,
int reading_routine = CLSM_SP8 )
static

Identifies line edges by reading start and stop markers in a time-tagged time-resolved (TTTR) dataset.

This function analyzes a TTTR object to extract line edges based on specified start and stop markers. The corresponding TTTR indices are returned as a vector.

Parameters
tttrPointer to the TTTR object that is inspected.
start_eventStarting event index for analysis.
stop_eventStopping event index for analysis.
marker_line_startMarker value indicating the start of a line (default is 1).
marker_line_stopMarker value indicating the stop of a line (default is 2).
marker_event_typeEvent type associated with line markers (default is 15).
reading_routineType of reading routine, e.g., CLSM_SP8 (default is CLSM_SP8).
Returns
Vector of TTTR indices corresponding to line edges.

◆ get_line_edges_by_duration()

static std::vector< int > CLSMImage::get_line_edges_by_duration ( TTTR * tttr,
int start_event,
int stop_event,
int marker_line_start = 1,
int line_duration = 2,
int marker_event_type = 15,
int reading_routine = CLSM_SP8 )
static

Identifies line edges by reading a start marker and using line duration as the stop criterion in a time-tagged time-resolved (TTTR) dataset.

This function analyzes a TTTR object to extract line edges based on a specified start marker and line duration. The corresponding TTTR indices are returned as a vector.

Parameters
tttrPointer to the TTTR object that is inspected.
start_eventStarting event index for analysis.
stop_eventStopping event index for analysis.
marker_line_startMarker value indicating the start of a line (default is 1).
line_durationDuration of a line, used as the stop criterion (default is 2).
marker_event_typeEvent type associated with line markers (default is 15).
reading_routineType of reading routine, e.g., CLSM_SP8 (default is CLSM_SP8).
Returns
Vector of TTTR indices corresponding to line edges.

◆ get_mean_lifetime()

void CLSMImage::get_mean_lifetime ( TTTR * tttr_data,
double ** output,
int * dim1,
int * dim2,
int * dim3,
int minimum_number_of_photons = 3,
TTTR * tttr_irf = nullptr,
double m0_irf = 1.0,
double m1_irf = 1.0,
bool stack_frames = false,
std::vector< double > background = std::vector< double >(),
double m0_bg = 0.0,
double m1_bg = 0.0,
double background_fraction = -1.0 )

Computes an image of average lifetimes.

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

Pixels with few photons can be discriminated. Discriminated pixels are filled with zeros.

By default, the fluorescence lifetimes of the pixels are computed in units of nanoseconds.

Parameters
tttr_dataPointer to a TTTR object.
outputPointer to the output array that will contain the image stack. The array is allocated by the function.
dim1Returns the number of frames.
dim2Returns the number of lines.
dim3Returns the number of pixels per line.
minimum_number_of_photonsThe minimum number of photons in a micro time (default is 3).
tttr_irfPointer to a TTTR object of the Instrument Response Function (IRF) (default is nullptr).
m0_irfThe zero moment of the IRF (optional, default is 1.0).
m1_irfThe first moment of the IRF (optional, default is 1.0).
stack_framesIf true, the frames are stacked (default is false).
backgroundVector of background values (optional, default is an empty vector).
m0_bgThe zero moment of the background (optional, default is 0.0).
m1_bgThe first moment of the background (optional, default is 0.0).
background_fractionBackground fraction used for discrimination (default is -1.0, which disables discrimination).

◆ get_mean_micro_time()

void CLSMImage::get_mean_micro_time ( TTTR * tttr_data,
double ** output,
int * dim1,
int * dim2,
int * dim3,
double microtime_resolution = -1.0,
int minimum_number_of_photons = 2,
bool stack_frames = false )

Calculates an image stack where the value of each pixel corresponds to the mean micro time (in units of the micro channel resolution).

Pixels with few photons can be discriminated. Discriminated pixels will be filled with zeros.

Parameters
tttr_dataPointer to a TTTR object.
outputPointer to the output array that will contain the image stack. The array is allocated by the function.
dim1Returns the number of frames.
dim2Returns the number of lines.
dim3Returns the number of pixels per line.
microtime_resolutionMicro channel resolution (default is -1.0, which means it will be obtained from the TTTR object).
minimum_number_of_photonsThe minimum number of photons in a micro time (default is 2).
stack_framesIf true, the frames are stacked (default is false). If stack frames is set to true, the mean arrival time is computed using the TTTR indices of all pixels (corresponding to the photon-weighted mean arrival time).

◆ get_n_frames()

int CLSMImage::get_n_frames ( ) const
inline

Get the number of frames in the CLSM image.

This member function returns the number of frames in the CLSM image.

Returns
The number of frames in the CLSM image.

◆ get_n_lines()

int CLSMImage::get_n_lines ( ) const
inline

Get the number of lines per frame in the CLSMImage.

This member function returns the number of lines per frame in the CLSMImage.

Returns
The number of lines per frame in the CLSMImage.

◆ get_n_pixel()

int CLSMImage::get_n_pixel ( ) const
inline

Get the number of pixels per line in a frame of the CLSMImage.

This member function returns the number of pixels per line in a frame of the CLSMImage.

Returns
The number of pixels per line in a frame of the CLSMImage.

◆ get_phasor()

void CLSMImage::get_phasor ( float ** output,
int * dim1,
int * dim2,
int * dim3,
int * dim4,
TTTR * tttr_data,
TTTR * tttr_irf = nullptr,
double frequency = -1,
int minimum_number_of_photons = 2,
bool stack_frames = false )

Computes the phasor values for every pixel.

Pixels with few photons can be discriminated. Discriminated pixels will be filled with zeros.

Parameters
outputPointer to the output array that will contain the image stack. The array is allocated by the function.
dim1Returns the number of frames.
dim2Returns the number of lines.
dim3Returns the number of pixels per line.
dim4Returns 2 (first is the g phasor value (cos), second the s phasor (sin)).
tttr_dataPointer to a TTTR object.
tttr_irfPointer to a TTTR object representing the Instrument Response Function (IRF) (default is nullptr).
frequencyModulation frequency for phasor computation (default is -1, which means it will be obtained from the TTTR object).
minimum_number_of_photonsThe minimum number of photons in a micro time (only used if frames are not stacked, default is 2).
stack_framesIf true, the frames are stacked (default is false). If stack frames is set to true, the mean arrival time is computed using the TTTR indices of all pixels (corresponding to the photon-weighted mean arrival time).

◆ get_pixel_duration()

double CLSMImage::get_pixel_duration ( int frame = 0,
int line = 0 )
inline

Obtains the duration of a pixel (in milliseconds) for a specified frame and line.

This function calculates the duration of a pixel in milliseconds for a given frame and line, based on the time-tagged time-resolved (TTTR) data, header information, and the number of pixels per line.

Parameters
frameSelected frame number (default is 0).
lineSelected line number (default is 0).
Returns
Duration of the pixel in the selected frame in milliseconds. Returns -1.0 if the TTTR object is not initialized, or if frame and line indices are out of bounds.

◆ get_roi()

static void CLSMImage::get_roi ( double ** output,
int * dim1,
int * dim2,
int * dim3,
CLSMImage * clsm = nullptr,
std::vector< int > x_range = std::vector< int >({0,-1}),
std::vector< int > y_range = std::vector< int >({0,-1}),
std::string subtract_average = "",
double background = 0.0,
bool clip = false,
double clip_max = 1e6,
double clip_min = -1e6,
double * images = nullptr,
int n_frames = -1,
int n_lines = -1,
int n_pixels = 1,
uint8_t * mask = nullptr,
int dmask1 = -1,
int dmask2 = -1,
int dmask3 = -1,
std::vector< int > selected_frames = std::vector< int >() )
static

Copies a region of interest (ROI) from the input images, performs background correction, and stores the result in a new array.

The ROI is defined by specifying ranges for pixels and lines. The function supports various correction options, such as subtracting a constant background value, clipping output values, and correcting by the mean intensity of frames.

Parameters
outputPointer to the array that will contain the ROI. The array is allocated by the function.
dim1Number of frames in the output ROI.
dim2Number of lines per frame in the output ROI.
dim3Number of pixels per line in the output ROI.
clsmPointer to a CLSMImage object (default is nullptr).
x_rangeRange (selection) of pixels for the ROI.
y_rangeRange (selection) of lines for the ROI.
subtract_averageIf set to "stack," the mean image of the ROIs computed by averaging over all frames is subtracted from each frame, and the mean intensity of all frames and pixels is added to the pixels. If set to "frame," the average of each frame is subtracted from that frame. Default is no correction.
backgroundConstant number subtracted from each pixel.
clipIf true, values in the ROI are clipped to the range [clip_min, clip_max] (default is false).
clip_maxMaximum value when output ROIs are clipped.
clip_minMinimum value when output ROIs are clipped.
imagesInput array of images used to define ROIs (default is nullptr).
n_framesNumber of frames in the input array images.
n_linesNumber of lines in the input array images.
n_pixelsNumber of pixels per line in the input array images.
maskStack of images used to select pixels (default is nullptr).
dmask1Number of frames; if smaller than ROI, the first mask frame is applied to all ROI frames greater than dmask1.
dmask2Number of lines; if smaller than ROI, the outside region is selected, and the mask is applied to all lines smaller than dmask2.
dmask3Number of pixels per line in the mask.
selected_framesList of frames used to define the ROIs. If empty, all frames in the input are used.

◆ get_settings()

const CLSMSettings * CLSMImage::get_settings ( )
inline

◆ get_tttr()

std::shared_ptr< TTTR > CLSMImage::get_tttr ( )
inline

◆ getPixel()

CLSMPixel * CLSMImage::getPixel ( unsigned int idx)
inline

Get a pointer to a CLSMPixel object based on a one-dimensional index.

This member function calculates the three-dimensional coordinates (frame, line, pixel) corresponding to a given one-dimensional index and returns a pointer to the corresponding CLSMPixel object.

Parameters
idxOne-dimensional index to determine the CLSMPixel.
Returns
Pointer to the CLSMPixel object.

◆ operator[]()

CLSMFrame * CLSMImage::operator[] ( unsigned int i_frame)
inline

Accessor for CLSMFrame at the specified index in CLSMImage.

Returns a pointer to the CLSMFrame located at the given index in the frames vector.

Parameters
i_frame[in] Index of the desired CLSMFrame.
Returns
Pointer to the CLSMFrame at the specified index.

◆ rebin()

void CLSMImage::rebin ( int bin_line,
int bin_pixel )

Rebin a CLSMImage.

Rebinning redistributes photons and macro times in pixels.

Note: Rebinning may alter the distribution of photons and macro times in the image.

Parameters
bin_line[in] Binning factor for lines.
bin_pixel[in] Binning factor for pixels within lines.

◆ set_tttr()

void CLSMImage::set_tttr ( std::shared_ptr< TTTR > v)
inline

◆ size()

size_t CLSMImage::size ( )
inline

Get the number of frames in the CLSMImage.

◆ stack_frames()

void CLSMImage::stack_frames ( )
inline

Stack frames in the CLSMImage.

This function stacks the frames in the CLSMImage by summing the pixel values of each corresponding pixel in all frames.

◆ strip()

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

Strips time-tagged time-resolved (TTTR) indices from all pixels in the image.

This function removes specified TTTR indices from all pixels in the image. It assumes that each TTTR index is present only once in the image.

Parameters
tttr_indicesList of TTTR indices to be removed from the pixels.
offsetOffset value added to the TTTR indices before removal (default is 0).

◆ to1D()

int CLSMImage::to1D ( int frame,
int line,
int pixel )
inline

Convert three-dimensional coordinates (frame, line, pixel) to a one-dimensional index.

This inline function calculates a unique one-dimensional index for a given set of three-dimensional coordinates representing a position in an array.

Parameters
frameIndex of the frame.
lineIndex of the line within the frame.
pixelIndex of the pixel within the line.
Returns
One-dimensional index corresponding to the input coordinates.

◆ to3D()

std::vector< int > CLSMImage::to3D ( int idx)
inline

Convert a one-dimensional index to three-dimensional coordinates (frame, line, pixel).

This inline function calculates the three-dimensional coordinates (frame, line, pixel) corresponding to a given one-dimensional index in an array.

Parameters
idxOne-dimensional index to be converted.
Returns
Vector containing frame, line, and pixel indices in that order.

◆ transform()

void CLSMImage::transform ( unsigned int * input,
int n_input )

Move the content of the Pixels based on source and target pixel indices.

The input is an interleaved array of source and target pixel indices. A pixel index is a mapping from frames, lines, and pixel combination to an index.

Parameters
input[in] Pointer to an interleaved array containing source and target pixel indices.
n_input[in] Number of elements in the input array.

Friends And Related Symbol Documentation

◆ CLSMFrame

friend class CLSMFrame
friend

◆ CLSMLine

friend class CLSMLine
friend

◆ CLSMPixel

friend class CLSMPixel
friend

◆ Correlator

friend class Correlator
friend

Member Data Documentation

◆ marker_event

int CLSMImage::marker_event

The event type used for the marker.

◆ marker_frame

std::vector<int> CLSMImage::marker_frame

Vector containing the tttr indices of the frame markers.

◆ marker_line_start

int CLSMImage::marker_line_start

Defines the marker for a line start.

◆ marker_line_stop

int CLSMImage::marker_line_stop

Defines the marker for a line stop.

◆ n_frames

size_t CLSMImage::n_frames = 0
protected

The number of frames in an CLSMImage.

◆ n_lines

size_t CLSMImage::n_lines = 0
protected

The number of lines per frames.

◆ n_pixel

size_t CLSMImage::n_pixel = 0
protected

The number if pixels per line.

◆ reading_routine

std::string CLSMImage::reading_routine = "default"

◆ skip_after_last_frame_marker

bool CLSMImage::skip_after_last_frame_marker = false

◆ skip_before_first_frame_marker

bool CLSMImage::skip_before_first_frame_marker = false

CLSM TTTR data starts can have incomplete frame. Thus skipping data can make sense

◆ tttr

std::shared_ptr<TTTR> CLSMImage::tttr = nullptr
protected

Pointer to tttr data that used to construct the Image.


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