6
6
def init_anat_preproc_wf (
7
7
* ,
8
8
bspline_fitting_distance : int = 200 ,
9
- precomputed_mask : bool = False ,
10
- precomputed_aseg : bool = False ,
11
9
name : str = "anat_preproc_wf" ,
12
10
) -> LiterateWorkflow :
13
11
"""Polish up raw anatomical data.
@@ -32,15 +30,15 @@ def init_anat_preproc_wf(
32
30
"""
33
31
from nipype .interfaces .ants import DenoiseImage , N4BiasFieldCorrection
34
32
from niworkflows .interfaces .header import ValidateImage
35
- from niworkflows .interfaces .nibabel import IntensityClip , RegridToZooms
33
+ from niworkflows .interfaces .nibabel import IntensityClip
36
34
37
35
wf = LiterateWorkflow (name = name )
38
36
inputnode = pe .Node (
39
- niu .IdentityInterface (fields = ["in_anat" , "in_mask" , "in_aseg" ]),
37
+ niu .IdentityInterface (fields = ["in_anat" ]),
40
38
name = "inputnode" ,
41
39
)
42
40
outputnode = pe .Node (
43
- niu .IdentityInterface (fields = ["anat_preproc" , "anat_mask" , "anat_aseg" ]),
41
+ niu .IdentityInterface (fields = ["anat_preproc" ]),
44
42
name = "outputnode" ,
45
43
)
46
44
@@ -61,32 +59,8 @@ def init_anat_preproc_wf(
61
59
),
62
60
name = "n4_correct" ,
63
61
)
64
-
65
62
final_clip = pe .Node (IntensityClip (p_min = 5.0 , p_max = 99.5 ), name = "final_clip" )
66
63
67
- if precomputed_mask :
68
- validate_mask = pe .Node (ValidateImage (), name = "validate_mask" )
69
- regrid_mask = pe .Node (RegridToZooms (), name = "regrid_mask" )
70
- # fmt:off
71
- wf .connect ([
72
- (inputnode , validate_mask , [("in_mask" , "in_file" )]),
73
- (validate_mask , regrid_mask , [("out_file" , "in_file" )]),
74
- (final_clip , regrid_mask , [(("out_file" , _get_zooms ), "zooms" )]),
75
- (regrid_mask , outputnode , [("out_file" , "anat_mask" )]),
76
- ])
77
- # fmt:on
78
- if precomputed_aseg :
79
- validate_aseg = pe .Node (ValidateImage (), name = "validate_aseg" )
80
- regrid_aseg = pe .Node (RegridToZooms (), name = "regrid_aseg" )
81
- # fmt:off
82
- wf .connect ([
83
- (inputnode , validate_aseg , [("in_aseg" , "in_file" )]),
84
- (validate_aseg , regrid_aseg , [("out_file" , "in_file" )]),
85
- (final_clip , regrid_aseg , [(("out_file" , _get_zooms ), "zooms" )]),
86
- (regrid_aseg , outputnode , [("out_file" , "anat_aseg" )]),
87
- ])
88
- # fmt:on
89
-
90
64
# fmt:off
91
65
wf .connect ([
92
66
(inputnode , validate , [("in_anat" , "in_file" )]),
@@ -98,9 +72,3 @@ def init_anat_preproc_wf(
98
72
])
99
73
# fmt:on
100
74
return wf
101
-
102
-
103
- def _get_zooms (in_file ):
104
- import nibabel as nb
105
-
106
- return tuple (nb .load (in_file ).header .get_zooms ()[:3 ])
0 commit comments