STIR  6.2.0
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
stir::InterfileHeader Class Reference

a class for Interfile keywords (and parsing) common to all types of data More...

#include "stir/IO/InterfileHeader.h"

Inheritance diagram for stir::InterfileHeader:
Inheritance graph
[legend]

Public Member Functions

bool post_processing () override
 This will be called at the end of the parsing. More...
 
- Public Member Functions inherited from stir::MinimalInterfileHeader
shared_ptr< const ExamInfoget_exam_info_sptr () const
 Get a shared pointer to the exam information.
 
const ExamInfoget_exam_info () const
 Get the exam information.
 
- Public Member Functions inherited from stir::KeyParser
bool parse (std::istream &f, const bool write_warnings=true)
 parse() returns false if there is some error, true otherwise More...
 
bool parse (const char *const filename, const bool write_warnings=true)
 parse() returns false if there is some error, true otherwise More...
 
bool parse (const std::string &, const bool write_warnings=true)
 
void add_key (const std::string &keyword, float *variable_ptr)
 add a keyword. When parsing, parse its value as a float and put it in *variable_ptr
 
void add_vectorised_key (const std::string &keyword, std::vector< float > *variable_ptr)
 add a vectorised keyword. When parsing, parse its value as a float and put it in (*variable_ptr)[current_index]
 
void add_key (const std::string &keyword, double *variable_ptr)
 add a keyword. When parsing, parse its value as a double and put it in *variable_ptr
 
void add_vectorised_key (const std::string &keyword, std::vector< double > *variable_ptr)
 add a vectorised keyword. When parsing, parse its value as a double and put it in (*variable_ptr)[current_index]
 
void add_vectorised_key (const std::string &keyword, std::vector< std::vector< double >> *variable_ptr)
 add a vectorised keyword. When parsing, parse its value as a list of doubles and put it in (*variable_ptr)[current_index]
 
void add_key (const std::string &keyword, int *variable_ptr)
 add a keyword. When parsing, parse its value as a int and put it in *variable_ptr
 
void add_key (const std::string &keyword, std::vector< int > *variable_ptr)
 add a keyword. When parsing, parse its value as a int and put it in *variable_ptr
 
void add_vectorised_key (const std::string &keyword, std::vector< int > *variable_ptr)
 add a vectorised keyword. When parsing, parse its value as a int and put it in (*variable_ptr)[current_index]
 
void add_vectorised_key (const std::string &keyword, std::vector< std::vector< int >> *variable_ptr)
 add a vectorised keyword. When parsing, parse its value as a list of ints and put it in (*variable_ptr)[current_index]
 
void add_key (const std::string &keyword, long int *variable_ptr)
 add a keyword. When parsing, parse its value as a int and put it in *variable_ptr
 
void add_key (const std::string &keyword, unsigned int *variable_ptr)
 add a keyword. When parsing, parse its value as a int and put it in *variable_ptr
 
void add_vectorised_key (const std::string &keyword, std::vector< unsigned int > *variable)
 add a vectorised keyword. When parsing, parse its value as an unsigned int and put it in (*variable_ptr)[current_index]
 
void add_key (const std::string &keyword, unsigned long *variable_ptr)
 add a keyword. When parsing, parse its value as an unsigned long and put it in *variable_ptr
 
void add_vectorised_key (const std::string &keyword, std::vector< unsigned long > *variable_ptr)
 add a vectorised keyword. When parsing, parse its value as an unsigned long and put it in (*variable_ptr)[current_index]
 
void add_key (const std::string &keyword, bool *variable_ptr)
 add a keyword. When parsing, parse its value as a int and put the bool value in *variable_ptr More...
 
void add_key (const std::string &keyword, std::vector< double > *variable_ptr)
 add a keyword. When parsing, parse its value as a list of doubles and put its value in *variable_ptr
 
void add_key (const std::string &keyword, std::vector< std::string > *variable_ptr)
 add a keyword. When parsing, parse its value as a list of comma-separated strings and put its value in *variable_ptr
 
