STIR  6.2.0
Files | Classes | Enumerations | Functions
ECAT6 ... ECAT8 support in the IO library
Collaboration diagram for ECAT6 ... ECAT8 support in the IO library:

Files

file  ECAT7DynamicDiscretisedDensityOutputFileFormat.cxx
 Implementation of class stir::ecat::ecat7::ECAT7DynamicDiscretisedDensityOutputFileFormat.
 
file  add_ecat7_header_to_sgl.cxx
 Prepend contents of ECAT7 header to a new sgl file (from list mode acquisition)
 
file  show_ecat7_header.cxx
 Show contents of ECAT7 header.
 
file  ecat6_types.h
 ECAT 6 CTI matrix parameters.
 
file  ecat6_utils.h
 Declaration of ECAT 6 CTI functions to access data.
 
file  ECAT6ImageInputFileFormat.h
 Declaration of class stir::ecat::ecat6::ECAT6ImageInputFileFormat.
 
file  ECAT6OutputFileFormat.h
 Declaration of class stir::ecat::ecat7::ECAT6OutputFileFormat.
 
file  ECAT7DynamicDiscretisedDensityInputFileFormat.h
 Declaration of class stir::ecat::ecat7::ECAT7DynamicDiscretisedDensityInputFileFormat.
 
file  ECAT7DynamicDiscretisedDensityOutputFileFormat.h
 Declaration of class stir::ecat::ecat7::ECAT7DynamicDiscretisedDensityOutputFileFormat.
 
file  ECAT7ImageInputFileFormat.h
 Declaration of class stir::ecat::ecat7::ECAT7ImageInputFileFormat.
 
file  ECAT7OutputFileFormat.h
 Declaration of class stir::ecat::ecat7::ECAT7OutputFileFormat.
 
file  ECAT7ParametricDensityOutputFileFormat.h
 Declaration of class stir::ecat::ecat7::ECAT7ParametricDensityOutputFileFormat.
 
file  ECAT8_32bitListmodeInputFileFormat.h
 Declaration of class stir::ecat::ECAT8_32bitListmodeInputFileFormat.
 
file  ECAT962ListmodeInputFileFormat.h
 Declaration of class stir::ecat::ecat7::ECAT962ListmodeInputFileFormat.
 
file  ECAT966ListmodeInputFileFormat.h
 Declaration of class stir::ecat::ecat7::ECAT966ListmodeInputFileFormat.
 
file  InterfileHeaderSiemens.h
 This file declares the classes stir::InterfileHeaderSiemens, stir::InterfileRawDataHeaderSiemens, stir::InterfilePDFSHeaderSiemens, stir::InterfileListmodeHeaderSiemens, stir:InterfileNormHeaderSiemens.
 
file  stir_ecat6.h
 Declaration of routines which convert ECAT6 things into our building blocks and vice versa.
 
file  stir_ecat7.h
 Declaration of routines which convert CTI things into our building blocks and vice versa.
 
file  stir_ecat_common.h
 Declaration of routines which convert ECAT things into our building blocks and vice versa.
 
file  ecat6_utils.cxx
 Implementation of ECAT 6 CTI functions to access data.
 
file  ECAT6OutputFileFormat.cxx
 Implementation of class stir::ECAT6OutputFileFormat.
 
file  ECAT7DynamicDiscretisedDensityInputFileFormat.cxx
 Implementation of class stir::ecat::ecat7::ECAT7DynamicDiscretisedDensityInputFileFormat.
 
file  ECAT7DynamicDiscretisedDensityOutputFileFormat.cxx
 Implementation of class stir::ecat::ecat7::ECAT7DynamicDiscretisedDensityOutputFileFormat.
 
file  ECAT7OutputFileFormat.cxx
 Implementation of class stir::ecat::ecat7::ECAT7OutputFileFormat.
 
file  ECAT7ParametricDensityOutputFileFormat.cxx
 Implementation of class stir::ecat::ecat7::ECAT7ParametricDensityOutputFileFormat.
 
file  stir_ecat6.cxx
 Implementation of routines which convert CTI things into our building blocks and vice versa.
 
file  stir_ecat7.cxx
 Implementation of routines which convert ECAT7 things into our building blocks and vice versa.
 
file  stir_ecat_common.cxx
 Implementation of routines which convert ECAT6, ECAT7 and ECAT8 things into our building blocks and vice versa.
 
file  add_ecat7_header_to_sgl.cxx
 Prepend contents of ECAT7 header to a new sgl file (from list mode acquisition)
 
file  BinNormalisationFromECAT7.cxx
 Implementation for class stir::ecat::ecat7::BinNormalisationFromECAT7.
 
file  BinNormalisationFromECAT8.cxx
 Implementation for class stir::ecat::BinNormalisationFromECAT8.
 
file  copy_ecat7_header.cxx
 Copy contents of an ECAT7 header from 1 file to another.
 
file  ecat_swap_corners.cxx
 A (slightly dangerous) utility to perform so-called corner-swapping for ECAT6 projection data.
 
file  is_ecat7_file.cxx
 A simple utility that allows to check if a file is in the ECAT7 format.
 

Classes

class  stir::ecat::ecat6::ECAT6ImageInputFileFormat
 Class for reading images in ECAT6 file-format. More...
 
class  stir::ecat::ecat6::ECAT6OutputFileFormat
 Implementation of OutputFileFormat paradigm for the ECAT6 format. More...
 
