libtpcimgio
 All Data Structures Files Functions Variables Typedefs Enumerator Macros Pages
Macros | Functions | Variables
libtpcimgio.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#include "libtpcmisc.h"
#include "include/imgio.h"

Go to the source code of this file.

Macros

#define LIB_NAME   "libtpcimgio"
 
#define ALLTESTS   0
 
#define IMG_IO   1
 
#define POLARMAP_IO   2
 
#define MODULE   100
 
#define MAXVAL   100000;
 
#define TEST_WITH_FILENAME(filename, desired_length, error_value)
 
#define TEST_WITH_FORMAT(filename, desired_format, error_value)
 

Functions

int test_create_img (IMG *img, int dim_x, int dim_y, int dim_z, int dim_t)
 
int test_polarmap ()
 
int test_create_polarmap (IMG *img, int num_rings, int *sectors_per_ring, float *ring_position, short int *ring_angle, short int start_angle)
 
int test_img_io (IMG *img)
 
int test_polarmap_io (IMG *img)
 
int test_modules (IMG *img)
 
void print_usage ()
 
int main (int argc, char *argv[])
 

Variables

int VERBOSE = 0
 

Macro Definition Documentation

#define ALLTESTS   0

Serial numbers for function names.

Definition at line 43 of file libtpcimgio.c.

Referenced by main().

#define IMG_IO   1

Definition at line 44 of file libtpcimgio.c.

Referenced by main().

#define LIB_NAME   "libtpcimgio"

Library name.

Definition at line 30 of file libtpcimgio.c.

Referenced by print_usage().

#define MAXVAL   100000;

Definition at line 48 of file libtpcimgio.c.

#define MODULE   100

Definition at line 46 of file libtpcimgio.c.

Referenced by main().

#define POLARMAP_IO   2

Definition at line 45 of file libtpcimgio.c.

Referenced by main().

#define TEST_WITH_FILENAME (   filename,
  desired_length,
  error_value 
)
Value:
sprintf(test_str,filename); \
anaRemoveFNameExtension(test_str); \
i = 0; \
while(test_str[i] != 0) i++; \
if(i != desired_length) return(error_value); \
memset(test_str,0,256); \
\

Referenced by test_modules().

#define TEST_WITH_FORMAT (   filename,
  desired_format,
  error_value 
)
Value:
img->_fileFormat = IMG_UNKNOWN; \
sprintf(test_str,filename); \
imgFormatFromFName(img, test_str); \
if(img->_fileFormat != desired_format) return(error_value); \
memset(test_str,0,256); \
\

Referenced by test_modules().

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Main function. For retrieval of library information and for testing.

Parameters
argcnumber of arguments
argvarray of pointers to string arguments
Returns
0 in case of successfull execution

Definition at line 80 of file libtpcimgio.c.

References ALLTESTS, IMG_IO, imgEmpty(), imgInit(), libtpcimgio_print_build(), libtpcimgio_print_dhistory(), libtpcimgio_print_dreadme(), libtpcimgio_print_history(), libtpcimgio_print_readme(), MODULE, POLARMAP_IO, print_usage(), test_create_img(), test_img_io(), test_modules(), test_polarmap(), and VERBOSE.

void print_usage ( )

Function for printing the usage information of the test program.

Function for printing the usage information of the library test program.

Definition at line 582 of file libtpcimgio.c.

References LIB_NAME, and libtpcimgio_print_build().

Referenced by main().

int test_create_img ( IMG img,
int  dim_x,
int  dim_y,
int  dim_z,
int  dim_t 
)

Create IMG for testing purposis.

Parameters
imgPointer to an initiated but not allocated IMG
dim_xX dimension (nr of columns)
dim_yY dimension (nr of rows)
dim_zZ dimension (nr of planes)
dim_ttime dimension (nr of time frames, or gates)
Returns
0 if IMG could be created, or nonzero in case of error.

Definition at line 184 of file libtpcimgio.c.

References IMG::decayCorrection, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, IMG::end, IMG_DC_CORRECTED, IMG_STATUS_INITIALIZED, IMG_TYPE_IMAGE, imgAllocate(), imgSetDecayCorrFactors(), IMG::isotopeHalflife, IMG::m, IMG::mid, IMG::planeNumber, IMG::scanStart, IMG::start, IMG::status, IMG::type, and IMG::unit.

Referenced by main().

int test_create_polarmap ( IMG img,
int  num_rings,
int *  sectors_per_ring,
float *  ring_position,
short int *  ring_angle,
short int  start_angle 
)

Create POLARMAP IMG for testing purposis.

Parameters
imgPointer to an initiated but not allocated IMG
num_ringsNumber of polar map rings
sectors_per_ringSectors per ring
ring_positionRing positions
ring_angleRing angles
start_anglePolar map start angle for rings, as defined in ECAT 7 header
Returns
0 if IMG could be created, or nonzero in case of error.

Definition at line 234 of file libtpcimgio.c.

References IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, IMG::end, IMG_STATUS_INITIALIZED, IMG_TYPE_POLARMAP, imgAllocate(), IMG::m, IMG::mid, IMG::polarmap_num_rings, IMG::polarmap_ring_angle, IMG::polarmap_ring_position, IMG::polarmap_sectors_per_ring, IMG::polarmap_start_angle, IMG::start, IMG::status, IMG::type, and IMG::unit.

Referenced by test_polarmap().

int test_img_io ( IMG img)

Test bench for IO functions. Tests include:
ECAT7 image write and read
ECAT7 image values write and read
ECAT6 image volume write and read
Analyze image volume write and read

Parameters
imgrelated image stucture
Returns
0 in case of success

Definition at line 283 of file libtpcimgio.c.

References IMG::_dataType, IMG::_fileFormat, ECAT7_SUNI2, IMG_ANA, IMG_ANA_L, IMG_E63, IMG_E7, IMG_E7_2D, IMG_NIFTI_1D, IMG_NIFTI_1S, IMG_TYPE_IMAGE, imgEmpty(), imgFormatDetermine(), imgInfo(), imgInit(), imgMatch(), imgRead(), imgWrite(), niftiRemove(), IMG::scanner, SCANNER_ECAT931, SCANNER_UNKNOWN, IMG::type, IMG::unit, and VERBOSE.

Referenced by main().

int test_modules ( IMG img)

Testbench for module tests.

Parameters
imgimg structure for testing
Returns
0 if ok

Definition at line 483 of file libtpcimgio.c.

References IMG::_fileFormat, IMG_ANA, IMG_E63, IMG_E7, IMG_POLARMAP, imgGetEcat7MHeader(), ecat7_mainheader::scan_start_time, IMG::scanStart, TEST_WITH_FILENAME, and TEST_WITH_FORMAT.

Referenced by main().

int test_polarmap ( )

Testbench for polar maps

Definition at line 424 of file libtpcimgio.c.

References imgEmpty(), imgInit(), test_create_polarmap(), and test_polarmap_io().

Referenced by main().

int test_polarmap_io ( IMG img)

Testbench for polar map images

Parameters
imgimg structure for testing
Returns
0 if ok

Definition at line 454 of file libtpcimgio.c.

References IMG::_fileFormat, IMG_POLARMAP, IMG_TYPE_POLARMAP, imgEmpty(), imgInit(), imgRead(), imgWrite(), and IMG::type.

Referenced by test_polarmap().

Variable Documentation

int VERBOSE = 0

Definition at line 69 of file libtpcimgio.c.

Referenced by main(), and test_img_io().