CASToR  1.0
Tomographic Reconstruction (PET/SPECT)
Defines | Functions
gDataConversionUtilities.hh File Reference

This file gathers various function dedicated to data conversion in order to convert various type of GATE files (macro file, root datafile) to the CASToR file formats. More...

#include "gVariables.hh"
#include "gOptions.hh"
#include "iDataFilePET.hh"
#include "sOutputManager.hh"
#include "sScannerManager.hh"
#include "oInterfileIO.hh"

Go to the source code of this file.

Defines

#define GATE_SYS_UNKNOWN   -1
#define GATE_SYS_CYLINDRICAL   0
#define GATE_SYS_ECAT   1
#define GATE_SYS_SPECT   2
#define GATE_NB_MAX_LAYERS   4

Functions

vector< string > CheckGATECommand (const string &a_key, const string &a_line)
 Check if the line contains the provided GATE command. In this case, parse the line and returns the values in a vector of strings.
vector< string > Split (string a_line)
 Split the line provided in parameter into a vector of strings (separator is blankspace)
void ConvertValuesTomm (vector< string > &values)
 Check if the vector of strings passed in parameter contains the 'cm' unit In this case, convert all its values in mm.
template<class T >
string toString (T a_val)
 Convert a value of any type into string.
template<typename T >
int WriteVector (ofstream &file, const string &a_key, vector< T > a_vals)
 Write the key and its values in the file provided in parameter.
int WriteVector (ofstream &file, const string &a_key, vector< string > a_vals)
 Write the key and its values in the file provided in parameter.
int WriteVector (ofstream &file, const string &a_key, vector< vector< string > > a_vals)
 Write the key and its values contained in a 2 level vector of strings in the file provided in parameter.
int GetGATESystemType (const string &a_pathMac)
 Read a GATE macro file and identify the system type from the 'gate/systems/' command lines.
int GetGATEMacFiles (const string &a_pathMac, vector< string > &ap_pathToMacFiles)
int GetGATEAliasesCylindrical (vector< string > path_mac_files, string &rsector_name, string &module_name, string &submodule_name, string &crystal_name, vector< string > &layers_name, int vb)
int GetGATEAliasesEcat (vector< string > path_mac_files, string &block_name, string &crystal_name, int vb)
 Loop over a list of path to GATE macro files passed in parameter to recover aliases of the different parts of an ecat system.
int GetGATEAliasesSPECT (vector< string > path_mac_files, string &base_name, string &crystal_name, string &pixel_name, int vb)
 Loop over a list of path to GATE macro files passed in parameter to recover aliases of the different parts of an ecat system.
uint32_t ConvertIDecat (int32_t nBlocksPerRing, int32_t nBlocksLine, int32_t nCrystalsTransaxial, int32_t nCrystalsAxial, int32_t crystalID, int32_t blockID)
uint32_t ConvertIDSPECTRoot1 (int32_t a_headID, float_t a_rotAngle, float_t a_angStep, uint32_t a_nProjectionsByHead)
uint32_t ConvertIDSPECTRoot2 (uint32_t a_nbSimulatedPixels, uint32_t a_nPixTrs, uint32_t a_nPixAxl, int32_t a_headID, int32_t a_crystalID, int32_t a_pixelID, float_t a_rotAngle, float_t a_headAngPitch, float_t a_crystalSizeAxl, float_t a_crystalSizeTrs, float_t a_gPosX, float_t a_gPosY, float_t a_gPosZ)
uint32_t ConvertIDcylindrical (uint32_t nRsectorsPerRing, uint32_t nModulesTransaxial, uint32_t nModulesAxial, uint32_t nSubmodulesTransaxial, uint32_t nSubmodulesAxial, uint32_t nCrystalsTransaxial, uint32_t nCrystalsAxial, uint8_t nLayers, uint32_t *nCrystalPerLayer, vector< uint32_t > nLayersRptTransaxial, vector< uint32_t > nLayersRptAxial, int32_t layerID, int32_t crystalID, int32_t submoduleID, int32_t moduleID, int32_t rsectorID)
 Compute a CASToR crystal index of a GATE cylindricalPET system from its indexes (rsector/module/submodule/crystal) and the system layout.
