Commit 57348825 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'evan-patch-smooth' into 'master'

ENH: add fslmaths simple smoothing

See merge request fsl/fslpy!271
parents 990f1d94 75ed6335
...@@ -105,6 +105,11 @@ class fslmaths(object): ...@@ -105,6 +105,11 @@ class fslmaths(object):
self.__args.append("-dilF") self.__args.append("-dilF")
return self return self
def smooth(self, sigma):
"""Spatial smoothing - mean filtering using a gauss kernel of sigma mm"""
self.__args.extend(("-s", sigma))
return self
def add(self, image): def add(self, image):
"""Add input to current image.""" """Add input to current image."""
self.__args.extend(("-add", image)) self.__args.extend(("-add", image))
...@@ -290,14 +290,15 @@ def test_fslmaths(): ...@@ -290,14 +290,15 @@ def test_fslmaths():
.abs().bin().binv().recip().Tmean().Tstd().Tmin().Tmax() \ .abs().bin().binv().recip().Tmean().Tstd().Tmin().Tmax() \
.fillh().ero().dilM().dilF().add('addim').sub('subim') \ .fillh().ero().dilM().dilF().add('addim').sub('subim') \
.mul('mulim').div('divim').mas('masim').rem('remim') \ .mul('mulim').div('divim').mas('masim').rem('remim') \
.thr('thrim').uthr('uthrim').inm('inmim').bptf(1, 10).run('output') .thr('thrim').uthr('uthrim').inm('inmim').bptf(1, 10) \
expected = [cmd, 'input', expected = [cmd, 'input',
'-abs', '-bin', '-binv', '-recip', '-Tmean', '-Tstd', '-abs', '-bin', '-binv', '-recip', '-Tmean', '-Tstd',
'-Tmin', '-Tmax', '-fillh', '-ero', '-dilM', '-dilF', '-Tmin', '-Tmax', '-fillh', '-ero', '-dilM', '-dilF',
'-add addim', '-sub subim', '-mul mulim', '-div divim', '-add addim', '-sub subim', '-mul mulim', '-div divim',
'-mas masim', '-rem remim', '-thr thrim', '-uthr uthrim', '-mas masim', '-rem remim', '-thr thrim', '-uthr uthrim',
'-inm inmim', '-bptf 1 10', 'output'] '-inm inmim', '-bptf 1 10', '-s 6', 'output']
expected = ' '.join(expected) expected = ' '.join(expected)
assert result.stdout[0] == expected assert result.stdout[0] == 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