class  stir::ecat::ecat7::ECAT7DynamicDiscretisedDensityInputFileFormat
 Class for reading images in ECAT7 file-format. More...
 
class  stir::ecat::ecat7::ECAT7DynamicDiscretisedDensityOutputFileFormat
 Implementation of OutputFileFormat paradigm for the ECAT7 format. More...
 
class  stir::ecat::ecat7::ECAT7ImageInputFileFormat
 Class for reading images in ECAT7 file-format. More...
 
class  stir::ecat::ecat7::ECAT7OutputFileFormat
 Implementation of OutputFileFormat paradigm for the ECAT7 format. More...
 
class  stir::ecat::ecat7::ECAT7ParametricDensityOutputFileFormat< DiscretisedDensityT >
 Implementation of OutputFileFormat paradigm for the ECAT7 format. More...
 
class  stir::ecat::ECAT8_32bitListmodeInputFileFormat
 Class for being able to read list mode data from the ECAT 8_32bit scanner via the listmode-data registry. More...
 
class  stir::ecat::ecat7::ECAT962ListmodeInputFileFormat
 Class for reading list mode data from the ECAT 962 scanner. More...
 
class  stir::ecat::ecat7::ECAT966ListmodeInputFileFormat
 Class for reading list mode data from the ECAT 966 scanner. More...
 
class  stir::ecat::ecat7::BinNormalisationFromECAT7
 A BinNormalisation class that gets the normalisation factors from an ECAT7 3D normalisation file. More...
 
class  stir::ecat::BinNormalisationFromECAT8
 A BinNormalisation class that gets the normalisation factors from an ECAT8 3D normalisation file. Note that you have to point it to the "Interfile" header. More...
 
struct  stir::ecat::ecat6::ScanInfoRec
 ECAT 6 CTI scanner parameters. More...
 

Enumerations

enum  stir::ecat::ECATDataType {
  ECAT_unknown_data_type = 0, ECAT_Byte_data_type = 1, ECAT_I2_little_endian_data_type = 2, ECAT_I4_little_endian_data_type = 3,
  ECAT_R4_VAX_data_type = 4, ECAT_R4_IEEE_big_endian_data_type = 5, ECAT_I2_big_endian_data_type = 6, ECAT_I4_big_endian_data_type = 7
}
 Possible values for the data_type field in ECAT headers. More...
 

Functions

long stir::ecat::ecat6::cti_numcod (int frame, int plane, int gate, int data, int bed)
 Encode scan information into a single, incomprehensible number.
 
void stir::ecat::ecat6::cti_numdoc (long matnum, Matval *matval)
 Unpack encoded data into a nice struct. Reverse of cti_numcod (). More...
 
int stir::ecat::ecat6::cti_rings2plane (short nrings, short ring0, short ring1)
 Get sinogram plane from ring pair. More...
 
FILE * stir::ecat::ecat6::cti_create (const char *fname, const ECAT6_Main_header *mhead)
 Open a file and write main header to it. Returns a pointer to the file, or 0 if unsuccessful. More...
 
int stir::ecat::ecat6::cti_rblk (FILE *fptr, int blkno, void *bufr, int nblks)
 Read from a matrix file starting at the given block. Returns EXIT_SUCCESS if all went well. More...
 
int stir::ecat::ecat6::cti_wblk (FILE *fptr, int blkno, void *bufr, int nblks)
 Write blocks from buffer into file. Returns EXIT_SUCCESS if successful. More...
 
int stir::ecat::ecat6::cti_read_ECAT6_Main_header (FILE *fptr, ECAT6_Main_header *h)
 Read header data from a file and place it into a ECAT6_Main_header struct. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::cti_read_scan_subheader (FILE *fptr, const ECAT6_Main_header *, int blknum, Scan_subheader *)
 Read header data from a file and place it into a Scan_subheader struct. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::cti_read_attn_subheader (FILE *fptr, const ECAT6_Main_header *h, int blknum, Attn_subheader *header_ptr)
 Read header data from a file and place it into a Attn_subheader struct. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::cti_read_norm_subheader (FILE *fptr, const ECAT6_Main_header *h, int blknum, Norm_subheader *header_ptr)
 Read header data from a file and place it into a Norm_subheader struct. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::cti_read_image_subheader (FILE *fptr, const ECAT6_Main_header *h, int blknum, Image_subheader *header_ptr)
 Read header data from a file and place it into an Image_subheader struct. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::cti_enter (FILE *fptr, const ECAT6_Main_header *mhead_ptr, long matnum, int nblks)
 Create entry in file corresponding to matnum, and return offset of next block. Or some such. Returns 0 if there was an error. More...
 
int stir::ecat::ecat6::cti_lookup (FILE *fptr, const ECAT6_Main_header *mhead_ptr, long matnum, MatDir *entry)
 Look up a "matrix number" in the file and return the MatDir entry for it. Returns 0 if the lookup was NOT successful. More...
 
int stir::ecat::ecat6::cti_write_idata (FILE *fptr, int blk, const short *data, int isize)
 Write data in blocks from buffer into file.
 
int stir::ecat::ecat6::cti_write_image_subheader (FILE *fptr, const ECAT6_Main_header *h, int blknum, const Image_subheader *header_ptr)
 Write an image subheader into a matrix file. Returns 0 if successful. More...
 
