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)[source]¶ Bases:
objectPerform mathematical manipulation of images.
fslmathsis unlike the other FSL wrapper tools in that it provides an object-oriented method-chaining interface, which is hopefully easier to use than constructing afslmathscommand-line call. For example, the following call to thefslmathswrapper 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
fslmathswrapper 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 anibabelimage. For example:import nibabel as nib input = nib.load('input.nii') output = fslmaths(input).thr(0.25).mul(-1).run()
-
fillh()[source]¶ fill holes in a binary mask (holes are internal - i.e. do not touch the edge of the FOV).
-
uthr(image)[source]¶ use image number to upper-threshold current image (zero anything above the number).
-
bptf(hp_sigma, lp_sigma)[source]¶ Bandpass temporal filtering; nonlinear highpass and Gaussian linear lowpass (with sigmas in volumes, not seconds); set either sigma<0 to skip that filter.
-
run(output=None)[source]¶ Save output of operations to image. Set
outputto a filename to have the result saved to file, or omitoutputentirely to have the result returned as anibabelimage.
-
__run(*cmd)¶ Run the given
fslmathscommand.
-
__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__>, 'abs': <function fslmaths.abs>, 'bin': <function fslmaths.bin>, 'binv': <function fslmaths.binv>, 'recip': <function fslmaths.recip>, 'Tmean': <function fslmaths.Tmean>, 'Tstd': <function fslmaths.Tstd>, 'Tmin': <function fslmaths.Tmin>, 'Tmax': <function fslmaths.Tmax>, 'fillh': <function fslmaths.fillh>, 'ero': <function fslmaths.ero>, 'dilM': <function fslmaths.dilM>, 'dilF': <function fslmaths.dilF>, 'add': <function fslmaths.add>, 'sub': <function fslmaths.sub>, 'mul': <function fslmaths.mul>, 'div': <function fslmaths.div>, 'mas': <function fslmaths.mas>, 'rem': <function fslmaths.rem>, 'thr': <function fslmaths.thr>, 'uthr': <function fslmaths.uthr>, 'inm': <function fslmaths.inm>, 'bptf': <function fslmaths.bptf>, 'run': <function fslmaths.run>, '_fslmaths__run': <function fslmaths.__run>, '__dict__': <attribute '__dict__' of 'fslmaths' objects>, '__weakref__': <attribute '__weakref__' of 'fslmaths' objects>})¶
-
__module__= 'fsl.wrappers.fslmaths'¶
-
__weakref__¶ list of weak references to the object (if defined)
-