26
26
27
27
__all__ = ["FSLMaths" , "Mul" ]
28
28
29
- import os
29
+ from os import PathLike
30
30
31
- import attrs
31
+ from attrs import define , field
32
+ from pydra .engine .specs import ShellSpec , SpecInfo
33
+ from pydra .engine .task import ShellCommandTask
32
34
33
- import pydra
34
35
35
-
36
- @attrs .define (slots = False , kw_only = True )
37
- class FSLMathsSpec (pydra .specs .ShellSpec ):
36
+ @define (slots = False , kw_only = True )
37
+ class FSLMathsSpec (ShellSpec ):
38
38
"""Specifications for fslmaths."""
39
39
40
- _ALLOWED_DATATYPES = {"char" , "short" , "int" , "float" , "double" , "input" }
40
+ _datatypes = {"char" , "short" , "int" , "float" , "double" , "input" }
41
41
42
- datatype : str = attrs .field (
43
- metadata = {
44
- "help_string" : "datatype used for internal computation" ,
45
- "argstr" : "-dt" ,
46
- "position" : 1 ,
47
- "allowed_values" : _ALLOWED_DATATYPES ,
48
- }
42
+ internal_datatype : str = field (
43
+ metadata = {"help_string" : "internal datatype" , "argstr" : "-dt" , "position" : 1 , "allowed_values" : _datatypes }
49
44
)
50
45
51
- input_image : os .PathLike = attrs .field (
52
- metadata = {
53
- "help_string" : "input image" ,
54
- "mandatory" : True ,
55
- "argstr" : "" ,
56
- "position" : 2 ,
57
- }
46
+ input_image : PathLike = field (
47
+ metadata = {"help_string" : "input image" , "mandatory" : True , "argstr" : "" , "position" : 2 }
58
48
)
59
49
60
- output_image : str = attrs . field (
50
+ output_image : str = field (
61
51
metadata = {
62
52
"help_string" : "output image" ,
63
53
"argstr" : "" ,
@@ -66,38 +56,30 @@ class FSLMathsSpec(pydra.specs.ShellSpec):
66
56
}
67
57
)
68
58
69
- output_datatype : str = attrs . field (
59
+ output_datatype : str = field (
70
60
default = "float" ,
71
- metadata = {
72
- "help_string" : "datatype used for output serialization" ,
73
- "argstr" : "-odt" ,
74
- "position" : - 1 ,
75
- "allowed_values" : _ALLOWED_DATATYPES ,
76
- },
61
+ metadata = {"help_string" : "output datatype" , "argstr" : "-odt" , "position" : - 1 , "allowed_values" : _datatypes },
77
62
)
78
63
79
64
80
- class FSLMaths (pydra . engine . ShellCommandTask ):
65
+ class FSLMaths (ShellCommandTask ):
81
66
"""Task definition for fslmaths."""
82
67
83
68
executable = "fslmaths"
84
69
85
- input_spec = pydra . specs . SpecInfo (name = "Input " , bases = (FSLMathsSpec ,))
70
+ input_spec = SpecInfo (name = "Inputs " , bases = (FSLMathsSpec ,))
86
71
87
72
88
- @attrs . define (slots = False , kw_only = True )
89
- class MulSpec (pydra . specs . ShellSpec ):
73
+ @define (kw_only = True )
74
+ class MulSpec (FSLMathsSpec ):
90
75
"""Specifications for fslmaths' mul."""
91
76
92
- other_image : os .PathLike = attrs .field (
93
- metadata = {
94
- "help_string" : "multiply input with other image" ,
95
- "argstr" : "-mul" ,
96
- }
77
+ other_image : PathLike = field (
78
+ metadata = {"help_string" : "multiply input with other image" , "mandatory" : True , "argstr" : "-mul" }
97
79
)
98
80
99
81
100
82
class Mul (FSLMaths ):
101
83
"""Task definition for fslmaths' mul."""
102
84
103
- input_spec = pydra . specs . SpecInfo (name = "Input " , bases = (FSLMathsSpec , MulSpec ))
85
+ input_spec = SpecInfo (name = "Inputs " , bases = (MulSpec , ))
0 commit comments