wrappers - Wrappers for generic imaging functions

simple wrappers for external programs

In general, functions are written independent of analysis package (although most of them are only implemented for AFNI right now)

wrappers.common.available_method(method_name)[source]

ruturn the method for earliest package in pkg_preferences, if package is available (based on pkg_available())

wrappers.common.blur(dset, fwhm, prefix=None)[source]

blurs dset with given fwhm runs 3dmerge to blur dataset to given fwhm default prefix is to suffix dset with _blur%.1fmm

wrappers.common.calc(dsets, expr, prefix=None, datum=None)[source]

returns a string of an inline 3dcalc-style expression

dsets can be a single string, or list of strings. Each string in dsets will be labeled ‘a’,’b’,’c’, sequentially. The expression expr is used directly

If prefix is not given, will return a 3dcalc string that can be passed to another AFNI program as a dataset. Otherwise, will create the dataset with the name prefix

wrappers.common.cdf(dset, p)[source]

converts p-values to the appropriate statistic for the specified subbrick

wrappers.common.cluster(dset, min_distance, min_cluster_size, prefix=None)[source]

clusters given dset connecting voxels min_distance``mm away with minimum cluster size of ``min_cluster_size default prefix is dset suffixed with _clust%d

wrappers.common.method_prefs = {'skull_strip': 'fsl'}

Specific methods for which the default pkg_prefs order should be overriden

wrappers.common.pkg_available(pkg_name, required=False)[source]

tests if analysis package is available on this machine (e.g., “afni” or “fsl”), and prints an error if required

wrappers.common.pkg_prefs = ['afni', 'fsl']

Order that packages are checked for methods

wrappers.common.roi_stats(mask, dset)[source]

returns ROI stats on dset using mask as the ROI mask returns a dictionary with the structure:

{
    ROI: {
        {keys: stat}
            ...
    },
    ...
}

keys:

:mean:
:median:
:mode:
:nzmean:
:nzmedian:
:nzmode:
:nzvoxels:
:min:
:max:
:nzmin:
:nzmax:
:sigma:
:nzsigma:
:sum:
:nzsum:
wrappers.common.segment(dset)[source]

segment dset into WM/GM/CSF

wrappers.common.skull_strip(dset, suffix='_ns', prefix=None, unifize=True)[source]

attempts to cleanly remove skull from dset

wrappers.common.thresh(dset, p, positive_only=False, prefix=None)[source]

returns a string containing an inline 3dcalc command that thresholds the given dataset at the specified p-value, or will create a new dataset if a suffix or prefix is given

wrappers.common.tshift(dset, suffix='_tshft', initial_ignore=3)[source]

applies slice-time based interpolation of raw data