Data Structures | Macros | Enumerations | Functions | Variables
img.h File Reference
#include "studynr.h"
Include dependency graph for img.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  IMG_PIXEL
 
struct  IMG_RANGE
 
struct  IMG
 

Macros

#define IMG_STATUS_UNINITIALIZED   0
 
#define IMG_STATUS_INITIALIZED   1
 
#define IMG_STATUS_OCCUPIED   2
 
#define IMG_STATUS_ERROR   3
 
#define IMG_ERR_OK   0
 
#define IMG_ERR_CALLING   1
 
#define IMG_ERR_OOM   2
 
#define IMG_TYPE_IMAGE   1
 
#define IMG_TYPE_RAW   2
 
#define IMG_TYPE_POLARMAP   3
 
#define IMG_UNKNOWN   0
 
#define IMG_E63   1
 
#define IMG_E7   2
 
#define IMG_E7_2D   3
 
#define IMG_POLARMAP   9
 
#define IMG_ANA   11
 
#define IMG_ANA_L   12 /* little endian variant */
 
#define IMG_INTERFILE   21
 
#define IMG_NIFTI_1D   31 /* dual file format */
 
#define IMG_NIFTI_1S   32 /* single file format */
 
#define IMG_MICROPET   41
 
#define SCANNER_UNKNOWN   0
 
#define SCANNER_ECAT931   12
 
#define SCANNER_ADVANCE   12096
 
#define SCANNER_HRPLUS   3
 
#define SCANNER_HRRT   4
 
#define SCANNER_MRI   5
 
#define SCANNER_STEVCT_PET   6
 
#define SCANNER_STEVCT_CT   7
 
#define SCANNER_PRIMATE   2000
 
#define SCANNER_RODENT   2001
 
#define SCANNER_MICROPET2   2002
 
#define SCANNER_FOCUS_220   2500
 
#define SCANNER_FOCUS_120   2501
 
#define SCANNER_INVEON_DEDICATED_PET   5000
 
#define SCANNER_INVEON_MM_PET   5500
 
#define SCANNER_MR_PET_HEAD_INSERT   6000
 
#define SCANNER_TUEBINGEN_PET_MR   8000
 
#define MAX_POLARMAP_NUM_RINGS   32
 

Enumerations

enum  {
  STATUS_OK, STATUS_FAULT, STATUS_NOMEMORY, STATUS_NOFILE,
  STATUS_UNKNOWNFORMAT, STATUS_UNSUPPORTED, STATUS_MISSINGMATRIX, STATUS_NOWRITEPERM,
  STATUS_DISKFULL, STATUS_NOMATLIST, STATUS_INVALIDMATLIST, STATUS_VARMATSIZE,
  STATUS_NOMAINHEADER, STATUS_NOSUBHEADER, STATUS_NOMATRIX, STATUS_UNSUPPORTEDAXIALCOMP,
  STATUS_NOIMGDATAFILE, STATUS_NOHEADERFILE, STATUS_INVALIDHEADER, STATUS_NOIMGDATA,
  STATUS_NOSIFDATA, STATUS_WRONGSIFDATA, STATUS_CANTWRITEIMGFILE, STATUS_CANTWRITEHEADERFILE,
  STATUS_WRONGFILETYPE, STATUS_CANNOTERASE, STATUS_CANNOTREAD, STATUS_CANNOTWRITE,
  STATUS_UNSUPPORTEDPOLARMAP, STATUS_INVALIDPOLARMAP
}
 

Functions

void imgInit (IMG *image)
 
void imgEmpty (IMG *image)
 
int imgAllocate (IMG *image, int planes, int rows, int columns, int frames)
 
int imgAllocateWithHeader (IMG *image, int planes, int rows, int columns, int frames, IMG *image_from)
 
char * imgStatus (int status_index)
 
void imgSetStatus (IMG *img, int status_index)
 
void imgInfo (IMG *image)
 
int imgCopyhdr (IMG *image1, IMG *image2)
 
int imgExtractRange (IMG *img1, IMG_RANGE r, IMG *img2)
 

Variables

int IMG_TEST
 

Macro Definition Documentation

#define IMG_ANA   11
#define IMG_ANA_L   12 /* little endian variant */
#define IMG_E63   1
#define IMG_E7   2
#define IMG_E7_2D   3
#define IMG_ERR_CALLING   1

Definition at line 77 of file img.h.

#define IMG_ERR_OK   0

Definitions for img error status message

Definition at line 76 of file img.h.

#define IMG_ERR_OOM   2

Definition at line 78 of file img.h.

#define IMG_INTERFILE   21

Definition at line 91 of file img.h.

#define IMG_MICROPET   41

Definition at line 94 of file img.h.

#define IMG_NIFTI_1D   31 /* dual file format */

Definition at line 92 of file img.h.

