io.nibcompat¶
Module: io.nibcompat¶
Compatibility functions for older versions of nibabel
Nibabel <= 1.3.0 do not have these attributes:
- header
- affine
- dataobj
The equivalents for these older versions of nibabel are:
- obj.get_header()
- obj.get_affine()
- obj._data
With old nibabel, getting unscaled data used read_img_data(img, prefer=”unscaled”). Newer nibabel should prefer the `get_unscaled method on the image proxy object
Functions¶
-
nipy.io.nibcompat.get_affine(img)¶ Return affine from nibabel image
Parameters: img :
SpatialImageinstanceInstance of nibabel
SpatialImageclassReturns: affine : object
affine object from img
-
nipy.io.nibcompat.get_dataobj(img)¶ Return data object for nibabel image
Parameters: img :
SpatialImageinstanceInstance of nibabel
SpatialImageclassReturns: dataobj : object
ArrayProxyor ndarray object containing data for img
-
nipy.io.nibcompat.get_header(img)¶ Return header from nibabel image
Parameters: img :
SpatialImageinstanceInstance of nibabel
SpatialImageclassReturns: header : object
header object from img
-
nipy.io.nibcompat.get_unscaled_data(img)¶ Get the data from a nibabel image, maybe without applying scaling
Parameters: img :
SpatialImageinstanceInstance of nibabel
SpatialImageclassReturns: data : ndarray
Data as loaded from image, not applying scaling if this can be avoided