Skip to content

Commit 8af8e47

Browse files
ghisvailtclose
authored andcommitted
ENH: Drop FSL prefix from maths (#60)
1 parent 6ca81ad commit 8af8e47

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ for FMRI, MRI and DTI brain imaging data.
2626

2727
## Available tasks
2828

29-
| Module | Tasks |
30-
|----------|--------------------------------------------------------------------------------------------------------------------|
31-
| bet | BET, RobustFOV |
32-
| eddy | Eddy, ApplyTopup, Topup |
33-
| fast | FAST |
34-
| flirt | FLIRT, ApplyXFM, ConcatXFM, ConvertXFM, InvertXFM, FixScaleSkew, Img2ImgCoord, Img2StdCoord, Std2ImgCoord |
35-
| fnirt | FNIRT, FNIRTFileUtils, ApplyWarp, ConvertWarp, InvWarp |
36-
| fugue | FUGUE, PrepareFieldmap, Prelude, SigLoss |
37-
| fslmaths | (**experimental**) FSLMaths, Mul |
38-
| susan | SUSAN |
39-
| utils | ChFileType, FFT, Info, Interleave, Merge, Orient, Reorient2Std, ROI, SelectVols, Slice, SmoothFill, Split, SwapDim |
29+
| Module | Tasks |
30+
|--------|--------------------------------------------------------------------------------------------------------------------|
31+
| bet | BET, RobustFOV |
32+
| eddy | Eddy, ApplyTopup, Topup |
33+
| fast | FAST |
34+
| flirt | FLIRT, ApplyXFM, ConcatXFM, ConvertXFM, InvertXFM, FixScaleSkew, Img2ImgCoord, Img2StdCoord, Std2ImgCoord |
35+
| fnirt | FNIRT, FNIRTFileUtils, ApplyWarp, ConvertWarp, InvWarp |
36+
| fugue | FUGUE, PrepareFieldmap, Prelude, SigLoss |
37+
| maths | (**experimental**) Maths, Mul |
38+
| susan | SUSAN |
39+
| utils | ChFileType, FFT, Info, Interleave, Merge, Orient, Reorient2Std, ROI, SelectVols, Slice, SmoothFill, Split, SwapDim |
4040

4141
## Installation
4242

src/pydra/tasks/fsl/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
.. automodule:: pydra.tasks.fsl.utils
1818
"""
1919

20-
from . import fslmaths
20+
from . import maths
2121
from .bet import BET, RobustFOV
2222
from .eddy import ApplyTopup, Eddy, Topup
2323
from .fast import FAST
@@ -66,3 +66,4 @@
6666
FSLSmoothFill = SmoothFill
6767
FSLSplit = Split
6868
FSLSwapDim = SwapDim
69+
fslmaths = maths

src/pydra/tasks/fsl/fslmaths.py renamed to src/pydra/tasks/fsl/maths.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,18 @@
99
1010
Convert input image to float:
1111
12-
>>> task = FSLMaths(input_image="input.nii")
13-
>>> task.cmdline # doctest: +ELLIPSIS
14-
'fslmaths input.nii .../input_fslmaths.nii -odt float'
12+
>>> task = Maths(input_image="input.nii")
13+
>>> task.cmdline # doctest: +ELLIPSIS
14+
'fslmaths input.nii .../input_fslmaths.nii'
1515
16-
Apply mask to input image:
16+
Multiply input image with a binary mask:
1717
18-
>>> task = Mul(
19-
... input_image="input.nii",
20-
... other_image="mask.nii",
21-
... output_image="output.nii",
22-
... )
18+
>>> task = Mul(input_image="input.nii", other_image="mask.nii", output_image="output.nii")
2319
>>> task.cmdline
24-
'fslmaths input.nii -mul mask.nii output.nii -odt float'
20+
'fslmaths input.nii -mul mask.nii output.nii'
2521
"""
2622

27-
__all__ = ["FSLMaths", "Mul"]
23+
__all__ = ["Maths", "MathsSpec", "Mul"]
2824

2925
from os import PathLike
3026

@@ -33,8 +29,8 @@
3329
from pydra.engine.task import ShellCommandTask
3430

3531

36-
@define(slots=False, kw_only=True)
37-
class FSLMathsSpec(ShellSpec):
32+
@define(kw_only=True)
33+
class MathsSpec(ShellSpec):
3834
"""Specifications for fslmaths."""
3935

4036
_datatypes = {"char", "short", "int", "float", "double", "input"}
@@ -57,29 +53,34 @@ class FSLMathsSpec(ShellSpec):
5753
)
5854

5955
output_datatype: str = field(
60-
default="float",
61-
metadata={"help_string": "output datatype", "argstr": "-odt", "position": -1, "allowed_values": _datatypes},
56+
metadata={"help_string": "output datatype", "argstr": "-odt", "position": -1, "allowed_values": _datatypes}
6257
)
6358

6459

65-
class FSLMaths(ShellCommandTask):
60+
class Maths(ShellCommandTask):
6661
"""Task definition for fslmaths."""
6762

6863
executable = "fslmaths"
6964

70-
input_spec = SpecInfo(name="Input", bases=(FSLMathsSpec,))
65+
input_spec = SpecInfo(name="Input", bases=(MathsSpec,))
7166

7267

7368
@define(kw_only=True)
74-
class MulSpec(FSLMathsSpec):
69+
class MulSpec(MathsSpec):
7570
"""Specifications for fslmaths' mul."""
7671

7772
other_image: PathLike = field(
7873
metadata={"help_string": "multiply input with other image", "mandatory": True, "argstr": "-mul"}
7974
)
8075

8176

82-
class Mul(FSLMaths):
77+
class Mul(Maths):
8378
"""Task definition for fslmaths' mul."""
8479

8580
input_spec = SpecInfo(name="Input", bases=(MulSpec,))
81+
82+
83+
# TODO: Drop compatibility alias for 0.x
84+
FSLMaths = Maths
85+
FSLMathsSpec = MathsSpec
86+
__all__ += ["FSLMaths", "FSLMathsSpec"]

0 commit comments

Comments
 (0)