#define IMG_NIFTI_1S   32 /* single file format */

Definition at line 93 of file img.h.

#define IMG_POLARMAP   9
#define IMG_STATUS_ERROR   3

Definition at line 74 of file img.h.

Referenced by imgInfo(), svolInfo(), and volInfo().

#define IMG_STATUS_INITIALIZED   1
#define IMG_STATUS_OCCUPIED   2
#define IMG_STATUS_UNINITIALIZED   0

Definitions for img status

Definition at line 71 of file img.h.

Referenced by ecat63ReadPlaneToImg(), img2svol(), img2vol(), imgAllocate(), imgExtractRange(), imgInfo(), svolAllocate(), svolInfo(), volAllocate(), and volInfo().

#define IMG_TYPE_IMAGE   1
#define IMG_TYPE_POLARMAP   3
#define IMG_TYPE_RAW   2
#define IMG_UNKNOWN   0
#define MAX_POLARMAP_NUM_RINGS   32

Maximum nr of rings in polar map (based on ECAT 7 polar map header)

Definition at line 116 of file img.h.

Referenced by imgCopyhdr(), imgEmpty(), imgInit(), and imgReadEcat7Header().

#define SCANNER_ADVANCE   12096

Definition at line 98 of file img.h.

#define SCANNER_ECAT931   12

Definition at line 97 of file img.h.

#define SCANNER_FOCUS_120   2501

Definition at line 110 of file img.h.

#define SCANNER_FOCUS_220   2500

Definition at line 109 of file img.h.

#define SCANNER_HRPLUS   3

Definition at line 99 of file img.h.

#define SCANNER_HRRT   4

Definition at line 100 of file img.h.

#define SCANNER_INVEON_DEDICATED_PET   5000

Definition at line 111 of file img.h.

#define SCANNER_INVEON_MM_PET   5500

Definition at line 112 of file img.h.

#define SCANNER_MICROPET2   2002

Definition at line 108 of file img.h.

#define SCANNER_MR_PET_HEAD_INSERT   6000

Definition at line 113 of file img.h.

#define SCANNER_MRI   5

Definition at line 102 of file img.h.

#define SCANNER_PRIMATE   2000

Definition at line 106 of file img.h.

#define SCANNER_RODENT   2001

Definition at line 107 of file img.h.

#define SCANNER_STEVCT_CT   7

Definition at line 104 of file img.h.

#define SCANNER_STEVCT_PET   6

Definition at line 103 of file img.h.

#define SCANNER_TUEBINGEN_PET_MR   8000

Definition at line 114 of file img.h.

#define SCANNER_UNKNOWN   0

Definition for scanner model (system type)

Definition at line 96 of file img.h.

Enumeration Type Documentation

anonymous enum

Definitions for img status message

Enumerator
STATUS_OK 
STATUS_FAULT 
STATUS_NOMEMORY 
STATUS_NOFILE 
STATUS_UNKNOWNFORMAT 
STATUS_UNSUPPORTED 
STATUS_MISSINGMATRIX 
STATUS_NOWRITEPERM 
STATUS_DISKFULL 
STATUS_NOMATLIST 
STATUS_INVALIDMATLIST 
STATUS_VARMATSIZE 
STATUS_NOMAINHEADER 
STATUS_NOSUBHEADER 
STATUS_NOMATRIX 
STATUS_UNSUPPORTEDAXIALCOMP 
STATUS_NOIMGDATAFILE 
STATUS_NOHEADERFILE 
STATUS_INVALIDHEADER 
STATUS_NOIMGDATA 
STATUS_NOSIFDATA 
STATUS_WRONGSIFDATA 
STATUS_CANTWRITEIMGFILE 
STATUS_CANTWRITEHEADERFILE 
STATUS_WRONGFILETYPE 
STATUS_CANNOTERASE 
STATUS_CANNOTREAD 
STATUS_CANNOTWRITE 
STATUS_UNSUPPORTEDPOLARMAP 
STATUS_INVALIDPOLARMAP 

Definition at line 118 of file img.h.

Function Documentation

int imgAllocate ( IMG image,
int  planes,
int  rows,
int  columns,
int  frames 
)

Allocates memory for img data. Old contents are not saved.

Parameters
imageinitialized image
planesnumber of allcoated planes
rowsnumber of allocated rows
columnsnumber of allocated columns
framesnumber of allocated frames
Returns
0 if ok, 1 image is not initialized, 2 invalid input dimension(s), 3 failed to allocate header, 4 - 8 failed to allocate image data

Definition at line 285 of file img.c.

