fsl.wrappers.fslmaths
This module provides the fslmaths
class, which acts as a wrapper
for the fslmaths
command-line tool.
- class fsl.wrappers.fslmaths.fslmaths(input, dt=None)[source]
Bases:
object
Perform mathematical manipulation of images.
fslmaths
is unlike the other FSL wrapper tools in that it provides an object-oriented method-chaining interface, which is hopefully easier to use than constructing afslmaths
command-line call. For example, the following call to thefslmaths
wrapper function:fslmaths('input.nii').thr(0.25).mul(-1).run('output.nii')
will be translated into the following command-line call:
fslmaths input.nii -thr 0.25 -mul -1 output.nii
The
fslmaths
wrapper function can also be used with in-memory images. If no output file name is passed to therun()
method, the result is loaded into memory and returned as anibabel
image. For example:import nibabel as nib input = nib.load('input.nii') output = fslmaths(input).thr(0.25).mul(-1).run()
- addargs()[source]
Decorator used by fslmaths methods. Allows them to just return a list of arguments to add to the command invocation.
- smooth(*args, **kwargs)
- run(output=None, odt=None, **kwargs)[source]
Save output of operations to image. Set
output
to a filename to have the result saved to file, or omitoutput
entirely to have the result returned as anibabel
image.All other arguments are ultimately passed through to the
fsl.utils.run.run()
function.
- __run(*cmd)
Run the given
fslmaths
command.
- __dict__ = mappingproxy({'__module__': 'fsl.wrappers.fslmaths', '__doc__': "Perform mathematical manipulation of images.\n\n ``fslmaths`` is unlike the other FSL wrapper tools in that it provides an\n object-oriented method-chaining interface, which is hopefully easier to\n use than constructing a ``fslmaths`` command-line call. For example, the\n following call to the ``fslmaths`` wrapper function::\n\n fslmaths('input.nii').thr(0.25).mul(-1).run('output.nii')\n\n will be translated into the following command-line call::\n\n fslmaths input.nii -thr 0.25 -mul -1 output.nii\n\n The ``fslmaths`` wrapper function can also be used with in-memory\n images. If no output file name is passed to the :meth:`run` method, the\n result is loaded into memory and returned as a ``nibabel`` image. For\n example::\n\n import nibabel as nib\n input = nib.load('input.nii')\n output = fslmaths(input).thr(0.25).mul(-1).run()\n ", '__init__': <function fslmaths.__init__>, 'addargs': <function fslmaths.addargs>, 'add': <function fslmaths.addargs.<locals>.wrapper>, 'sub': <function fslmaths.addargs.<locals>.wrapper>, 'mul': <function fslmaths.addargs.<locals>.wrapper>, 'div': <function fslmaths.addargs.<locals>.wrapper>, 'rem': <function fslmaths.addargs.<locals>.wrapper>, 'mas': <function fslmaths.addargs.<locals>.wrapper>, 'thr': <function fslmaths.addargs.<locals>.wrapper>, 'thrp': <function fslmaths.addargs.<locals>.wrapper>, 'thrP': <function fslmaths.addargs.<locals>.wrapper>, 'uthr': <function fslmaths.addargs.<locals>.wrapper>, 'uthrp': <function fslmaths.addargs.<locals>.wrapper>, 'uthrP': <function fslmaths.addargs.<locals>.wrapper>, 'max': <function fslmaths.addargs.<locals>.wrapper>, 'min': <function fslmaths.addargs.<locals>.wrapper>, 'seed': <function fslmaths.addargs.<locals>.wrapper>, 'restart': <function fslmaths.addargs.<locals>.wrapper>, 'save': <function fslmaths.addargs.<locals>.wrapper>, 'exp': <function fslmaths.addargs.<locals>.wrapper>, 'log': <function fslmaths.addargs.<locals>.wrapper>, 'sin': <function fslmaths.addargs.<locals>.wrapper>, 'cos': <function fslmaths.addargs.<locals>.wrapper>, 'tan': <function fslmaths.addargs.<locals>.wrapper>, 'asin': <function fslmaths.addargs.<locals>.wrapper>, 'acos': <function fslmaths.addargs.<locals>.wrapper>, 'atan': <function fslmaths.addargs.<locals>.wrapper>, 'sqr': <function fslmaths.addargs.<locals>.wrapper>, 'sqrt': <function fslmaths.addargs.<locals>.wrapper>, 'recip': <function fslmaths.addargs.<locals>.wrapper>, 'abs': <function fslmaths.addargs.<locals>.wrapper>, 'bin': <function fslmaths.addargs.<locals>.wrapper>, 'binv': <function fslmaths.addargs.<locals>.wrapper>, 'fillh': <function fslmaths.addargs.<locals>.wrapper>, 'fillh26': <function fslmaths.addargs.<locals>.wrapper>, 'index': <function fslmaths.addargs.<locals>.wrapper>, 'grid': <function fslmaths.addargs.<locals>.wrapper>, 'edge': <function fslmaths.addargs.<locals>.wrapper>, 'dog_edge': <function fslmaths.addargs.<locals>.wrapper>, 'tfce': <function fslmaths.addargs.<locals>.wrapper>, 'tfceS': <function fslmaths.addargs.<locals>.wrapper>, 'nan': <function fslmaths.addargs.<locals>.wrapper>, 'nanm': <function fslmaths.addargs.<locals>.wrapper>, 'rand': <function fslmaths.addargs.<locals>.wrapper>, 'randn': <function fslmaths.addargs.<locals>.wrapper>, 'inm': <function fslmaths.addargs.<locals>.wrapper>, 'ing': <function fslmaths.addargs.<locals>.wrapper>, 'range': <function fslmaths.addargs.<locals>.wrapper>, 'tensor_decomp': <function fslmaths.addargs.<locals>.wrapper>, 'kernel': <function fslmaths.addargs.<locals>.wrapper>, 'dilM': <function fslmaths.addargs.<locals>.wrapper>, 'dilD': <function fslmaths.addargs.<locals>.wrapper>, 'dilF': <function fslmaths.addargs.<locals>.wrapper>, 'dilall': <function fslmaths.addargs.<locals>.wrapper>, 'ero': <function fslmaths.addargs.<locals>.wrapper>, 'eroF': <function fslmaths.addargs.<locals>.wrapper>, 'fmedian': <function fslmaths.addargs.<locals>.wrapper>, 'fmean': <function fslmaths.addargs.<locals>.wrapper>, 'fmeanu': <function fslmaths.addargs.<locals>.wrapper>, 's': <function fslmaths.addargs.<locals>.wrapper>, 'smooth': <function fslmaths.addargs.<locals>.wrapper>, 'subsamp2': <function fslmaths.addargs.<locals>.wrapper>, 'subsamp2offc': <function fslmaths.addargs.<locals>.wrapper>, 'Tmean': <function fslmaths.addargs.<locals>.wrapper>, 'Tstd': <function fslmaths.addargs.<locals>.wrapper>, 'Tmin': <function fslmaths.addargs.<locals>.wrapper>, 'Tmax': <function fslmaths.addargs.<locals>.wrapper>, 'Tmaxn': <function fslmaths.addargs.<locals>.wrapper>, 'Tmedian': <function fslmaths.addargs.<locals>.wrapper>, 'Tperc': <function fslmaths.addargs.<locals>.wrapper>, 'Tar1': <function fslmaths.addargs.<locals>.wrapper>, 'pval': <function fslmaths.addargs.<locals>.wrapper>, 'pval0': <function fslmaths.addargs.<locals>.wrapper>, 'cpval': <function fslmaths.addargs.<locals>.wrapper>, 'ztop': <function fslmaths.addargs.<locals>.wrapper>, 'ptoz': <function fslmaths.addargs.<locals>.wrapper>, 'rank': <function fslmaths.addargs.<locals>.wrapper>, 'ranknorm': <function fslmaths.addargs.<locals>.wrapper>, 'roi': <function fslmaths.addargs.<locals>.wrapper>, 'bptf': <function fslmaths.addargs.<locals>.wrapper>, 'run': <function fslmaths.run>, '_fslmaths__run': <function fslmaths.__run>, '__dict__': <attribute '__dict__' of 'fslmaths' objects>, '__weakref__': <attribute '__weakref__' of 'fslmaths' objects>, '__annotations__': {}})
- __module__ = 'fsl.wrappers.fslmaths'
- __weakref__
list of weak references to the object (if defined)