int ComputeKindGATEEvent (uint32_t eventID1, uint32_t eventID2, int comptonPhantom1, int comptonPhantom2, int rayleighPhantom1, int rayleighPhantom2)
int ReadMacECAT (string a_pathMac, uint32_t &nCrystalsTot, uint32_t &nCrystalsAxial, uint32_t &nCrystalsTransaxial, uint32_t &nBlocksLine, uint32_t &nBlocksPerRing, uint32_t &start_time_ms, uint32_t &duration_ms, int vb)
int ReadMacSPECT (string a_pathMac, float_t &distToDetector, uint32_t &nHeads, uint32_t &nPixAxl, uint32_t &nPixTrs, float_t &crystalSizeAxl, float_t &crystalSizeTrs, uint32_t &nProjectionsTot, uint32_t &nProjectionsByHead, float_t &head1stAngle, float_t &headAngPitch, float_t &headAngStepDeg, int &headRotDirection, uint32_t &start_time_ms, uint32_t &duration_ms, int vb)
int ReadIntfSPECT (string a_pathIntf, float_t &ap_distToDetector, uint32_t &ap_nHeads, uint32_t &ap_nPixAxl, uint32_t &ap_nPixTrs, float_t &ap_crystalSizeAxl, float_t &ap_crystalSizeTrs, uint32_t &ap_nProjectionsTot, uint32_t &ap_nProjectionsByHead, float_t &ap_head1stAngle, float_t &ap_headAngPitch, float_t &headAngStepDeg, int &ap_headRotDirection, uint32_t &ap_start_time_ms, uint32_t &ap_duration_ms, int vb)
int ReadMacCylindrical (string a_pathMac, uint8_t &nLayers, uint32_t *nb_crystal_per_layer, uint32_t &nCrystalsTot, uint32_t &nCrystalsAxial, uint32_t &nCrystalsTransaxial, vector< uint32_t > &nLayersRptAxial, vector< uint32_t > &nLayersRptTransaxial, uint32_t &nSubmodulesAxial, uint32_t &nSubmodulesTransaxial, uint32_t &nModulesAxial, uint32_t &nModulesTransaxial, uint32_t &nRsectorsPerRing, uint32_t &start_time_ms, uint32_t &duration_ms, int vb)
int CreateGeomWithECAT (string a_pathMac, string a_pathGeom)
 Read a GATE macro file containing the description of an ecat system, and convert it to a geom file.
int CreateGeomWithCylindrical (string a_pathMac, string a_pathGeom)
 Read a GATE macro file containing the description of a cylindricalPET system, and convert it to a geom file.
int CreateGeomWithSPECT (string a_pathMac, string a_pathGeom)

Detailed Description

This file gathers various function dedicated to data conversion in order to convert various type of GATE files (macro file, root datafile) to the CASToR file formats.

Definition in file gDataConversionUtilities.hh.


Define Documentation

#define GATE_NB_MAX_LAYERS   4

Definition at line 49 of file gDataConversionUtilities.hh.


Function Documentation

CheckGATECommand ( const string &  a_key,
const string &  a_line 
)

Check if the line contains the provided GATE command. In this case, parse the line and returns the values in a vector of strings.

Parameters:
a_key,:string containing a GATE command to recover
a_line: string containing the line to check

Values are converted in mm if 'cm' is found in the line

Returns:
the vector of strings containing the elements of the line.

Definition at line 41 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

int ComputeKindGATEEvent ( uint32_t  eventID1,
uint32_t  eventID2,
int  comptonPhantom1,
int  comptonPhantom2,
int  rayleighPhantom1,
int  rayleighPhantom2 
)

Definition at line 925 of file gDataConversionUtilities.cc.

Here is the caller graph for this function:

ConvertIDcylindrical ( uint32_t  nRsectorsPerRing,
uint32_t  nModulesTransaxial,
uint32_t  nModulesAxial,
uint32_t  nSubmodulesTransaxial,
uint32_t  nSubmodulesAxial,
uint32_t  nCrystalsTransaxial,
uint32_t  nCrystalsAxial,
uint8_t  nLayers,
uint32_t *  nCrystalPerLayer,
vector< uint32_t >  nLayersRptTransaxial,
vector< uint32_t >  nLayersRptAxial,
int32_t  layerID,
int32_t  crystalID,
int32_t  submoduleID,
int32_t  moduleID,
int32_t  rsectorID 
)

