Image processing functions for:
Smoothing and resampling routines need scipy
adapt_affine(affine, n_dim) | Adapt input / output dimensions of spatial affine for n_dims |
fwhm2sigma(fwhm) | Convert a FWHM value to sigma in a Gaussian kernel. |
resample_from_to(from_img, to_vox_map[, ...]) | Resample image from_img to mapped voxel space to_vox_map |
resample_to_output(in_img[, voxel_sizes, ...]) | Resample image in_img to output voxel axes (world space) |
sigma2fwhm(sigma) | Convert a sigma in a Gaussian kernel to a FWHM value |
smooth_image(img, fwhm[, mode, cval, out_class]) | Smooth image img along voxel axes by FWHM fwhm millimeters |
Adapt input / output dimensions of spatial affine for n_dims
Adapts a spatial (4, 4) affine that is being applied to an image with fewer than 3 spatial dimensions, or more than 3 dimensions. If there are more than three dimensions, assume an identity transformation for these dimensions.
Parameters: | affine : array-like
n_dims : int
|
---|---|
Returns: | adapted : shape (M, n_dims+1) array
|
Convert a FWHM value to sigma in a Gaussian kernel.
Parameters: | fwhm : array-like
|
---|---|
Returns: | sigma : array or float
|
Examples
>>> sigma = fwhm2sigma(6)
>>> sigmae = fwhm2sigma([6, 7, 8])
>>> sigma == sigmae[0]
True
Resample image from_img to mapped voxel space to_vox_map
Resample using N-d spline interpolation.
Parameters: | from_img : object
to_vox_map : image object or length 2 sequence
order : int, optional
mode : str, optional
cval : scalar, optional
out_class : None or SpatialImage class, optional
|
---|---|
Returns: | out_img : object
|
Resample image in_img to output voxel axes (world space)
Parameters: | in_img : object
voxel_sizes : None or sequence
order : int, optional
mode : str, optional
cval : scalar, optional
out_class : None or SpatialImage class, optional
|
---|---|
Returns: | out_img : object
|
Convert a sigma in a Gaussian kernel to a FWHM value
Parameters: | sigma : array-like
|
---|---|
Returns: | fwhm : array or float
|
Examples
>>> fwhm = sigma2fwhm(3)
>>> fwhms = sigma2fwhm([3, 4, 5])
>>> fwhm == fwhms[0]
True
Smooth image img along voxel axes by FWHM fwhm millimeters
Parameters: | img : object
fwhm : scalar or length 3 sequence
mode : str, optional
cval : scalar, optional
out_class : None or SpatialImage class, optional
|
---|---|
Returns: | smoothed_img : object
|