8 #include "oImageSpace.hh" 9 #include "vOptimizer.hh" 61 if (
m_verbose>=3)
Cout(
"oImageSpace::InstantiateImage() -> Initialize to 0."<< endl);
100 if (
m_verbose>=3)
Cout(
"oImageSpace::DeallocateImage() -> Free memory"<< endl);
130 if (
m_verbose>=3)
Cout(
"oImageSpace::InstantiateForwardImage() -> Initialize to 0."<< endl);
169 if (
m_verbose>=3)
Cout(
"oImageSpace::DeallocateForwardImage() -> Free memory"<< endl);
200 if (
m_verbose>=3)
Cout(
"oImageSpace::InstantiateBackwardImageFromDynamicBasis() -> Initialize to 0."<< endl);
248 if (
m_verbose>=3)
Cout(
"oImageSpace::DeallocateBackwardImageFromDynamicBasis() -> Free memory" << endl);
288 if (
m_verbose>=3)
Cout(
"oImageSpace::InstantiateBackwardImageFromDynamicBins() -> Initialize to 0."<< endl);
327 if (
m_verbose>=3)
Cout(
"oImageSpace::DeallocateBackwardImageFromDynamicBins() -> Free memory"<< endl);
373 if (!a_pathToSensitivityImage.empty())
376 if (
m_verbose>=3)
Cout(
"oImageSpace::InstantiateSensitivityImage() -> Will be loaded from '" << a_pathToSensitivityImage <<
"'" << endl);
407 if (
m_verbose>=3)
Cout(
"oImageSpace::InstantiateSensitivityImage() -> For all threads"<< endl);
445 if (
m_verbose>=3)
Cout(
"oImageSpace::DeallocateSensitivityImage() -> Free memory"<< endl);
541 if (
m_verbose>=3)
Cout(
"oImageSpace::DeallocateMiscellaneousImage() -> Free memory"<< endl);
560 if(
m_verbose>=3)
Cout(
"oImageSpace::InstantiateVisitedVoxelsImage ..."<< endl);
572 if(
m_verbose>=3)
Cout(
"oImageSpace::InstantiateVisitedVoxelsImage ..."<< endl);
585 if (!a_pathToImage.empty())
594 if (
m_verbose>=3)
Cout(
"oImageSpace::InitMultiModalImage() -> From file '" << a_pathToImage.at(nb) <<
"'"<< endl);
596 ifstream image_file(a_pathToImage.at(nb).c_str(), ios::in|ios::binary);
597 if (!image_file.is_open())
599 Cerr(
"***** oImageSpace::InitMultiModalImage() -> Input file '" << a_pathToImage.at(nb) <<
"' is missing or corrupted !" << endl);
608 Cerr(
"***** oImageSpace::InitMultiModalImage() -> Error reading interfile image '" << a_pathToImage.at(nb) <<
"' !" << endl);
635 if (
m_verbose>=3)
Cout(
"oImageSpace::DeallocateMultiModalImage() -> Free memory" << endl);
651 if (!a_pathToImage.empty())
654 if (
m_verbose>=3)
Cout(
"oImageSpace::InitMaskImage() -> From file '" << a_pathToImage <<
"'"<< endl);
656 ifstream image_file(a_pathToImage.c_str(), ios::in|ios::binary);
657 if (!image_file.is_open())
659 Cerr(
"***** oImageSpace::InitMaskImage() -> Input file '" << a_pathToImage <<
"' is missing or corrupted !" << endl);
670 Cerr(
"***** oImageSpace::InitMaskImage() -> Error reading interfile image '" << a_pathToImage <<
"' !" << endl);
695 if (
m_verbose>=3)
Cout(
"oImageSpace::DeallocateMaskImage() -> Free memory" << endl);
720 if(
m_verbose>=3)
Cout(
"oImageSpace::InstantiateOutputImage ..."<< endl);
767 if(
m_verbose>=3)
Cout(
"oImageSpace::DeallocateOutputImage ..."<< endl);
847 if(
m_verbose>=3)
Cout(
"oImageSpace::InstantiateRefImagesForDeformation ..."<< endl);
959 if(
m_verbose>=3)
Cout(
"oImageSpace::DeallocateRefImagesForDeformation ..."<< endl);
1085 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_DeallocateAttenuationImage ..."<< endl);
1119 if (a_pathToAtnImage.empty())
return 0;
1121 if (
m_verbose>=
VERBOSE_NORMAL)
Cout(
"oImageSpace::InitAttenuationImage() -> Initialize and read attenuation image from file '" << a_pathToAtnImage <<
"'"<< endl);
1140 ifstream image_file(a_pathToAtnImage.c_str(), ios::in|ios::binary);
1142 if (!image_file.is_open())
1144 Cerr(
"***** oImageSpace::InitAttenuationImage() -> Failed to open attenuation image from file '" << a_pathToAtnImage <<
"' !" << endl);
1152 Cerr(
"***** oImageSpace::InitAttenuationImage() -> An error occurred while reading from file '" << a_pathToAtnImage <<
"' !" << endl);
1159 int nb_atn_frames = 1, nb_atn_rgates = 1, nb_atn_cgates = 1;
1165 Cerr(
"***** oImageSpace::InitAttenuationImage() -> An error occurred while reading'number of time frames', 'number of respiratory gates' or 'number of cardiac gates' keys from file '" << a_pathToAtnImage <<
"' !" << endl);
1226 if (!a_pathToInitialImage.empty())
1230 Cerr(
"***** oImageSpace::InitImage()-> Error while trying to read file at " << a_pathToInitialImage << endl);
1239 FLTNB exterior_fov_value = a_value * 1.;
1245 squared_radius_x *= squared_radius_x;
1247 squared_radius_y *= squared_radius_y;
1254 #pragma omp parallel for private(x) schedule(guided) 1259 squared_distance_x *= squared_distance_x;
1265 squared_distance_y *= squared_distance_y;
1267 FLTNB affected_value = 0.;
1269 if ( squared_distance_x/squared_radius_x + squared_distance_y/squared_radius_y <= 1. ) affected_value = a_value;
1271 else affected_value = exterior_fov_value;
1282 m4p_image[tbf][rbf][cbf][index] = affected_value;
1306 if(
m_verbose>=3)
Cout(
"oImageSpace::LoadInitialImage ..."<< endl);
1308 ifstream image_file;
1309 image_file.open(a_pathToImage.c_str(), ios::in | ios::binary);
1311 if(!image_file.is_open())
1313 Cerr(
"***** oImageSpace::LoadInitialImage()-> Error reading file!" << endl);
1322 Cerr(
"***** oImageSpace::LoadInitialImage()-> Error reading Interfile : " << a_pathToImage <<
" !" << endl);
1344 if(
m_verbose>=3)
Cout(
"oImageSpace::InitBackwardImage ..." << endl);
1350 #pragma omp parallel for private(th) schedule(static, 1) 1365 #pragma omp parallel for private(th) schedule(static, 1) 1396 if(
m_verbose>=3)
Cout(
"oImageSpace::InitSensitivityImage ..."<< endl);
1403 if (!a_pathToSensitivityImage.empty())
1406 ifstream input_file;
1407 input_file.open(a_pathToSensitivityImage.c_str(), ios::binary | ios::in);
1409 if (input_file.is_open())
1414 Cerr(
"***** oImageSpace::InitSensitivityImage()-> Error reading Interfile : " << a_pathToSensitivityImage <<
" !" << endl);
1422 Cerr(
"***** oImageSpace::InitSensitivityImage() -> Input sensitivity file '" << a_pathToSensitivityImage <<
"' is missing or corrupted !" << endl);
1466 if(
m_verbose>=3)
Cout(
"oDeformationManager::InitBwdImageForDeformation ..." << endl);
1535 if(
m_verbose>=3)
Cout(
"oImageSpace::ComputeOutputImage ..."<< endl);
1548 #pragma omp parallel for private(v) schedule(guided) 1556 if (time_basis_coef==0.)
continue;
1562 if (resp_basis_coef==0.)
continue;
1568 if (card_basis_coef==0.)
continue;
1570 FLTNB global_basis_coeff = time_basis_coef * resp_basis_coef * card_basis_coef;
1572 #pragma omp parallel for private(v) schedule(guided) 1602 Cout(
"oImageSpace::ApplyOutputFlip() -> Flip image" << endl);
1647 INTNB indice_1 = base_z1 + base_y + x;
1648 INTNB indice_2 = base_z2 + base_y + x;
1682 INTNB indice_1 = base_z + base_y1 + x;
1683 INTNB indice_2 = base_z + base_y2 + x;
1716 INTNB indice_1 = base_z + base_y + x_1;
1717 INTNB indice_2 = base_z + base_y + x_2;
1754 Cout(
"oImageSpace::ApplyOutputFOVMasking() -> Mask output image" << endl);
1769 squared_radius_x *= squared_radius_x;
1772 squared_radius_y *= squared_radius_y;
1779 #pragma omp parallel for private(x) schedule(guided) 1784 squared_distance_x *= squared_distance_x;
1790 squared_distance_y *= squared_distance_y;
1792 if ( squared_distance_x/squared_radius_x + squared_distance_y/squared_radius_y <= 1. )
continue;
1846 for (
int z=0; z<removed_slices; z++)
1853 INTNB index = base_z_first + i;
1862 INTNB index = base_z_last + i;
1887 Cout(
"oImageSpace::ApplyOutputMaskImage() -> Mask output image with the provided input mask image" << endl);
1893 #pragma omp parallel for private(v) schedule(guided) 1924 Cout(
"oImageSpace::ApplyMaskToSensitivity() -> Mask the sensitivity image with the provided input mask image" << endl);
1931 #pragma omp parallel for private(v) schedule(guided) 1962 Cout(
"oImageSpace::ApplyMaskToBackwardImage() -> Mask the backward image with the provided input mask image" << endl);
1969 #pragma omp parallel for private(v) schedule(guided) 2000 if (
m_verbose>=3)
Cout(
"oImageSpace::SaveOutputImage ..."<< endl);
2009 if (a_iteration >= 0)
2011 stringstream ss; ss << a_iteration + 1;
2012 path_to_img.append(
"_it").append(ss.str());
2018 stringstream ss; ss << a_subset + 1;
2019 path_to_img.append(
"_ss").append(ss.str());
2026 Cerr(
"***** oImageSpace::SaveOutputImage()-> Error writing Interfile of output image !" << endl);
2041 if (
m_verbose>=3)
Cout(
"oImageSpace::SaveOutputBasisCoefficientImage ..."<< endl);
2050 if (a_iteration >= 0)
2052 stringstream ss; ss << a_iteration + 1;
2053 path_to_img.append(
"_it").append(ss.str());
2059 stringstream ss; ss << a_subset + 1;
2060 path_to_img.append(
"_ss").append(ss.str());
2066 Cerr(
"***** oImageSpace::SaveOutputImage()-> Error writing Interfile of output image !" << endl);
2088 if(
m_verbose>=3)
Cout(
"oImageSpace::SaveDebugImage ..."<< endl);
2091 ofstream output_file;
2092 output_file.open(a_name.c_str(), ios::binary | ios::out);
2101 output_file.close();
2120 if(
m_verbose>=3)
Cout(
"oImageSpace::PrepareForwardImage ..."<< endl);
2143 #if defined(CASTOR_OMP) || defined(CASTOR_MPI) 2144 if (
m_verbose>=3)
Cout(
"oImageSpace::Reduce() -> Merge parallel results" << endl);
2160 int alternative = 2;
2175 else if (alternative==2)
2178 #pragma omp parallel for private(v) schedule(guided) 2201 else if (alternative==2)
2204 #pragma omp parallel for private(v) schedule(guided) 2260 if(
m_verbose>=3)
Cout(
"oImageSpace::CleanNeverVisitedVoxels ..."<< endl);
2263 #pragma omp parallel for private(v) schedule(guided) 2299 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_InstantiateImage ..."<< endl);
2331 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_DeallocateImage ..."<< endl);
2362 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_InstantiateForwardImage ..."<< endl);
2396 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_DeallocateForwardImage ..."<< endl);
2428 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_InstantiateSensitivityImage ..."<< endl);
2458 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_DeallocateSensitivityImage ..."<< endl);
2492 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_CopyAtnToImage ..."<< endl);
2527 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_CopyAtnToForwardImage ..."<< endl);
2535 int rg_atn = a_use1stMotion ? 0 : rg ;
2536 int cg_atn = a_use1stMotion ? 0 : cg ;
2564 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_CopyBackwardToSensitivity ..."<< endl);
2584 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_PrepareForwardImage ..."<< endl);
2603 #if defined(CASTOR_OMP) || defined(CASTOR_MPI) 2604 if (
m_verbose>=3)
Cout(
"oImageSpace::ReduceBackwardImage() -> Merge parallel results" << endl);
2652 if(
m_verbose>=3)
Cout(
"oImageSpace::LMS_SaveSensitivityImage ..."<< endl);
2666 nb_reco_card_images = 1;
2687 for (
int cg=0 ; cg<nb_reco_card_images ; cg++)
2716 FLTNB sensitivity_value_avg = 0.;
2733 Cerr(
"***** oImageSpace::LMS_SaveSensitivityImage()-> Error writing Sensitivity image !" << endl);
2755 if(
m_verbose>=3)
Cout(
"oImageSpace::SaveSensitivityImage ..."<< endl);
2759 Cerr(
"***** oImageSpace::SaveSensitivityImage()-> Error writing Interfile of output image !" << endl);
2784 if(
m_verbose>=3)
Cout(
"oImageSpace::PROJ_InstantiateProjectionImage ..."<< endl);
2788 for(
int p=0 ; p<a_nbProjs ; p++)
2791 for(
int px=0 ; px<a_nbPixels ; px++)
2812 if(
m_verbose>=3)
Cout(
"oImageSpace::PROJ_DeallocateProjectionImage ..."<< endl);
2814 for(
int p=0 ; p<a_nbProjs ; p++)
2838 if(
m_verbose>=3)
Cout(
"oImageSpace::PROJ_InitImage ..."<< endl);
2840 if (!a_pathToInitialImage.empty())
2844 Cerr(
"***** oImageSpace::PROJ_InitImage()-> Error while trying to read file at " << a_pathToInitialImage << endl);
2851 Cerr(
"***** oImageSpace::PROJ_InitImage()-> No projected image provided ! " << endl);
2873 if(
m_verbose>=3)
Cout(
"oImageSpace::PROJ_LoadInitialImage ..."<< endl);
2875 ifstream image_file;
2876 image_file.open(a_pathToImage.c_str(), ios::in | ios::binary);
2878 if(!image_file.is_open())
2880 Cerr(
"***** oImageSpace::PROJ_LoadInitialImage()-> Error reading file !" << endl);
2888 Cerr(
"***** oImageSpace::PROJ_LoadInitialImage()-> Error reading Interfile : " << a_pathToImage <<
" !" << endl);
2914 if(
m_verbose>=3)
Cout(
"oImageSpace::PROJ_SaveProjectionImage ..."<< endl);
2916 string img_name =
"_ProjectionImage";
2933 uint16_t nb_projs, nb_heads;
2935 uint16_t nb_bins[2];
2951 Img_fields.
mtx_size[0] = nb_bins[0];
2952 Img_fields.
mtx_size[1] = nb_bins[1];
2953 Img_fields.
vox_size[0] = pix_size[0];
2954 Img_fields.
vox_size[1] = pix_size[1];
2968 string angles_str =
"{";
2969 string radius_str =
"{";
2972 bool has_single_radius =
true;
2974 for(uint16_t p=0 ; p<nb_projs ; p++)
2976 stringstream ss_a, ss_r;
2978 ss_a << p_angles[p];
2979 angles_str.append(ss_a.str());
2980 (p<nb_projs-1) ? angles_str.append(
",") : angles_str.append(
"}");
2983 ss_r << p_radius[p];
2984 radius_str.append(ss_r.str());
2985 (p<nb_projs-1) ? radius_str.append(
",") : radius_str.append(
"}");
2986 if(p_radius[p] != p_radius[0])
2987 has_single_radius =
false;
2994 angles_str.append(
"\n");
2995 radius_str.append(
"\n");
3000 if(has_single_radius)
3004 radius_str = ss.str();
3008 Img_fields.
radius = radius_str;
3014 img_file_name.append(
"_ProjImage");
3018 Cerr(
"***** oImageSpace::PROJ_SaveProjectionImage()-> Error writing Interfile of output image !" << endl);
int ApplyMaskToBackwardImage(int a_imageIndex, int a_timeIndex, int a_respIndex, int a_cardIndex)
#define INTF_LERP_DISABLED
void IntfKeySetFieldsOutput(Intf_fields *ap_IF, oImageDimensionsAndQuantification *ap_ID)
Init the keys of the Interfile header of an image to be written on disk.
void LMS_InstantiateImage()
Allocate memory for the main image matrices (for list-mode sensitivity generation) ...
FLTNB * mp_visitedVoxelsImage
static sScannerManager * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
void DeallocateMiscellaneousImage()
Deallocate all allocated miscellaneous images.
string direction_rotation
FLTNB **** m4p_refDynForwardImage
void DeallocateBackwardImageFromDynamicBasis()
Free memory for the backward image matrices.
void LMS_CopyAtnToForwardImage(bool a_use1stMotion, bool a_use2ndMotion)
int GetNbCardBasisFunctions()
Get the number of cardiac basis functions.
#define INTF_LERP_ENABLED
int InitMaskImage(const string &a_pathToImage)
int PROJ_InitImage(const string &a_pathToInitialImage)
FLTNB GetVoxSizeX()
Get the voxel's size along the X axis, in mm.
int ApplyOutputMaskImage()
Mask the outside of the provided input mask image.
void DeallocateImage()
Free memory for the main image matrices.
int LMS_SaveSensitivityImage(const string &a_pathToSensitivityImage, oDeformationManager *ap_DeformationManager)
FLTNB GetTimeBasisCoefficient(int a_timeBasisFunction, int a_timeFrame)
void LMS_PrepareForwardImage()
Copy current image in forward-image buffer (for list-mode sensitivity generation) ...
FLTNB GetFOVOutPercent()
Get the percentage of transaxial unmasked FOV.
void Reduce()
Merge parallel results into the matrix of the backward image matrix of the first thread. Also for MPI.
int InitMultiModalImage(const vector< string > &a_pathToMultiModalImage)
FLTNB ** m2p_projectionImage
int ApplyOutputFOVMasking()
Mask the outside of the transaxial FOV based on the m_fovOutPercent.
void DeallocateMultiModalImage()
Free memory for the multimodal image.
~oImageSpace()
oImageSpace destructor.
void DeallocateSensitivityImage()
Free memory for the sensitivity image matrices.
void InstantiateImage()
Allocate memory for the main image matrices.
int PROJ_SaveProjectionImage()
Save an image of the projected data (for analytic projection)
void InstantiateBackwardImageFromDynamicBasis(int a_nbBackwardImages)
FLTNB **** m4p_refDynSensitivityImage
int GetNbMultiModalImages()
Get the number of additional multimodal images.
int ApplyMaskToSensitivity()
Apply the mask to the sensitivity image (only for the first thread, the image must be reduced beforeh...
int GetNbTimeBasisFunctions()
Get the number of time basis functions.
void LMS_InstantiateForwardImage()
Allocate memory for the forward image matrices (for list-mode sensitivity generation) ...
void InstantiateSensitivityImage(const string &a_pathToSensitivityImage)
int GetSPECTSpecificParameters(uint16_t *ap_nbOfProjections, uint16_t *ap_nbHeads, FLTNB *ap_acquisitionZoom, uint16_t *ap_nbOfBins, FLTNB *ap_pixSizeXY, FLTNB *&ap_angles, FLTNB *&ap_CORtoDetectorDistance, int *ap_headRotDirection)
static sOutputManager * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
void LMS_CopyAtnToImage()
Copy the attenuation image contained in the 'm2p_attenuation' matrix inside the m2p_image matrix...
int InitAttenuationImage(const string &a_pathToAtnImage)
int InitImage(const string &a_pathToInitialImage, FLTNB a_value)
void DeallocateVisitedVoxelsImage()
Free memory for the image matrix containing binary information regarding which 3D voxels have been vi...
void SaveDebugImage(const string &a_name)
void DeallocateMaskImage()
Free memory for the mask image.
FLTNB ***** m5p_refDynBackwardImage
bool GetRespStaticFlag()
Get the respiratory static flag that says if the reconstruction has only one respiratory gate or not...
int PROJ_LoadInitialImage(const string &a_pathToImage)
FLTNB ****** m6p_backwardImage
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 In...
FLTNB GetListPMotionWeightInFrameForLMS(int a_fr, int a_pmsset)
void PROJ_DeallocateProjectionImage(int a_nbProjs)
void PrepareForwardImage()
Copy current image matrix in the forward-image buffer matrix.
FLTNB GetVoxSizeY()
Get the voxel's size along the Y axis, in mm.
int SaveOutputBasisCoefficientImage(int a_iteration, int a_subset=-1)
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.
FLTNB **** m4p_outputImage
const string & GetPathName()
bool GetCardStaticFlag()
Get the cardiac static flag that says if the reconstruction has only one cardiac gate or not...
void InstantiateVisitedVoxelsImage()
Memory allocation and initialization for the image matrix containing binary information regarding whi...
void InitRefImagesForDeformation()
FLTNB GetRespBasisCoefficient(int a_respBasisFunction, int a_respGate)
void CleanNeverVisitedVoxels()
Based on the visitedVoxelsImage, clean the never visited voxels in the image. This function must be c...
Singleton class that manages output writing on disk (images, sinograms, etc). It also manages loggi...
void LMS_DeallocateSensitivityImage()
Free memory for the sensitivity image matrices (for list-mode sensitivity generation) ...
Singleton class that Instantiate and initialize the scanner object.
int SaveOutputImage(int a_iteration, int a_subset=-1)
void LMS_DeallocateImage()
Free memory for the main image matrices (for list-mode sensitivity generation)
FLTNB GetCardBasisCoefficient(int a_cardBasisFunction, int a_cardGate)
void ComputeOutputImage()
int LoadInitialImage(const string &a_pathToImage)
int IntfWriteWholeDynBasisCoeffImgFile(const string &a_pathToImg, FLTNB ****a4p_ImgMatrix, oImageDimensionsAndQuantification *ap_ID, int vb)
Main function dedicated to Interfile 6D (dynamic dims + 3D ) image writing of basis function coeffici...
void DeallocateRefImagesForDeformation()
Free memory for the buffer sensitivity image required for image-based deformation. This function is called from the Deformation Manager.
INTNB GetNbVoxXY()
Get the number of voxels in a slice.
FLTNB ** m2p_multiModalImage
void InstantiateForwardImage()
Allocate memory for the forward image matrices.
FLTNB **** m4p_attenuation
bool GetTimeStaticFlag()
Get the time static flag that says if the reconstruction has only one frame or not.
FLTNB ***** m5p_sensitivity
FLTNB ** m2p_miscellaneousImage
void PROJ_InstantiateProjectionImage(int a_nbProjs, int a_nbPixels)
FLTNB **** m4p_forwardImage
bool GetFlipOutX()
Get the boolean saying if the output image must be flipped along the X axis.
int GetNb1stMotImgsForLMS(int a_fr)
void ReduceBackwardImage(int a_imageIndex, int a_timeIndex, int a_respIndex, int a_cardIndex)
bool GetFlipOutY()
Get the boolean saying if the output image must be flipped along the Y axis.
const string & GetBaseName()
int ApplyOutputFlip()
Just flip the output image.
void InstantiateBackwardImageFromDynamicBins()
Allocate memory for the backward image matrices and initialize them.
void LMS_DeallocateAttenuationImage()
Free memory for the Attenuation image matrices (for analytical projection or list-mode sensitivity ge...
int GetNbCardGates()
Get the number of cardiac gates.
void DeallocateOutputImage()
Free memory for the Image matrices dedicated to output writing on disk.
Interfile fields. This structure contains all the Interfile keys currently managed by CASToR Decl...
uint16_t nb_detector_heads
int GetNbThreadsForImageComputation()
Get the number of threads used for image operations.
int GetNbTimeFrames()
Get the number of time frames.
INTNB GetNbVoxXYZ()
Get the total number of voxels.
int GetNb2ndMotImgsForLMS()
call the eponym function from the oDynamicDataManager object
FLTNB * AllocateMiscellaneousImage()
Allocate a new miscellaneous image on m2p_miscellaneousImages and return the pointer to this image...
int GetNbThreadsForProjection()
Get the number of threads used for projections.
oImageSpace()
oImageSpace constructor. Initialize the member variables to their default values. ...
INTNB GetNbVoxX()
Get the number of voxels along the X axis.
INTNB GetNbVoxZ()
Get the number of voxels along the Z axis.
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.
int GetNbRespGates()
Get the number of respiratory gates.
void InstantiateRefImagesForDeformation()
Allocate memory for the buffer sensitivity image required for image-based deformation. This function is called from the Deformation Manager.
int m_nbMiscellaneousImages
int SaveSensitivityImage(const string &a_pathToSensitivityImage)
bool GetFlipOutZ()
Get the boolean saying if the output image must be flipped along the Z axis.
void DeallocateBackwardImageFromDynamicBins()
Free memory of the backward image matrices.
oImageDimensionsAndQuantification * mp_ID
void InitBackwardImage()
Initialize each voxel of the backward images to 0, also for sensitivity if not loaded (estimated on t...
int InitSensitivityImage(const string &a_pathToSensitivityImage)
void LMS_InstantiateSensitivityImage()
Allocate memory for the sensitivity image matrices (for list-mode sensitivity generation) ...
void DeallocateForwardImage()
Free memory for the forward image matrices.
int GetNbRespBasisFunctions()
Get the number of respiratory basis functions.
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...
void LMS_CopyBackwardToSensitivity()
INTNB GetNbSliceOutMask()
Get the number of extrem slices that will be masked at each side.
INTNB GetNbVoxY()
Get the number of voxels along the Y axis.
#define KEYWORD_OPTIONAL_ERROR
void InstantiateOutputImage()
Instanciate Image matrices dedicated to output writing on disk.
void LMS_DeallocateForwardImage()
Free memory for the forward image matrices (for list-mode sensitivity generation) ...