Compute a CASToR crystal index of a GATE cylindricalPET system from its indexes (rsector/module/submodule/crystal) and the system layout.

Parameters:
nRsectorsPerRing
nModulesTransaxial
nModulesAxial
nSubmodulesTransaxial
nSubmodulesAxial
nCrystalsTransaxial
nCrystalsAxial
nLayers
nb_crystal_per_layer
nLayersRptTransaxial
nLayersRptAxial
layerID
crystalID
submoduleID
moduleID
rsectorID
Returns:
CASToR crystal index

Definition at line 814 of file gDataConversionUtilities.cc.

Here is the caller graph for this function:

uint32_t ConvertIDecat ( int32_t  nBlocksPerRing,
int32_t  nBlocksLine,
int32_t  nCrystalsTransaxial,
int32_t  nCrystalsAxial,
int32_t  crystalID,
int32_t  blockID 
)

Definition at line 655 of file gDataConversionUtilities.cc.

Here is the caller graph for this function:

uint32_t ConvertIDSPECTRoot1 ( int32_t  a_headID,
float_t  a_rotAngle,
float_t  a_angStep,
uint32_t  a_nProjectionsByHead 
)

Definition at line 689 of file gDataConversionUtilities.cc.

Here is the caller graph for this function:

uint32_t ConvertIDSPECTRoot2 ( uint32_t  a_nbSimulatedPixels,
uint32_t  a_nPixTrs,
uint32_t  a_nPixAxl,
int32_t  a_headID,
int32_t  a_crystalID,
int32_t  a_pixelID,
float_t  a_rotAngle,
float_t  a_headAngPitch,
float_t  a_crystalSizeAxl,
float_t  a_crystalSizeTrs,
float_t  a_gPosX,
float_t  a_gPosY,
float_t  a_gPosZ 
)

Definition at line 728 of file gDataConversionUtilities.cc.

Here is the caller graph for this function:

ConvertValuesTomm ( vector< string > &  values)

Check if the vector of strings passed in parameter contains the 'cm' unit In this case, convert all its values in mm.

Parameters:
ap_v: vector of strings

Definition at line 101 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

CreateGeomWithCylindrical ( string  a_pathMac,
string  a_pathGeom 
)

Read a GATE macro file containing the description of a cylindricalPET system, and convert it to a geom file.

Parameters:
a_pathMac: string containing the path to a GATE macro file
a_pathGeom: string containing the path to a CASToR output geom file
Returns:
0 if success, positive value otherwise

Definition at line 2104 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

CreateGeomWithECAT ( string  a_pathMac,
string  a_pathGeom 
)

Read a GATE macro file containing the description of an ecat system, and convert it to a geom file.

Parameters:
a_pathMac: string containing the path to a GATE macro file
a_pathGeom: string containing the path to a CASToR output geom file
Returns:
0 if success, positive value otherwise

Definition at line 3020 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

int CreateGeomWithSPECT ( string  a_pathMac,
string  a_pathGeom 
)

Definition at line 3474 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

int GetGATEAliasesCylindrical ( vector< string >  path_mac_files,
string &  rsector_name,
string &  module_name,
string &  submodule_name,
string &  crystal_name,
vector< string > &  layers_name,
int  vb 
)

Definition at line 362 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

GetGATEAliasesEcat ( vector< string >  path_mac_files,
string &  block_name,
string &  crystal_name,
int  vb 
)

Loop over a list of path to GATE macro files passed in parameter to recover aliases of the different parts of an ecat system.

Parameters:
path_mac_files
block_name
crystal_name
vb
Returns:
0 if success, positive value otherwise

Definition at line 485 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

GetGATEAliasesSPECT ( vector< string >  path_mac_files,
string &  base_name,
string &  crystal_name,
string &  pixel_name,
int  vb 
)

Loop over a list of path to GATE macro files passed in parameter to recover aliases of the different parts of an ecat system.

Parameters:
path_mac_files
base_name
crystal_name
pixel_name
vb
Returns:
0 if success, positive value otherwise

Definition at line 569 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

int GetGATEMacFiles ( const string &  a_pathMac,
vector< string > &  ap_pathToMacFiles 
)

Definition at line 232 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

GetGATESystemType ( const string &  a_pathMac)

Read a GATE macro file and identify the system type from the 'gate/systems/' command lines.

