My Project
Data Structures | Functions | Variables
vol.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  VOL_PIXEL
 
struct  VOL_RANGE
 
struct  VOL
 
struct  SVOL
 

Functions

void volInit (VOL *vol)
 
void volEmpty (VOL *vol)
 
int volAllocate (VOL *vol, int planes, int rows, int columns)
 
int img2vol (IMG *img, VOL *vol, int frame)
 
int vol2img (VOL *vol, IMG *img, int frame)
 
void volInfo (VOL *vol, FILE *fp)
 
void volContents (VOL *vol, VOL_RANGE r, FILE *fp)
 
int volMax (VOL *vol, VOL_RANGE r, VOL_PIXEL *p, float *maxv)
 
int volAvg (VOL *vol, VOL_RANGE r, float *avg)
 
void svolInit (SVOL *svol)
 
void svolEmpty (SVOL *svol)
 
int svolAllocate (SVOL *svol, int planes, int rows, int columns)
 
int img2svol (IMG *img, SVOL *svol, int frame)
 
int svol2img (SVOL *svol, IMG *img, int frame)
 
void svolInfo (SVOL *svol, FILE *fp)
 

Variables

int VOL_TEST
 

Function Documentation

◆ img2svol()

int img2svol ( IMG img,
SVOL svol,
int  frame 
)

Copy one time frame (1..dimt) from 4D image to 3D short int volume. Svol can be but need not to be allocated.

Parameters
imgimage structure
svolshort volume structure
frameframe number [1..number of frames]
Returns
0 if ok, 1 invalid image status, 2 invalid input

Definition at line 322 of file vol.c.

References _volStatusMessage, IMG::dimx, SVOL::dimx, IMG::dimy, SVOL::dimy, IMG::dimz, SVOL::dimz, IMG_STATUS_OCCUPIED, IMG_STATUS_UNINITIALIZED, imgFrameMinMax(), IMG::m, IMG::orientation, SVOL::orientation, SVOL::scale_factor, IMG::sizex, SVOL::sizex, IMG::sizey, SVOL::sizey, IMG::sizez, SVOL::sizez, SVOL::statmsg, IMG::status, SVOL::status, svolAllocate(), SVOL::v, and VOL_TEST.

Here is the call graph for this function:

◆ img2vol()

int img2vol ( IMG img,
VOL vol,
int  frame 
)

Copy one time frame (1..dimt) from 4D image to 3D volume. Vol can be but need not to be allocated.

Parameters
imgimage structure
volvolume structure
frameframe number [1..number of frames]
Returns
0 if ok, 1 invalid image status, 2 invalid input

Definition at line 284 of file vol.c.

References _volStatusMessage, IMG::dimx, VOL::dimx, IMG::dimy, VOL::dimy, IMG::dimz, VOL::dimz, IMG_STATUS_OCCUPIED, IMG_STATUS_UNINITIALIZED, IMG::m, IMG::orientation, VOL::orientation, IMG::sizex, VOL::sizex, IMG::sizey, VOL::sizey, IMG::sizez, VOL::sizez, VOL::statmsg, IMG::status, VOL::status, VOL::v, VOL_TEST, and volAllocate().

Here is the call graph for this function:

◆ svol2img()

int svol2img ( SVOL svol,
IMG img,
int  frame 
)

Copy 3D short int volume as one time frame (1..dimt) into 4D image. Img must be allocated.

Parameters
svolshort volume structure
imgimage structure
frameframe number [1..img->dimt]
Returns
0 if ok, 1 invalid image, 2 invalid frame number, 3 (x,y) dimension inconsistency, 4 plane number inconsistency

Definition at line 401 of file vol.c.

References _volStatusMessage, IMG::dimx, SVOL::dimx, IMG::dimy, SVOL::dimy, IMG::dimz, SVOL::dimz, IMG_STATUS_OCCUPIED, IMG::m, SVOL::scale_factor, SVOL::statmsg, IMG::status, SVOL::status, SVOL::v, and VOL_TEST.

