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

#include <TTTRHeader.h>

Public Member Functions

int get_tttr_record_type ()
 
void set_tttr_record_type (int v)
 
int get_tttr_container_type ()
 
void set_tttr_container_type (int v)
 
size_t get_bytes_per_record ()
 
size_t end () const
 
size_t size ()
 
nlohmann::json & operator[] (std::size_t idx)
 
const nlohmann::json & operator[] (std::size_t idx) const
 
unsigned int get_number_of_micro_time_channels ()
 
double get_macro_time_resolution ()
 Resolution for the macro time in nanoseconds.
 
double get_micro_time_resolution ()
 Resolution for the micro time in nanoseconds.
 
int get_pixel_duration ()
 Duration of a pixel in LSM in units of macro time clock.
 
int get_line_duration ()
 Duration of a line in LSM in units of macro time clock.
 
unsigned int get_effective_number_of_micro_time_channels ()
 
 TTTRHeader ()
 
 TTTRHeader (int tttr_container_type)
 
 TTTRHeader (const TTTRHeader &p2)
 Copy constructor.
 
 TTTRHeader (std::FILE *fpin, int tttr_container_type=0, bool close_file=false)
 
 TTTRHeader (std::string fn, int tttr_container_type=0)
 
 ~TTTRHeader ()=default
 
std::string get_json (std::string tag_name="", int idx=-1, int indent=1)
 
void set_json (std::string json_string)
 

Static Public Member Functions

static nlohmann::json get_tag (nlohmann::json json_data, const std::string &name, int idx=-1)
 
static int find_tag (nlohmann::json &json_data, const std::string &name, int idx=-1)
 
static void add_tag (nlohmann::json &json_data, const std::string &name, std::any value, unsigned int type=tyAnsiString, int idx=-1)
 
static size_t read_ptu_header (std::FILE *fpin, int &tttr_record_type, nlohmann::json &json_data, bool rewind=true)
 Reads the header of a PTU file and sets the reading routing.
 
static size_t read_ht3_header (std::FILE *fpin, nlohmann::json &data, bool rewind=true)
 Reads the header of an HT3 file and sets the reading routing.
 
static size_t read_bh132_header (std::FILE *fpin, nlohmann::json &data, bool rewind=true)
 Reads the header of a Becker & Hickel SPC132 file and sets the reading routing.
 
static size_t read_cz_confocor3_header (std::FILE *fpin, nlohmann::json &data, bool rewind=true)
 Reads the header of a Carl Zeiss (CZ) Confocor3 file and sets the reading routing.
 
static void write_spc132_header (std::string fn, TTTRHeader *header, std::string modes="w")
 
static void write_ptu_header (std::string fn, TTTRHeader *header, std::string modes="wb")
 
static void write_ht3_header (std::string fn, TTTRHeader *header, std::string modes="wb")
 

Protected Attributes

nlohmann::json json_data
 
size_t header_end = 0
 

Friends

class TTTR
 

Constructor & Destructor Documentation

◆ TTTRHeader() [1/5]

TTTRHeader::TTTRHeader ( )

Default constructor

◆ TTTRHeader() [2/5]

TTTRHeader::TTTRHeader ( int tttr_container_type)

◆ TTTRHeader() [3/5]

TTTRHeader::TTTRHeader ( const TTTRHeader & p2)

Copy constructor.

◆ TTTRHeader() [4/5]

TTTRHeader::TTTRHeader ( std::FILE * fpin,
int tttr_container_type = 0,
bool close_file = false )

◆ TTTRHeader() [5/5]

TTTRHeader::TTTRHeader ( std::string fn,
int tttr_container_type = 0 )

◆ ~TTTRHeader()

TTTRHeader::~TTTRHeader ( )
default

Member Function Documentation

◆ add_tag()

static void TTTRHeader::add_tag ( nlohmann::json & json_data,
const std::string & name,
std::any value,
unsigned int type = tyAnsiString,
int idx = -1 )
static

Add a meta data tag. If the tag already exists the value of the meta data tag is replaced.

Parameters
json_data
name
value
type
idx

◆ end()

size_t TTTRHeader::end ( ) const
inline

◆ find_tag()

static int TTTRHeader::find_tag ( nlohmann::json & json_data,
const std::string & name,
int idx = -1 )
static

Find the index of a tag in the JSON data by name type and index

Parameters
json_data
name
type
idx
Returns

◆ get_bytes_per_record()

size_t TTTRHeader::get_bytes_per_record ( )
inline

Stores the bytes per TTTR record of the associated TTTR file This attribute is changed when a header is read

◆ get_effective_number_of_micro_time_channels()

unsigned int TTTRHeader::get_effective_number_of_micro_time_channels ( )
inline

The number of micro time channels that fit between two macro times.

The total (possible) number of TAC channels can exceed the number that fit between two macro time channels. This function returns the effective number, i.e., the number of micro time channels between two macro times. The micro time channels that are outside of this bound should (usually) not be filled.

Returns
effective_tac_channels (that fit between to macro times)

◆ get_json()

std::string TTTRHeader::get_json ( std::string tag_name = "",
int idx = -1,
int indent = 1 )

Get a representation of the TTTRHeader meta data as a JSON string

Parameters
tag_namename of requested tag (if no name is provided) the entire information in the TTTRHeader is returned
idxindex of the tag
indentan integer that controls the indent in the returned JSON string
Returns

◆ get_line_duration()

