CASToR
1.1
Tomographic Reconstruction (PET/SPECT)
|
Implementation of class Interfile management functions. More...
Go to the source code of this file.
Functions | |
template<class T > | |
int | IntfKeyGetValueFromFile (const string &a_pathToHeader, const string &a_key, T *ap_return, int a_nbElts, int a_mandatoryFlag) |
Look for "a_nbElts" elts in the "a_pathToHeader" interfile header matching the "a_keyword" key passed as parameter and return the corresponding value(s) in the "ap_return" templated array. More... | |
template int | IntfKeyGetValueFromFile< string > (const string &a_pathToHeader, const string &a_key, string *ap_return, int a_nbElts, int a_mandatoryFlag) |
template int | IntfKeyGetValueFromFile< int > (const string &a_pathToHeader, const string &a_key, int *ap_return, int a_nbElts, int a_mandatoryFlag) |
template int | IntfKeyGetValueFromFile< int64_t > (const string &a_pathToHeader, const string &a_key, int64_t *ap_return, int a_nbElts, int a_mandatoryFlag) |
template int | IntfKeyGetValueFromFile< float > (const string &a_pathToHeader, const string &a_key, float *ap_return, int a_nbElts, int a_mandatoryFlag) |
template int | IntfKeyGetValueFromFile< double > (const string &a_pathToHeader, const string &a_key, double *ap_return, int a_nbElts, int a_mandatoryFlag) |
template int | IntfKeyGetValueFromFile< long double > (const string &a_pathToHeader, const string &a_key, long double *ap_return, int a_nbElts, int a_mandatoryFlag) |
template int | IntfKeyGetValueFromFile< uint8_t > (const string &a_pathToHeader, const string &a_key, uint8_t *ap_return, int a_nbElts, int a_mandatoryFlag) |
template int | IntfKeyGetValueFromFile< uint16_t > (const string &a_pathToHeader, const string &a_key, uint16_t *ap_return, int a_nbElts, int a_mandatoryFlag) |
template int | IntfKeyGetValueFromFile< uint32_t > (const string &a_pathToHeader, const string &a_key, uint32_t *ap_return, int a_nbElts, int a_mandatoryFlag) |
template int | IntfKeyGetValueFromFile< bool > (const string &a_pathToHeader, const string &a_key, bool *ap_return, int a_nbElts, int a_mandatoryFlag) |
template<typename T > | |
int | IntfKeyGetRecurringValueFromFile (const string &a_pathToHeader, const string &a_key, T *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
template int | IntfKeyGetRecurringValueFromFile< string > (const string &a_pathToHeader, const string &a_key, string *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
template int | IntfKeyGetRecurringValueFromFile< int > (const string &a_pathToHeader, const string &a_key, int *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
template int | IntfKeyGetRecurringValueFromFile< int64_t > (const string &a_pathToHeader, const string &a_key, int64_t *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
template int | IntfKeyGetRecurringValueFromFile< float > (const string &a_pathToHeader, const string &a_key, float *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
template int | IntfKeyGetRecurringValueFromFile< double > (const string &a_pathToHeader, const string &a_key, double *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
template int | IntfKeyGetRecurringValueFromFile< long double > (const string &a_pathToHeader, const string &a_key, long double *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
template int | IntfKeyGetRecurringValueFromFile< uint8_t > (const string &a_pathToHeader, const string &a_key, uint8_t *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
template int | IntfKeyGetRecurringValueFromFile< uint16_t > (const string &a_pathToHeader, const string &a_key, uint16_t *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
template int | IntfKeyGetRecurringValueFromFile< uint32_t > (const string &a_pathToHeader, const string &a_key, uint32_t *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
template int | IntfKeyGetRecurringValueFromFile< bool > (const string &a_pathToHeader, const string &a_key, bool *ap_return, int a_nbElts, int a_mandatoryFlag, uint16_t a_nbOccurrences) |
int | IntfReadProjectionImage (const string &a_pathToHeaderFile, FLTNB *ap_ImgMatrix, Intf_fields *ap_IF, int vb, bool a_lerpFlag) |
Main function which reads a projection Interfile 3D projection image and store its content in the provided ap_ImgMatrix . More... | |
int | IntfCheckDimensionsConsistency (Intf_fields ImgFields1, Intf_fields ImgFields2) |
FLTNB * | IntfLoadImageFromScratch (const string &a_pathToHeaderFile, Intf_fields *ap_ImgFields, int vb) |
int | IntfWriteImageFromIntfFields (const string &a_pathToImg, FLTNB *ap_ImgMatrix, Intf_fields Img_fields, int vb) |
int | IntfReadImage (const string &a_pathToHeaderFile, FLTNB *ap_ImgMatrix, oImageDimensionsAndQuantification *ap_ID, int vb, bool a_lerpFlag) |
Main function dedicated to Interfile 3D image loading. More... | |
int | IntfReadImage (const string &a_pathToHeaderFile, FLTNB ****a4p_ImgMatrix, oImageDimensionsAndQuantification *ap_ID, int vb, bool a_lerpFlag) |
Main function dedicated to Interfile 5D (1D+1D+1D time + 3D) image loading. More... | |
int | IntfReadImgDynCoeffFile (const string &a_pathToHeaderFile, FLTNB **a2p_ImgMatrix, oImageDimensionsAndQuantification *ap_ID, int a_nbFbases, int vb, bool a_lerpFlag) |
Function dedicated to Interfile image reading for dynamic coefficients images. More... | |
void | IntfAllocInterpImg (FLTNB **a2p_img, Intf_fields a_IF) |
Allocate memory for an image matrix to recover an image to interpolate. More... | |
int | IntfCheckConsistency (Intf_fields *ap_IF, oImageDimensionsAndQuantification *ap_ID, int vb, int a_lerpFlag) |
Check if the mandatory fields have been initialize in the ap_IF structure, and check consistencies with the reconstruction parameters. More... | |
int | IntfGetPixelTypeAndReadData (Intf_fields a_IF, ifstream *ap_iFile, FLTNB *ap_outImgMatrix, FLTNB *ap_inImgMatrix, uint32_t *ap_offset, int a_nbVox, int vb) |
The purpose of this function is to call the templated ReadData() function with the data type corresponding to the interfile image. More... | |
template<class T > | |
int | IntfReadData (Intf_fields a_IF, ifstream *ap_iFile, FLTNB *ap_outImgMatrix, FLTNB *ap_inImgMatrix, uint32_t *a_offset, int a_nbVox, int vb, T *bytes) |
Templated function which read an image voxel by voxel and store it in the ap_outImgMtx image matrix. More... | |
int | ImageInterpolation (FLTNB *ap_iImg, FLTNB *ap_oImg, const uint32_t ap_iDimVox[3], const uint32_t ap_oDimVox[3], const FLTNB ap_iSizeVox[3], const FLTNB ap_oSizeVox[3]) |
Trilinear interpolation. More... | |
int | IntfWriteImgFile (const string &a_pathToImg, FLTNB *ap_ImgMatrix, const Intf_fields &ap_IntfF, int vb) |
Main function dedicated to Interfile 3D image writing. Recover image information from a provided Intf_fields structure. More... | |
int | IntfWriteImgFile (const string &a_pathToImg, FLTNB *ap_ImgMatrix, oImageDimensionsAndQuantification *ap_ID, int vb) |
Main function dedicated to Interfile 3D image writing. More... | |
int | IntfWriteProjFile (const string &a_pathToImg, FLTNB **a2p_ImgMatrix, oImageDimensionsAndQuantification *ap_ID, Intf_fields a_Imgfields, int vb) |
Function dedicated to Interfile image writing for projected data. More... | |
int | IntfWriteImgDynCoeffFile (const string &a_pathToImg, FLTNB **a2p_ImgMatrix, oImageDimensionsAndQuantification *ap_ID, int a_nbParImgs, int vb) |
Function dedicated to Interfile image writing for dynamic coefficients images. More... | |
int | IntfWriteImgFile (const string &a_pathToImg, FLTNB ****a4p_ImgMatrix, oImageDimensionsAndQuantification *ap_ID, int vb) |
Main function dedicated to Interfile 6D (dynamic dims + 3D ) image writing. More... | |
int | IntfIsMHD (string a_pathToFile, vector< string > &ap_lPathToImgs) |
Check if the string in argument contains the path to a Interfile metaheader. More... | |
int | IntfWriteMHD (const string &a_pathToMhd, const vector< string > &ap_lPathToImgs, Intf_fields a_IntfF, oImageDimensionsAndQuantification *ap_ID, int vb) |
Write an Interfile meta header at the path provided in parameter, using the field stack provided in parameter. More... | |
int | IntfReadHeader (const string &a_pathToHeaderFile, Intf_fields *ap_IF, int vb) |
Read an Interfile header. More... | |
int | IntfWriteHeaderMainData (const string &a_path, const Intf_fields &ap_IntfF, int vb) |
int | IntfWriteHeaderImgData (ofstream &ap_ofile, const Intf_fields &ap_IntfF, int vb) |
int | IntfWriteImage (const string &a_pathToImg, FLTNB *ap_outImgMtx, uint32_t a_dim, int vb) |
Write Interfile raw data whose path is provided in parameter, using image matrix provided in parameter. More... | |
int | IntfWriteImage (vector< string > ap_pathToImgs, FLTNB **a2p_outImgMtx, uint32_t ap_dim[2], int vb) |
Write Interfile raw data whose path is provided in parameter, using the image matrix provided in parameter. More... | |
int | IntfWriteImage (vector< string > ap_pathToImgs, FLTNB ****a4p_outImgMtx, uint32_t ap_dim[4], int vb) |
Write Interfile raw data whose path is provided in parameter, using the image matrix provided in parameter. More... | |
int | IntfWriteData (ofstream *ap_oFile, FLTNB *ap_outImgMatrix, int a_nbVox, int vb) |
Write the content of the image matrix in the file pointed by ofstream. More... | |
void | IntfKeyInitFields (Intf_fields *ap_IF) |
Init the file of an Interfile fields structure passed in parameter to their default values. More... | |
void | IntfKeySetFieldsOutput (Intf_fields *ap_IF, oImageDimensionsAndQuantification *ap_ID) |
Init the keys of the Interfile header of an image to be written on disk. More... | |
void | IntfKeyPrintFields (Intf_fields a_IF) |
Print all the keys of the Intf_fields structure passed in parameter, as well as their values for debugging purposes. More... | |
int | IntfRecoverKey (Intf_key *ap_Key, const string &a_line) |
Process the line passed in parameter and write the key information in the ap_Key Intf_key member structure. More... | |
int | IntfCheckKeyMatch (Intf_key ap_Key, const string &a_field) |
Check if the key matches the string passed in parameter. More... | |
int | IntfKeyIsArray (Intf_key ap_Key) |
Check if the key passed in parameter is an array (contains brackets '{' and '}' ) More... | |
int | IntfKeyGetArrayNbElts (Intf_key a_Key) |
Return the number of elts in an Interfile array Key. More... | |
int | IntfKeyGetMaxArrayKey (Intf_key ap_Key) |
Return the maximum value from an array key (key value contains brackets '{,,}' ) More... | |
template<class T > | |
int | IntfKeyGetArrayElts (Intf_key a_Key, T *ap_return) |
Get all the elements in an array key in a templated array passed in parameter. It assumes the return variable has been instanciated with a correct number of elements. More... | |
int | IntfGetVoxIdxSHTOrientation (Intf_fields a_IF, int a_voxId) |
Compute a voxel index corresponding to the default orientation (Sup/Hin/Trans) from the orientation informations contained in the Intf_fields passed in parameter. More... | |
string | IntfKeyGetEndianStr (int a_val) |
return the endian string corresponding to the value passed in parameter (see module INTF_ENDIANNESS). More... | |
string | IntfKeyGetModalityStr (int a_modalityIdx) |
Convert the integer provided in parameter to the string related to the corresponding modality as defined by the scanner objects. More... | |
int | IntfKeyGetInputImgDataType (const string &a_str) |
Get the image data type corresponding to the image metadata passed in parameter. More... | |
int | IntfKeyGetOutputImgDataType (oImageDimensionsAndQuantification *ap_ID) |
string | IntfKeyGetPixTypeStr () |
Return the string corresponding to the nb of bytes in the type FLTNB. More... | |
int | IntfKeyGetPatOrientation (Intf_fields ap_IF) |
Get the complete patient orientation from an Intf_fields structure according to the values of keys 'slice orientation', 'patient rotation', and 'patient orientation'. More... | |
void | GetUserEndianness () |
Check user/host computer endianness and write it to the global variable User_Endianness. More... | |
void | IntfEraseSpaces (string *input_str) |
Erase space, blank characters ((t,r,n)), and '!' before and after the characters in the string passed in parameter. More... | |
void | IntfToLowerCase (string *ap_str) |
Set all characters of the string passed in parameter to lower case. More... | |
template<class T > | |
void | SwapBytes (T *ap_type) |
Variables | |
int | User_Endianness = -1 |
Implementation of class Interfile management functions.
Definition in file oInterfileIO.cc.
void GetUserEndianness | ( | ) |
Check user/host computer endianness and write it to the global variable User_Endianness.
This function should be called once during the initialization step of the algorithm (currently, the singleton initialization)
Definition at line 4623 of file oInterfileIO.cc.
int ImageInterpolation | ( | FLTNB * | ap_iImg, |
FLTNB * | ap_oImg, | ||
const uint32_t | ap_iDimVox[3], | ||
const uint32_t | ap_oDimVox[3], | ||
const FLTNB | ap_iSizeVox[3], | ||
const FLTNB | ap_oSizeVox[3] | ||
) |
Trilinear interpolation.
ap_iImg | : Image matrix to interpolate, with dimensions of the original interfile |
ap_oImg | : Image matrix to recover the interpolated image to the reconstruction dimensions |
ap_iDimVox[3] | : X,Y,Z dimensions of the image to interpolate |
ap_oDimVox[3] | : X,Y,Z dimensions for the reconstruction |
ap_iSizeVox[3] | : X,Y,Z voxel size of the image to interpolate |
ap_oSizeVox[3] | : X,Y,Z voxel size for the reconstruction |
Definition at line 1274 of file oInterfileIO.cc.
void IntfAllocInterpImg | ( | FLTNB ** | a2p_img, |
Intf_fields | a_IF | ||
) |
Allocate memory for an image matrix to recover an image to interpolate.
ap_img | : pointer to 1 dimensional image matrix to recover the image to interpolate |
ap_IF | : Structure containing the interfile fields read in a interfile header |
Definition at line 912 of file oInterfileIO.cc.
int IntfCheckConsistency | ( | Intf_fields * | ap_IF, |
oImageDimensionsAndQuantification * | ap_ID, | ||
int | vb, | ||
int | a_lerpFlag | ||
) |
Check if the mandatory fields have been initialize in the ap_IF structure, and check consistencies with the reconstruction parameters.
Intf_fields* | ap_IF : Structure containing the interfile fields read in a interfile header |
oImageDimensionsAndQuantification* | ap_ImageDimensions : Provide the Image dimensions object containing reconstruction dimensions |
int | vb : Verbosity level |
a_lerpFlag | : if true, enable linear interpolation of the image if img dimensions differ from the reconstruction dimensions |
This function also checks if the matrix size of the original image is different to the reconstruction matrix size.
In this case a boolean is set up to enable interpolation during image reading
Definition at line 946 of file oInterfileIO.cc.
int IntfCheckDimensionsConsistency | ( | Intf_fields | ImgFields1, |
Intf_fields | ImgFields2 | ||
) |
int IntfCheckKeyMatch | ( | Intf_key | ap_Key, |
const string & | a_field | ||
) |
Check if the key matches the string passed in parameter.
ap_Key | : Structure containing the parsed key components (key, value,..) |
a_line | : String containing an interfile key |
Definition at line 4085 of file oInterfileIO.cc.
void IntfEraseSpaces | ( | string * | input_str | ) |
Erase space, blank characters ((t,r,n)), and '!' before and after the characters in the string passed in parameter.
string* | input_str |
Definition at line 4641 of file oInterfileIO.cc.
int IntfGetPixelTypeAndReadData | ( | Intf_fields | a_IF, |
ifstream * | ap_iFile, | ||
FLTNB * | ap_outImgMatrix, | ||
FLTNB * | ap_inImgMatrix, | ||
uint32_t * | ap_offset, | ||
int | a_nbVox, | ||
int | vb | ||
) |
The purpose of this function is to call the templated ReadData() function with the data type corresponding to the interfile image.
a_IF | : Interfile fields recovered from the header |
ap_iFile | : Ifstream pointing to an image file |
ap_outImgMtx | : 3D image matrix with reconstruction dimensions/voxel size |
ap_inImgMtx | : 3D image matrix with original dimensions/voxel size |
ap_offset | : Offset indicating the beginning of the data to read in the image file |
a_nbVox | : A number of voxels in the 3D image matrix with reconstruction dimensions/voxel size |
vb | : Verbosity level |
It uses "number format" and "number of bytes per pixel" fields to identify the correct type
ASCII and bit images NOT supported
Definition at line 1035 of file oInterfileIO.cc.
int IntfGetVoxIdxSHTOrientation | ( | Intf_fields | a_IF, |
int | a_voxId | ||
) |
Compute a voxel index corresponding to the default orientation (Sup/Hin/Trans)
from the orientation informations contained in the Intf_fields passed in parameter.
ap_IF | |
a_voxId | : index of the voxel in a 1-D image vector |
Definition at line 4276 of file oInterfileIO.cc.
int IntfIsMHD | ( | string | a_pathToFile, |
vector< string > & | ap_lPathToImgs | ||
) |
Check if the string in argument contains the path to a Interfile metaheader.
a_pathToFile | : String containing path to an Interfile header |
ap_lPathToImgs | : pointer to a list of strings containing the path to the different images |
Check for '!total number of data sets' key, and the associated image file names
If the file is metaheader, the names of the header files of the images will be returned in ap_lPathToImgs list
It not, the file is a single header, that we add to the list as solo file
Definition at line 2168 of file oInterfileIO.cc.
int IntfKeyGetArrayElts | ( | Intf_key | a_Key, |
T * | ap_return | ||
) |
Get all the elements in an array key in a templated array passed in parameter.
It assumes the return variable has been instanciated with a correct number of elements.
ap_Key | |
T* | ap_return : Templated parameter in which the elts will be returned |
Definition at line 4219 of file oInterfileIO.cc.
int IntfKeyGetArrayNbElts | ( | Intf_key | a_Key | ) |
Return the number of elts in an Interfile array Key.
ap_Key |
Definition at line 4129 of file oInterfileIO.cc.
string IntfKeyGetEndianStr | ( | int | a_val | ) |
return the endian string corresponding to the value passed in parameter (see module INTF_ENDIANNESS).
a_val | : |
Definition at line 4406 of file oInterfileIO.cc.
int IntfKeyGetInputImgDataType | ( | const string & | a_str | ) |
Get the image data type corresponding to the image metadata passed in parameter.
a_str | : input string |
Definition at line 4451 of file oInterfileIO.cc.
int IntfKeyGetMaxArrayKey | ( | Intf_key | ap_Key | ) |
Return the maximum value from an array key (key value contains brackets '{,,}' )
ap_Key |
Definition at line 4174 of file oInterfileIO.cc.
string IntfKeyGetModalityStr | ( | int | a_modalityIdx | ) |
Convert the integer provided in parameter to the string related
to the corresponding modality as defined by the scanner objects.
a_modalityIdx |
Definition at line 4422 of file oInterfileIO.cc.
int IntfKeyGetOutputImgDataType | ( | oImageDimensionsAndQuantification * | ap_ID | ) |
Definition at line 4482 of file oInterfileIO.cc.
int IntfKeyGetPatOrientation | ( | Intf_fields | ap_IF | ) |
Get the complete patient orientation from an Intf_fields structure according to the values of keys 'slice orientation', 'patient rotation', and 'patient orientation'.
ap_IF |
Definition at line 4545 of file oInterfileIO.cc.
string IntfKeyGetPixTypeStr | ( | ) |
Return the string corresponding to the nb of bytes in the type FLTNB.
Definition at line 4518 of file oInterfileIO.cc.
int IntfKeyGetRecurringValueFromFile | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
T * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
Definition at line 170 of file oInterfileIO.cc.
template int IntfKeyGetRecurringValueFromFile< bool > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
bool * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
template int IntfKeyGetRecurringValueFromFile< double > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
double * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
template int IntfKeyGetRecurringValueFromFile< float > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
float * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
template int IntfKeyGetRecurringValueFromFile< int > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
int * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
template int IntfKeyGetRecurringValueFromFile< int64_t > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
int64_t * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
template int IntfKeyGetRecurringValueFromFile< long double > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
long double * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
template int IntfKeyGetRecurringValueFromFile< string > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
string * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
template int IntfKeyGetRecurringValueFromFile< uint16_t > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
uint16_t * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
template int IntfKeyGetRecurringValueFromFile< uint32_t > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
uint32_t * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
template int IntfKeyGetRecurringValueFromFile< uint8_t > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
uint8_t * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag, | ||
uint16_t | a_nbOccurrences | ||
) |
int IntfKeyGetValueFromFile | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
T * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
Look for "a_nbElts" elts in the "a_pathToHeader" interfile header matching the "a_keyword" key passed as parameter and return the corresponding value(s) in the "ap_return" templated array.
a_pathToHeader | : path to the interfile header |
a_key | : the key to recover |
T* | ap_return : template array in which the data will be recovered |
int | a_nbElts : number of elements to recover |
int | a_mandatoryFlag : flag indicating if the data to recover if mandatory (true) or optionnal (false) |
If more than one elements are to be recovered, the function first check the key has a correct Interfile kay layout (brackets and commas : {,,})
Depending on the mandatoryFlag, the function will return an error (flag > 0) or a warning (flag = 0) if the key is not found
Definition at line 52 of file oInterfileIO.cc.
template int IntfKeyGetValueFromFile< bool > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
bool * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
template int IntfKeyGetValueFromFile< double > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
double * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
template int IntfKeyGetValueFromFile< float > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
float * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
template int IntfKeyGetValueFromFile< int > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
int * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
template int IntfKeyGetValueFromFile< int64_t > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
int64_t * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
template int IntfKeyGetValueFromFile< long double > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
long double * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
template int IntfKeyGetValueFromFile< string > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
string * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
template int IntfKeyGetValueFromFile< uint16_t > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
uint16_t * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
template int IntfKeyGetValueFromFile< uint32_t > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
uint32_t * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
template int IntfKeyGetValueFromFile< uint8_t > | ( | const string & | a_pathToHeader, |
const string & | a_key, | ||
uint8_t * | ap_return, | ||
int | a_nbElts, | ||
int | a_mandatoryFlag | ||
) |
void IntfKeyInitFields | ( | Intf_fields * | ap_IF | ) |
Init the file of an Interfile fields structure passed in parameter to their default values.
ap_IF | : Structure containing Interfile keys |
Definition at line 3816 of file oInterfileIO.cc.
int IntfKeyIsArray | ( | Intf_key | ap_Key | ) |
Check if the key passed in parameter is an array (contains brackets '{' and '}' )
ap_Key |
Definition at line 4107 of file oInterfileIO.cc.
void IntfKeyPrintFields | ( | Intf_fields | a_IF | ) |
Print all the keys of the Intf_fields structure passed in parameter, as well as their values for debugging purposes.
ap_IF |
Definition at line 3962 of file oInterfileIO.cc.
void IntfKeySetFieldsOutput | ( | Intf_fields * | ap_IF, |
oImageDimensionsAndQuantification * | ap_ID | ||
) |
Init the keys of the Interfile header of an image to be written on disk.
ap_IF | : Structure containing Interfile keys |
ap_ID | : oImageDimensionsAndQuantification object containing additional infos about reconstruction |
Init the keys of the Interfile structure passed in parameter for output writing using the ImageDimensions object containing information about the reconstruction
Definition at line 3881 of file oInterfileIO.cc.
FLTNB* IntfLoadImageFromScratch | ( | const string & | a_pathToHeaderFile, |
Intf_fields * | ap_ImgFields, | ||
int | vb | ||
) |
Definition at line 408 of file oInterfileIO.cc.
int IntfReadData | ( | Intf_fields | a_IF, |
ifstream * | ap_iFile, | ||
FLTNB * | ap_outImgMatrix, | ||
FLTNB * | ap_inImgMatrix, | ||
uint32_t * | a_offset, | ||
int | a_nbVox, | ||
int | vb, | ||
T * | bytes | ||
) |
Templated function which read an image voxel by voxel and store it in the ap_outImgMtx image matrix.
a_IF | : Interfile fields recovered from the header |
ap_iFile | : Ifstream pointing to an image file |
ap_outImgMtx | : 3D image matrix with reconstruction dimensions/voxel size |
ap_inImgMtx | : 3D image matrix with original dimensions/voxel size |
ap_offset | : Offset indicating the beginning of the data to read in the image file |
a_nbVox | : A number of voxels in the 3D image matrix with reconstruction dimensions/voxel size |
vb | : Verbosity level |
T* | bytes : Buffer of templated size, to recover any voxel value |
Call an interpolation function if the original image dimensions/voxel sizes are different to the reconstruction dimensions/voxel sizes
Manage endianness and the optionnal calibration with the rescale slope/intercept interfile keys
Definition at line 1154 of file oInterfileIO.cc.
int IntfReadHeader | ( | const string & | a_pathToHeaderFile, |
Intf_fields * | ap_IF, | ||
int | vb | ||
) |
Read an Interfile header.
const | string& a_pathToHeaderFile |
Intf_fields* | ap_IF |
int | vb : Verbosity level |
Initialize all mandatory fields from the Intf_fields structure passed in parameter with the related interfile key from the image interfile header
Definition at line 2415 of file oInterfileIO.cc.
int IntfReadImage | ( | const string & | a_pathToHeaderFile, |
FLTNB * | ap_ImgMatrix, | ||
oImageDimensionsAndQuantification * | ap_ID, | ||
int | vb, | ||
bool | a_lerpFlag | ||
) |
Main function dedicated to Interfile 3D image loading.
a_pathToHeaderFile | : path to the header file |
ap_ImgMatrix | : 1 dimensional image matrix which will recover the image. |
ap_ID | : Provide the Image dimensions object containing reconstruction dimensions |
vb | : Verbosity level |
a_lerpFlag | : if true, enable linear interpolation of the image if img dimensions differ from the reconstruction dimensions |
Call the main functions dedicated to Interfile reading : IntfReadHeader(), IntfCheckConsistency(), then IntfReadImage()
Definition at line 504 of file oInterfileIO.cc.
int IntfReadImage | ( | const string & | a_pathToHeaderFile, |
FLTNB **** | a4p_ImgMatrix, | ||
oImageDimensionsAndQuantification * | ap_ID, | ||
int | vb, | ||
bool | a_lerpFlag | ||
) |
Main function dedicated to Interfile 5D (1D+1D+1D time + 3D) image loading.
a_pathToHeaderFile | : path to the main header file |
a4p_ImgMatrix | : 4 dimensional image matrix which will recover the image. |
ap_ID | : Provide the Image dimensions object containing reconstruction dimensions |
vb | : Verbosity level |
a_lerpFlag | : if true, enable linear interpolation of the image if img dimensions differ from the reconstruction dimensions |
Check is the main header file is a metaheader associated to several image files, or a unique interfile header
Depending on the type of file input (metaheader or unique file), read the group of image files or the unique provided image file
Definition at line 578 of file oInterfileIO.cc.
int IntfReadImgDynCoeffFile | ( | const string & | a_pathToHeaderFile, |
FLTNB ** | a2p_ImgMatrix, | ||
oImageDimensionsAndQuantification * | ap_ID, | ||
int | a_nbFbases, | ||
int | vb, | ||
bool | a_lerpFlag | ||
) |
Function dedicated to Interfile image reading for dynamic coefficients images.
a_pathToHeaderFile | : path to the header file |
a2p_ImgMatrix | : 2 dimensional image matrix which will recover the image.. |
ap_ID | : Provide the Image dimensions object containing reconstruction dimensions |
a_nbFbases | : Number of basis functions |
vb | : verbosity |
a_lerpFlag | : if true, enable linear interpolation of the image if img dimensions differ from the reconstruction dimensions |
The total number of basis functions should be provided in parameters
Check is the main header file is a metaheader associated to several image files, or a unique interfile header
Depending on the type of file input (metaheader or unique file), read the group of image files or the unique provided image file
Definition at line 764 of file oInterfileIO.cc.
int IntfReadProjectionImage | ( | const string & | a_pathToHeaderFile, |
FLTNB * | ap_ImgMatrix, | ||
Intf_fields * | ap_IF, | ||
int | vb, | ||
bool | a_lerpFlag | ||
) |
Main function which reads a projection Interfile 3D projection image and store its content in the provided ap_ImgMatrix
.
a_pathToHeaderFile | : path to the header file |
ap_ImgMatrix | : 1 dimensional image matrix which will recover the image. |
ap_IF | : Intf_fields structure containing image metadata |
vb | : Verbosity level |
a_lerpFlag | : if true, enable linear interpolation of the image if img dimensions differ from the reconstruction dimensions |
Call the main functions dedicated to Interfile reading : IntfReadHeader(), and IntfReadImage()
Definition at line 304 of file oInterfileIO.cc.
int IntfRecoverKey | ( | Intf_key * | ap_Key, |
const string & | a_line | ||
) |
Process the line passed in parameter and write the key information in the ap_Key Intf_key member structure.
ap_Key | : Structure to recover the parsed key components (key, value,..) |
a_line | : String to process |
.korig : Get original line without comments
.kcase : Get key without spaces and without comments
.klcase: Same as kcase, in lower case
.kvalue: Value of the key, without spaces
Definition at line 4036 of file oInterfileIO.cc.
void IntfToLowerCase | ( | string * | ap_str | ) |
Set all characters of the string passed in parameter to lower case.
string* | ap_str : original string |
Definition at line 4660 of file oInterfileIO.cc.
int IntfWriteData | ( | ofstream * | ap_oFile, |
FLTNB * | ap_outImgMatrix, | ||
int | a_nbVox, | ||
int | vb | ||
) |
Write the content of the image matrix in the file pointed by ofstream.
ap_oFile | : Ofstream pointing to an image file |
ap_outImgMtx | : 3D image matrix with reconstruction dimensions/voxel size containing the image data |
a_nbVox | : A number of voxels in the 3D image matrix with reconstruction dimensions/voxel size |
vb | : Verbosity level |
Definition at line 3789 of file oInterfileIO.cc.
int IntfWriteHeaderImgData | ( | ofstream & | ap_ofile, |
const Intf_fields & | ap_IntfF, | ||
int | vb | ||
) |
int IntfWriteHeaderMainData | ( | const string & | a_path, |
const Intf_fields & | ap_IntfF, | ||
int | vb | ||
) |
Definition at line 3266 of file oInterfileIO.cc.
int IntfWriteImage | ( | const string & | a_pathToImg, |
FLTNB * | ap_outImgMtx, | ||
uint32_t | a_dim, | ||
int | vb | ||
) |
Write Interfile raw data whose path is provided in parameter, using image matrix provided in parameter.
a_pathToImg | : th to the directory where the image will be written |
ap_outImgMtx | : Matrix containing the image to write |
a_dim | : Number of voxels in the 3D image |
vb | : Verbosity level For 1 dimensional image matrices |
Definition at line 3561 of file oInterfileIO.cc.
int IntfWriteImage | ( | vector< string > | ap_pathToImgs, |
FLTNB ** | a2p_outImgMtx, | ||
uint32_t | ap_dim[2], | ||
int | vb | ||
) |
Write Interfile raw data whose path is provided in parameter, using the image matrix provided in parameter.
ap_pathToImgs | List of string containing the paths to the image to write |
a2p_outImgMtx | : 2 dimensional image matrix (1D temporal + 3D) |
ap_imgDim[2] | : Dimensions of ap_outImgMtx |
vb | : Verbosity level For 2 dimensional image matrices |
Definition at line 3602 of file oInterfileIO.cc.
int IntfWriteImage | ( | vector< string > | ap_pathToImgs, |
FLTNB **** | a4p_outImgMtx, | ||
uint32_t | ap_dim[4], | ||
int | vb | ||
) |
Write Interfile raw data whose path is provided in parameter, using the image matrix provided in parameter.
vector<string> | ap_pathToImgs: List of string containing the paths to the image to write |
FLTNB**** | a4p_outImgMtx : 4 dimensional image matrix (3D temporal + 3D) |
int | ap_imgDim[4] : Dimensions of ap_outImgMtx |
int | vb : Verbosity level For 4 dimensional image matrices |
Definition at line 3690 of file oInterfileIO.cc.
int IntfWriteImageFromIntfFields | ( | const string & | a_pathToImg, |
FLTNB * | ap_ImgMatrix, | ||
Intf_fields | Img_fields, | ||
int | vb | ||
) |
Definition at line 460 of file oInterfileIO.cc.
int IntfWriteImgDynCoeffFile | ( | const string & | a_pathToImg, |
FLTNB ** | a2p_ImgMatrix, | ||
oImageDimensionsAndQuantification * | ap_ID, | ||
int | a_nbParImgs, | ||
int | vb | ||
) |
Function dedicated to Interfile image writing for dynamic coefficients images.
a_pathToImg | : string containing the path to the image basename |
a2p_ImgMatrix | : 2 dimensional image matrix which contains the image to write. |
ap_ID | : Provide the Image dimensions object containing reconstruction dimensions |
a_nbParImgs | : Number of parametric images |
vb | : verbosity |
Call the main functions dedicated to Interfile header and data writing
The total number of basis functions should be provided in parameters
Depending on the output writing mode (stored in sOutputManager),
One image with one file and one will be created for the whole dynamic image
or a metaheader and associated multiple 3D image raw file/headers will be generated
Definition at line 1845 of file oInterfileIO.cc.
int IntfWriteImgFile | ( | const string & | a_pathToImg, |
FLTNB * | ap_ImgMatrix, | ||
const Intf_fields & | ap_IntfF, | ||
int | vb | ||
) |
Main function dedicated to Interfile 3D image writing.
Recover image information from a provided Intf_fields structure.
a_pathToImg | : path to image basename |
ap_ImgMatrix | : 1 dimensional image matrix which contains the image to write |
ap_IntfF | : Intf_fields structure containing image metadata |
vb | : verbosity |
Call the main functions dedicated to Interfile header and data writing : IntfWriteHeaderMainData() and then IntfWriteImage()
Definition at line 1697 of file oInterfileIO.cc.
int IntfWriteImgFile | ( | const string & | a_pathToImg, |
FLTNB * | ap_ImgMatrix, | ||
oImageDimensionsAndQuantification * | ap_ID, | ||
int | vb | ||
) |
Main function dedicated to Interfile 3D image writing.
a_pathToImg | : path to image basename |
ap_ImgMatrix | : 1 dimensional image matrix which contains the image to write |
ap_ID | : Provide the Image dimensions object containing reconstruction dimensions |
vb | : verbosity |
Call the main functions dedicated to Interfile header and data writing :
IntfWriteHeaderMainData() and then IntfWriteImage()
Definition at line 1741 of file oInterfileIO.cc.
int IntfWriteImgFile | ( | const string & | a_pathToImg, |
FLTNB **** | a4p_ImgMatrix, | ||
oImageDimensionsAndQuantification * | ap_ID, | ||
int | vb | ||
) |
Main function dedicated to Interfile 6D (dynamic dims + 3D ) image writing.
a_pathToImg | : string containing the path to the image basename |
a4p_ImgMatrix | : 4 dimensional image matrix which contains the image to write. |
ap_ID | : Provide the Image dimensions object containing reconstruction dimensions |
vb | : verbosity |
Call the main functions dedicated to Interfile header and data writing
Depending on the output writing mode (stored in sOutputManager),
One image with one file and one will be created for the whole dynamic image
or a metaheader and associated multiple 3D image raw file/headers will be generated
Definition at line 1965 of file oInterfileIO.cc.
int IntfWriteMHD | ( | const string & | a_pathToMhd, |
const vector< string > & | ap_lPathToImgs, | ||
Intf_fields | a_IntfF, | ||
oImageDimensionsAndQuantification * | ap_ID, | ||
int | vb | ||
) |
Write an Interfile meta header at the path provided in parameter, using the field stack provided in parameter.
a_path | : path to the Meta interfile header to write |
ap_lPathToImgs | : pointer to a list of strings containing the path to the different images |
a_IntfF | : Structure containing interfile keys of the image to write |
ap_ID | : oImageDimensionsAndQuantification object containing additional infos about reconstruction |
vb | : verbosity |
Definition at line 2329 of file oInterfileIO.cc.
int IntfWriteProjFile | ( | const string & | a_pathToImg, |
FLTNB ** | a2p_ImgMatrix, | ||
oImageDimensionsAndQuantification * | ap_ID, | ||
Intf_fields | a_Imgfields, | ||
int | vb | ||
) |
Function dedicated to Interfile image writing for projected data.
a_pathToImg | : string containing the path to the image basename |
a2p_ImgMatrix | : 2 dimensional image matrix which contains the image to write. |
ap_ID | : Provide the Image dimensions object containing reconstruction dimensions |
a_Imgfields | Structure containing information about the projected data |
vb | : verbosity |
Call the main functions dedicated to Interfile header and data writing
Currently work for SPECT projected data
The total number of projections should be provided in parameters
Depending on the output writing mode (stored in sOutputManager),
Definition at line 1791 of file oInterfileIO.cc.
void SwapBytes | ( | T * | ap_type | ) |
int User_Endianness = -1 |
Global variable recovering endianness of user system
Definition at line 29 of file oInterfileIO.cc.