int stir::ecat::ecat6::cti_write_ECAT6_Main_header (FILE *fptr, const ECAT6_Main_header *header_ptr)
 Write an image main header into a matrix file. Returns 0 if successful. More...
 
int stir::ecat::ecat6::cti_write_scan_subheader (FILE *fptr, const ECAT6_Main_header *h, int blknum, const Scan_subheader *header_ptr)
 Write a scan subheader into a matrix file. More...
 
int stir::ecat::ecat6::cti_write_image (FILE *fptr, long matnum, const ECAT6_Main_header *mhead_ptr, const Image_subheader *header_ptr, const short *data, int data_size)
 Write an image, including headers, into a matrix file.
 
int stir::ecat::ecat6::cti_write_scan (FILE *fptr, long matnum, const ECAT6_Main_header *mhead_ptr, const Scan_subheader *header_ptr, const short *data, int data_size)
 Write a scan, including headers, into a matrix file.
 
int stir::ecat::ecat6::get_scanheaders (FILE *fptr, long matnum, ECAT6_Main_header *mhead, Scan_subheader *shead, ScanInfoRec *scanParams)
 Read main header and subheader from scan file. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::get_scandata (FILE *fptr, char *scan, ScanInfoRec *scanParams)
 Read scan data from file. Returns EXIT_FAILURE if the data could not be read. More...
 
int stir::ecat::ecat6::get_attnheaders (FILE *fptr, long matnum, ECAT6_Main_header *mhead, Attn_subheader *shead, ScanInfoRec *attnParams)
 Read main header and subheader from attn file. Returns EXIT_SUCCESS if no error. More...
 
int stir::ecat::ecat6::get_normheaders (FILE *fptr, long matnum, ECAT6_Main_header *mhead, Norm_subheader *shead, ScanInfoRec *nrmParams)
 Read main header and subheader from normalisation file. Returns EXIT_SUCCESS if no error. More...
 
bool stir::ecat::ecat6::is_ECAT6_file (const std::string &filename)
 checks if the file is in ECAT6 formatAs ECAT6 doesn't have a 'magic number' this check is somewhat heuristic. Checks are only on the main header. Current checks are: More...
 
bool stir::ecat::ecat6::is_ECAT6_image_file (const std::string &filename)
 checks if the file is in ECAT6 format and if the file contains images
 
bool stir::ecat::ecat6::is_ECAT6_emission_file (const std::string &filename)
 checks if the file is in ECAT6 format and if the file contains emission sinograms (or blank/transmision)
 
bool stir::ecat::ecat6::is_ECAT6_attenuation_file (const std::string &filename)
 checks if the file is in ECAT6 format and if the file contains attenuation correction factors
 
Scannerstir::ecat::ecat6::find_scanner_from_ECAT6_Main_header (const ECAT6_Main_header &mhead)
 determine scanner type from the ECAT6_Main_header More...
 
Succeeded stir::ecat::ecat6::DiscretisedDensity_to_ECAT6 (DiscretisedDensity< 3, float > const &density, std::string const &cti_name, std::string const &orig_name, const Scanner &scanner, const int frame_num=1, const int gate_num=1, const int data_num=0, const int bed_num=0)
 Create a new ECAT6 image file and write the data in there. More...
 
Succeeded stir::ecat::ecat6::DiscretisedDensity_to_ECAT6 (FILE *fptr, DiscretisedDensity< 3, float > const &density, const ECAT6_Main_header &mhead, const int frame_num=1, const int gate_num=1, const int data_num=0, const int bed_num=0)
 Write an (extra) image to an existing ECAT6 file. More...
 
Succeeded stir::ecat::ecat6::ProjData_to_ECAT6 (ProjData const &proj_data, std::string const &cti_name, std::string const &orig_name, const int frame_num=1, const int gate_num=1, const int data_num=0, const int bed_num=0, const bool write_2D_sinograms=false)
 Create a new ECAT6 sinogram file and write the data in there. More...
 
Succeeded stir::ecat::ecat6::ProjData_to_ECAT6 (FILE *fptr, ProjData const &proj_data, const ECAT6_Main_header &mhead, const int frame_num=1, const int gate_num=1, const int data_num=0, const int bed_num=0, const bool write_2D_sinograms=false)
 Write an (extra) set of sinograms to an existing ECAT6 file. More...
 
void stir::ecat::ecat6::make_ECAT6_Main_header (ECAT6_Main_header &, const Scanner &, const std::string &orig_name, ExamInfo const &exam_info)
 Fill in most of the main header given a Scanner object and orig_name.
 
void stir::ecat::ecat6::make_ECAT6_Main_header (ECAT6_Main_header &mhead, Scanner const &scanner, const std::string &orig_name, DiscretisedDensity< 3, float > const &density)
 Fill in most of the main header given a Scanner object and orig_name and an image. More...
 
void stir::ecat::ecat6::make_ECAT6_Main_header (ECAT6_Main_header &mhead, const std::string &orig_name, ProjDataInfo const &proj_data_info)
 Fill in most of the main header given an orig_name and a proj_data_info. More...
 
bool stir::ecat::ecat7::is_ECAT7_file (const std::string &filename)
 checks if the file is in ECAT7 formatThis partly relies on the implementation of matrix_open in the LLN matrix library. Additional checks are made on the main header. Current checks are: More...
 