int TTTRHeader::get_line_duration ( )
inline

Duration of a line in LSM in units of macro time clock.

◆ get_macro_time_resolution()

double TTTRHeader::get_macro_time_resolution ( )

Resolution for the macro time in nanoseconds.

◆ get_micro_time_resolution()

double TTTRHeader::get_micro_time_resolution ( )
inline

Resolution for the micro time in nanoseconds.

◆ get_number_of_micro_time_channels()

unsigned int TTTRHeader::get_number_of_micro_time_channels ( )
inline

The total (possible) number of micro time channels.

The number of TAC channels (TAC - Time to analog converter) refers to the number of micro time channels.

◆ get_pixel_duration()

int TTTRHeader::get_pixel_duration ( )
inline

Duration of a pixel in LSM in units of macro time clock.

◆ get_tag()

static nlohmann::json TTTRHeader::get_tag ( nlohmann::json json_data,
const std::string & name,
int idx = -1 )
static

Get a tag / entry from the meta data list in a JSON dict

Parameters
json_data
name
idx
Returns

◆ get_tttr_container_type()

int TTTRHeader::get_tttr_container_type ( )
inline

The container type

Returns

◆ get_tttr_record_type()

int TTTRHeader::get_tttr_record_type ( )
inline
Returns
The TTTR container type of the associated TTTR file as a char

◆ operator[]() [1/2]

nlohmann::json & TTTRHeader::operator[] ( std::size_t idx)
inline

◆ operator[]() [2/2]

const nlohmann::json & TTTRHeader::operator[] ( std::size_t idx) const
inline

◆ read_bh132_header()

static size_t TTTRHeader::read_bh132_header ( std::FILE * fpin,
nlohmann::json & data,
bool rewind = true )
static

Reads the header of a Becker & Hickel SPC132 file and sets the reading routing.

Parameters
fpinFile pointer to the SPC132 file.
dataOutput parameter for JSON data.
rewindFlag to indicate whether to rewind the file (default is true).
Returns
The position of the file pointer at the end of the header.

◆ read_cz_confocor3_header()

static size_t TTTRHeader::read_cz_confocor3_header ( std::FILE * fpin,
nlohmann::json & data,
bool rewind = true )
static

Reads the header of a Carl Zeiss (CZ) Confocor3 file and sets the reading routing.

Parameters
fpinFile pointer to the Confocor3 file.
dataOutput parameter for JSON data.
rewindFlag to indicate whether to rewind the file (default is true).
Returns
The position of the file pointer at the end of the header.

◆ read_ht3_header()

static size_t TTTRHeader::read_ht3_header ( std::FILE * fpin,
nlohmann::json & data,
bool rewind = true )
static

Reads the header of an HT3 file and sets the reading routing.

Parameters
fpinFile pointer to the HT3 file.
dataOutput parameter for JSON data.
rewindFlag to indicate whether to rewind the file (default is true).
Returns
The position of the file pointer at the end of the header.

◆ read_ptu_header()

static size_t TTTRHeader::read_ptu_header ( std::FILE * fpin,
int & tttr_record_type,
nlohmann::json & json_data,
bool rewind = true )
static

Reads the header of a PTU file and sets the reading routing.

Parameters
fpinFile pointer to the PTU file.
tttr_record_typeOutput parameter for the TTTR record type.
json_dataOutput parameter for JSON data.
rewindFlag to indicate whether to rewind the file (default is true).
Returns
The position of the file pointer at the end of the header.

◆ set_json()

void TTTRHeader::set_json ( std::string json_string)
inline

Set / update the TTTRHeader meta data using a JSON string

Parameters
json_string

◆ set_tttr_container_type()

void TTTRHeader::set_tttr_container_type ( int v)
inline
Parameters
vcontainer type

◆ set_tttr_record_type()

void TTTRHeader::set_tttr_record_type ( int v)
inline
Parameters
vrecord type

◆ size()

size_t TTTRHeader::size ( )
inline

Number of meta data entries

◆ write_ht3_header()

static void TTTRHeader::write_ht3_header ( std::string fn,
TTTRHeader * header,
std::string modes = "wb" )
static

Write a HT3 header to a file

WARNING: If the default write mode is "wb". Existing files are overwritten.

Parameters
fnfilename
headerpointer to the TTTRHeader object that is written to the file
modesthe writing modes (default 'wb')

◆ write_ptu_header()

static void TTTRHeader::write_ptu_header ( std::string fn,
TTTRHeader * header,
std::string modes = "wb" )
static

Write a PTU header to a file

WARNING: If the default write mode is "wb". Existing files are overwritten.

Parameters
fnfilename
headerpointer to the TTTRHeader object that is written to the file
modesthe writing modes (default 'wb')

◆ write_spc132_header()

static void TTTRHeader::write_spc132_header ( std::string fn,
TTTRHeader * header,
std::string modes = "w" )
static

Write a spc132 header to a file

WARNING: If the default write mode is "wb". Existing files are overwritten.

Parameters
fnfilename
headerpointer to the TTTRHeader object that is written to the file
modesthe writing modes (default 'w+b')

Friends And Related Symbol Documentation

◆ TTTR

friend class TTTR
friend

Member Data Documentation

◆ header_end

size_t TTTRHeader::header_end = 0
protected

Marks the end of the header in the file (position in file)

◆ json_data

nlohmann::json TTTRHeader::json_data
protected

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