void add_key (const std::string &keyword, Array< 2, float > *variable_ptr)
 add a keyword. When parsing, parse its value as a 2d array of floats and put its value in *variable_ptr
 
void add_key (const std::string &keyword, Array< 3, float > *variable_ptr)
 add a keyword. When parsing, parse its value as a 3d array of floats and put its value in *variable_ptr
 
void add_key (const std::string &keyword, BasicCoordinate< 3, float > *variable_ptr)
 add a keyword. When parsing, parse its value as a 3d BasicCoordinate of floats and put its value in *variable_ptr
 
void add_key (const std::string &keyword, BasicCoordinate< 3, Array< 3, float >> *variable_ptr)
 add a keyword. When parsing, parse its value as a 3d BasicCoordinate of a 3d array of floats and put its value in *variable_ptr
 
void add_key (const std::string &keyword, std::string *variable_ptr)
 
void add_vectorised_key (const std::string &keyword, std::vector< std::string > *variable_ptr)
 add a vectorised keyword. When parsing, parse its value as a string and put it in (*variable_ptr)[current_index] More...
 
void add_key (const std::string &keyword, int *variable_ptr, const ASCIIlist_type *const list_of_values)
 add a keyword. When parsing, its string value is checked against a list of strings. The corresponding index is stored in variable_ptr. More...
 
void ignore_key (const std::string &keyword)
 Add keyword this is just ignored by the parser.
 
void add_start_key (const std::string &keyword)
 add keyword that has to occur before all others More...
 
void add_stop_key (const std::string &keyword)
 add a keyword that when encountered, will stop the parsing
 
template<typename ParsingClass >
void add_parsing_key (const std::string &keyword, ParsingClass **parsed_object_ptr_ptr)
 add keyword corresponding to an object that will parse the next keys itself More...
 
template<typename ParsingClass >
void add_parsing_key (const std::string &keyword, shared_ptr< ParsingClass > *parsed_object_ptr_ptr)
 add keyword corresponding to an object that will parse the next keys itself More...
 
bool remove_key (const std::string &keyword)
 Removes a key from the kep map. More...
 
void add_alias_key (const std::string &keyword, const std::string &alias, bool deprecated_key=true)
 Add an alias for keyword. More...
 
void print_keywords_to_stream (std::ostream &) const
 Prints all keywords (in random order) to the stream.
 
virtual std::string parameter_info () const
 Returns a string with keywords and their values. More...
 
virtual void ask_parameters ()
 Ask interactively for values for all keywords. More...
 
int find_in_ASCIIlist (const std::string &, const ASCIIlist_type &list_of_values)
 returns the index of a string in 'list_of_values', -1 if not found More...
 
void start_parsing ()
 callback function to start parsing, has to be set by first keyword
 
void stop_parsing ()
 to stop parsing
 
void do_nothing ()
 callback function for keys which do not do anything
 
void set_variable ()
 callback function that sets the variable to the value given as the value of the keyword More...
 
void set_parsing_object ()
 callback function that sets the variable by calling the parser (as stored by add_parsing_key()), with argument the value of the keyword More...
 
void set_shared_parsing_object ()
 callback function that sets the shared_ptr variable by calling the parser (as stored by add_parsing_key()), with argument the value of the keyword More...
 

Public Attributes

ASCIIlist_type type_of_data_values
 
int type_of_data_index
 
ASCIIlist_type PET_data_type_values
 
int PET_data_type_index
 
ASCIIlist_type process_status_values
 
int process_status_index
 
std::string data_file_name
 
DateTimeStrings study_date_time
 
NumericType type_of_numbers
 This will be determined from number_format_index and bytes_per_pixel.
 
ByteOrder file_byte_order
 This will be determined from byte_order_index, or just keep its default value;.
 
int num_dimensions
 
int num_energy_windows
 
std::vector< std::string > matrix_labels
 
std::vector< std::vector< int > > matrix_size
 
std::vector< float > pixel_sizes
 
std::vector< std::vector< double > > image_scaling_factors
 
std::vector< unsigned long > data_offset_each_dataset
 
