Skip to content

Commit d61ae90

Browse files
committed
updated import location to v7_4 sub-package
1 parent d5c6d36 commit d61ae90

21 files changed

+341
-116
lines changed

pydra/tasks/freesurfer/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
imported.
44
55
>>> import pydra.engine
6-
>>> import pydra.tasks.freesurfer
6+
>>> import pydra.tasks.freesurfer.v7_4
77
"""
88

99
from warnings import warn
@@ -25,7 +25,7 @@
2525
warn(
2626
"Nipype interfaces haven't been automatically converted from their specs in "
2727
f"`nipype-auto-conv`. Please run `{str(pkg_path / 'nipype-auto-conv' / 'generate')}` "
28-
"to generated the converted Nipype interfaces in pydra.tasks.freesurfer.auto"
28+
"to generated the converted Nipype interfaces in pydra.tasks.freesurfer.v7_4.auto"
2929
)
3030
else:
3131
n_ver = nipype_version.replace(".", "_")

pydra/tasks/freesurfer/v7_4/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@
44
55
The main task definition for recon-all can be imported directly from the root package.
66
7-
>>> from pydra.tasks.freesurfer import ReconAll
7+
>>> from pydra.tasks.freesurfer.v7_4 import ReconAll
88
99
Additional task definitions are available under the :mod:`recon_all` namespace
1010
for more advanced use cases.
1111
12-
>>> from pydra.tasks.freesurfer.recon_all import BaseReconAll, LongReconAll
12+
>>> from pydra.tasks.freesurfer.v7_4.recon_all import BaseReconAll, LongReconAll
1313
1414
2. Volume Utilities
1515
1616
Task definitions for volume processing utilities are available under the :mod:`mri` namespace.
1717
18-
>>> from pydra.tasks.freesurfer import mri
18+
>>> from pydra.tasks.freesurfer.v7_4 import mri
1919
2020
3. Surface Utilities
2121
2222
Task definitions for surface processing utilities are available under the :mod:`mris` namespace.
2323
24-
>>> from pydra.tasks.freesurfer import mris
24+
>>> from pydra.tasks.freesurfer.v7_4 import mris
2525
26-
.. automodule:: pydra.tasks.freesurfer.gtmseg
27-
.. automodule:: pydra.tasks.freesurfer.mri
28-
.. automodule:: pydra.tasks.freesurfer.mris
29-
.. automodule:: pydra.tasks.freesurfer.recon_all
30-
.. automodule:: pydra.tasks.freesurfer.tkregister2
26+
.. automodule:: pydra.tasks.freesurfer.v7_4.gtmseg
27+
.. automodule:: pydra.tasks.freesurfer.v7_4.mri
28+
.. automodule:: pydra.tasks.freesurfer.v7_4.mris
29+
.. automodule:: pydra.tasks.freesurfer.v7_4.recon_all
30+
.. automodule:: pydra.tasks.freesurfer.v7_4.tkregister2
3131
"""
3232

3333
from .gtmseg import GTMSeg

pydra/tasks/freesurfer/v7_4/gtmseg.py

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,37 @@
3737

3838
from pydra.engine.specs import ShellSpec, SpecInfo
3939
from pydra.engine.task import ShellCommandTask
40-
from pydra.tasks.freesurfer import specs
40+
from pydra.tasks.freesurfer.v7_4 import specs
4141

4242

4343
@define(kw_only=True)
4444
class GTMSegSpec(ShellSpec):
4545
"""Specifications for gtmseg."""
4646

47-
subject_id: str = field(metadata={"help_string": "subject identifier", "mandatory": True, "argstr": "--s"})
47+
subject_id: str = field(
48+
metadata={
49+
"help_string": "subject identifier",
50+
"mandatory": True,
51+
"argstr": "--s",
52+
}
53+
)
4854

4955
output_volume: str = field(
5056
default="gtmseg.mgz",
51-
metadata={"help_string": "output volume relative to the subject's mri directory", "argstr": "--o"},
57+
metadata={
58+
"help_string": "output volume relative to the subject's mri directory",
59+
"argstr": "--o",
60+
},
5261
)
5362

5463
generate_segmentation: bool = field(
5564
metadata={
5665
"help_string": "generate or use subject's head segmentation",
5766
"mandatory": True,
5867
"formatter": lambda generate_segmentation: (
59-
"" if generate_segmentation is NOTHING else "--xcerseg" if generate_segmentation else "--no-xcerseg"
68+
""
69+
if generate_segmentation is NOTHING
70+
else "--xcerseg" if generate_segmentation else "--no-xcerseg"
6071
),
6172
"xor": {"head_segmentation"},
6273
}
@@ -87,9 +98,13 @@ class GTMSegSpec(ShellSpec):
8798
}
8899
)
89100

90-
colortable: str = field(metadata={"help_string": "use custom colortable", "argstr": "--ctab"})
101+
colortable: str = field(
102+
metadata={"help_string": "use custom colortable", "argstr": "--ctab"}
103+
)
91104

