CASToR  1.1
Tomographic Reconstruction (PET/SPECT)
 All Classes Files Functions Variables Typedefs Macros Groups Pages
Classes | Macros | Functions
oInterfileIO.hh File Reference

This group of functions manages Interfile image file format. More...

#include "oImageDimensionsAndQuantification.hh"
#include "sScannerManager.hh"
#include "gVariables.hh"
#include "sOutputManager.hh"
#include "gOptions.hh"

Go to the source code of this file.

Classes

class  Intf_key
 Interfile key elements.
This structure is used to recover and process the elements of an Interfile key ( key := value #anycomment)
Declared in oInterfileIO.hh. More...
 
class  Intf_fields
 Interfile fields.
This structure contains all the Interfile keys currently managed by CASToR
Declared in oInterfileIO.hh. More...
 

Macros

#define INTF_BIG_ENDIAN   0
 
#define INTF_LITTLE_ENDIAN   1
 
#define INTF_IMG_STATIC   0
 
#define INTF_IMG_DYNAMIC   1
 
#define INTF_IMG_PET   2
 
#define INTF_IMG_SPECT   3
 
#define INTF_IMG_GATED   4
 
#define INTF_IMG_GSPECT   5
 
#define INTF_IMG_UNKNOWN   6
 
#define INTF_LERP_DISABLED   false
 
#define INTF_LERP_ENABLED   true
 
#define BIT_str   "bit"
 
#define UINT32_str   "unsigned integer"
 
#define INT32_str   "signed integer"
 
#define FLT32_str   "short float"
 
#define FLT32_str2   "float"
 
#define FLT64_str   "long float"
 
#define ASCII_str   "ASCII"
 
#define INTF_SUPINE_HEADIN_TRANSAXIAL   0
 
#define INTF_SUPINE_HEADIN_SAGITTAL   1
 
#define INTF_SUPINE_HEADIN_CORONAL   2
 
#define INTF_SUPINE_FEETIN_TRANSAXIAL   3
 
#define INTF_SUPINE_FEETIN_SAGITTAL   4
 
#define INTF_SUPINE_FEETIN_CORONAL   5
 
#define INTF_PRONE_HEADIN_TRANSAXIAL   6
 
#define INTF_PRONE_HEADIN_SAGITTAL   7
 
#define INTF_PRONE_HEADIN_CORONAL   8
 
#define INTF_PRONE_FEETIN_TRANSAXIAL   9
 
#define INTF_PRONE_FEETIN_SAGITTAL   10
 
#define INTF_PRONE_FEETIN_CORONAL   11
 
#define INTF_TRANSVERSE   0
 
#define INTF_CORONAL   1
 
#define INTF_SAGITTAL   2
 
#define INTF_OTHER   3
 
#define INTF_SUPINE   0
 
#define INTF_PRONE   1
 
#define INTF_HEADIN   0
 
#define INTF_FEETIN   1
 

Functions

template<typename 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<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)
 
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)
 
FLTNBIntfLoadImageFromScratch (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...
 
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 *a_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 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...
 
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_IntfFields, 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)
 
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 a_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 ap_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<typename 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...
 
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...
 
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...
 
void IntfAllocInterpImg (FLTNB **a2p_img, Intf_fields a_IF)
 Allocate memory for an image matrix to recover an image to interpolate. 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 Type >
void SwapBytes (Type *ap_type)
 Use std::reverse to swap the bits of a variable of any type. More...
 

Detailed Description

This group of functions manages Interfile image file format.

These functions can read and write interfile header and image files. It contains an interfile dictionnary.

Definition in file oInterfileIO.hh.

Function Documentation

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.

Here is the caller graph for this function:

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.

Parameters
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.

Here is the caller graph for this function:

IntfAllocInterpImg ( FLTNB **  a2p_img,
Intf_fields  a_IF 
)

Allocate memory for an image matrix to recover an image to interpolate.

Parameters
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.

Here is the caller graph for this function:

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.

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
intvb : 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.

Here is the call graph for this function:

Here is the caller graph for this function:

int IntfCheckDimensionsConsistency ( Intf_fields  ImgFields1,
Intf_fields  ImgFields2 
)

Definition at line 353 of file oInterfileIO.cc.

Here is the caller graph for this function:

IntfCheckKeyMatch ( Intf_key  ap_Key,
const string &  a_field 
)