std::vector< float > lower_en_window_thresholds
 lower_en_window_thresholds More...
 
std::vector< float > upper_en_window_thresholds
 upper_en_window_thresholds More...
 
- Public Attributes inherited from stir::MinimalInterfileHeader
std::string version_of_keys
 
std::string siemens_mi_version
 

Protected Member Functions

void set_version_specific_keys () override
 Overload with specifics for STIR3.0 for backwards compatibility.
 
virtual void read_matrix_info ()
 
virtual void read_num_energy_windows ()
 
void read_frames_info ()
 
virtual int get_num_datasets () const
 Get the number of datasets. More...
 
- Protected Member Functions inherited from stir::KeyParser
virtual std::string standardise_keyword (const std::string &keyword) const
 convert 'rough' keyword into a standardised form More...
 
virtual std::string get_keyword (const std::string &) const
 gets a keyword from a string More...
 
void add_key (const std::string &keyword, KeyArgument::type t, KeywordProcessor function, void *variable=0, const ASCIIlist_type *const list=0)
 add a keyword to the list, together with its call_back function More...
 
void add_key (const std::string &keyword, KeyArgument::type t, KeywordProcessor function, void *variable, const int vectorised_key_level, const ASCIIlist_type *const list=0)
 add a keyword to the list, together with its call_back function More...
 
void add_key (const std::string &keyword, KeyArgument::type t, void *variable, const ASCIIlist_type *const list=0)
 version that defaults 'function' to set_variable More...
 
void add_key (const std::string &keyword, KeyArgument::type t, void *variable, const int vectorised_key_level, const ASCIIlist_type *const list=0)
 version that defaults 'function' to set_variable More...
 

Protected Attributes

int num_time_frames
 
std::vector< double > image_relative_start_times
 
std::vector< double > image_durations
 
int bytes_per_pixel
 
std::string isotope_name
 
std::vector< std::string > radionuclide_name
 
std::vector< float > radionuclide_half_life
 
std::vector< float > radionuclide_branching_ratio
 
float calibration_factor
 
unsigned long data_offset
 
float bed_position_horizontal
 
float bed_position_vertical
 
- Protected Attributes inherited from stir::MinimalInterfileHeader
shared_ptr< ExamInfoexam_info_sptr
 

Additional Inherited Members

- Static Public Attributes inherited from stir::MinimalInterfileHeader
static const double double_value_not_set = -12345.60789
 A value that can be used to signify that a variable has not been set during parsing.
 
- Protected Types inherited from stir::KeyParser
typedef void(KeyParser::* KeywordProcessor) ()
 

Detailed Description

a class for Interfile keywords (and parsing) common to all types of data

Member Function Documentation

◆ post_processing()

bool stir::InterfileHeader::post_processing ( )
overridevirtual

This will be called at the end of the parsing.

Returns
false if everything OK, true if not
Todo:

return Succeeded instead.

rename to post_parsing()

Reimplemented from stir::KeyParser.

Reimplemented in stir::InterfilePDFSHeader, stir::InterfileImageHeader, and stir::InterfilePDFSHeaderSPECT.

References stir::Interfile_datetime_to_secs_since_Unix_epoch(), and stir::warning().

Referenced by stir::InterfilePDFSHeaderSPECT::post_processing().

◆ get_num_datasets()

virtual int stir::InterfileHeader::get_num_datasets ( ) const
inlineprotectedvirtual

Get the number of datasets.

To be overloaded by derived classes if multiple "dimensions" are supported. Default is just to use num_time_frames.

Reimplemented in stir::InterfileImageHeader.

Member Data Documentation

◆ isotope_name

std::string stir::InterfileHeader::isotope_name
protected

◆ lower_en_window_thresholds

std::vector<float> stir::InterfileHeader::lower_en_window_thresholds

lower_en_window_thresholds

Low energy window limit

◆ upper_en_window_thresholds

std::vector<float> stir::InterfileHeader::upper_en_window_thresholds

upper_en_window_thresholds

High energy window limit


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