bool stir::ecat::ecat7::is_ECAT7_image_file (const std::string &filename)
 checks if the file is in ECAT6 format and if the file contains images
 
bool stir::ecat::ecat7::is_ECAT7_emission_file (const std::string &filename)
 checks if the file is in ECAT6 format and if the file contains emission sinograms (or blank/transmision)
 
bool stir::ecat::ecat7::is_ECAT7_attenuation_file (const std::string &filename)
 checks if the file is in ECAT6 format and if the file contains attenuation correction factors
 
void stir::ecat::ecat7::find_scanner (shared_ptr< Scanner > &scanner_ptr, const Main_header &mhead)
 determine scanner type from the main_header More...
 
Succeeded stir::ecat::ecat7::DiscretisedDensity_to_ECAT7 (DiscretisedDensity< 3, float > const &density, std::string const &cti_name, std::string const &orig_name, const Scanner &scanner, const int frame_num=1, const int gate_num=1, const int data_num=0, const int bed_num=0)
 Create a new ECAT7 image file and write the data in there.
 
Succeeded stir::ecat::ecat7::DiscretisedDensity_to_ECAT7 (MatrixFile *mptr, DiscretisedDensity< 3, float > const &density, const int frame_num=1, const int gate_num=1, const int data_num=0, const int bed_num=0)
 Write an (extra) image to an existing ECAT7 file. More...
 
Succeeded stir::ecat::ecat7::ProjData_to_ECAT7 (ProjData const &proj_data, NumericType output_type, std::string const &cti_name, std::string const &orig_name, const int frame_num=1, const int gate_num=1, const int data_num=0, const int bed_num=0, const bool write_as_attenuation=false, float scale_factor=0.0F)
 Create a new ECAT7 sinogram file and write the data in there. More...
 
Succeeded stir::ecat::ecat7::ProjData_to_ECAT7 (MatrixFile *mptr, ProjData const &proj_data, const int frame_num=1, const int gate_num=1, const int data_num=0, const int bed_num=0, float scale_factor=0.0F)
 Write an (extra) set of sinograms to an existing ECAT7 file. More...
 
void stir::ecat::ecat7::make_ECAT7_main_header (Main_header &, const Scanner &, const std::string &orig_name, ExamInfo const &exam_info)
 Fill in most of the main header given a Scanner object and orig_name.
 
void stir::ecat::ecat7::make_ECAT7_main_header (Main_header &mhead, Scanner const &scanner, const std::string &orig_name, DiscretisedDensity< 3, float > const &density)
 Fill in most of the main header given a Scanner object and orig_name and an image. More...
 
NumericType stir::ecat::ecat7::make_ECAT7_main_header (Main_header &mhead, const std::string &orig_name, ExamInfo const &exam_info, ProjDataInfo const &proj_data_info, const bool write_as_attenuation=false, NumericType output_type=NumericType::FLOAT)
 Fill in most of the main header given an orig_name and a proj_data_info. More...
 
void stir::ecat::ecat7::make_subheader_for_ECAT7 (Attn_subheader &shead, const Main_header &mhead, const ProjDataInfo &proj_data_info)
 Fill in most of the subheader. More...
 
void stir::ecat::ecat7::make_subheader_for_ECAT7 (Scan3D_subheader &shead, const Main_header &mhead, const ProjDataInfo &proj_data_info)
 Fill in most of the subheader. More...
 
ProjDataFromStreamstir::ecat::ecat7::make_pdfs_from_matrix (MatrixFile *const mptr, MatrixData *const matrix, const shared_ptr< std::iostream > &stream_ptr)
 Make a ProjDataFromStream object that 'points' into an ECAT7 file. More...
 
Succeeded stir::ecat::ecat7::write_basic_interfile_header_for_ECAT7 (std::string &interfile_header_name, const std::string &ECAT7_filename, const int frame_num, const int gate_num, const int data_num, const int bed_num)
 Writes an Interfile header that 'points' into an ECAT7 file. More...
 
void stir::ecat::find_type_from_ECAT_data_type (NumericType &type, ByteOrder &byte_order, const short data_type)
 Find out which NumericType and ByteOrder corresponds to a ECAT data type.
 
short stir::ecat::find_ECAT_data_type (const NumericType &type, const ByteOrder &byte_order)
 Find out which ECAT data type corresponds to a certain NumericType and ByteOrder. More...
 
short stir::ecat::find_ECAT_system_type (const Scanner &scanner)
 Find the value used in the ECAT Main header for a given scanner. More...
 
Scannerstir::ecat::find_scanner_from_ECAT_system_type (const short system_type)
 Find the scanner corresponding to the system type in the main header. More...
 
std::vector< int > stir::ecat::find_segment_sequence (const ProjDataInfo &pdi)
 Return the sequence of how Siemens stores segments. More...
 
std::vector< int > stir::ecat::find_timing_poss_sequence (const ProjDataInfo &pdi)
 Return the sequence of how Siemens stores TOF bins. More...
 
virtual bool stir::ecat::ecat7::ECAT7DynamicDiscretisedDensityInputFileFormat::actual_can_read (const FileSignature &signature, std::istream &input) const
 Class for reading images in ECAT7 file-format. More...
 

Detailed Description

Enumeration Type Documentation

◆ ECATDataType

Possible values for the data_type field in ECAT headers.

