|
TPCCLIB
|
NIfTI-1 PET image I/O routines for IMG data. More...
#include "libtpcimgio.h"Go to the source code of this file.
Functions | |
| int | imgReadNifti (const char *filename, IMG *img, int verbose) |
| int | imgReadNiftiFirstFrame (const char *filename, IMG *img, int verbose) |
| int | imgReadNiftiHeader (const char *filename, IMG *img, int verbose) |
| int | imgGetNiftiHeader (IMG *img, NIFTI_DSR *dsr, int verbose) |
| int | imgReadNiftiFrame (const char *filename, int frame_to_read, IMG *img, int frame_index, int verbose) |
| int | imgSetNiftiHeader (IMG *img, const char *dbname, NIFTI_DSR *dsr, float fmin, float fmax, int verbose) |
| int | imgWriteNiftiFrame (const char *dbname, int frame_to_write, IMG *img, int frame_index, float fmin, float fmax, int verbose) |
| int | imgWriteNifti (const char *dbname, IMG *img, int save_sif, int verbose) |
NIfTI-1 PET image I/O routines for IMG data.
Function are not intended to support all NIfTI files or file properties, but only those that have been found necessary in Turku PET Centre.
Definition in file img_nii.c.
Copy Nifti header information into IMG.
| img | Pointer to IMG struct |
| dsr | Pointer to Nifti header contents |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 218 of file img_nii.c.
Referenced by imgFormatDetermine(), imgReadNiftiHeader(), and imgWriteNiftiFrame().
| int imgReadNifti | ( | const char * | filename, |
| IMG * | img, | ||
| int | verbose ) |
Read Nifti-1 image.
Nifti database name must be given with path. Either one file with extension .nii, or image and header files with extensions .img and .hdr must exist. Also SIF file with .sif extension is used, if it exists.
| filename | Nifti database name with path, with or without extension |
| img | Pointer to initialized IMG structure |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 23 of file img_nii.c.
Referenced by imgRead().
| int imgReadNiftiFirstFrame | ( | const char * | filename, |
| IMG * | img, | ||
| int | verbose ) |
Read the first frame of Nifti-1 image into IMG data structure.
Nifti database name must be given with path. Either one file with extension .nii, or image and header files with extensions .img and .hdr must exist. Also SIF file with .sif extension is used, if it exists.
| filename | Nifti database name with path, with or without extension |
| img | Pointer to initialized IMG structure |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 78 of file img_nii.c.
Referenced by imgNiftiToEcat().
| int imgReadNiftiFrame | ( | const char * | filename, |
| int | frame_to_read, | ||
| IMG * | img, | ||
| int | frame_index, | ||
| int | verbose ) |
Read a specified frame from a Nifti database files into preallocated IMG data structure.
IMG header is assumed to be filled correctly before calling this function, except for information concerning separate planes and this frame, which is filled here.
| filename | Pointer to string that contains the name of NIfTI database with path, with or without filename extension. Either one file with extension .nii, or image and header files with extensions .img and .hdr must exist. Also SIF file with .sif extension is used, if it exists; however, information concerning separate frames or planes is not filled. |
| frame_to_read | Frame which will be read from database [1..frameNr] |
| img | Pointer to the IMG data. Place for the frame must be preallocated |
| frame_index | IMG frame index [0..dimt-1] where data will be placed |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 311 of file img_nii.c.
Referenced by imgNiftiToEcat(), imgReadFrame(), imgReadNifti(), and imgReadNiftiFirstFrame().
| int imgReadNiftiHeader | ( | const char * | filename, |
| IMG * | img, | ||
| int | verbose ) |
Fill IMG struct header information from Nifti database files.
Nifti database name must be given with path. Either one file with extension .nii, or image and header files with extensions .img and .hdr must exist. Also SIF file with .sif extension is used, if it exists; however, information concerning separate frames or planes is not filled.
| filename | Nifti database name with path, with or without extension |
| img | Pointer to initialized IMG structure |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 134 of file img_nii.c.
Referenced by imgReadHeader(), imgReadNifti(), and imgReadNiftiFirstFrame().
| int imgSetNiftiHeader | ( | IMG * | img, |
| const char * | dbname, | ||
| NIFTI_DSR * | dsr, | ||
| float | fmin, | ||
| float | fmax, | ||
| int | verbose ) |
Copy header information in IMG structure into NIfTI header structure.
Min, max, and scale factor are set here and they apply to all frames.
| img | pointer to IMG structure from which header information is read |
| dbname | NIfTI database name |
| dsr | pointer to NIfTI header struct to be filled |
| fmin | minimum pixel value in all frames that will be written |
| fmax | maximum pixel value in all frames that will be written |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 471 of file img_nii.c.
Referenced by imgWriteNiftiFrame().
| int imgWriteNifti | ( | const char * | dbname, |
| IMG * | img, | ||
| int | save_sif, | ||
| int | verbose ) |
Write NIfTI-1 image.
Nifti database name can be given with path, however, path is not created in here. IMG field _fileFormat determines whether NIfTI is written in single file format (*.nii) or dual file format (*.hdr and *.img). Optionally SIF file with .sif extension is saved to store frame times.
| dbname | Nifti database name with path, with or without extension |
| img | Pointer to IMG structure containing the image data to be written |
| save_sif | Save (1) or do not save (0) SIF |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 811 of file img_nii.c.
Referenced by imgWrite().
| int imgWriteNiftiFrame | ( | const char * | dbname, |
| int | frame_to_write, | ||
| IMG * | img, | ||
| int | frame_index, | ||
| float | fmin, | ||
| float | fmax, | ||
| int | verbose ) |
Write one PET frame from IMG data struct into NIfTI file.
This function can be called repeatedly to write all frames one at a time to conserve memory. This function does not write SIF. Single or dual file format is determined based on _fileFormat field in IMG struct. Byte order is the not changed.
| dbname | Name of NIfTI file where IMG contents will be written. If file does not exist, it is created. Make sure to delete existing file, unless you want to add data. |
| frame_to_write | PET frame number (1..frameNr) which will be written: If set to 0, frame data will be written to an existing or new PET file as a new additional frame, never overwriting existing data. If >0, then frame data is written as specified frame number, overwriting any data existing with the same frame number |
| img | pointer to the IMG data struct. |
| frame_index | IMG frame index (0..dimt-1) which will be written. |
| fmin | minimum pixel value in all frames that will be written; used only when writing the first frame. |
| fmax | maximum pixel value in all frames that will be written; used only when writing the first frame. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 594 of file img_nii.c.
Referenced by imgWriteFrame(), and imgWriteNifti().