◆ svolAllocate()

int svolAllocate ( SVOL svol,
int  planes,
int  rows,
int  columns 
)

Allocate memory for 3D short int volume. Returns 0 if ok.

Parameters
svolshort volume structure
planesnumber of planes [>=1]
rowsnumber of rows [>=1]
columnsnumber of columns [>=1]
Returns
0 if ok, 1 invalid image status, 2 invalid input, 5 failed to allocate memory for planes, 6 failed to allocate memory for rows, 8 failed to allocate memory for rows

Definition at line 221 of file vol.c.

References SVOL::_col, SVOL::_pln, SVOL::_row, _volStatusMessage, SVOL::_vxl, SVOL::column, SVOL::dimx, SVOL::dimy, SVOL::dimz, IMG_STATUS_OCCUPIED, IMG_STATUS_UNINITIALIZED, SVOL::plane, SVOL::row, SVOL::statmsg, SVOL::status, svolEmpty(), SVOL::v, VOL_TEST, and SVOL::voxel.

Referenced by img2svol().

Here is the call graph for this function:

◆ svolEmpty()

void svolEmpty ( SVOL svol)

◆ svolInfo()

void svolInfo ( SVOL svol,
FILE *  fp 
)

Prints short int volume information to specified file pointer, e.g. stdout

Parameters
svolshort volume structure
fptarget file pointer

Definition at line 455 of file vol.c.

References SVOL::dimx, SVOL::dimy, SVOL::dimz, IMG_STATUS_ERROR, IMG_STATUS_INITIALIZED, IMG_STATUS_UNINITIALIZED, SVOL::orientation, SVOL::scale_factor, SVOL::sizex, SVOL::sizey, SVOL::sizez, SVOL::statmsg, SVOL::status, and VOL_TEST.

◆ svolInit()

void svolInit ( SVOL svol)

Initiate short int volume before any use of SVOL data; this should be called once.

Parameters
svolshort int volume structure

Definition at line 68 of file vol.c.

References _volStatusMessage, SVOL::column, SVOL::dimx, SVOL::dimy, SVOL::dimz, IMG_STATUS_INITIALIZED, SVOL::orientation, SVOL::plane, SVOL::row, SVOL::scale_factor, SVOL::sizex, SVOL::sizey, SVOL::sizez, SVOL::statmsg, SVOL::status, SVOL::v, VOL_TEST, and SVOL::voxel.

◆ vol2img()

int vol2img ( VOL vol,
IMG img,
int  frame 
)

Copy 3D volume as one time frame (1..dimt) into 4D image. Img must be allocated.

Parameters
volvolume structure
imgimage structure
frameframe number [1..number of frames]
Returns
0 if ok, 1 invalid image status, 2 invalid input, 3 image<->volume (x,y) dimensions do not match, 4 image<->volume planes do not match

Definition at line 367 of file vol.c.

References _volStatusMessage, IMG::dimx, VOL::dimx, IMG::dimy, VOL::dimy, IMG::dimz, VOL::dimz, IMG_STATUS_OCCUPIED, IMG::m, VOL::statmsg, IMG::status, VOL::status, VOL::v, and VOL_TEST.

◆ volAllocate()

int volAllocate ( VOL vol,
int  planes,
int  rows,
int  columns 
)

Allocate memory for 3D image volume. Returns 0 if ok.

Parameters
volvolume structure
planesnumber of planes [>=1]
rowsnumber of rows [>=1]
columnsnumber of columns [>=1]
Returns
0 if ok, 1 invalid image status, 2 invalid input, 5 failed to allocate memory for planes, 6 failed to allocate memory for rows, 8 failed to allocate memory for rows

Definition at line 156 of file vol.c.