The data_type field is used to indicate how the data are written. Note that the VAX_float type is not the same as IEEE float with little_endian byte order.

Function Documentation

◆ cti_numdoc()

void stir::ecat::ecat6::cti_numdoc ( long  matnum,
Matval *  matval 
)

Unpack encoded data into a nice struct. Reverse of cti_numcod ().

Parameters
matnumthe thingy to decode
matvalstruct containing the decoded values from matnum

◆ cti_rings2plane()

int stir::ecat::ecat6::cti_rings2plane ( short  nrings,
short  ring0,
short  ring1 
)

Get sinogram plane from ring pair.

Parameters
ring0first ring in ring pair
ring1second ring in ring pair

◆ cti_create()

FILE * stir::ecat::ecat6::cti_create ( const char *  fname,
const ECAT6_Main_header *  mhead 
)

Open a file and write main header to it. Returns a pointer to the file, or 0 if unsuccessful.

Parameters
fnamename of file to open
mheadpointer to main header struct to copy into the file

Referenced by stir::ecat::ecat6::ECAT6OutputFileFormat::actual_write_to_file(), stir::ecat::ecat6::DiscretisedDensity_to_ECAT6(), and stir::ecat::ecat6::ProjData_to_ECAT6().

◆ cti_rblk()

int stir::ecat::ecat6::cti_rblk ( FILE *  fptr,
int  blkno,
void *  bufr,
int  nblks 
)

Read from a matrix file starting at the given block. Returns EXIT_SUCCESS if all went well.

Parameters
fptrfile pointer
blknofirst block to read
nblksnumber of blocks to read

◆ cti_wblk()

int stir::ecat::ecat6::cti_wblk ( FILE *  fptr,
int  blkno,
void *  bufr,
int  nblks 
)

Write blocks from buffer into file. Returns EXIT_SUCCESS if successful.

Parameters
fptrpointer to file.
blknoposition in file of first block to write.
nblksnumber of blocks to write.

◆ cti_read_ECAT6_Main_header()

int stir::ecat::ecat6::cti_read_ECAT6_Main_header ( FILE *  fptr,
ECAT6_Main_header *  h 
)

Read header data from a file and place it into a ECAT6_Main_header struct. Returns EXIT_SUCCESS if no error.

Parameters
fptrfile containing the header data
hstruct to fill with header info

Referenced by stir::ecat::ecat6::ECAT6ImageInputFileFormat::read_from_file().

◆ cti_read_scan_subheader()

int stir::ecat::ecat6::cti_read_scan_subheader ( FILE *  fptr,
const ECAT6_Main_header *  h,
int  blknum,
Scan_subheader *  header_ptr 
)

Read header data from a file and place it into a Scan_subheader struct. Returns EXIT_SUCCESS if no error.

Parameters
fptrfile containing the header data
blknumblock number at which to begin reading
hstruct to fill

◆ cti_read_attn_subheader()

int stir::ecat::ecat6::cti_read_attn_subheader ( FILE *  fptr,
const ECAT6_Main_header *  h,
int  blknum,
Attn_subheader *  header_ptr 
)

Read header data from a file and place it into a Attn_subheader struct. Returns EXIT_SUCCESS if no error.

Parameters
fptrfile containing the header data
blknumblock number at which to begin reading
header_ptrstruct to fill

◆ cti_read_norm_subheader()

int stir::ecat::ecat6::cti_read_norm_subheader ( FILE *  fptr,
const ECAT6_Main_header *  h,
int  blknum,
Norm_subheader *  header_ptr 
)

Read header data from a file and place it into a Norm_subheader struct. Returns EXIT_SUCCESS if no error.

Parameters
fptrfile containing the header data
blknumblock number at which to begin reading
header_ptrstruct to fill

◆ cti_read_image_subheader()

int stir::ecat::ecat6::cti_read_image_subheader ( FILE *  fptr,
const ECAT6_Main_header *  h,
int  blknum,
Image_subheader *  header_ptr 
)

Read header data from a file and place it into an Image_subheader struct. Returns EXIT_SUCCESS if no error.

Parameters
fptrfile containing the header data
blknumblock number at which to begin reading
header_ptrstruct to fill

◆ cti_enter()

int stir::ecat::ecat6::cti_enter ( FILE *  fptr,
const ECAT6_Main_header *  mhead_ptr,
long  matnum,
int  nblks 
)

Create entry in file corresponding to matnum, and return offset of next block. Or some such. Returns 0 if there was an error.

Parameters
fptrpointer to file.
mhead_ptrpointer to a main header
matnumdesired matnum.
nblksnumber of blocks

◆ cti_lookup()

int stir::ecat::ecat6::cti_lookup ( FILE *  fptr,
const ECAT6_Main_header *  mhead_ptr,
long  matnum,
MatDir *  entry 
)

Look up a "matrix number" in the file and return the MatDir entry for it. Returns 0 if the lookup was NOT successful.

Parameters
fptrfile containing all the tabulated information.
mhead_ptrpointer to a main header
matnumindex.
entrywhere to put the result.

◆ cti_write_image_subheader()

int stir::ecat::ecat6::cti_write_image_subheader ( FILE *  fptr,
const ECAT6_Main_header *  h,
int  blknum,
const Image_subheader *  header_ptr 
)

Write an image subheader into a matrix file. Returns 0 if successful.

Parameters
fptrpointer to file.
blknumoffset (in blocks) in file of first block to write.
header_ptrheader to write

