#include <stdio.h>#include <stdlib.h>#include <math.h>#include <ctype.h>#include <string.h>#include <unistd.h>#include <time.h>#include "swap.h"#include "include/ecat63.h"
Go to the source code of this file.
Functions | |
| int | ecat63ReadMainheader (FILE *fp, ECAT63_mainheader *h) |
| int | ecat63ReadImageheader (FILE *fp, int blk, ECAT63_imageheader *h) |
| int | ecat63ReadAttnheader (FILE *fp, int blk, ECAT63_attnheader *h) |
| int | ecat63ReadScanheader (FILE *fp, int blk, ECAT63_scanheader *h) |
| int | ecat63ReadNormheader (FILE *fp, int blk, ECAT63_normheader *h) |
| int | ecat63ReadMatdata (FILE *fp, int strtblk, int blkNr, char *data, int dtype) |
| int | ecat63ReadImageMatrix (FILE *fp, int first_block, int last_block, ECAT63_imageheader *h, float **fdata) |
| int | ecat63ReadScanMatrix (FILE *fp, int first_block, int last_block, ECAT63_scanheader *h, float **fdata) |
| float | ecat63rFloat (void *bufi, int isvax, int islittle) |
| int | ecat63rInt (void *bufi, int isvax, int islittle) |
| int | ecat63pxlbytes (short int data_type) |
| int ecat63pxlbytes | ( | short int | data_type | ) |
Returns the nr of bytes required for storage of one pixel of specified data_type
| data_type | data type code |
Definition at line 711 of file ecat63r.c.
References BYTE_TYPE, IEEE_R4, SUN_I2, SUN_I4, VAX_I2, VAX_I4, and VAX_R4.
Referenced by ecat63WriteImageMatrix(), and ecat63WriteScanMatrix().
| int ecat63ReadAttnheader | ( | FILE * | fp, |
| int | blk, | ||
| ECAT63_attnheader * | h | ||
| ) |
Read ECAT 6.3 attenuation header
| fp | file pointer |
| blk | block number [2..number of blocks] |
| h | Ecat 6.3 attenuation header |
Definition at line 238 of file ecat63r.c.
References ecat63_attnheader::attenuation_coeff, ecat63_attnheader::attenuation_type, BYTE_TYPE, ecat63_attnheader::data_type, ecat63_attnheader::dimension_1, ecat63_attnheader::dimension_2, ECAT63_TEST, ecat63rFloat(), MatBLKSIZE, ecat63_attnheader::sample_distance, ecat63_attnheader::scale_factor, SUN_I4, ecat63_attnheader::tilt_angle, ecat63_attnheader::x_origin, ecat63_attnheader::x_radius, ecat63_attnheader::y_origin, and ecat63_attnheader::y_radius.
Referenced by ecat63ReadAllToImg(), ecat63ReadPlaneToImg(), ecat6PrintSubheader(), imgReadEcat63Frame(), and imgReadEcat63Header().

| int ecat63ReadImageheader | ( | FILE * | fp, |
| int | blk, | ||
| ECAT63_imageheader * | h | ||
| ) |
Read ECAT 6.3 image header
| fp | file pointer |
| blk | block number [2..number of blocks] |
| h | Ecat 6.3 image header |
Definition at line 152 of file ecat63r.c.
References ecat63_imageheader::annotation, ecat63_imageheader::atten_cor_mat_num, BYTE_TYPE, ecat63_imageheader::data_type, ecat63_imageheader::decay_corr_fctr, ecat63_imageheader::dimension_1, ecat63_imageheader::dimension_2, ECAT63_TEST, ecat63rFloat(), ecat63rInt(), ecat63_imageheader::ecat_calibration_fctr, ecat63_imageheader::fill1, ecat63_imageheader::fill2, ecat63_imageheader::filter_code, ecat63_imageheader::filter_params, ecat63_imageheader::frame_duration, ecat63_imageheader::frame_start_time, ecat63_imageheader::image_max, ecat63_imageheader::image_min, ecat63_imageheader::image_rotation, ecat63_imageheader::intrinsic_tilt, ecat63_imageheader::loss_corr_fctr, MatBLKSIZE, ecat63_imageheader::norm_matrix_num, ecat63_imageheader::num_dimensions, ecat63_imageheader::pixel_size, ecat63_imageheader::plane_eff_corr_fctr, ecat63_imageheader::processing_code, ecat63_imageheader::quant_scale, ecat63_imageheader::quant_units, ecat63_imageheader::recon_duration, ecat63_imageheader::recon_scale, ecat63_imageheader::recon_start_day, ecat63_imageheader::recon_start_hour, ecat63_imageheader::recon_start_min, ecat63_imageheader::recon_start_month, ecat63_imageheader::recon_start_sec, ecat63_imageheader::recon_start_year, ecat63_imageheader::scan_matrix_num, ecat63_imageheader::slice_location, ecat63_imageheader::slice_width, SUN_I4, ecat63_imageheader::well_counter_cal_fctr, ecat63_imageheader::x_origin, and ecat63_imageheader::y_origin.
Referenced by ecat63ReadAllToImg(), ecat63ReadImageMatrix(), ecat63ReadPlaneToImg(), ecat6PrintSubheader(), imgReadEcat63Frame(), and imgReadEcat63Header().