References VOL::_col, VOL::_pln, VOL::_row, _volStatusMessage, VOL::_vxl, VOL::column, VOL::dimx, VOL::dimy, VOL::dimz, IMG_STATUS_OCCUPIED, IMG_STATUS_UNINITIALIZED, VOL::plane, VOL::row, VOL::statmsg, VOL::status, VOL::v, VOL_TEST, volEmpty(), and VOL::voxel.

Referenced by img2vol().

Here is the call graph for this function:

◆ volAvg()

int volAvg ( VOL vol,
VOL_RANGE  r,
float *  avg 
)

Calculates average voxel value inside specified volume range.

Parameters
volvolume structure
rvolume range structure
avgtarget for average value
Returns
0 if ok, 1 invalid image status, 2 inconsistent range ending, 3 inconsistent range dimensions, 4 inconsistent dimensions

Definition at line 545 of file vol.c.

References VOL::dimx, VOL::dimy, VOL::dimz, IMG_STATUS_OCCUPIED, VOL::status, VOL::v, VOL_RANGE::x1, VOL_RANGE::x2, VOL_RANGE::y1, VOL_RANGE::y2, VOL_RANGE::z1, and VOL_RANGE::z2.

◆ volContents()

void volContents ( VOL vol,
VOL_RANGE  r,
FILE *  fp 
)

Prints matrix values inside specified range to file pointer.

Parameters
volvolume structure
rvolume range structure
fptarget file pointer

Definition at line 480 of file vol.c.

References VOL::dimx, VOL::dimy, VOL::dimz, IMG_STATUS_OCCUPIED, VOL::status, VOL::v, VOL_RANGE::x1, VOL_RANGE::x2, VOL_RANGE::y1, VOL_RANGE::y2, VOL_RANGE::z1, and VOL_RANGE::z2.

◆ volEmpty()

void volEmpty ( VOL vol)

◆ volInfo()

void volInfo ( VOL vol,
FILE *  fp 
)

Prints volume information to specified file pointer, e.g. stdout

Parameters
volvolume structure
fptarget file pointer

Definition at line 431 of file vol.c.

References VOL::dimx, VOL::dimy, VOL::dimz, IMG_STATUS_ERROR, IMG_STATUS_INITIALIZED, IMG_STATUS_UNINITIALIZED, VOL::orientation, VOL::sizex, VOL::sizey, VOL::sizez, VOL::statmsg, VOL::status, and VOL_TEST.

◆ volInit()

void volInit ( VOL vol)

Initiate volume before any use of VOL data; this should be called once.

Parameters
volpointer to volume structure

Definition at line 45 of file vol.c.

References _volStatusMessage, VOL::column, VOL::dimx, VOL::dimy, VOL::dimz, IMG_STATUS_INITIALIZED, VOL::orientation, VOL::plane, VOL::row, VOL::sizex, VOL::sizey, VOL::sizez, VOL::statmsg, VOL::status, VOL::v, VOL_TEST, and VOL::voxel.

◆ volMax()

int volMax ( VOL vol,
VOL_RANGE  r,
VOL_PIXEL p,
float *  maxv 
)

Finds max voxel inside specified volume range.

Parameters
volvolume structure
rvolume range structure
pvolume pixel structure
maxvtarget for maximum value
Returns
0 if ok, 1 invalid volume status, 2 invalid range endings, 3 inconsistent range dimensions, 4 inconsistent dimensions

Definition at line 513 of file vol.c.

References VOL::dimx, VOL::dimy, VOL::dimz, IMG_STATUS_OCCUPIED, VOL::status, VOL::v, VOL_PIXEL::x, VOL_RANGE::x1, VOL_RANGE::x2, VOL_PIXEL::y, VOL_RANGE::y1, VOL_RANGE::y2, VOL_PIXEL::z, VOL_RANGE::z1, and VOL_RANGE::z2.

Variable Documentation

◆ VOL_TEST

int VOL_TEST