cmdline
¶
Functionality to be exposed in the command line
Module: cmdline.dicomfs
¶
DICOMFS (\*args, \*\*kwargs) |
|
FileHandle (fno) |
|
dummy_fuse |
Dummy fuse “module” so that nose does not blow during doctests |
get_opt_parser () |
|
main ([args]) |
Module: cmdline.diff
¶
Quick summary of the differences among a set of neuroimaging files
are_values_different (\*values) |
Generically compare values, return True if different |
diff (files[, header_fields, ...]) |
|
display_diff (files, diff) |
Format header differences into a nice string |
get_data_diff (files[, max_abs, max_rel, dtype]) |
Get difference between data |
get_data_hash_diff (files[, dtype]) |
Get difference between md5 values of data |
get_headers_diff (file_headers[, names]) |
Get difference between headers |
get_opt_parser () |
|
main ([args, out]) |
Getting the show on the road |
Module: cmdline.ls
¶
Output a summary table for neuroimaging files (resolution, dimensionality, etc.)
get_opt_parser () |
|
main ([args]) |
Show must go on |
proc_file (f, opts) |
Module: cmdline.parrec2nii
¶
Code for PAR/REC to NIfTI converter command
error (msg, exit_code) |
|
get_opt_parser () |
|
main () |
|
proc_file (infile, opts) |
|
verbose (msg[, indent]) |
Module: cmdline.utils
¶
Helper utilities to be used in cmdline applications
ap (helplist, format_[, sep]) |
Little helper to enforce consistency |
safe_get (obj, name) |
A getattr which would return ‘-‘ if getattr fails |
table2string (table[, out]) |
Given list of lists figure out their common widths and print to out |
verbose (thing, msg) |
Print s if thing is less than the verbose_level |
are_values_different¶
-
nibabel.cmdline.diff.
are_values_different
(*values)¶ Generically compare values, return True if different
Note that comparison is targetting 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=<type '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=<type '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=<type '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
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: table : list of lists of strings
What is aimed to be printed
out : None or stream
Where to print. If None – will print and return string
Returns: string if out was None