My Project
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include "studynr.h"
#include "halflife.h"
#include "include/imgunit.h"
#include "include/img.h"
Go to the source code of this file.
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 | |
static const char * | imgmsg [] |
int imgAllocate | ( | IMG * | image, |
int | planes, | ||
int | rows, | ||
int | columns, | ||
int | frames | ||
) |
Allocates memory for img data. Old contents are not saved.
image | initialized image |
planes | number of allcoated planes |
rows | number of allocated rows |
columns | number of allocated columns |
frames | number of allocated frames |
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().
int imgAllocateWithHeader | ( | IMG * | image, |
int | planes, | ||
int | rows, | ||
int | columns, | ||
int | frames, | ||
IMG * | image_from | ||
) |
This functions just combines imgAllocate() and imgCopyhdr().
image | Pointer to IMG struct which will be allocated here |
planes | Image matrix dimensions; z |
rows | Image matrix dimensions; y |
columns | Image matrix dimensions; x |
frames | Image matrix dimensions; t |
image_from | Pointer to IMG struct where header contents will be copied from |
Definition at line 357 of file img.c.
References imgAllocate(), and imgCopyhdr().
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.
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 | ) |
Free memory that is allocated for IMG.
image | image structure that has allocated memory |
Definition at line 216 of file img.c.
References IMG::_col, IMG::_dataType, IMG::_fileFormat, IMG::_header, IMG::_pln, IMG::_pxl, IMG::_row, IMG::axialFOV, IMG::column, IMG::decayCorrected, IMG::decayCorrFactor, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, IMG::end, IMG::errstatus, IMG::gapx, IMG::gapy, IMG::gapz, IMG_STATUS_INITIALIZED, IMG_STATUS_OCCUPIED, IMG_TEST, imgSetStatus(), IMG::isotopeHalflife, IMG::isWeight, IMG::m, MAX_POLARMAP_NUM_RINGS, IMG::mid, IMG::orientation, IMG::patientID, IMG::patientName, IMG::pixel, IMG::plane, IMG::planeNumber, IMG::polarmap_num_rings, IMG::polarmap_ring_angle, IMG::polarmap_ring_position, IMG::polarmap_sectors_per_ring, IMG::polarmap_start_angle, IMG::radiopharmaceutical, IMG::resolutionx, IMG::resolutiony, IMG::resolutionz, IMG::row, IMG::sampleDistance, IMG::scanner, IMG::scanStart, IMG::sd, IMG::sizex, IMG::sizey, IMG::sizez, IMG::start, IMG::status, STATUS_OK, IMG::studyDescription, IMG::studyNr, IMG::transaxialFOV, IMG::type, IMG::unit, IMG::userProcessCode, IMG::weight, and IMG::zoom.
Referenced by ecat63ReadPlaneToImg(), imgAllocate(), imgExtractRange(), imgMicropetCTToEcat7(), imgMicropetPETToEcat7(), imgReadFrame(), imgReadMinMax(), imgWriteAnalyzeFrame(), imgWriteEcat63Frame(), imgWriteEcat7Frame(), main(), test_img_io(), and test_polarmap_io().
Extract a smaller 4D image from inside an IMG. Any existing data is overwritten.
img1 | source image structure, 'occupied' (has allocated data) |
r | image range structure |
img2 | target image structure 'initialized' (has not allocated data) |
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.
void imgInfo | ( | IMG * | image | ) |
Prints img information to stdout; mainly for testing purposes.
image | image structure |
Definition at line 414 of file img.c.
References IMG::_dataType, IMG::_fileFormat, IMG::axialFOV, IMG::decayCorrected, IMG::decayCorrFactor, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, IMG::end, IMG_STATUS_ERROR, IMG_STATUS_INITIALIZED, IMG_STATUS_UNINITIALIZED, IMG_TEST, imgUnit(), IMG::isotopeHalflife, IMG::isWeight, IMG::mid, IMG::orientation, IMG::planeNumber, IMG::polarmap_num_rings, IMG::polarmap_ring_angle, IMG::polarmap_ring_position, IMG::polarmap_sectors_per_ring, IMG::polarmap_start_angle, IMG::radiopharmaceutical, IMG::sampleDistance, IMG::scanner, IMG::scanStart, IMG::sizex, IMG::sizey, IMG::sizez, IMG::start, IMG::statmsg, IMG::status, IMG::studyNr, IMG::transaxialFOV, IMG::type, IMG::unit, and IMG::zoom.
Referenced by ecat63AddImg(), imgReadAnalyzeFirstFrame(), imgReadEcat63FirstFrame(), imgReadEcat7FirstFrame(), and imgReadFrame().
void imgInit | ( | IMG * | image | ) |
Call this once before any use of IMG data.
image | target image structure |
Definition at line 163 of file img.c.
References IMG::_dataType, IMG::_fileFormat, IMG::_header, IMG::axialFOV, IMG::column, IMG::decayCorrected, IMG::decayCorrFactor, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, IMG::end, IMG::errstatus, IMG::gapx, IMG::gapy, IMG::gapz, IMG_STATUS_INITIALIZED, IMG_TEST, imgSetStatus(), IMG::isotopeHalflife, IMG::isWeight, IMG::m, MAX_POLARMAP_NUM_RINGS, IMG::mid, IMG::orientation, IMG::patientName, IMG::pixel, IMG::plane, 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::row, IMG::sampleDistance, IMG::scanner, IMG::scanStart, IMG::sd, IMG::sizex, IMG::sizey, IMG::sizez, IMG::start, IMG::status, STATUS_OK, IMG::studyNr, IMG::transaxialFOV, IMG::type, IMG::unit, IMG::weight, and IMG::zoom.
Referenced by imgMicropetCTToEcat7(), imgMicropetPETToEcat7(), imgReadFrame(), imgReadMinMax(), imgWriteAnalyzeFrame(), imgWriteEcat63Frame(), imgWriteEcat7Frame(), main(), test_img_io(), and test_polarmap_io().
void imgSetStatus | ( | IMG * | img, |
int | status_index | ||
) |
Set the IMG image error status message pointer (statmsg) and index
img | Pointer to IMG struct where statmsg will be set |
status_index | Index of img_status_string |
Definition at line 399 of file img.c.
References IMG::errstatus, imgmsg, IMG::statmsg, and STATUS_FAULT.
Referenced by ecat63ReadAllToImg(), imgAllocate(), imgEmpty(), imgExtractRange(), imgGetAnalyzeHeader(), imgInit(), imgReadAnalyze(), imgReadAnalyzeFirstFrame(), imgReadAnalyzeFrame(), imgReadAnalyzeHeader(), imgReadEcat63FirstFrame(), imgReadEcat63Frame(), imgReadEcat63Header(), imgReadEcat7(), imgReadEcat7FirstFrame(), imgReadEcat7Frame(), imgReadEcat7Header(), imgReadFrame(), imgReadHeader(), imgSetAnalyzeHeader(), imgWrite(), imgWrite2DEcat7(), imgWriteAnalyze(), imgWriteEcat7(), imgWriteFrame(), and imgWritePolarmap().
char* imgStatus | ( | int | status_index | ) |
Return pointer to string describing the image error status message
status_index | index of img_status_string |
Definition at line 384 of file img.c.
References imgmsg, and STATUS_FAULT.
Referenced by imgRead().
|
static |
Status (error) messages from image processing; see enum img_status_msg
Definition at line 113 of file img.c.
Referenced by imgSetStatus(), and imgStatus().