Parameters:
a_pathMac: path to a GATE macro file
Returns:
system type, as described by the macro GATE_SYS_TYPE

Definition at line 273 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

int ReadIntfSPECT ( string  a_pathIntf,
float_t &  ap_distToDetector,
uint32_t &  ap_nHeads,
uint32_t &  ap_nPixAxl,
uint32_t &  ap_nPixTrs,
float_t &  ap_crystalSizeAxl,
float_t &  ap_crystalSizeTrs,
uint32_t &  ap_nProjectionsTot,
uint32_t &  ap_nProjectionsByHead,
float_t &  ap_head1stAngle,
float_t &  ap_headAngPitch,
float_t &  headAngStepDeg,
int &  ap_headRotDirection,
uint32_t &  ap_start_time_ms,
uint32_t &  ap_duration_ms,
int  vb 
)

Definition at line 1874 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

int ReadMacCylindrical ( string  a_pathMac,
uint8_t &  nLayers,
uint32_t *  nb_crystal_per_layer,
uint32_t &  nCrystalsTot,
uint32_t &  nCrystalsAxial,
uint32_t &  nCrystalsTransaxial,
vector< uint32_t > &  nLayersRptAxial,
vector< uint32_t > &  nLayersRptTransaxial,
uint32_t &  nSubmodulesAxial,
uint32_t &  nSubmodulesTransaxial,
uint32_t &  nModulesAxial,
uint32_t &  nModulesTransaxial,
uint32_t &  nRsectorsPerRing,
uint32_t &  start_time_ms,
uint32_t &  duration_ms,
int  vb 
)

Definition at line 979 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

int ReadMacECAT ( string  a_pathMac,
uint32_t &  nCrystalsTot,
uint32_t &  nCrystalsAxial,
uint32_t &  nCrystalsTransaxial,
uint32_t &  nBlocksLine,
uint32_t &  nBlocksPerRing,
uint32_t &  start_time_ms,
uint32_t &  duration_ms,
int  vb 
)

Definition at line 1305 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

int ReadMacSPECT ( string  a_pathMac,
float_t &  distToDetector,
uint32_t &  nHeads,
uint32_t &  nPixAxl,
uint32_t &  nPixTrs,
float_t &  crystalSizeAxl,
float_t &  crystalSizeTrs,
uint32_t &  nProjectionsTot,
uint32_t &  nProjectionsByHead,
float_t &  head1stAngle,
float_t &  headAngPitch,
float_t &  headAngStepDeg,
int &  headRotDirection,
uint32_t &  start_time_ms,
uint32_t &  duration_ms,
int  vb 
)

Definition at line 1525 of file gDataConversionUtilities.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

Split ( string  a_line)

Split the line provided in parameter into a vector of strings (separator is blankspace)

Parameters:
a_line: string to split
Returns:
vector of string containing the splitted elements of the line

Definition at line 76 of file gDataConversionUtilities.cc.

Here is the caller graph for this function:

template<class T >
toString ( a_val)

Convert a value of any type into string.

Parameters:
a_val: value to convert
Returns:
the value in parameter converted in string

Definition at line 88 of file gDataConversionUtilities.hh.

Here is the caller graph for this function:

template<typename T >
WriteVector ( ofstream &  file,
const string &  a_key,
vector< T >  a_vals 
)

Write the key and its values in the file provided in parameter.

Parameters:
file: the output file
a_key: key to write
a_vals: vector containing the key values
Returns:
0 if success, positive value otherwise

Definition at line 130 of file gDataConversionUtilities.cc.

Here is the caller graph for this function:

WriteVector ( ofstream &  file,
const string &  a_key,
vector< string >  a_vals 
)

Write the key and its values in the file provided in parameter.

Parameters:
file: the output file
a_key: key to write
a_vals: vector containing the key values
Returns:
0 if success, positive value otherwise

Definition at line 169 of file gDataConversionUtilities.cc.

WriteVector ( ofstream &  file,
const string &  a_key,
vector< vector< string > >  a_vals 
)

Write the key and its values contained in a 2 level vector of strings in the file provided in parameter.

Parameters:
file: the output file
a_key: key to write
a_vals: vector containing the key values
Returns:
0 if success, positive value otherwise

Definition at line 204 of file gDataConversionUtilities.cc.

 All Classes Files Functions Variables Typedefs Defines