| int ecat63ReadImageMatrix | ( | FILE * | fp, |
| int | first_block, | ||
| int | last_block, | ||
| ECAT63_imageheader * | h, | ||
| float ** | fdata | ||
| ) |
Read ECAT63 image matrix header and data. If only header is to be read, set last_block=first_block. Note: data is not calibrated with factor in main header.
| fp | ECAT file pointer |
| first_block | Subheader record number |
| last_block | Last data block number |
| h | Ptr to subheader data which is filled |
| fdata | Ptr to the address of the matrix data |
Definition at line 494 of file ecat63r.c.
References BYTE_TYPE, ecat63_imageheader::data_type, ecat63_imageheader::dimension_1, ecat63_imageheader::dimension_2, ECAT63_TEST, ecat63errmsg, ecat63PrintImageheader(), ecat63ReadImageheader(), ecat63ReadMatdata(), ecat63_imageheader::ecat_calibration_fctr, IEEE_R4, MatBLKSIZE, MatFirstDirBlk, ecat63_imageheader::quant_scale, SUN_I2, SUN_I4, VAX_I2, VAX_I4, and VAX_R4.

| int ecat63ReadMainheader | ( | FILE * | fp, |
| ECAT63_mainheader * | h | ||
| ) |
Read ECAT 6.3 main header
| fp | file pointer |
| h | target Ecat 6.3 main header struture |
Definition at line 50 of file ecat63r.c.
References ecat63_mainheader::acquisition_type, ATTN_DATA, ecat63_mainheader::axial_fov, ecat63_mainheader::axial_samp_mode, ecat63_mainheader::bed_elevation, ecat63_mainheader::bed_offset, ecat63_mainheader::bed_type, BYTE_TYPE, ecat63_mainheader::calibration_factor, ecat63_mainheader::calibration_units, ecat63_mainheader::coin_samp_mode, ecat63_mainheader::collimator, ecat63_mainheader::compression_code, ecat63_mainheader::data_type, ECAT63_TEST, ecat63rFloat(), ecat63_mainheader::ecat_format, ecat63_mainheader::facility_name, ecat63_mainheader::file_type, ecat63_mainheader::fill1, ecat63_mainheader::fill2, ecat63_mainheader::gantry_rotation, ecat63_mainheader::gantry_tilt, IMAGE_DATA, ecat63_mainheader::init_bed_position, ecat63_mainheader::isotope_code, ecat63_mainheader::isotope_halflife, ecat63_mainheader::lwr_sctr_thres, ecat63_mainheader::lwr_true_thres, MatBLKSIZE, ecat63_mainheader::node_id, NORM_DATA, ecat63_mainheader::num_bed_pos, ecat63_mainheader::num_frames, ecat63_mainheader::num_gates, ecat63_mainheader::num_planes, ecat63_mainheader::operator_name, ecat63_mainheader::original_file_name, ecat63_mainheader::patient_age, ecat63_mainheader::patient_dexterity, ecat63_mainheader::patient_height, ecat63_mainheader::patient_id, ecat63_mainheader::patient_name, ecat63_mainheader::patient_sex, ecat63_mainheader::patient_weight, ecat63_mainheader::physician_name, ecat63_mainheader::plane_separation, ecat63_mainheader::radiopharmaceutical, RAW_DATA, ecat63_mainheader::rot_source_speed, 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, ecat63_mainheader::septa_type, ecat63_mainheader::study_description, ecat63_mainheader::study_name, SUN_I4, ecat63_mainheader::sw_version, ecat63_mainheader::system_type, ecat63_mainheader::transaxial_fov, ecat63_mainheader::transaxial_samp_mode, ecat63_mainheader::transm_source_type, ecat63_mainheader::upr_true_thres, ecat63_mainheader::user_process_code, and ecat63_mainheader::wobble_speed.
Referenced by ecat63AddImg(), ecat63ReadAllToImg(), ecat63ReadPlaneToImg(), imgRead(), imgReadEcat63Frame(), imgReadEcat63Header(), and imgWriteEcat63Frame().

| int ecat63ReadMatdata | ( | FILE * | fp, |
| int | strtblk, | ||
| int | blkNr, | ||
| char * | data, | ||
| int | dtype | ||
| ) |
Read ECAT 6.3 matrix data and convert byte order if necessary Remember to allocate memory for full blocks! There are differences here when compared to ecat7.c
| fp | file pointer from where data is read |
| strtblk | starting block [>= 1] |
| blkNr | number of block to be read [>= 0] |
| data | pointer to block where data is read |
| dtype | data type code |
Definition at line 432 of file ecat63r.c.
References BYTE_TYPE, ECAT63_TEST, ecat63rFloat(), ecat63rInt(), IEEE_R4, MatBLKSIZE, SUN_I2, SUN_I4, VAX_I2, VAX_I4, and VAX_R4.
Referenced by ecat63ReadAllToImg(), ecat63ReadImageMatrix(), ecat63ReadPlaneToImg(), ecat63ReadScanMatrix(), and imgReadEcat63Frame().