Check if the key matches the string passed in parameter.

Parameters
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.

Here is the caller graph for this function:

IntfEraseSpaces ( string *  input_str)

Erase space, blank characters ((t,r,n)), and '!' before and after the characters in the string passed in parameter.

Parameters
string*input_str

Definition at line 4641 of file oInterfileIO.cc.

Here is the caller graph for this function:

IntfGetPixelTypeAndReadData ( Intf_fields  a_IF,
ifstream *  ap_iFile,
FLTNB ap_outImgMatrix,
FLTNB ap_inImgMatrix,
uint32_t *  a_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.

Parameters
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

Returns
0 if success, positive value otherwise.

Definition at line 1035 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
ap_IF
a_voxId: index of the voxel in a 1-D image vector

Definition at line 4276 of file oInterfileIO.cc.

IntfIsMHD ( string  a_pathToFile,
vector< string > &  ap_lPathToImgs 
)

Check if the string in argument contains the path to a Interfile metaheader.

Parameters
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

Returns
1 if we have a metaheader,
0 if not,
negative value if error.

Definition at line 2168 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
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.

Parameters
ap_Key
T*ap_return : Templated parameter in which the elts will be returned
Returns
0 if success, positive value otherwise

Definition at line 4219 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

IntfKeyGetArrayNbElts ( Intf_key  ap_Key)

Return the number of elts in an Interfile array Key.

Parameters
ap_Key
Returns
the number of elements in the array key, or negative value if error

Definition at line 4129 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

IntfKeyGetEndianStr ( int  a_val)

return the endian string corresponding to the value passed in parameter (see module INTF_ENDIANNESS).

Parameters
a_val:
Returns
"BIG_ENDIAN" if 0,
"LITTLE_ENDIAN" if 1,
"UNKNOWN" otherwise

Definition at line 4406 of file oInterfileIO.cc.

Here is the caller graph for this function:

IntfKeyGetInputImgDataType ( const string &  a_str)

Get the image data type corresponding to the image metadata passed in parameter.

Parameters
a_str: input string
Returns
int value corresponding to the image data type (see module INTF_IMG_TYPE).

Definition at line 4451 of file oInterfileIO.cc.

Here is the caller graph for this function:

IntfKeyGetMaxArrayKey ( Intf_key  ap_Key)

Return the maximum value from an array key (key value contains brackets '{,,}' )

Parameters
ap_Key
Returns
the max value in the array key.

Definition at line 4174 of file oInterfileIO.cc.

Here is the call graph for this function:

IntfKeyGetModalityStr ( int  a_modalityIdx)

Convert the integer provided in parameter to the string related
to the corresponding modality as defined by the scanner objects.

Parameters
a_modalityIdx

Definition at line 4422 of file oInterfileIO.cc.

int IntfKeyGetOutputImgDataType ( oImageDimensionsAndQuantification ap_ID)

Definition at line 4482 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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'.

Parameters
ap_IF
Returns
int value corresponding to the patient orientation (see module PATIENT_ORIENTATION).

Definition at line 4545 of file oInterfileIO.cc.

IntfKeyGetPixTypeStr ( )

Return the string corresponding to the nb of bytes in the type FLTNB.

Returns
string corresponding to the pixel data type

Definition at line 4518 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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 
)

Definition at line 170 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
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.

Parameters
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
inta_nbElts : number of elements to recover
inta_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

Returns
0 if success, and positive value otherwise (1 if error, 2 if key not found).

Definition at line 52 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

void IntfKeyInitFields ( Intf_fields ap_IF)

Init the file of an Interfile fields structure passed in parameter to their default values.

Parameters
ap_IF: Structure containing Interfile keys

Definition at line 3816 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

int IntfKeyIsArray ( Intf_key  ap_Key)

Check if the key passed in parameter is an array (contains brackets '{' and '}' )

Parameters
ap_Key
Returns
1 if success, 0 otherwise (not array).

Definition at line 4107 of file oInterfileIO.cc.

Here is the caller graph for this function:

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.

Parameters
ap_IF

Definition at line 3962 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

IntfKeySetFieldsOutput ( Intf_fields ap_IF,
oImageDimensionsAndQuantification ap_ID 
)

Init the keys of the Interfile header of an image to be written on disk.

Parameters
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.

Here is the call graph for this function:

Here is the caller graph for this function:

FLTNB* IntfLoadImageFromScratch ( const string &  a_pathToHeaderFile,
Intf_fields ap_ImgFields,
int  vb 
)

Definition at line 408 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
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.

Parameters
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.

Here is the call graph for this function:

Here is the caller graph for this function:

IntfReadHeader ( const string &  a_pathToHeaderFile,
Intf_fields ap_IntfFields,
int  vb 
)

Read an Interfile header.

Parameters
conststring& a_pathToHeaderFile
Intf_fields*ap_IF
intvb : 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.

Here is the call graph for this function:

Here is the caller graph for this function:

IntfReadImage ( const string &  a_pathToHeaderFile,
FLTNB ap_ImgMatrix,
oImageDimensionsAndQuantification ap_ID,
int  vb,
bool  a_lerpFlag 
)

Main function dedicated to Interfile 3D image loading.

Parameters
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()

Returns
0 if success, positive value otherwise.

Definition at line 504 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
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.

Here is the call graph for this function:

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.

Parameters
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

Returns
0 if success, positive value otherwise.

Definition at line 764 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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
.

Parameters
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()

Returns
0 if success, positive value otherwise.

Definition at line 304 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
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.

Here is the call graph for this function:

Here is the caller graph for this function:

void IntfToLowerCase ( string *  ap_str)

Set all characters of the string passed in parameter to lower case.

Parameters
string*ap_str : original string

Definition at line 4660 of file oInterfileIO.cc.

Here is the caller graph for this function:

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.

Parameters
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.

Here is the caller graph for this function:

int IntfWriteHeaderImgData ( ofstream &  ap_ofile,
const Intf_fields ap_IntfF,
int  vb 
)

Definition at line 3477 of file oInterfileIO.cc.

Here is the caller graph for this function:

int IntfWriteHeaderMainData ( const string &  a_path,
const Intf_fields ap_IntfF,
int  vb 
)

Definition at line 3266 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
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
Returns
0 if success, positive value otherwise.

Definition at line 3561 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
ap_pathToImgsList 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
Returns
0 if success, positive value otherwise.

Definition at line 3602 of file oInterfileIO.cc.

Here is the call graph for this function:

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.

Parameters
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)
intap_imgDim[4] : Dimensions of ap_outImgMtx
intvb : Verbosity level For 4 dimensional image matrices
Returns
0 if success, positive value otherwise.

Definition at line 3690 of file oInterfileIO.cc.

Here is the call graph for this function:

int IntfWriteImageFromIntfFields ( const string &  a_pathToImg,
FLTNB ap_ImgMatrix,
Intf_fields  Img_fields,
int  vb 
)

Definition at line 460 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

IntfWriteImgDynCoeffFile ( const string &  a_pathToImg,
FLTNB **  a2p_ImgMatrix,
oImageDimensionsAndQuantification ap_ID,
int  a_nbFbases,
int  vb 
)

Function dedicated to Interfile image writing for dynamic coefficients images.

Parameters
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.

Here is the call graph for this function:

Here is the caller graph for this function:

IntfWriteImgFile ( const string &  a_pathToImg,
FLTNB ap_ImgMatrix,
const Intf_fields ap_IF,
int  vb 
)

Main function dedicated to Interfile 3D image writing.
Recover image information from a provided Intf_fields structure.

Parameters
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()

Returns
0 if success, positive value otherwise.

Definition at line 1697 of file oInterfileIO.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

IntfWriteImgFile ( const string &  a_pathToImg,
FLTNB ap_ImgMatrix,
oImageDimensionsAndQuantification ap_ID,
int  vb 
)

Main function dedicated to Interfile 3D image writing.

Parameters
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.

Here is the call graph for this function:

IntfWriteImgFile ( const string &  a_pathToImg,
FLTNB ****  a4p_ImgMatrix,
oImageDimensionsAndQuantification ap_ID,
int  vb 
)

Main function dedicated to Interfile 6D (dynamic dims + 3D ) image writing.

Parameters
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.

Here is the call graph for this function:

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.

Parameters
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.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
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_ImgfieldsStructure 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.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Type >
SwapBytes ( Type *  ap_type)

Use std::reverse to swap the bits of a variable of any type.

Parameters
T*ap_type : Variable of type T

Used for Little/Big Endian conversion