algorithms.diagnostics.commands¶
Module: algorithms.diagnostics.commands
¶
Implementation of diagnostic command line tools
Tools are:
nipy_diagnose
nipy_tsdiffana
This module has the logic for each command.
The command script files deal with argument parsing and any custom imports.
The implementation here accepts the args
object from argparse
and does
the work.
Functions¶
- nipy.algorithms.diagnostics.commands.diagnose(args)¶
Calculate, write results from diagnostic screen
- Parameters:
- argsobject
object with attributes:
filename : str - 4D image filename
time_axis : str - name or number of time axis in filename
slice_axis : str - name or number of slice axis in filename
out_path : None or str - path to which to write results
out_fname_label : None or filename - suffix of output results files
ncomponents : int - number of PCA components to write images for
- Returns:
- resdict
Results of running
screen()
on filename
- nipy.algorithms.diagnostics.commands.parse_fname_axes(img_fname, time_axis, slice_axis)¶
Load img_fname, check time_axis, slice_axis or use default
- Parameters:
- img_fnamestr
filename of image on which to do diagnostics
- time_axisNone or str or int, optional
Axis indexing time-points. None is default, will be replaced by a value of ‘t’. If time_axis is an integer, gives the index of the input (domain) axis of img. If time_axis is a str, can be an input (domain) name, or an output (range) name, that maps to an input (domain) name.
- slice_axisNone or str or int, optional
Axis indexing MRI slices. If slice_axis is an integer, gives the index of the input (domain) axis of img. If slice_axis is a str, can be an input (domain) name, or an output (range) name, that maps to an input (domain) name. If None (the default) then 1) try the name ‘slice’ to select the axis - if this fails, and fname refers to an Analyze type image (such as Nifti), then 2) default to the third image axis, otherwise 3) raise a ValueError
- Returns:
- img
Image
instance Image as loaded from img_fname
- time_axisint or str
Time axis, possibly filled with default
- slice_axisint or str
Slice axis, possibly filled with default
- img
- nipy.algorithms.diagnostics.commands.tsdiffana(args)¶
Generate tsdiffana plots from command line params args
- Parameters:
- argsobject
object with attributes
filename : str - 4D image filename
out_file : str - graphics file to write to instead of leaving graphics on screen
time_axis : str - name or number of time axis in filename
slice_axis : str - name or number of slice axis in filename
write_results : bool - if True, write images and plots to files
out_path : None or str - path to which to write results
out_fname_label : None or filename - suffix of output results files
- Returns:
- axesMatplotlib axes
Axes on which we have done the plots.