Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ecat7w.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include "include/swap.h"
#include "include/petc99.h"
#include "include/ecat7.h"

Functions

int ecat7WriteMainheader (FILE *fp, ECAT7_mainheader *h)
int ecat7WriteImageheader (FILE *fp, int blk, ECAT7_imageheader *h)
int ecat7WriteAttenheader (FILE *fp, int blk, ECAT7_attenheader *h)
int ecat7WritePolmapheader (FILE *fp, int blk, ECAT7_polmapheader *h)
int ecat7WriteNormheader (FILE *fp, int blk, ECAT7_normheader *h)
int ecat7WriteScanheader (FILE *fp, int blk, ECAT7_scanheader *h)
int ecat7Write2DScanheader (FILE *fp, int blk, ECAT7_2Dscanheader *h)
int ecat7Write2DNormheader (FILE *fp, int blk, ECAT7_2Dnormheader *h)
FILE * ecat7Create (char *fname, ECAT7_mainheader *h)
int ecat7_is_scaling_needed (float amax, float *data, int nr)
int ecat7WriteImageMatrix (FILE *fp, int matrix_id, ECAT7_imageheader *h, float *fdata)
int ecat7Write2DScanMatrix (FILE *fp, int matrix_id, ECAT7_2Dscanheader *h, float *fdata)
int ecat7WriteScanMatrix (FILE *fp, int matrix_id, ECAT7_scanheader *h, float *fdata)
int ecat7WriteMatrixdata (FILE *fp, int start_block, char *data, int pxl_nr, int pxl_size)

Function Documentation

int ecat7_is_scaling_needed float  amax,
float *  data,
int  nr
 

Check if pixel float values need to be scaled to be saved as short ints, or if they are already all very close to integers.

Returns:
Returns 1, if scaling is necessary, and 0 if not.
Parameters:
amax  Absolute maximum value
data  Float array
nr  Nr of float values

FILE* ecat7Create char *  fname,
ECAT7_mainheader h
 

Create a new ECAT 7.x file and return file pointer or NULL in case of an error. If file exists, it is renamed as fname% if possible. Directory list is written in big endian byte order.

int ecat7Write2DNormheader FILE *  fp,
int  blk,
ECAT7_2Dnormheader h
 

Write ECAT 7.x 2D normalization header

int ecat7Write2DScanheader FILE *  fp,
int  blk,
ECAT7_2Dscanheader h
 

Write ECAT 7.x 2D scan header

int ecat7Write2DScanMatrix FILE *  fp,
int  matrix_id,
ECAT7_2Dscanheader h,
float *  fdata
 

Write ECAT 7.x 2D sinogram matrix header and data

Returns:
Returns 0 if ok.

int ecat7WriteAttenheader FILE *  fp,
int  blk,
ECAT7_attenheader h
 

Write ECAT 7.x attenuation header

int ecat7WriteImageheader FILE *  fp,
int  blk,
ECAT7_imageheader h
 

Write ECAT 7.x image header

Changes data type to big endian.

Returns:
Returns 0, if ok.

int ecat7WriteImageMatrix FILE *  fp,
int  matrix_id,
ECAT7_imageheader h,
float *  fdata
 

Write ECAT 7.x image or volume matrix header and data

Returns:
Returns 0 if ok.

int ecat7WriteMainheader FILE *  fp,
ECAT7_mainheader h
 

Write ECAT 7.x main header.

Writes header always in big endian byte order.

Returns:
Returns 0, if ok.

int ecat7WriteMatrixdata FILE *  fp,
int  start_block,
char *  data,
int  pxl_nr,
int  pxl_size
 

Write ECAT 7.x matrix data to a specified file position. Data does not need to be allocated for full blocks. Data must be represented in current machines byte order, and it is always saved in big endian byte order.

Returns:
Returns >0 in case of an error.
Parameters:
fp  Pointer to an opened ECAT file
start_block  Block number where matrix data is written
data  Pointer to matrix data
pxl_nr  Number of pixels
pxl_size  Size of data for one pixel in bytes

int ecat7WriteNormheader FILE *  fp,
int  blk,
ECAT7_normheader h
 

Write ECAT 7.x 3D normalization header

int ecat7WritePolmapheader FILE *  fp,
int  blk,
ECAT7_polmapheader h
 

Write ECAT 7.x polar map header

int ecat7WriteScanheader FILE *  fp,
int  blk,
ECAT7_scanheader h
 

Write ECAT 7.x 3D scan header (512 bytes)

Changes data type to big endian.

Returns:
Returns 0, if ok.

int ecat7WriteScanMatrix FILE *  fp,
int  matrix_id,
ECAT7_scanheader h,
float *  fdata
 

Write ECAT 7.x 3D sinogram matrix header and data

Returns:
Returns 0 if ok.


Generated on Fri Jan 21 16:17:41 2005 for libPET by  doxygen 1.4.1