cmdline
¶
Functionality to be exposed in the command line
Module: cmdline.conform
¶
Conform neuroimaging volume to arbitrary shape and voxel size.
|
Main program function. |
Module: cmdline.convert
¶
Convert neuroimaging file to new parameters
|
Main program function. |
Module: cmdline.dicomfs
¶
|
Not much happens here apart from initializing the parser attribute. |
|
|
Dummy fuse "module" so that nose does not blow during doctests |
|
|
Module: cmdline.diff
¶
Quick summary of the differences among a set of neuroimaging files
- Notes:
difference in data types for header fields will be detected, but endianness difference will not be detected. It is done so to compare files with native endianness used in data files.
|
Generically compare values, return True if different |
|
|
|
Format header differences into a nice string |
|
Get difference between data |
|
Get difference between md5 values of data |
|
Get difference between headers |
|
Getting the show on the road |
Module: cmdline.ls
¶
Output a summary table for neuroimaging files (resolution, dimensionality, etc.)
|
Show must go on |
|
Module: cmdline.nifti_dx
¶
Print nifti diagnostics for header files
|
Go go team |
Module: cmdline.parrec2nii
¶
Code for PAR/REC to NIfTI converter command
|
|
|
|
|
|
|
Module: cmdline.roi
¶
|
|
|
|
|
|
|
Module: cmdline.stats
¶
Compute image statistics
|
Main program function. |
Module: cmdline.tck2trk
¶
Convert tractograms (TCK -> TRK).
|
|
Module: cmdline.trk2tck
¶
Convert tractograms (TRK -> TCK).
|
|
Module: cmdline.utils
¶
Helper utilities to be used in cmdline applications
|
Little helper to enforce consistency |
|
A getattr which would return '-' if getattr fails |
|
Given list of lists figure out their common widths and print to out |
|
Print s if thing is less than the verbose_level |
main¶
- nibabel.cmdline.conform.main(args=None)¶
Main program function.
main¶
- nibabel.cmdline.convert.main(args=None)¶
Main program function.
DICOMFS
¶
- class nibabel.cmdline.dicomfs.DICOMFS(*args, **kwargs)¶
Bases:
Fuse
Not much happens here apart from initializing the parser attribute. Arguments are forwarded to the constructor of the parser class almost unchanged.
The parser class is FuseOptParse unless you specify one using the
parser_class
keyword. (See FuseOptParse documentation for available options.)- __init__(*args, **kwargs)¶
Not much happens here apart from initializing the parser attribute. Arguments are forwarded to the constructor of the parser class almost unchanged.
The parser class is FuseOptParse unless you specify one using the
parser_class
keyword. (See FuseOptParse documentation for available options.)
- get_paths()¶
- getattr(path)¶
- match_path(path)¶
- open(path, flags)¶
- read(path, size, offset, fh)¶
- readdir(path, fh)¶
- release(path, flags, fh)¶
FileHandle
¶
dummy_fuse
¶
get_opt_parser¶
- nibabel.cmdline.dicomfs.get_opt_parser()¶
main¶
- nibabel.cmdline.dicomfs.main(args=None)¶
are_values_different¶
- nibabel.cmdline.diff.are_values_different(*values)¶
Generically compare values, return True if different
Note that comparison is targeting reporting of comparison of the headers so has following specifics: - even a difference in data types is considered a difference, i.e. 1 != 1.0 - nans are considered to be the “same”, although generally nan != nan
diff¶
- nibabel.cmdline.diff.diff(files, header_fields='all', data_max_abs_diff=None, data_max_rel_diff=None, dtype=<class 'numpy.float64'>)¶
display_diff¶
- nibabel.cmdline.diff.display_diff(files, diff)¶
Format header differences into a nice string
- Parameters:
- files: list of files that were compared so we can print their names
- diff: dict of different valued header fields
- Returns:
- str
string-formatted table of differences
get_data_diff¶
- nibabel.cmdline.diff.get_data_diff(files, max_abs=0, max_rel=0, dtype=<class 'numpy.float64'>)¶
Get difference between data
- Parameters:
- files: list of (str or ndarray)
If list of strings is provided – they must be existing file names
- max_abs: float, optional
Maximal absolute difference to tolerate.
- max_rel: float, optional
Maximal relative (abs(diff)/mean(diff)) difference to tolerate. If max_abs is specified, then those data points with lesser than that absolute difference, are not considered for relative difference testing
- dtype: np, optional
Datatype to be used when extracting data from files
- Returns:
- diffs: OrderedDict
An ordered dict with a record per each file which has differences with other files subsequent detected. Each record is a list of difference records, one per each file pair. Each difference record is an Ordered Dict with possible keys ‘abs’ or ‘rel’ showing maximal absolute or relative differences in the file or the record (‘CMP’: ‘incompat’) if file shapes are incompatible.
get_data_hash_diff¶
- nibabel.cmdline.diff.get_data_hash_diff(files, dtype=<class 'numpy.float64'>)¶
Get difference between md5 values of data
- Parameters:
- files: list of actual files
- Returns:
- list
np.array: md5 values of respective files
get_headers_diff¶
- nibabel.cmdline.diff.get_headers_diff(file_headers, names=None)¶
Get difference between headers
- Parameters:
- file_headers: list of actual headers (dicts) from files
- names: list of header fields to test
- Returns:
- dict
str: list for each header field which differs, return list of values per each file
get_opt_parser¶
- nibabel.cmdline.diff.get_opt_parser()¶
main¶
- nibabel.cmdline.diff.main(args=None, out=None)¶
Getting the show on the road
get_opt_parser¶
- nibabel.cmdline.ls.get_opt_parser()¶
main¶
- nibabel.cmdline.ls.main(args=None)¶
Show must go on
proc_file¶
- nibabel.cmdline.ls.proc_file(f, opts)¶
main¶
- nibabel.cmdline.nifti_dx.main(args=None)¶
Go go team
error¶
- nibabel.cmdline.parrec2nii.error(msg, exit_code)¶
get_opt_parser¶
- nibabel.cmdline.parrec2nii.get_opt_parser()¶
main¶
- nibabel.cmdline.parrec2nii.main()¶
proc_file¶
- nibabel.cmdline.parrec2nii.proc_file(infile, opts)¶
verbose¶
- nibabel.cmdline.parrec2nii.verbose(msg, indent=0)¶
lossless_slice¶
- nibabel.cmdline.roi.lossless_slice(img, slicers)¶
main¶
- nibabel.cmdline.roi.main(args=None)¶
parse_slice¶
- nibabel.cmdline.roi.parse_slice(crop, allow_step=True)¶
sanitize¶
- nibabel.cmdline.roi.sanitize(args)¶
main¶
- nibabel.cmdline.stats.main(args=None)¶
Main program function.
main¶
- nibabel.cmdline.tck2trk.main()¶
parse_args¶
- nibabel.cmdline.tck2trk.parse_args()¶
main¶
- nibabel.cmdline.trk2tck.main()¶
parse_args¶
- nibabel.cmdline.trk2tck.parse_args()¶
ap¶
- nibabel.cmdline.utils.ap(helplist, format_, sep=', ')¶
Little helper to enforce consistency
safe_get¶
- nibabel.cmdline.utils.safe_get(obj, name)¶
A getattr which would return ‘-’ if getattr fails
table2string¶
- nibabel.cmdline.utils.table2string(table, out=None)¶
Given list of lists figure out their common widths and print to out
- Parameters:
- tablelist of lists of strings
What is aimed to be printed
- outNone or stream
Where to print. If None – will print and return string
- Returns:
- string if out was None
verbose¶
- nibabel.cmdline.utils.verbose(thing, msg)¶
Print s if thing is less than the verbose_level