| int ecat63ReadNormheader | ( | FILE * | fp, |
| int | blk, | ||
| ECAT63_normheader * | h | ||
| ) |
Read ECAT 6.3 normalization header
| fp | file pointer |
| blk | block number [2..number of blocks] |
| h | Ecat 6.3 normalization header |
Definition at line 375 of file ecat63r.c.
References BYTE_TYPE, ecat63_normheader::data_type, ecat63_normheader::dimension_1, ecat63_normheader::dimension_2, ECAT63_TEST, ecat63rFloat(), ecat63_normheader::fov_source_width, MatBLKSIZE, ecat63_normheader::norm_day, ecat63_normheader::norm_hour, ecat63_normheader::norm_minute, ecat63_normheader::norm_month, ecat63_normheader::norm_second, ecat63_normheader::norm_year, ecat63_normheader::scale_factor, and SUN_I4.
Referenced by ecat63ReadAllToImg(), ecat63ReadPlaneToImg(), ecat6PrintSubheader(), imgReadEcat63Frame(), and imgReadEcat63Header().

| int ecat63ReadScanheader | ( | FILE * | fp, |
| int | blk, | ||
| ECAT63_scanheader * | h | ||
| ) |
Read ECAT 6.3 scan header
| fp | file pointer |
| blk | block number [2..number of blocks] |
| h | Ecat 6.3 scan header |
Definition at line 296 of file ecat63r.c.
References BYTE_TYPE, ecat63_scanheader::cor_singles, ecat63_scanheader::data_type, ecat63_scanheader::delayed, ecat63_scanheader::dimension_1, ecat63_scanheader::dimension_2, ECAT63_TEST, ecat63rFloat(), ecat63rInt(), ecat63_scanheader::fill1, ecat63_scanheader::fill2, ecat63_scanheader::frame_duration, ecat63_scanheader::frame_duration_sec, ecat63_scanheader::frame_start_time, ecat63_scanheader::gate_duration, ecat63_scanheader::isotope_halflife, ecat63_scanheader::loss_correction_fctr, MatBLKSIZE, ecat63_scanheader::multiples, ecat63_scanheader::net_trues, ecat63_scanheader::processing_code, ecat63_scanheader::prompts, ecat63_scanheader::r_wave_offset, ecat63_scanheader::sample_distance, ecat63_scanheader::scale_factor, ecat63_scanheader::scan_max, ecat63_scanheader::scan_min, ecat63_scanheader::smoothing, SUN_I4, ecat63_scanheader::tot_avg_cor, ecat63_scanheader::tot_avg_uncor, ecat63_scanheader::total_coin_rate, and ecat63_scanheader::uncor_singles.
Referenced by ecat63ReadAllToImg(), ecat63ReadPlaneToImg(), ecat63ReadScanMatrix(), ecat6PrintSubheader(), imgReadEcat63Frame(), and imgReadEcat63Header().

| int ecat63ReadScanMatrix | ( | FILE * | fp, |
| int | first_block, | ||
| int | last_block, | ||
| ECAT63_scanheader * | h, | ||
| float ** | fdata | ||
| ) |
Read ECAT63 scan matrix header and data. If only header is to be read, set last_block=first_block. Note: data is not calibrated with factor in main header.
| fp | ECAT file pointer |
| first_block | Subheader record number |
| last_block | Last data block number |
| h | Ptr to subheader data which is filled |
| fdata | Ptr to the address of the matrix data |
Definition at line 586 of file ecat63r.c.
References BYTE_TYPE, ecat63_scanheader::data_type, ecat63_scanheader::dimension_1, ecat63_scanheader::dimension_2, ECAT63_TEST, ecat63errmsg, ecat63PrintScanheader(), ecat63ReadMatdata(), ecat63ReadScanheader(), IEEE_R4, MatBLKSIZE, MatFirstDirBlk, ecat63_scanheader::scale_factor, SUN_I2, SUN_I4, VAX_I2, VAX_I4, and VAX_R4.

| float ecat63rFloat | ( | void * | bufi, |
| int | isvax, | ||
| int | islittle | ||
| ) |
Reading ECAT 6.3 floats
| bufi | pointer to 32-bit long data block |
| isvax | 1 for VAX format |
| islittle | 1 for little endian |
Definition at line 671 of file ecat63r.c.
Referenced by ecat63ReadAttnheader(), ecat63ReadImageheader(), ecat63ReadMainheader(), ecat63ReadMatdata(), ecat63ReadNormheader(), and ecat63ReadScanheader().
| int ecat63rInt | ( | void * | bufi, |
| int | isvax, | ||
| int | islittle | ||
| ) |
Reading and writing ECAT 6.3 32-bit ints. 32-bit int format is same in VAX and i386
| bufi | pointer to 32-bit long data block |
| isvax | 1 for VAX format |
| islittle | 1 for littel endian |
Definition at line 694 of file ecat63r.c.
Referenced by ecat63ReadImageheader(), ecat63ReadMatdata(), and ecat63ReadScanheader().
1.8.11