#include <stdio.h>
#include <nifti1_io.h>
#include <znzlib.h>
#include "dbh.h"
Go to the source code of this file.
Classes | |
struct | FSLIO |
High level data structure for open datasets in the fslio API. More... | |
Defines | |
#define | __FSLIO_H |
#define | FSL_TYPE_ANALYZE 0 |
#define | FSL_TYPE_NIFTI 1 |
#define | FSL_TYPE_NIFTI_PAIR 2 |
#define | FSL_TYPE_MINC 4 |
#define | FSL_TYPE_ANALYZE_GZ 100 |
#define | FSL_TYPE_NIFTI_GZ 101 |
#define | FSL_TYPE_NIFTI_PAIR_GZ 102 |
#define | FSL_TYPE_MINC_GZ 104 |
#define | FSL_RADIOLOGICAL -1 |
#define | FSL_NEUROLOGICAL 1 |
Typedefs | |
typedef unsigned char | THIS_UINT8 |
typedef char | THIS_INT8 |
typedef unsigned short | THIS_UINT16 |
typedef short | THIS_INT16 |
typedef unsigned int | THIS_UINT32 |
typedef int | THIS_INT32 |
typedef unsigned long | THIS_UINT64 |
typedef long | THIS_INT64 |
typedef float | THIS_FLOAT32 |
typedef double | THIS_FLOAT64 |
Functions | |
FSLIO * | FslOpen (const char *filename, const char *opts) |
Opens a file for either reading or writing. | |
FSLIO * | FslXOpen (const char *filename, const char *opts, int filetype) |
Opens a file for either reading or writing. | |
int | FslSeekVolume (FSLIO *fslio, size_t vols) |
int | FslClose (FSLIO *fslio) |
Write header and image data if this dataset was open for writing. Close the dataset header and data files. | |
void * | FslReadAllVolumes (FSLIO *fslio, char *filename) |
Read the header and all data into the FSLIO structure. | |
void | FslWriteAllVolumes (FSLIO *fslio, const void *buffer) |
Writes all data from buffer (using size info from fslio) to file. | |
size_t | FslReadVolumes (FSLIO *fslio, void *buffer, size_t nvols) |
Read the first nvols Volumes from a 4D dataset. | |
size_t | FslWriteVolumes (FSLIO *fslio, const void *buffer, size_t nvols) |
Write the first nvols volumes in buffer to disk. | |
void | FslWriteHeader (FSLIO *fslio) |
Writes nifti/anz header and opens img file ready for writing. | |
int | FslFileExists (const char *filename) |
char * | FslMakeBaseName (const char *fname) |
int | FslCheckForMultipleFileNames (const char *filename) |
int | FslGetEnvOutputType () |
void | FslSetIgnoreMFQ (int flag) |
int | FslGetIgnoreMFQ () |
void | FslSetOverrideOutputType (int type) |
int | FslGetOverrideOutputType () |
int | FslGetFileType (const FSLIO *fslio) |
void | FslSetFileType (FSLIO *fslio, int filetype) |
int | FslIsSingleFileType (int filetype) |
int | FslIsCompressedFileType (int filetype) |
int | FslBaseFileType (int filetype) |
char * | FslFileTypeString (int filetype) |
Return a string describing the format of the dataset. | |
int | FslGetWriteMode (const FSLIO *fslio) |
void | FslSetWriteMode (FSLIO *fslio, int mode) |
void | AvwSwapHeader (struct dsr *avw) |
int | FslReadRawHeader (void *buffer, const char *filename) |
FSLIO * | FslInit () |
allocate space for the FSLIO struct and set some sensible defaults | |
void | FslInitHeader (FSLIO *fslio, short t, size_t x, size_t y, size_t z, size_t v, float vx, float vy, float vz, float tr, size_t dim, const char *units) |
void | FslSetInit (FSLIO *fslio) |
void | FslCloneHeader (FSLIO *dest, const FSLIO *src) |
size_t | FslGetVolSize (FSLIO *fslio) |
void | FslSetDim (FSLIO *fslio, short x, short y, short z, short v) |
void | FslGetDim (FSLIO *fslio, short *x, short *y, short *z, short *v) |
void | FslSetDimensionality (FSLIO *fslio, size_t dim) |
void | FslGetDimensionality (FSLIO *fslio, size_t *dim) |
void | FslSetVoxDim (FSLIO *fslio, float x, float y, float z, float tr) |
void | FslGetVoxDim (FSLIO *fslio, float *x, float *y, float *z, float *tr) |
void | FslGetCalMinMax (FSLIO *fslio, float *min, float *max) |
void | FslSetCalMinMax (FSLIO *fslio, float min, float max) |
void | FslGetAuxFile (FSLIO *fslio, char *aux_file) |
void | FslSetAuxFile (FSLIO *fslio, const char *aux_file) |
void | FslSetTimeUnits (FSLIO *fslio, const char *units) |
void | FslGetTimeUnits (FSLIO *fslio, char *units) |
void | FslSetDataType (FSLIO *fslio, short t) |
size_t | FslGetDataType (FSLIO *fslio, short *t) |
int | FslGetIntensityScaling (FSLIO *fslio, float *slope, float *intercept) |
void | FslSetIntent (FSLIO *fslio, short intent_code, float p1, float p2, float p3) |
short | FslGetIntent (FSLIO *fslio, short *intent_code, float *p1, float *p2, float *p3) |
short | FslGetStdXform (FSLIO *fslio, mat44 *stdmat) |
void | FslSetStdXform (FSLIO *fslio, short sform_code, mat44 stdmat) |
void | FslGetMMCoord (mat44 stdmat, float voxx, float voxy, float voxz, float *mmx, float *mmy, float *mmz) |
void | FslGetVoxCoord (mat44 stdmat, float mmx, float mmy, float mmz, float *voxx, float *voxy, float *voxz) |
short | FslGetRigidXform (FSLIO *fslio, mat44 *rigidmat) |
void | FslSetRigidXform (FSLIO *fslio, short qform_code, mat44 rigidmat) |
int | FslGetLeftRightOrder (FSLIO *fslio) |
void | FslSetAnalyzeSform (FSLIO *fslio, const short *orig, float dx, float dy, float dz) |
void | FslGetAnalyzeOrigin (FSLIO *fslio, short orig[5]) |
size_t | FslReadSliceSeries (FSLIO *fslio, void *buffer, short slice, size_t nvols) |
Read one slice from each of the first nvols volumes in the dataset, ie get an xyt buffer. | |
size_t | FslReadRowSeries (FSLIO *fslio, void *buffer, short row, short slice, size_t nvols) |
Read one row from one slice for first nvols volumes in dataset; ie get an xt buffer. | |
size_t | FslReadTimeSeries (FSLIO *fslio, void *buffer, short xVox, short yVox, short zVox, size_t nvols) |
Read one voxel (xyz location) from first nvols volumes in dataset; ie get a t dim buffer. | |
mat33 | mat44_to_mat33 (mat44 x) |
double **** | d4matrix (int th, int zh, int yh, int xh) |
allocate a 4D buffer, use 1 contiguous buffer for the data | |
double **** | FslGetBufferAsScaledDouble (FSLIO *fslio) |
Return the fslio data buffer of a 1-4D dataset as a 4D array of scaled doubles. | |
int | convertBufferToScaledDouble (double *outbuf, void *inbuf, long len, float slope, float inter, int nifti_datatype) |
allocate a 4D buffer, use 1 contiguous buffer for the data |
|
allocate a 4D buffer, use 1 contiguous buffer for the data
Array is indexed as buf[0..th-1][0..zh-1][0..yh-1][0..xh-1].
fill the buffer |
|
allocate a 4D buffer, use 1 contiguous buffer for the data
Array is indexed as buf[0..th][0..zh][0..yh][0..xh].
allocate pointers to vols allocate pointers to slices allocate pointers for ydim allocate the data blob point everything to the data blob |
|
Write header and image data if this dataset was open for writing. Close the dataset header and data files.
----- if writing the image, need to worry about the header bit ----- * |
|
Return a string describing the format of the dataset.
|
|
Return the fslio data buffer of a 1-4D dataset as a 4D array of scaled doubles.
Array is indexed as buf[0..tdim-1][0..zdim-1][0..ydim-1][0..xdim-1].
allocate new 4D buffer cvt it |
|
allocate space for the FSLIO struct and set some sensible defaults
|
|
Opens a file for either reading or writing. The format of the output dataset is determined automatically by passing filetype -1 to FslXOpen.
|
|
Read the header and all data into the FSLIO structure.
There is no need for FslOpen or FslClose calls when FslReadAllVolumes() is called.
otherwise it is a nifti file - so read it! * |
|
Read one row from one slice for first nvols volumes in dataset; ie get an xt buffer. Dimension and datatype of buffer are as is specified in nifti_image structure fslio->niftiptr. Note: filepointer in file data array is restored to its initial position.
|
|
Read one slice from each of the first nvols volumes in the dataset, ie get an xyt buffer. Dimension and datatype of buffer are as is specified in nifti_image structure fslio->niftiptr. Note: filepointer in file data array is restored to its initial position.
|
|
Read one voxel (xyz location) from first nvols volumes in dataset; ie get a t dim buffer. Dimension and datatype of buffer are as is specified in nifti_image structure fslio->niftiptr. Note: filepointer in file data array is restored to its initial position.
|
|
Read the first nvols Volumes from a 4D dataset.
|
|
Writes all data from buffer (using size info from fslio) to file. Dimension and datatype of buffer are as is specified in nifti_image structure fslio->niftiptr. Note: If file format is Analyze (not nifti) and in Neurological order then SWAP DATA into Radiological order.
|
|
Writes nifti/anz header and opens img file ready for writing.
|
|
Write the first nvols volumes in buffer to disk. Dimension and datatype of buffer are as is specified in nifti_image structure fslio->niftiptr. Note: If file format is Analyze (not nifti) and in Neurological order then SWAP DATA into Radiological order.
|
|
Opens a file for either reading or writing. Files to be read are automatically read whether compressed or not. Also, reading uses the file extension and will fail if that file does not exist. For a more robust read, pass the basename in as then all types will be tried.
====================== Open file for writing ====================== * ======================== Open file for reading ====================== * |