◆ cti_write_ECAT6_Main_header()

int stir::ecat::ecat6::cti_write_ECAT6_Main_header ( FILE *  fptr,
const ECAT6_Main_header *  header_ptr 
)

Write an image main header into a matrix file. Returns 0 if successful.

Parameters
fptrpointer to file.
header_ptrheader to write

◆ cti_write_scan_subheader()

int stir::ecat::ecat6::cti_write_scan_subheader ( FILE *  fptr,
const ECAT6_Main_header *  h,
int  blknum,
const Scan_subheader *  header_ptr 
)

Write a scan subheader into a matrix file.

Parameters
fptrpointer to file.
blknumblock offset at which to begin writing
header_ptrheader to write

◆ get_scanheaders()

int stir::ecat::ecat6::get_scanheaders ( FILE *  fptr,
long  matnum,
ECAT6_Main_header *  mhead,
Scan_subheader *  shead,
ScanInfoRec scanParams 
)

Read main header and subheader from scan file. Returns EXIT_SUCCESS if no error.

Parameters
fptrpointer to scan file
matnummatnum for scan
mheadwhere to put the main header
sheadwhere to put the subheader
scanParamswhere to put the scan parameters

◆ get_scandata()

int stir::ecat::ecat6::get_scandata ( FILE *  fptr,
char *  scan,
ScanInfoRec scanParams 
)

Read scan data from file. Returns EXIT_FAILURE if the data could not be read.

Parameters
fptrscan file
scanbuffer for the data, must be preallocated
scanParamsdata parameters

The data will be stored according to the data_type in scanParams, but converted (i.e. byte-swapped etc.) to the hosts native format.

Warning
the scan buffer has to be allocated with size a multiple of MatBLKSIZE, even if there is actually less data in the sinogram.

◆ get_attnheaders()

int stir::ecat::ecat6::get_attnheaders ( FILE *  fptr,
long  matnum,
ECAT6_Main_header *  mhead,
Attn_subheader *  shead,
ScanInfoRec attnParams 
)

Read main header and subheader from attn file. Returns EXIT_SUCCESS if no error.

Parameters
fptrpointer to attn file
matnummatnum for attn
mheadwhere to put the main header
sheadwhere to put the subheader
attnParamswhere to put the attn parameters

◆ get_normheaders()

int stir::ecat::ecat6::get_normheaders ( FILE *  fptr,
long  matnum,
ECAT6_Main_header *  mhead,
Norm_subheader *  shead,
ScanInfoRec nrmParams 
)

Read main header and subheader from normalisation file. Returns EXIT_SUCCESS if no error.

Parameters
fptrpointer to nrm file
matnummatnum for nrm
mheadwhere to put the main header
sheadwhere to put the subheader
nrmParamswhere to put the nrm parameters

◆ is_ECAT6_file()

bool stir::ecat::ecat6::is_ECAT6_file ( const std::string &  filename)

checks if the file is in ECAT6 formatAs ECAT6 doesn't have a 'magic number' this check is somewhat heuristic. Checks are only on the main header. Current checks are:

  1. sw_version field between 0 and 69
  2. file_type field one of the values in the enum MatFileType
  3. num_frames field > 0

Referenced by stir::TimeFrameDefinitions::TimeFrameDefinitions().

◆ find_scanner_from_ECAT6_Main_header()

Scanner * stir::ecat::ecat6::find_scanner_from_ECAT6_Main_header ( const ECAT6_Main_header &  mhead)

determine scanner type from the ECAT6_Main_header

Returns a Unknown_Scanner if it does not recognise it.

References stir::ecat::find_scanner_from_ECAT_system_type().

◆ DiscretisedDensity_to_ECAT6() [1/2]

Succeeded stir::ecat::ecat6::DiscretisedDensity_to_ECAT6 ( DiscretisedDensity< 3, float > const &  density,
std::string const &  cti_name,
std::string const &  orig_name,
const Scanner scanner,
const int  frame_num = 1,
const int  gate_num = 1,
const int  data_num = 0,
const int  bed_num = 0 
)

Create a new ECAT6 image file and write the data in there.

References stir::ecat::ecat6::cti_create(), and stir::ecat::ecat6::make_ECAT6_Main_header().

Referenced by stir::ecat::ecat6::ECAT6OutputFileFormat::actual_write_to_file().

◆ DiscretisedDensity_to_ECAT6() [2/2]

Succeeded stir::ecat::ecat6::DiscretisedDensity_to_ECAT6 ( FILE *  fptr,
DiscretisedDensity< 3, float > const &  density,
const ECAT6_Main_header &  mhead,
const int  frame_num = 1,
const int  gate_num = 1,
const int  data_num = 0,
const int  bed_num = 0 
)

Write an (extra) image to an existing ECAT6 file.

Some consistency checks are performed between the image and the data in the main header

Warning
This does NOT write the main header.

◆ ProjData_to_ECAT6() [1/2]

Succeeded stir::ecat::ecat6::ProjData_to_ECAT6 ( ProjData const &  proj_data,
std::string const &  cti_name,
std::string const &  orig_name,
const int  frame_num = 1,
const int  gate_num = 1,
const int  data_num = 0,
const int  bed_num = 0,
const bool  write_2D_sinograms = false 
)

Create a new ECAT6 sinogram file and write the data in there.