References IMG::_col, IMG::_header, IMG::_pln, IMG::_pxl, IMG::_row, IMG::column, IMG::decayCorrFactor, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, IMG::end, IMG_STATUS_OCCUPIED, IMG_STATUS_UNINITIALIZED, IMG_TEST, imgEmpty(), imgSetStatus(), IMG::m, IMG::mid, IMG::pixel, IMG::plane, IMG::planeNumber, IMG::prompts, IMG::randoms, IMG::row, IMG::sd, IMG::start, IMG::status, STATUS_FAULT, STATUS_NOMEMORY, STATUS_OK, and IMG::weight.

Referenced by ecat63ReadAllToImg(), ecat63ReadPlaneToImg(), imgAllocateWithHeader(), imgExtractRange(), imgMicropetCTToEcat7(), imgMicropetPETToEcat7(), imgReadAnalyze(), imgReadAnalyzeFirstFrame(), imgReadEcat63FirstFrame(), imgReadEcat7(), imgReadEcat7FirstFrame(), imgReadFrame(), test_create_img(), and test_create_polarmap().

Here is the call graph for this function:

int imgAllocateWithHeader ( IMG image,
int  planes,
int  rows,
int  columns,
int  frames,
IMG image_from 
)

This functions just combines imgAllocate() and imgCopyhdr().

Returns
Returns 0 if successful, otherwise returns <>0.
Parameters
imagePointer to IMG struct which will be allocated here
planesImage matrix dimensions; z
rowsImage matrix dimensions; y
columnsImage matrix dimensions; x
framesImage matrix dimensions; t
image_fromPointer to IMG struct where header contents will be copied from

Definition at line 357 of file img.c.

References imgAllocate(), and imgCopyhdr().

Here is the call graph for this function:

int imgCopyhdr ( IMG image1,
IMG image2 
)

Copies the header fields from one image struct to another. Does not copy memory addresses or IMG sizes. Frame times, decay correction factors etc are copied, when possible. Plane numbers are copied, when possible.

Parameters
image1Pointer to input IMG data
image2Pointer to output IMG data
Returns
0 if successful, 1 invalid input, 2 poiters are to same image

Definition at line 501 of file img.c.

References IMG::_dataType, IMG::_fileFormat, IMG::axialFOV, IMG::decayCorrected, IMG::decayCorrFactor, IMG::dimt, IMG::dimz, IMG::end, IMG::gapx, IMG::gapy, IMG::gapz, IMG_TEST, IMG::isotopeHalflife, IMG::isWeight, MAX_POLARMAP_NUM_RINGS, IMG::mid, IMG::orientation, IMG::patientID, IMG::patientName, IMG::planeNumber, IMG::polarmap_num_rings, IMG::polarmap_ring_angle, IMG::polarmap_ring_position, IMG::polarmap_sectors_per_ring, IMG::polarmap_start_angle, IMG::prompts, IMG::radiopharmaceutical, IMG::randoms, IMG::resolutionx, IMG::resolutiony, IMG::resolutionz, IMG::sampleDistance, IMG::scanner, IMG::scanStart, IMG::sd, IMG::sizex, IMG::sizey, IMG::sizez, IMG::start, IMG::studyDescription, IMG::studyNr, IMG::transaxialFOV, IMG::type, IMG::unit, IMG::userProcessCode, IMG::weight, and IMG::zoom.

Referenced by imgAllocateWithHeader(), and imgExtractRange().

void imgEmpty ( IMG image)
int imgExtractRange ( IMG img1,
IMG_RANGE  r,
IMG img2 
)

Extract a smaller 4D image from inside an IMG. Any existing data is overwritten.

Parameters
img1source image structure, 'occupied' (has allocated data)
rimage range structure
img2target image structure 'initialized' (has not allocated data)
Returns
0 if ok, 1 invalid input, 2 failed to allocate memory for target image

Definition at line 570 of file img.c.

References IMG::decayCorrFactor, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, IMG::end, IMG_RANGE::f1, IMG_RANGE::f2, IMG_STATUS_OCCUPIED, IMG_STATUS_UNINITIALIZED, IMG_TEST, imgAllocate(), imgCopyhdr(), imgEmpty(), imgSetStatus(), IMG::m, IMG::mid, IMG::planeNumber, IMG::prompts, IMG::randoms, IMG::sd, IMG::start, IMG::status, STATUS_FAULT, STATUS_NOMEMORY, STATUS_OK, IMG::weight, IMG_RANGE::x1, IMG_RANGE::x2, IMG_RANGE::y1, IMG_RANGE::y2, IMG_RANGE::z1, and IMG_RANGE::z2.

Here is the call graph for this function:

void imgInfo ( IMG image)
void imgInit ( IMG image)
void imgSetStatus ( IMG img,
int  status_index 
)
char* imgStatus ( int  status_index)

Return pointer to string describing the image error status message

Parameters
status_indexindex of img_status_string
Returns
pointer to string

Definition at line 384 of file img.c.

References imgmsg, and STATUS_FAULT.

Referenced by imgRead().

Variable Documentation

int IMG_TEST