Home | Trees | Indices | Help |
|
---|
|
Wrapper class for convenient access to NIfTI data.
The class can either load an image from file or convert a NumPy ndarray
into a NIfTI file structure. Either way is automatically determined
by the type of the 'source' argument. If source
is a string, it is
assumed to be a filename an ndarray is treated as such.
One can optionally specify whether the image data should be loaded into memory when opening NIfTI data from files (load). When converting a NumPy array one can optionally specify a dictionary with NIfTI header data as available via the header attribute.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from |
|
|||
data Return the NIfTI image data wrapped into a NumPy array. |
|||
bbox Get the bounding box of the image. |
|||
Inherited from Inherited from |
|
source .
|
|
Save the image. If the image was created using array data (not loaded from a file) one has to specify a filename. Warning: There will be no exception if writing fails for any reason, as the underlying function nifti_write_hdr_img() from libniftiio does not provide any feedback. Suggestions for improvements are appreciated. If not yet done already, the image data will be loaded into memory before saving the file.
|
Returns if the image data is accessible -- either loaded into memory or memory mapped. |
Load the image data into memory, if it is not already accessible. It is save to call this method several times successively. |
Unload image data and free allocated memory. This methods does nothing in case of memory mapped files. |
Return the NIfTI image data wrapped into a NumPy array. The data property is an alternative way to access this function. |
|
Returns a scaled copy of the data array. Scaling is done by multiplying with the slope and adding the intercept that is stored in the NIfTI header.
|
Get the bounding box of the image. This functions returns a tuple of (min, max) tuples. It contains as many tuples as image dimensions. The order of dimensions is identical to that in the data array. The bbox property is an alternative way to access this function. |
Set the filename for the NIfTI image. Setting the filename also determines the filetype. If the filename ends with '.nii' the type will be set to NIfTI single file. A '.hdr' extension can be used for NIfTI file pairs. If the desired filetype is ANALYZE the extension should be '.img'. However, one can use the '.hdr' extension and force the filetype to ANALYZE by setting the filetype argument to ANALYZE. Setting filetype if the filename extension is '.nii' has no effect, the file will always be in NIFTI format. If the filename carries an additional '.gz' the resulting file(s) will be compressed. Uncompressed NIfTI single files are the default filetype that will be used if the filename has no valid extension. The '.nii' extension is appended automatically. The 'filetype' argument can be used to force a certain filetype when no extension can be used to determine it. 'filetype' can be one of the nifticlibs filtetypes or any of 'NIFTI', 'NIFTI_GZ', 'NIFTI_PAIR', 'NIFTI_PAIR_GZ', 'ANALYZE', 'ANALYZE_GZ'. Setting the filename will cause the image data to be loaded into memory if not yet done already. This has to be done, because without the filename of the original image file there would be no access to the image data anymore. As a side-effect a simple operation like setting a filename may take a significant amount of time (e.g. for a large 4d dataset). By passing an empty string or none as filename one can reset the filename and detach the NiftiImage object from any file on disk. Examples: Filename Output of save() ---------------------------------- exmpl.nii exmpl.nii (NIfTI) exmpl.hdr exmpl.hdr, exmpl.img (NIfTI) exmpl.img exmpl.hdr, exmpl.img (ANALYZE) exmpl exmpl.nii (NIfTI) exmpl.hdr.gz exmpl.hdr.gz, exmpl.img.gz (NIfTI) ! exmpl.gz exmpl.gz.nii (uncompressed NIfTI) Setting the filename is also possible by assigning to the 'filename' property. |
Deprecated method only here for backward compatibility. Please refer to NiftiFormat.updateFromDict() |
|
dataReturn the NIfTI image data wrapped into a NumPy array. The data property is an alternative way to access this function.
|
bboxGet the bounding box of the image. This functions returns a tuple of (min, max) tuples. It contains as many tuples as image dimensions. The order of dimensions is identical to that in the data array. The bbox property is an alternative way to access this function.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Oct 17 15:19:38 2008 | http://epydoc.sourceforge.net |