Warning
Only data without axial compression can be handled by the ECAT6 3D sinogram format, and hence also by this function (CTI span==1), except when write_2D_sinograms==true

References stir::ecat::ecat6::cti_create(), stir::ProjData::get_proj_data_info_sptr(), and stir::ecat::ecat6::make_ECAT6_Main_header().

◆ ProjData_to_ECAT6() [2/2]

Succeeded stir::ecat::ecat6::ProjData_to_ECAT6 ( FILE *  fptr,
ProjData const &  proj_data,
const ECAT6_Main_header &  mhead,
const int  frame_num = 1,
const int  gate_num = 1,
const int  data_num = 0,
const int  bed_num = 0,
const bool  write_2D_sinograms = false 
)

Write an (extra) set of sinograms to an existing ECAT6 file.

Some consistency checks are performed between the proj_data and the data in the main header

Warning
Only data without axial compression can be handled by the ECAT6 3D sinogram format, and hence also by this function (CTI span==1), except when write_2D_sinograms==true
This does NOT write the main header.

◆ make_ECAT6_Main_header() [1/2]

void stir::ecat::ecat6::make_ECAT6_Main_header ( ECAT6_Main_header &  mhead,
Scanner const &  scanner,
const std::string &  orig_name,
DiscretisedDensity< 3, float > const &  density 
)

Fill in most of the main header given a Scanner object and orig_name and an image.

Sets file_type, num_planes, plane_separation as well

References stir::ecat::ecat6::make_ECAT6_Main_header().

◆ make_ECAT6_Main_header() [2/2]

void stir::ecat::ecat6::make_ECAT6_Main_header ( ECAT6_Main_header &  mhead,
const std::string &  orig_name,
ProjDataInfo const &  proj_data_info 
)

Fill in most of the main header given an orig_name and a proj_data_info.

It gets the scanner from the proj_data_info object. Sets file_type, num_planes, plane_separation as well

References stir::ProjDataInfo::get_scanner_sptr(), stir::ecat::ecat6::make_ECAT6_Main_header(), and stir::warning().

◆ is_ECAT7_file()

bool stir::ecat::ecat7::is_ECAT7_file ( const std::string &  filename)

checks if the file is in ECAT7 formatThis partly relies on the implementation of matrix_open in the LLN matrix library. Additional checks are made on the main header. Current checks are:

  1. sw_version field between 70 and 79
  2. file_type field one of the values in the enum MatFileType
  3. num_frames field > 0
Warning
When the file is not readable, error() is called.

Referenced by stir::TimeFrameDefinitions::TimeFrameDefinitions().

◆ find_scanner()

void stir::ecat::ecat7::find_scanner ( shared_ptr< Scanner > &  scanner_ptr,
const Main_header &  mhead 
)

◆ DiscretisedDensity_to_ECAT7()

Succeeded stir::ecat::ecat7::DiscretisedDensity_to_ECAT7 ( MatrixFile *  mptr,
DiscretisedDensity< 3, float > const &  density,
const int  frame_num = 1,
const int  gate_num = 1,
const int  data_num = 0,
const int  bed_num = 0 
)

Write an (extra) image to an existing ECAT7 file.

Some consistency checks are performed between the image and the data in the main header

Warning
This does NOT write the main header.

References stir::DiscretisedDensityOnCartesianGrid< num_dimensions, elemT >::get_grid_spacing(), stir::VectorWithOffset< Array< num_dimensions - 1, elemT > >::get_length(), and stir::warning().

◆ ProjData_to_ECAT7() [1/2]

Succeeded stir::ecat::ecat7::ProjData_to_ECAT7 ( ProjData const &  proj_data,
NumericType  output_type,
std::string const &  cti_name,
std::string const &  orig_name,
const int  frame_num = 1,
const int  gate_num = 1,
const int  data_num = 0,
const int  bed_num = 0,
const bool  write_as_attenuation = false,
float  scale_factor = 0.0F 
)

Create a new ECAT7 sinogram file and write the data in there.

Note that not all output_type are supported by the ECAT7 format. If a wrong type is used, it will be forced to floats.

References stir::ProjData::get_proj_data_info_sptr(), and stir::ecat::ecat7::make_ECAT7_main_header().

◆ ProjData_to_ECAT7() [2/2]

Succeeded stir::ecat::ecat7::ProjData_to_ECAT7 ( MatrixFile *  mptr,
ProjData const &  proj_data,
const int  frame_num = 1,
const int  gate_num = 1,
const int  data_num = 0,
const int  bed_num = 0,
float  scale_factor = 0.0F 
)

Write an (extra) set of sinograms to an existing ECAT7 file.

Some consistency checks are performed between the proj_data and the data in the main header pointer of mptr.

For ECAT7, the data type for the output is determined by the file_type field of the main header.

Warning
This does NOT write the main header.

◆ make_ECAT7_main_header() [1/2]

void stir::ecat::ecat7::make_ECAT7_main_header ( Main_header &  mhead,
Scanner const &  scanner,
const std::string &  orig_name,
DiscretisedDensity< 3, float > const &  density 
)

Fill in most of the main header given a Scanner object and orig_name and an image.

Sets num_planes, plane_separation as well

References stir::ecat::ecat7::make_ECAT7_main_header().

◆ make_ECAT7_main_header() [2/2]