92-
upsampling_factor: int = field(metadata={"help_string": "upsampling factor (defaults to 2)", "argstr": "--usf"})
105+
upsampling_factor: int = field(
106+
metadata={"help_string": "upsampling factor (defaults to 2)", "argstr": "--usf"}
107+
)
93108

94109
output_upsampling_factor: int = field(
95110
metadata={
@@ -99,15 +114,24 @@ class GTMSegSpec(ShellSpec):
99114
)
100115

101116
keep_hypointensities: bool = field(
102-
metadata={"help_string": "do not relabel hypointensities as white matter", "argstr": "--keep-hypo"}
117+
metadata={
118+
"help_string": "do not relabel hypointensities as white matter",
119+
"argstr": "--keep-hypo",
120+
}
103121
)
104122

105123
keep_corpus_callosum: bool = field(
106-
metadata={"help_string": "do not relabel corpus callosum as white matter", "argstr": "--keep-cc"}
124+
metadata={
125+
"help_string": "do not relabel corpus callosum as white matter",
126+
"argstr": "--keep-cc",
127+
}
107128
)
108129

109130
subsegment_white_matter: bool = field(
110-
metadata={"help_string": "subsegment white matter into lobes", "argstr": "--subsegwm"}
131+
metadata={
132+
"help_string": "subsegment white matter into lobes",
133+
"argstr": "--subsegwm",
134+
}
111135
)
112136

113137

pydra/tasks/freesurfer/v7_4/mri/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
Volume Utilities
33
================
44
5-
.. automodule:: pydra.tasks.freesurfer.mri.aparc2aseg
6-
.. automodule:: pydra.tasks.freesurfer.mri.binarize
7-
.. automodule:: pydra.tasks.freesurfer.mri.convert
8-
.. automodule:: pydra.tasks.freesurfer.mri.coreg
9-
.. automodule:: pydra.tasks.freesurfer.mri.label2vol
10-
.. automodule:: pydra.tasks.freesurfer.mri.robust_register
11-
.. automodule:: pydra.tasks.freesurfer.mri.robust_template
12-
.. automodule:: pydra.tasks.freesurfer.mri.surf2surf
13-
.. automodule:: pydra.tasks.freesurfer.mri.vol2vol
5+
.. automodule:: pydra.tasks.freesurfer.v7_4.mri.aparc2aseg
6+
.. automodule:: pydra.tasks.freesurfer.v7_4.mri.binarize
7+
.. automodule:: pydra.tasks.freesurfer.v7_4.mri.convert
8+
.. automodule:: pydra.tasks.freesurfer.v7_4.mri.coreg
9+
.. automodule:: pydra.tasks.freesurfer.v7_4.mri.label2vol
10+
.. automodule:: pydra.tasks.freesurfer.v7_4.mri.robust_register
11+
.. automodule:: pydra.tasks.freesurfer.v7_4.mri.robust_template
12+
.. automodule:: pydra.tasks.freesurfer.v7_4.mri.surf2surf
13+
.. automodule:: pydra.tasks.freesurfer.v7_4.mri.vol2vol
1414
"""

pydra/tasks/freesurfer/v7_4/mri/aparc2aseg.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,24 @@
2121

2222
from pydra.engine.specs import ShellSpec, SpecInfo
2323
from pydra.engine.task import ShellCommandTask
24-
from pydra.tasks.freesurfer import specs
24+
from pydra.tasks.freesurfer.v7_4 import specs
2525

2626

2727
@define(slots=False, kw_only=True)
2828
class Aparc2AsegSpec(ShellSpec):
2929
"""Specifications for mri_aparc2aseg."""
3030

31-
subject_id: str = field(metadata={"help_string": "subject identifier", "mandatory": True, "argstr": "--s"})
31+
subject_id: str = field(
32+
metadata={
33+
"help_string": "subject identifier",
34+
"mandatory": True,
35+
"argstr": "--s",
36+
}
37+
)
3238

3339
output_image: str = field(
34-
default="mri/aparc+aseg.mgz", metadata={"help_string": "output segmented volume", "argstr": "--o"}
40+
default="mri/aparc+aseg.mgz",
41+
metadata={"help_string": "output segmented volume", "argstr": "--o"},
3542
)
3643

3744
cortex_mask: str = field(
@@ -68,14 +75,20 @@ class Aparc2AsegSpec(ShellSpec):
6875
)
6976

7077
num_threads: int = field(
71-
metadata={"help_string": "run in parallel with this number of threads", "argstr": "--nthreads"}
78+
metadata={
79+
"help_string": "run in parallel with this number of threads",
80+
"argstr": "--nthreads",
81+
}
7282
)
7383

7484

7585
class Aparc2Aseg(ShellCommandTask):
7686
"""Task definition for mri_aparc2aseg."""
7787

78-
input_spec = SpecInfo(name="Input", bases=(Aparc2AsegSpec, specs.HemisphereSpec, specs.SubjectsDirSpec))
88+
input_spec = SpecInfo(
89+
name="Input",
90+
bases=(Aparc2AsegSpec, specs.HemisphereSpec, specs.SubjectsDirSpec),
91+
)
7992

8093
output_spec = SpecInfo(name="Output", bases=(specs.SubjectsDirOutSpec,))
8194

pydra/tasks/freesurfer/v7_4/mri/label2vol.py

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,29 +93,51 @@
9393

9494
from pydra.engine.specs import ShellSpec, SpecInfo
9595
from pydra.engine.task import ShellCommandTask
96-
from pydra.tasks.freesurfer import specs
96+
from pydra.tasks.freesurfer.v7_4 import specs
9797

9898

9999
@define(kw_only=True)
100100
class Label2VolSpec(ShellSpec):
101101
"""Specifications for mri_label2vol."""
102102

103-
_xor = frozenset(["label_file", "label_files", "annotation_file", "segmentation_file"])
103+
_xor = frozenset(
104+
["label_file", "label_files", "annotation_file", "segmentation_file"]
105+
)
104106

105107
label_file: PathLike = field(
106-
metadata={"help_string": "label file", "mandatory": True, "argstr": "--label", "xor": _xor}
108+
metadata={
109+
"help_string": "label file",
110+
"mandatory": True,
111+
"argstr": "--label",
112+
"xor": _xor,
113+
}
107114
)
108115

109116
label_files: Sequence[PathLike] = field(
110-
metadata={"help_string": "label files", "mandatory": True, "argstr": "--label ...", "xor": _xor}
117+
metadata={
118+
"help_string": "label files",
119+
"mandatory": True,
120+
"argstr": "--label ...",
121+
"xor": _xor,
122+
}
111123
)
112124

113125
annotation_file: PathLike = field(
114-
metadata={"help_string": "annotation file", "mandatory": True, "argstr": "--annot", "xor": _xor}
126+
metadata={
127+
"help_string": "annotation file",
128+
"mandatory": True,
129+
"argstr": "--annot",
130+
"xor": _xor,
131+
}
115132
)
116133

117134
segmentation_file: PathLike = field(
118-
metadata={"help_string": "segmentation file", "mandatory": True, "argstr": "--seg", "xor": _xor}
135+
metadata={
136+
"help_string": "segmentation file",
137+
"mandatory": True,
138+
"argstr": "--seg",
139+
"xor": _xor,
140+
}
119141
)
120142

121143
template_volume: PathLike = field(
@@ -150,7 +172,10 @@ class Label2VolSpec(ShellSpec):
150172
)
151173

152174
subject_id: str = field(
153-
metadata={"help_string": "subject identifier to load the surface from", "argstr": "--subject"}
175+
metadata={
176+
"help_string": "subject identifier to load the surface from",
177+
"argstr": "--subject",
178+
}
154179
)
155180

156181
no_registration: bool = field(
@@ -161,14 +186,18 @@ class Label2VolSpec(ShellSpec):
161186
}
162187
)
163188

164-
output_volume: str = field(metadata={"help_string": "output volume", "argstr": "--o"})
189+
output_volume: str = field(
190+
metadata={"help_string": "output volume", "argstr": "--o"}
191+
)
165192

166193

167194
class Label2Vol(ShellCommandTask):
168195
"""Task definition for mri_label2vol."""
169196

170197
executable = "mri_label2vol"
171198

172-
input_spec = SpecInfo(name="Input", bases=(Label2VolSpec, specs.HemisphereSpec, specs.SubjectsDirSpec))
199+
input_spec = SpecInfo(
200+
name="Input", bases=(Label2VolSpec, specs.HemisphereSpec, specs.SubjectsDirSpec)
201+
)
173202

174203
output_spec = SpecInfo(name="Output", bases=(specs.SubjectsDirOutSpec,))

pydra/tasks/freesurfer/v7_4/mri/surf2surf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898

9999
from pydra.engine.specs import ShellSpec, SpecInfo
100100
from pydra.engine.task import ShellCommandTask
101-
from pydra.tasks.freesurfer import specs
101+
from pydra.tasks.freesurfer.v7_4 import specs
102102

103103

104104
@define(kw_only=True)
@@ -256,6 +256,8 @@ class Surf2SurfSpec(ShellSpec):
256256
class Surf2Surf(ShellCommandTask):
257257
"""Task definition for mri_surf2surf."""
258258

259-
input_spec = SpecInfo(name="Input", bases=(Surf2SurfSpec, specs.HemisphereSpec, specs.SubjectsDirSpec))
259+
input_spec = SpecInfo(
260+
name="Input", bases=(Surf2SurfSpec, specs.HemisphereSpec, specs.SubjectsDirSpec)
261+
)
260262

261263
executable = "mri_surf2surf"

0 commit comments

Comments
 (0)