#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include "petc99.h"
#include "swap.h"
#include "halflife.h"
#include "include/img.h"
#include "include/ecat63.h"
#include "include/ecat7.h"
#include "include/imgmax.h"
#include "include/imgdecay.h"
#include "include/sif.h"
#include "include/imgfile.h"
Go to the source code of this file.
Functions | |
int | ecat63ReadAllToImg (const char *fname, IMG *img) |
int | ecat63WriteAllImg (const char *fname, IMG *img) |
int | ecat63ReadPlaneToImg (const char *fname, IMG *img) |
int | ecat63AddImg (const char *fname, IMG *img) |
int | imgEcat63Supported (ECAT63_mainheader *h) |
void | imgGetEcat63MHeader (IMG *img, ECAT63_mainheader *h) |
void | imgSetEcat63MHeader (IMG *img, ECAT63_mainheader *h) |
int | imgGetEcat63Fileformat (ECAT63_mainheader *h) |
int | imgReadEcat63Header (const char *fname, IMG *img) |
int | imgReadEcat63FirstFrame (const char *fname, IMG *img) |
int | imgReadEcat63Frame (const char *fname, int frame_to_read, IMG *img, int frame_index) |
int | imgWriteEcat63Frame (const char *fname, int frame_to_write, IMG *img, int frame_index) |
void | imgSetEcat63SHeader (IMG *img, void *h) |
int ecat63AddImg | ( | const char * | fname, |
IMG * | img | ||
) |
Adds all matrices in memory to the ECAT file. If ECAT file does not exist, it is created. Please note that existing ECAT file is NOT saved as fname%
fname | name of the output ECAT 6.3 file |
img | data structure from which the data is written |
Definition at line 886 of file img_e63.c.
References IMG::_dataType, ecat63_mainheader::axial_fov, IMG::axialFOV, ecat63_mainheader::calibration_factor, ecat63_mainheader::calibration_units, ecat63_mainheader::data_type, ecat63_imageheader::data_type, ecat63_scanheader::data_type, ecat63_imageheader::decay_corr_fctr, IMG::decayCorrected, IMG::decayCorrFactor, ecat63_scanheader::delayed, ecat63_imageheader::dimension_1, ecat63_scanheader::dimension_1, ecat63_imageheader::dimension_2, ecat63_scanheader::dimension_2, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, ECAT63_SYSTEM_TYPE_DEFAULT, ecat63Create(), ecat63EmptyMatlist(), ecat63errmsg, ecat63InitMatlist(), ecat63PrintMainheader(), ecat63ReadMainheader(), ecat63ReadMatlist(), ecat63WriteImage(), ecat63WriteMainheader(), ecat63WriteScan(), ecat63_imageheader::ecat_calibration_fctr, IMG::end, ecat63_mainheader::file_type, Matval::frame, ecat63_imageheader::frame_duration, ecat63_scanheader::frame_duration, ecat63_scanheader::frame_duration_sec, ecat63_imageheader::frame_start_time, ecat63_scanheader::frame_start_time, IMAGE_DATA, ecat63_imageheader::image_max, ecat63_imageheader::image_min, IMG_STATUS_OCCUPIED, IMG_TEST, IMG_TYPE_IMAGE, IMG_TYPE_RAW, imgInfo(), imgIsotope(), imgUnitToEcat6(), ecat63_mainheader::isotope_code, ecat63_mainheader::isotope_halflife, IMG::isotopeHalflife, ecat63_imageheader::loss_corr_fctr, ecat63_scanheader::loss_correction_fctr, IMG::m, mat_numcod(), mat_numdoc(), MATRIXLIST::matdir, MatDir::matnum, MATRIXLIST::matrixNr, ecat63_mainheader::num_bed_pos, ecat63_imageheader::num_dimensions, ecat63_mainheader::num_frames, ecat63_mainheader::num_gates, ecat63_mainheader::num_planes, ecat63_mainheader::patient_id, ecat63_mainheader::patient_name, IMG::patientID, IMG::patientName, ecat63_imageheader::pixel_size, Matval::plane, ecat63_imageheader::plane_eff_corr_fctr, ecat63_mainheader::plane_separation, IMG::planeNumber, ecat63_scanheader::prompts, IMG::prompts, ecat63_imageheader::quant_scale, ecat63_imageheader::quant_units, ecat63_mainheader::radiopharmaceutical, IMG::radiopharmaceutical, IMG::randoms, RAW_DATA, ecat63_imageheader::recon_scale, ecat63_scanheader::sample_distance, IMG::sampleDistance, ecat63_scanheader::scale_factor, ecat63_scanheader::scan_max, ecat63_scanheader::scan_min, ecat63_mainheader::scan_start_day, ecat63_mainheader::scan_start_hour, ecat63_mainheader::scan_start_minute, ecat63_mainheader::scan_start_month, ecat63_mainheader::scan_start_second, ecat63_mainheader::scan_start_year, IMG::scanner, IMG::scanStart, IMG::sizex, IMG::sizez, ecat63_imageheader::slice_width, IMG::start, IMG::status, ecat63_mainheader::study_description, ecat63_mainheader::study_name, IMG::studyDescription, IMG::studyNr, ecat63_mainheader::sw_version, ecat63_mainheader::system_type, ecat63_mainheader::transaxial_fov, IMG::transaxialFOV, IMG::type, ecat63_mainheader::user_process_code, IMG::userProcessCode, VAX_I2, ecat63_imageheader::well_counter_cal_fctr, and IMG::zoom.
int ecat63ReadAllToImg | ( | const char * | fname, |
IMG * | img | ||
) |
Read all matrices in ECAT file to memory. Img data must be initialized before this procedure.
fname | name of the input ECAT 6.3 file |
img | data structure in which the file is read |
Definition at line 77 of file img_e63.c.
References IMG::_dataType, IMG::_fileFormat, ATTN_DATA, ecat63_mainheader::axial_fov, IMG::axialFOV, BYTE_TYPE, ecat63_mainheader::calibration_factor, ecat63_mainheader::calibration_units, ecat63_imageheader::data_type, ecat63_scanheader::data_type, ecat63_normheader::data_type, ecat63_attnheader::data_type, ecat63_imageheader::decay_corr_fctr, IMG::decayCorrected, IMG::decayCorrFactor, ecat63_scanheader::delayed, ecat63_imageheader::dimension_1, ecat63_scanheader::dimension_1, ecat63_normheader::dimension_1, ecat63_attnheader::dimension_1, ecat63_imageheader::dimension_2, ecat63_scanheader::dimension_2, ecat63_normheader::dimension_2, ecat63_attnheader::dimension_2, ecat63DeleteLateFrames(), ecat63EmptyMatlist(), ecat63errmsg, ecat63InitMatlist(), ecat63PrintMainheader(), ecat63PrintMatlist(), ecat63ReadAttnheader(), ecat63ReadImageheader(), ecat63ReadMainheader(), ecat63ReadMatdata(), ecat63ReadMatlist(), ecat63ReadNormheader(), ecat63ReadScanheader(), ecat63_imageheader::ecat_calibration_fctr, IMG::end, MatDir::endblk, ecat63_mainheader::file_type, Matval::frame, ecat63_imageheader::frame_duration, ecat63_scanheader::frame_duration, ecat63_imageheader::frame_start_time, ecat63_scanheader::frame_start_time, Matval::gate, IEEE_R4, IMAGE_DATA, IMG_E63, IMG_STATUS_INITIALIZED, IMG_TEST, IMG_TYPE_IMAGE, IMG_TYPE_RAW, imgAllocate(), imgSetStatus(), imgUnitFromEcat(), ecat63_mainheader::isotope_halflife, IMG::isotopeHalflife, ecat63_scanheader::loss_correction_fctr, IMG::m, mat_numdoc(), MatBLKSIZE, MATRIXLIST::matdir, MatDir::matnum, MATRIXLIST::matrixNr, MatDir::matstat, IMG::mid, NORM_DATA, ecat63_mainheader::num_frames, ecat63_mainheader::num_gates, ecat63_mainheader::patient_id, ecat63_mainheader::patient_name, IMG::patientID, IMG::patientName, ecat63_imageheader::pixel_size, Matval::plane, ecat63_mainheader::plane_separation, IMG::planeNumber, ecat63_scanheader::prompts, IMG::prompts, ecat63_imageheader::quant_scale, ecat63_imageheader::quant_units, ecat63_mainheader::radiopharmaceutical, IMG::radiopharmaceutical, IMG::randoms, RAW_DATA, ecat63_imageheader::recon_scale, ecat63_scanheader::sample_distance, IMG::sampleDistance, ecat63_scanheader::scale_factor, ecat63_normheader::scale_factor, ecat63_attnheader::scale_factor, ecat63_mainheader::scan_start_day, ecat63_mainheader::scan_start_hour, ecat63_mainheader::scan_start_minute, ecat63_mainheader::scan_start_month, ecat63_mainheader::scan_start_second, ecat63_mainheader::scan_start_year, IMG::scanner, IMG::scanStart, IMG::sizex, IMG::sizey, IMG::sizez, ecat63_imageheader::slice_width, IMG::start, IMG::status, STATUS_FAULT, STATUS_NOFILE, STATUS_NOMAINHEADER, STATUS_NOMATLIST, MatDir::strtblk, ecat63_mainheader::study_description, ecat63_mainheader::study_name, IMG::studyDescription, IMG::studyNr, SUN_I2, SUN_I4, ecat63_mainheader::system_type, ecat63_mainheader::transaxial_fov, IMG::transaxialFOV, IMG::type, IMG::unit, ecat63_mainheader::user_process_code, IMG::userProcessCode, VAX_I2, VAX_I4, VAX_R4, and IMG::zoom.
Referenced by imgRead().
int ecat63ReadPlaneToImg | ( | const char * | fname, |
IMG * | img | ||
) |
Reads one CTI ECAT 6.3 plane (all frames or gates) at a time to memory. Img data must be initialized before this procedure. Existing img->_dataType is not changed. If img data structure is empty, reads the first plane. If img data structure contains data, reads the next plane. Any existing data in img is cleared and replaced by the new plane.
fname | name of the input ECAT 6.3 file |
img | data structure in which the file is read |
Definition at line 568 of file img_e63.c.
References IMG::_dataType, IMG::_fileFormat, ATTN_DATA, ecat63_mainheader::axial_fov, IMG::axialFOV, BYTE_TYPE, ecat63_mainheader::calibration_factor, ecat63_mainheader::calibration_units, ecat63_imageheader::data_type, ecat63_scanheader::data_type, ecat63_normheader::data_type, ecat63_attnheader::data_type, ecat63_imageheader::decay_corr_fctr, IMG::decayCorrected, IMG::decayCorrFactor, ecat63_scanheader::delayed, ecat63_imageheader::dimension_1, ecat63_scanheader::dimension_1, ecat63_normheader::dimension_1, ecat63_attnheader::dimension_1, ecat63_imageheader::dimension_2, ecat63_scanheader::dimension_2, ecat63_normheader::dimension_2, ecat63_attnheader::dimension_2, IMG::dimt, IMG::dimz, ecat63DeleteLateFrames(), ecat63EmptyMatlist(), ecat63errmsg, ecat63InitMatlist(), ecat63PrintMainheader(), ecat63ReadAttnheader(), ecat63ReadImageheader(), ecat63ReadMainheader(), ecat63ReadMatdata(), ecat63ReadMatlist(), ecat63ReadNormheader(), ecat63ReadScanheader(), ecat63_imageheader::ecat_calibration_fctr, IMG::end, MatDir::endblk, ecat63_mainheader::file_type, Matval::frame, ecat63_imageheader::frame_duration, ecat63_scanheader::frame_duration, ecat63_imageheader::frame_start_time, ecat63_scanheader::frame_start_time, Matval::gate, IEEE_R4, IMAGE_DATA, IMG_E63, IMG_STATUS_OCCUPIED, IMG_STATUS_UNINITIALIZED, IMG_TEST, IMG_TYPE_IMAGE, IMG_TYPE_RAW, imgAllocate(), imgEmpty(), imgUnitFromEcat(), ecat63_mainheader::isotope_halflife, IMG::isotopeHalflife, ecat63_scanheader::loss_correction_fctr, IMG::m, mat_numdoc(), MatBLKSIZE, MATRIXLIST::matdir, MatDir::matnum, MATRIXLIST::matrixNr, MatDir::matstat, IMG::mid, NORM_DATA, ecat63_mainheader::num_frames, ecat63_mainheader::num_gates, ecat63_mainheader::patient_id, ecat63_mainheader::patient_name, IMG::patientID, IMG::patientName, ecat63_imageheader::pixel_size, Matval::plane, ecat63_mainheader::plane_separation, IMG::planeNumber, ecat63_scanheader::prompts, IMG::prompts, ecat63_imageheader::quant_scale, ecat63_imageheader::quant_units, ecat63_mainheader::radiopharmaceutical, IMG::radiopharmaceutical, IMG::randoms, RAW_DATA, ecat63_imageheader::recon_scale, ecat63_scanheader::sample_distance, IMG::sampleDistance, ecat63_scanheader::scale_factor, ecat63_normheader::scale_factor, ecat63_attnheader::scale_factor, ecat63_mainheader::scan_start_day, ecat63_mainheader::scan_start_hour, ecat63_mainheader::scan_start_minute, ecat63_mainheader::scan_start_month, ecat63_mainheader::scan_start_second, ecat63_mainheader::scan_start_year, IMG::scanner, IMG::scanStart, IMG::sizex, IMG::sizey, IMG::sizez, ecat63_imageheader::slice_width, IMG::start, IMG::status, MatDir::strtblk, ecat63_mainheader::study_description, ecat63_mainheader::study_name, IMG::studyDescription, IMG::studyNr, SUN_I2, SUN_I4, ecat63_mainheader::system_type, ecat63_mainheader::transaxial_fov, IMG::transaxialFOV, IMG::type, IMG::unit, ecat63_mainheader::user_process_code, IMG::userProcessCode, VAX_I2, VAX_I4, VAX_R4, and IMG::zoom.
int ecat63WriteAllImg | ( | const char * | fname, |
IMG * | img | ||
) |
Write all matrices in memory to the ECAT file.
fname | name of the output ECAT 6.3 file, If ECAT file exists, it is renamed as filename% |
img | data structure from which the data is written |
Definition at line 374 of file img_e63.c.
References IMG::_dataType, ecat63_mainheader::axial_fov, IMG::axialFOV, ecat63_mainheader::calibration_factor, ecat63_mainheader::calibration_units, ecat63_mainheader::data_type, ecat63_imageheader::data_type, ecat63_scanheader::data_type, ecat63_imageheader::decay_corr_fctr, IMG::decayCorrected, IMG::decayCorrFactor, ecat63_scanheader::delayed, ecat63_imageheader::dimension_1, ecat63_scanheader::dimension_1, ecat63_imageheader::dimension_2, ecat63_scanheader::dimension_2, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, ECAT63_SYSTEM_TYPE_DEFAULT, ecat63Create(), ecat63errmsg, ecat63PrintImageheader(), ecat63PrintMainheader(), ecat63PrintScanheader(), ecat63WriteImage(), ecat63WriteScan(), ecat63_imageheader::ecat_calibration_fctr, IMG::end, ecat63_mainheader::file_type, ecat63_imageheader::frame_duration, ecat63_scanheader::frame_duration, ecat63_scanheader::frame_duration_sec, ecat63_imageheader::frame_start_time, ecat63_scanheader::frame_start_time, IMAGE_DATA, ecat63_imageheader::image_max, ecat63_imageheader::image_min, IMG_STATUS_OCCUPIED, IMG_TEST, IMG_TYPE_IMAGE, imgIsotope(), imgUnitToEcat6(), ecat63_mainheader::isotope_code, ecat63_mainheader::isotope_halflife, IMG::isotopeHalflife, ecat63_imageheader::loss_corr_fctr, ecat63_scanheader::loss_correction_fctr, IMG::m, mat_numcod(), ecat63_mainheader::num_bed_pos, ecat63_imageheader::num_dimensions, ecat63_mainheader::num_frames, ecat63_mainheader::num_gates, ecat63_mainheader::num_planes, ecat63_mainheader::patient_id, ecat63_mainheader::patient_name, IMG::patientID, IMG::patientName, ecat63_imageheader::pixel_size, ecat63_imageheader::plane_eff_corr_fctr, ecat63_mainheader::plane_separation, IMG::planeNumber, ecat63_scanheader::prompts, IMG::prompts, ecat63_imageheader::quant_scale, ecat63_imageheader::quant_units, ecat63_mainheader::radiopharmaceutical, IMG::radiopharmaceutical, IMG::randoms, RAW_DATA, ecat63_imageheader::recon_scale, ecat63_scanheader::sample_distance, IMG::sampleDistance, ecat63_scanheader::scale_factor, ecat63_scanheader::scan_max, ecat63_scanheader::scan_min, ecat63_mainheader::scan_start_day, ecat63_mainheader::scan_start_hour, ecat63_mainheader::scan_start_minute, ecat63_mainheader::scan_start_month, ecat63_mainheader::scan_start_second, ecat63_mainheader::scan_start_year, IMG::scanner, IMG::scanStart, IMG::sizex, IMG::sizez, ecat63_imageheader::slice_width, IMG::start, IMG::status, ecat63_mainheader::study_description, ecat63_mainheader::study_name, IMG::studyDescription, IMG::studyNr, ecat63_mainheader::sw_version, ecat63_mainheader::system_type, ecat63_mainheader::transaxial_fov, IMG::transaxialFOV, IMG::type, ecat63_mainheader::user_process_code, IMG::userProcessCode, VAX_I2, ecat63_imageheader::well_counter_cal_fctr, and IMG::zoom.
Referenced by imgWrite().
int imgEcat63Supported | ( | ECAT63_mainheader * | h | ) |
Check whether read functions in IMG library support this ECAT 6.3 file_type.
h | Ecat 6.3 main header |
Definition at line 1140 of file img_e63.c.
References ATTN_DATA, ecat63_mainheader::file_type, IMAGE_DATA, NORM_DATA, and RAW_DATA.
Referenced by imgReadEcat63Header().
int imgGetEcat63Fileformat | ( | ECAT63_mainheader * | h | ) |
Return the IMG fileformat based on ECAT 6.3 file_type.
h | Ecat 6.3 main header |
Definition at line 1260 of file img_e63.c.
References ATTN_DATA, ecat63_mainheader::file_type, IMAGE_DATA, IMG_E63, IMG_UNKNOWN, NORM_DATA, and RAW_DATA.
Referenced by imgReadEcat63Header().
void imgGetEcat63MHeader | ( | IMG * | img, |
ECAT63_mainheader * | h | ||
) |
Copy ECAT 6.3 main header information into IMG
img | target image structure |
h | source Ecat 6.3 main header |
Definition at line 1157 of file img_e63.c.
References IMG::_dataType, ATTN_DATA, ecat63_mainheader::axial_fov, IMG::axialFOV, ecat63_mainheader::calibration_units, ecat63_mainheader::data_type, ecat63_mainheader::file_type, IMAGE_DATA, IMG_TYPE_IMAGE, IMG_TYPE_RAW, imgUnitFromEcat(), ecat63_mainheader::isotope_halflife, IMG::isotopeHalflife, NORM_DATA, ecat63_mainheader::patient_id, ecat63_mainheader::patient_name, IMG::patientID, IMG::patientName, ecat63_mainheader::plane_separation, ecat63_mainheader::radiopharmaceutical, IMG::radiopharmaceutical, RAW_DATA, ecat63_mainheader::scan_start_day, ecat63_mainheader::scan_start_hour, ecat63_mainheader::scan_start_minute, ecat63_mainheader::scan_start_month, ecat63_mainheader::scan_start_second, ecat63_mainheader::scan_start_year, IMG::scanner, IMG::scanStart, IMG::sizez, ecat63_mainheader::study_description, ecat63_mainheader::study_name, IMG::studyDescription, IMG::studyNr, ecat63_mainheader::system_type, ecat63_mainheader::transaxial_fov, IMG::transaxialFOV, IMG::type, ecat63_mainheader::user_process_code, IMG::userProcessCode, VAX_I2, VAX_I4, and VAX_R4.
Referenced by imgReadEcat63Header().
int imgReadEcat63FirstFrame | ( | const char * | fname, |
IMG * | img | ||
) |
Read the first frame from an ECAT 6.3 file into IMG data structure.
fname | name of file from which IMG contents will be read |
img | pointer to the initiated but not preallocated IMG data |
Definition at line 1422 of file img_e63.c.
References IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, IMG_STATUS_INITIALIZED, IMG_TEST, imgAllocate(), imgInfo(), imgReadEcat63Frame(), imgReadEcat63Header(), imgSetStatus(), IMG::status, STATUS_FAULT, STATUS_NOMEMORY, and STATUS_OK.
int imgReadEcat63Frame | ( | const char * | fname, |
int | frame_to_read, | ||
IMG * | img, | ||
int | frame_index | ||
) |
Read a specified frame from an ECAT 6.3 file into preallocated IMG data structure. IMG header is assumed to be filled correctly before calling this function, except for information concerning separate planes and this frame, which is filled here.
fname | name of file from which IMG contents will be read |
frame_to_read | frame which will be read (1..frameNr) |
img | pointer to the IMG data. Place for the frame must be preallocated |
frame_index | IMG frame index (0..dimt-1) where data will be placed |
Definition at line 1464 of file img_e63.c.
References IMG::_dataType, ATTN_DATA, BYTE_TYPE, ecat63_mainheader::calibration_factor, ecat63_imageheader::data_type, ecat63_scanheader::data_type, ecat63_normheader::data_type, ecat63_attnheader::data_type, ecat63_imageheader::decay_corr_fctr, IMG::decayCorrFactor, ecat63_scanheader::delayed, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, ecat63EmptyMatlist(), ecat63GatherMatlist(), ecat63GetMatrixBlockSize(), ecat63InitMatlist(), ecat63ReadAttnheader(), ecat63ReadImageheader(), ecat63ReadMainheader(), ecat63ReadMatdata(), ecat63ReadMatlist(), ecat63ReadNormheader(), ecat63ReadScanheader(), ecat63SortMatlistByFrame(), ecat63_imageheader::ecat_calibration_fctr, IMG::end, MatDir::endblk, ecat63_mainheader::file_type, Matval::frame, ecat63_imageheader::frame_duration, ecat63_scanheader::frame_duration, ecat63_imageheader::frame_start_time, ecat63_scanheader::frame_start_time, Matval::gate, IEEE_R4, IMAGE_DATA, IMG_STATUS_OCCUPIED, IMG_TEST, imgSetStatus(), ecat63_scanheader::loss_correction_fctr, IMG::m, mat_numdoc(), MatBLKSIZE, MATRIXLIST::matdir, MatDir::matnum, MATRIXLIST::matrixNr, MatDir::matstat, IMG::mid, NORM_DATA, ecat63_mainheader::num_frames, ecat63_mainheader::num_gates, Matval::plane, IMG::planeNumber, ecat63_scanheader::prompts, IMG::prompts, ecat63_imageheader::quant_scale, IMG::randoms, RAW_DATA, ecat63_scanheader::sample_distance, IMG::sampleDistance, ecat63_scanheader::scale_factor, ecat63_normheader::scale_factor, ecat63_attnheader::scale_factor, IMG::start, IMG::status, STATUS_FAULT, STATUS_INVALIDMATLIST, STATUS_MISSINGMATRIX, STATUS_NOFILE, STATUS_NOMAINHEADER, STATUS_NOMATLIST, STATUS_NOMATRIX, STATUS_NOMEMORY, STATUS_NOSUBHEADER, STATUS_OK, MatDir::strtblk, SUN_I2, SUN_I4, VAX_I2, VAX_I4, and VAX_R4.
Referenced by imgReadEcat63FirstFrame(), and imgReadFrame().
int imgReadEcat63Header | ( | const char * | fname, |
IMG * | img | ||
) |
Fill IMG struct header information from an image or sinogram file in ECAT 6.3 format. Information concerning separate frames or planes is not filled. Please note: ECAT 6.3 files do not have a magic number, therefore, do not use this function to determine if your file is in this format, at least test all other possible formats before calling this.
fname | image or sinogram filename |
img | pointer to initialized IMG structure |
Definition at line 1289 of file img_e63.c.
References IMG::_dataType, IMG::_fileFormat, ATTN_DATA, ecat63_imageheader::data_type, ecat63_scanheader::data_type, ecat63_normheader::data_type, ecat63_attnheader::data_type, ecat63_imageheader::decay_corr_fctr, IMG::decayCorrected, ecat63_imageheader::dimension_1, ecat63_scanheader::dimension_1, ecat63_normheader::dimension_1, ecat63_attnheader::dimension_1, ecat63_imageheader::dimension_2, ecat63_scanheader::dimension_2, ecat63_normheader::dimension_2, ecat63_attnheader::dimension_2, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, ecat63DeleteLateFrames(), ecat63EmptyMatlist(), ecat63GatherMatlist(), ecat63GetMatrixBlockSize(), ecat63GetPlaneAndFrameNr(), ecat63InitMatlist(), ecat63ReadAttnheader(), ecat63ReadImageheader(), ecat63ReadMainheader(), ecat63ReadMatlist(), ecat63ReadNormheader(), ecat63ReadScanheader(), ecat63SortMatlistByPlane(), ecat63_mainheader::file_type, IMAGE_DATA, IMG_STATUS_INITIALIZED, IMG_TEST, IMG_TYPE_RAW, IMG_UNKNOWN, imgEcat63Supported(), imgGetEcat63Fileformat(), imgGetEcat63MHeader(), imgSetStatus(), imgUnitFromEcat(), MATRIXLIST::matdir, MATRIXLIST::matrixNr, NORM_DATA, ecat63_mainheader::num_frames, ecat63_imageheader::pixel_size, ecat63_imageheader::quant_units, RAW_DATA, ecat63_imageheader::recon_scale, ecat63_scanheader::sample_distance, IMG::sampleDistance, IMG::sizex, IMG::sizey, IMG::sizez, ecat63_imageheader::slice_width, IMG::status, STATUS_FAULT, STATUS_INVALIDMATLIST, STATUS_NOFILE, STATUS_NOMAINHEADER, STATUS_NOMATLIST, STATUS_NOSUBHEADER, STATUS_OK, STATUS_UNSUPPORTED, MatDir::strtblk, IMG::type, IMG::unit, VAX_I2, VAX_I4, VAX_R4, and IMG::zoom.
Referenced by imgReadEcat63FirstFrame(), imgReadHeader(), and imgWriteEcat63Frame().
void imgSetEcat63MHeader | ( | IMG * | img, |
ECAT63_mainheader * | h | ||
) |
Copy information from IMG struct into ECAT 6.3 main header
img | source image structure |
h | target Ecat 6.3 main header |
Definition at line 1208 of file img_e63.c.
References ecat63_mainheader::axial_fov, IMG::axialFOV, ecat63_mainheader::calibration_factor, ecat63_mainheader::calibration_units, ecat63_mainheader::data_type, IMG::dimt, IMG::dimz, ECAT63_SYSTEM_TYPE_DEFAULT, ecat63_mainheader::file_type, IMAGE_DATA, IMG_TYPE_IMAGE, imgIsotope(), imgUnitToEcat6(), ecat63_mainheader::isotope_code, ecat63_mainheader::isotope_halflife, IMG::isotopeHalflife, ecat63_mainheader::num_bed_pos, ecat63_mainheader::num_frames, ecat63_mainheader::num_gates, ecat63_mainheader::num_planes, ecat63_mainheader::patient_id, ecat63_mainheader::patient_name, IMG::patientID, IMG::patientName, ecat63_mainheader::plane_separation, ecat63_mainheader::radiopharmaceutical, IMG::radiopharmaceutical, RAW_DATA, ecat63_mainheader::scan_start_day, ecat63_mainheader::scan_start_hour, ecat63_mainheader::scan_start_minute, ecat63_mainheader::scan_start_month, ecat63_mainheader::scan_start_second, ecat63_mainheader::scan_start_year, IMG::scanner, IMG::scanStart, IMG::sizez, ecat63_mainheader::study_description, ecat63_mainheader::study_name, IMG::studyDescription, IMG::studyNr, ecat63_mainheader::sw_version, ecat63_mainheader::system_type, ecat63_mainheader::transaxial_fov, IMG::transaxialFOV, IMG::type, ecat63_mainheader::user_process_code, IMG::userProcessCode, and VAX_I2.
Referenced by imgWriteEcat63Frame().
void imgSetEcat63SHeader | ( | IMG * | img, |
void * | h | ||
) |
Copies Ecat6.3 sub header information
img | source image stucture |
h | target sub header stucture |
Definition at line 1790 of file img_e63.c.
References ecat63_imageheader::data_type, ecat63_scanheader::data_type, ecat63_imageheader::decay_corr_fctr, ecat63_imageheader::dimension_1, ecat63_scanheader::dimension_1, ecat63_imageheader::dimension_2, ecat63_scanheader::dimension_2, IMG::dimx, IMG::dimy, ecat63_imageheader::ecat_calibration_fctr, ecat63_imageheader::frame_duration, ecat63_scanheader::frame_duration, ecat63_scanheader::frame_duration_sec, ecat63_imageheader::frame_start_time, ecat63_scanheader::frame_start_time, IMG_TYPE_RAW, imgUnitToEcat6(), ecat63_imageheader::loss_corr_fctr, ecat63_scanheader::loss_correction_fctr, ecat63_imageheader::num_dimensions, ecat63_imageheader::pixel_size, ecat63_imageheader::plane_eff_corr_fctr, ecat63_imageheader::quant_scale, ecat63_imageheader::quant_units, ecat63_imageheader::recon_scale, ecat63_scanheader::scale_factor, IMG::sizex, IMG::sizez, ecat63_imageheader::slice_width, IMG::type, VAX_I2, ecat63_imageheader::well_counter_cal_fctr, and IMG::zoom.
Referenced by imgWriteEcat63Frame().
int imgWriteEcat63Frame | ( | const char * | fname, |
int | frame_to_write, | ||
IMG * | img, | ||
int | frame_index | ||
) |
Write one PET frame from IMG data struct into ECAT 6.3 image or sinogram file; format is specified in IMG struct. This function can be called repeatedly to write all frames one at a time to conserve memory. However, file with just mainheader and matrix list without any previous frame is not accepted.
fname | name of file where IMG contents will be written. If file does not exist, it is created. Make sure to delete existing file, unless you want to add data |
frame_to_write | PET frame number (1..frameNr) which will be written: If set to 0, frame data will be written to an existing or new PET file as a new frame, never overwriting existing data. If >0, then frame data is written as specified frame number, overwriting any data existing with the same frame number |
img | pointer to the IMG data struct |
frame_index | IMG frame index (0..dimt-1) which will be written |
Definition at line 1656 of file img_e63.c.
References IMG::_fileFormat, ecat63_imageheader::decay_corr_fctr, IMG::decayCorrected, IMG::decayCorrFactor, ecat63_scanheader::delayed, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, ECAT63_TEST, ecat63Create(), ecat63PrintMainheader(), ecat63ReadMainheader(), ecat63WriteImageMatrix(), ecat63WriteMainheader(), ecat63WriteScanMatrix(), IMG::end, ecat63_imageheader::frame_duration, ecat63_scanheader::frame_duration, ecat63_imageheader::frame_start_time, ecat63_scanheader::frame_start_time, IMG_E63, IMG_STATUS_OCCUPIED, IMG_TEST, IMG_TYPE_IMAGE, IMG_TYPE_RAW, imgEmpty(), imgInit(), imgReadEcat63Header(), imgSetEcat63MHeader(), imgSetEcat63SHeader(), IMG::m, mat_numcod(), ecat63_mainheader::num_frames, IMG::planeNumber, ecat63_scanheader::prompts, IMG::prompts, IMG::randoms, IMG::start, IMG::status, STATUS_DISKFULL, STATUS_FAULT, STATUS_NOMAINHEADER, STATUS_NOMEMORY, STATUS_NOWRITEPERM, STATUS_OK, STATUS_VARMATSIZE, STATUS_WRONGFILETYPE, and IMG::type.
Referenced by imgWriteFrame().