Skip to content

Commit 1fc0c51

Browse files
NicolasGensollenghisvail
authored andcommitted
NEW: Add Threshold to fsl.maths (#68)
* add threshold to fsl maths * MNT: Add unit test for Threshold task --------- Co-authored-by: Ghislain Vaillant <[email protected]>
1 parent 2e8c3bc commit 1fc0c51

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/pydra/tasks/fsl/maths.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@
1818
>>> task = Mul(input_image="input.nii", other_image="mask.nii", output_image="output.nii")
1919
>>> task.cmdline
2020
'fslmaths input.nii -mul mask.nii output.nii'
21+
22+
>>> task = Threshold(input_image="input.nii", threshold=0.3, output_image="output.nii")
23+
>>> task.cmdline
24+
'fslmaths input.nii -thr 0.3 output.nii'
2125
"""
2226

23-
__all__ = ["Maths", "MathsSpec", "Mul"]
27+
__all__ = ["Maths", "MathsSpec", "Mul", "Threshold"]
2428

2529
from os import PathLike
2630

@@ -80,6 +84,21 @@ class Mul(Maths):
8084
input_spec = SpecInfo(name="Input", bases=(MulSpec,))
8185

8286

87+
@define(kw_only=True)
88+
class ThresholdSpec(MathsSpec):
89+
"""Specifications for fslmaths' threshold."""
90+
91+
threshold: float = field(
92+
metadata={"help_string": "value for thresholding the image", "mandatory": True, "argstr": "-thr"}
93+
)
94+
95+
96+
class Threshold(Maths):
97+
"""Task definition for fslmaths' threshold."""
98+
99+
input_spec = SpecInfo(name="Input", bases=(ThresholdSpec,))
100+
101+
83102
# TODO: Drop compatibility alias for 0.x
84103
FSLMaths = Maths
85104
FSLMathsSpec = MathsSpec

0 commit comments

Comments
 (0)