Commit 6591fca6 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'enh/fslmaths-roi' into 'master'

Enh/fslmaths roi

See merge request fsl/fslpy!346
parents 0f917661 dc44b462
Pipeline #14727 canceled with stages
in 5 seconds
......@@ -2,6 +2,19 @@ This document contains the ``fslpy`` release history in reverse chronological
order.
3.9.6 (Wednesday 15th June 2022)
--------------------------------
Added
^^^^^
* The `.fslmaths` wrapper now supports the ``-roi`` option, via the
:meth:`.fslmaths.roi` method (!346).
3.9.5 (Thursday 2nd June 2022)
------------------------------
......
......@@ -173,6 +173,13 @@ class fslmaths(object):
self.__args.append("-fmeanu")
return self
def roi(self, xmin, xsize, ymin, ysize, zmin, zsize, tmin=0, tsize=-1):
"""Zero outside ROI (using voxel coordinates). """
self.__args.extend(('-roi',
xmin, xsize, ymin, ysize,
zmin, zsize, tmin, tsize))
return self
def run(self, output=None):
"""Save output of operations to image. Set ``output`` to a filename to have
the result saved to file, or omit ``output`` entirely to have the
......
......@@ -321,7 +321,8 @@ def test_fslmaths():
.fillh().ero().dilM().dilF().add('addim').sub('subim') \
.mul('mulim').div('divim').mas('masim').rem('remim') \
.thr('thrim').uthr('uthrim').inm('inmim').bptf(1, 10) \
.smooth(sigma=6).kernel('3D').fmeanu().run('output')
.smooth(sigma=6).kernel('3D').fmeanu().roi(10, 3, 20, 21, 1, 5) \
.run('output')
expected = [cmd, 'input',
'-abs', '-bin', '-binv', '-recip', '-Tmean', '-Tstd',
......@@ -329,6 +330,7 @@ def test_fslmaths():
'-add addim', '-sub subim', '-mul mulim', '-div divim',
'-mas masim', '-rem remim', '-thr thrim', '-uthr uthrim',
'-inm inmim', '-bptf 1 10', '-s 6', '-kernel 3D', '-fmeanu',
'-roi 10 3 20 21 1 5 0 -1',
'output']
expected = ' '.join(expected)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment