9
9
10
10
Convert input image to float:
11
11
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'
15
15
16
- Apply mask to input image:
16
+ Multiply input image with a binary mask :
17
17
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")
23
19
>>> task.cmdline
24
- 'fslmaths input.nii -mul mask.nii output.nii -odt float '
20
+ 'fslmaths input.nii -mul mask.nii output.nii'
25
21
"""
26
22
27
- __all__ = ["FSLMaths " , "Mul" ]
23
+ __all__ = ["Maths" , "MathsSpec " , "Mul" ]
28
24
29
25
from os import PathLike
30
26
33
29
from pydra .engine .task import ShellCommandTask
34
30
35
31
36
- @define (slots = False , kw_only = True )
37
- class FSLMathsSpec (ShellSpec ):
32
+ @define (kw_only = True )
33
+ class MathsSpec (ShellSpec ):
38
34
"""Specifications for fslmaths."""
39
35
40
36
_datatypes = {"char" , "short" , "int" , "float" , "double" , "input" }
@@ -57,29 +53,34 @@ class FSLMathsSpec(ShellSpec):
57
53
)
58
54
59
55
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 }
62
57
)
63
58
64
59
65
- class FSLMaths (ShellCommandTask ):
60
+ class Maths (ShellCommandTask ):
66
61
"""Task definition for fslmaths."""
67
62
68
63
executable = "fslmaths"
69
64
70
- input_spec = SpecInfo (name = "Input" , bases = (FSLMathsSpec ,))
65
+ input_spec = SpecInfo (name = "Input" , bases = (MathsSpec ,))
71
66
72
67
73
68
@define (kw_only = True )
74
- class MulSpec (FSLMathsSpec ):
69
+ class MulSpec (MathsSpec ):
75
70
"""Specifications for fslmaths' mul."""
76
71
77
72
other_image : PathLike = field (
78
73
metadata = {"help_string" : "multiply input with other image" , "mandatory" : True , "argstr" : "-mul" }
79
74
)
80
75
81
76
82
- class Mul (FSLMaths ):
77
+ class Mul (Maths ):
83
78
"""Task definition for fslmaths' mul."""
84
79
85
80
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