algorithms.diagnostics.screens

Module: algorithms.diagnostics.screens

Diagnostic 4d image screen

Functions

nipy.algorithms.diagnostics.screens.screen(img4d, ncomp=10, time_axis='t', slice_axis=None)[source]

Diagnostic screen for 4d FMRI image

Includes PCA, tsdiffana and mean, std, min, max images.

Parameters

img4d : Image

4d image file

ncomp : int, optional

number of component images to return. Default is 10

time_axis : str or int, optional

Axis over which to do PCA, time difference analysis. Defaults to t

slice_axis : None or str or int, optional

Name or index of input axis over which to do slice analysis for time difference analysis. If None, look for input axis slice. At the moment we then assume slice is the last non-time axis, but this last guess we will remove in future versions of nipy. The default will then be ‘slice’ and you’ll get an error if there is no axis named ‘slice’.

Returns

screen : dict

with keys:

  • mean : mean image (all summaries are over last dimension)

  • std : standard deviation image

  • max : image of max

  • min : min

  • pca : 4D image of PCA component images

  • pca_res : dict of results from PCA

  • ts_res : dict of results from tsdiffana

Examples

>>> import nipy as ni
>>> from nipy.testing import funcfile
>>> img = ni.load_image(funcfile)
>>> screen_res = screen(img)
>>> screen_res['mean'].ndim
3
>>> screen_res['pca'].ndim
4
nipy.algorithms.diagnostics.screens.write_screen_res(res, out_path, out_root, out_img_ext='.nii', pcnt_var_thresh=0.1)[source]

Write results from screen to disk as images

Parameters

res : dict

output from screen function

out_path : str

directory to which to write output images

out_root : str

part of filename between image-specific prefix and image-specific extension to use for writing images

out_img_ext : str, optional

extension (identifying image type) to which to write volume images. Default is ‘.nii’

pcnt_var_thresh : float, optional

threshold below which we do not plot percent variance explained by components; default is 0.1. This removes the long tail from percent variance plots.

Returns

None