NumericType stir::ecat::ecat7::make_ECAT7_main_header ( Main_header &  mhead,
const std::string &  orig_name,
ExamInfo const &  exam_info,
ProjDataInfo const &  proj_data_info,
const bool  write_as_attenuation = false,
NumericType  output_type = NumericType::FLOAT 
)

Fill in most of the main header given an orig_name and a proj_data_info.

It gets the scanner from the proj_data_info object. Sets num_planes, plane_separation as well and attempts septa_state.

Returns
the actual NumericType that should be used for further IO. This is necessary because the file_type in the ECAT7 main header depends on the output_type (sign).

Defaults mean that it will set to file_type Float3dSinogram.

Warning
Note that not all output_type are supported by the ECAT7 format. If a wrong type is used, it will be forced to floats.
The acquisition_type field will be set to either TransmissionScan or StaticEmission, depending on write_as_attenuation. This is not necessarily correct.

References stir::Scanner::get_default_bin_size(), stir::ProjDataInfo::get_max_segment_num(), stir::ProjDataInfo::get_min_segment_num(), stir::ProjDataInfo::get_num_axial_poss(), stir::ProjDataInfo::get_sampling_in_s(), stir::ProjDataInfo::get_scanner_ptr(), stir::ecat::ecat7::make_ECAT7_main_header(), and stir::warning().

◆ make_subheader_for_ECAT7() [1/2]

void stir::ecat::ecat7::make_subheader_for_ECAT7 ( Attn_subheader &  shead,
const Main_header &  mhead,
const ProjDataInfo proj_data_info 
)

Fill in most of the subheader.

Warning
data_type and volume_mode has still to be set

◆ make_subheader_for_ECAT7() [2/2]

void stir::ecat::ecat7::make_subheader_for_ECAT7 ( Scan3D_subheader &  shead,
const Main_header &  mhead,
const ProjDataInfo proj_data_info 
)

Fill in most of the subheader.

Warning
data_type and volume_mode has still to be set

◆ make_pdfs_from_matrix()

ProjDataFromStream* stir::ecat::ecat7::make_pdfs_from_matrix ( MatrixFile *const  mptr,
MatrixData *const  matrix,
const shared_ptr< std::iostream > &  stream_ptr 
)

Make a ProjDataFromStream object that 'points' into an ECAT7 file.

  • mptr is the LLN structure that has the file pointer etc for the ECAT7 file
  • matrix encodes frame, gate, data, bed numbers
  • stream_ptr is a pointer to a stream object corresponding to the SAME file as the ECAT7 file. This argument is necessary as it isn't possible to make a stream from a FILE pointer.
    Returns
    NULL when it is an unsupported data type
    Only data types AttenCor, Byte3dSinogram, Short3dSinogram, Float3dSinogram can be handled. Other sinogram formats have subheaders interleaved with the data which makes it impossible to have a corresponding ProjDataFromStream

◆ write_basic_interfile_header_for_ECAT7()

Succeeded stir::ecat::ecat7::write_basic_interfile_header_for_ECAT7 ( std::string &  interfile_header_name,
const std::string &  ECAT7_filename,
const int  frame_num,
const int  gate_num,
const int  data_num,
const int  bed_num 
)

Writes an Interfile header that 'points' into an ECAT7 file.

Only data types AttenCor, Byte3dSinogram, Short3dSinogram, Float3dSinogram, ByteVolume, PetVolume can be handled.

interfile_header_name will be set to the header name used. It will be of the form ECAT7_filename_extension_f1g1d0b0.hs or .hv. For example, for ECAT7_filename test.S, and frame=2, gate=3, data=4, bed=5, the header name will be test_S_f2g3d4b5.hs

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

◆ find_ECAT_data_type()

short stir::ecat::find_ECAT_data_type ( const NumericType type,
const ByteOrder byte_order 
)

Find out which ECAT data type corresponds to a certain NumericType and ByteOrder.

Returns 0 when it does not recognise it

References stir::NumericType::integer_type(), stir::NumericType::signed_type(), stir::NumericType::size_in_bytes(), and stir::warning().

◆ find_ECAT_system_type()

short stir::ecat::find_ECAT_system_type ( const Scanner scanner)

◆ find_scanner_from_ECAT_system_type()

Scanner * stir::ecat::find_scanner_from_ECAT_system_type ( const short  system_type)

◆ find_segment_sequence()

std::vector< int > stir::ecat::find_segment_sequence ( const ProjDataInfo pdi)

Return the sequence of how Siemens stores segments.

ECAT 7,8 always stores segments as 0, -1, +1, ... (numbering is in STIR convention)

References stir::ProjDataInfo::get_max_segment_num().

◆ find_timing_poss_sequence()

std::vector< int > stir::ecat::find_timing_poss_sequence ( const ProjDataInfo pdi)

Return the sequence of how Siemens stores TOF bins.

Siemens always stores segments as 0, -1, +1, ... (numbering is in STIR convention)

References stir::ProjDataInfo::get_num_tof_poss().

◆ actual_can_read()

bool stir::ecat::ecat7::ECAT7DynamicDiscretisedDensityInputFileFormat::actual_can_read ( const FileSignature signature,
std::istream &  input 
) const
protectedvirtual

Class for reading images in ECAT7 file-format.


Preliminary

Implements stir::InputFileFormat< DynamicDiscretisedDensity >.

References stir::FileSignature::get_signature().