44
44
45
45
def init_syn_sdc_wf (
46
46
* ,
47
- atlas_threshold = 3 ,
48
47
sloppy = False ,
49
48
debug = False ,
50
49
name = "syn_sdc_wf" ,
51
50
omp_nthreads = 1 ,
52
51
laplacian_weight = None ,
53
- sd_prior = True ,
54
52
** kwargs ,
55
53
):
56
54
"""
@@ -59,10 +57,6 @@ def init_syn_sdc_wf(
59
57
SyN deformation is restricted to the phase-encoding (PE) direction.
60
58
If no PE direction is specified, anterior-posterior PE is assumed.
61
59
62
- SyN deformation is also restricted to regions that are expected to have a
63
- >3mm (approximately 1 voxel) warp, based on the fieldmap atlas.
64
-
65
-
66
60
Workflow Graph
67
61
.. workflow ::
68
62
:graph2use: orig
@@ -73,9 +67,6 @@ def init_syn_sdc_wf(
73
67
74
68
Parameters
75
69
----------
76
- atlas_threshold : :obj:`float`
77
- Exclude from the registration metric computation areas with average distortions
78
- below this threshold (in mm).
79
70
sloppy : :obj:`bool`
80
71
Whether a fast (less accurate) configuration of the workflow should be applied.
81
72
debug : :obj:`bool`
@@ -150,16 +141,15 @@ def init_syn_sdc_wf(
150
141
workflow = Workflow (name = name )
151
142
workflow .__desc__ = f"""\
152
143
A deformation field to correct for susceptibility distortions was estimated
153
- based on *fMRIPrep*'s *fieldmap-less* approach.
144
+ based on *SDCFlows*' *fieldmap-less* approach.
154
145
The deformation field is that resulting from co-registering the EPI reference
155
- to the same-subject T1w-reference with its intensity inverted [@fieldmapless1;
156
- @fieldmapless2].
146
+ to the same-subject's T1w-reference [@fieldmapless1; @fieldmapless2].
157
147
Registration is performed with `antsRegistration`
158
148
(ANTs { ants_version or "-- version unknown" } ), and
159
149
the process regularized by constraining deformation to be nonzero only
160
- along the phase-encoding direction, and modulated with an average fieldmap
161
- template [@fieldmapless3].
150
+ along the phase-encoding direction.
162
151
"""
152
+
163
153
inputnode = pe .Node (niu .IdentityInterface (INPUT_FIELDS ), name = "inputnode" )
164
154
outputnode = pe .Node (
165
155
niu .IdentityInterface (
@@ -211,10 +201,11 @@ def init_syn_sdc_wf(
211
201
212
202
epi_umask = pe .Node (Union (), name = "epi_umask" )
213
203
moving_masks = pe .Node (
214
- niu .Merge (3 ),
204
+ niu .Merge (2 ),
215
205
name = "moving_masks" ,
216
206
run_without_submitting = True ,
217
207
)
208
+ moving_masks .inputs .in1 = "NULL"
218
209
219
210
fixed_masks = pe .Node (
220
211
niu .Merge (2 ),
@@ -287,7 +278,7 @@ def init_syn_sdc_wf(
287
278
(inputnode , amask2epi , [("epi_mask" , "reference_image" )]),
288
279
(inputnode , zooms_bmask , [("anat_mask" , "input_image" )]),
289
280
(inputnode , fixed_masks , [("anat_mask" , "in1" ),
290
- ("anat_mask " , "in2" )]),
281
+ ("sd_prior " , "in2" )]),
291
282
(inputnode , anat_dilmsk , [("anat_mask" , "in_file" )]),
292
283
(inputnode , warp_dir , [("anat_ref" , "fixed_image" )]),
293
284
(inputnode , anat_merge , [("anat_ref" , "in1" )]),
@@ -298,9 +289,7 @@ def init_syn_sdc_wf(
298
289
(inputnode , epi_umask , [("epi_mask" , "in1" )]),
299
290
(lap_anat , lap_anat_norm , [("output_image" , "in_file" )]),
300
291
(lap_anat_norm , anat_merge , [("out" , "in2" )]),
301
- (epi_umask , moving_masks , [("out_file" , "in1" ),
302
- ("out_file" , "in2" ),
303
- ("out_file" , "in3" )]),
292
+ (epi_umask , moving_masks , [("out_file" , "in2" )]),
304
293
(clip_epi , epi_merge , [("out_file" , "in1" )]),
305
294
(clip_epi , lap_epi , [("out_file" , "op1" )]),
306
295
(clip_epi , zooms_epi , [("out_file" , "in_file" )]),
@@ -339,6 +328,7 @@ def init_syn_sdc_wf(
339
328
340
329
def init_syn_preprocessing_wf (
341
330
* ,
331
+ atlas_threshold = 3 ,
342
332
debug = False ,
343
333
name = "syn_preprocessing_wf" ,
344
334
omp_nthreads = 1 ,
@@ -359,6 +349,9 @@ def init_syn_preprocessing_wf(
359
349
360
350
Parameters
361
351
----------
352
+ atlas_threshold : :obj:`float`
353
+ Mask excluding areas with average distortions below this threshold (in mm)
354
+ on the prior.
362
355
debug : :obj:`bool`
363
356
Whether a fast (less accurate) configuration of the workflow should be applied.
364
357
name : :obj:`str`
@@ -499,6 +492,8 @@ def _remove_first_mask(in_file):
499
492
sampling_ref = pe .Node (GenerateSamplingReference (), name = "sampling_ref" )
500
493
501
494
if sd_prior :
495
+ from niworkflows .interfaces .nibabel import Binarize
496
+
502
497
# Mapping & preparing prior knowledge
503
498
# Concatenate transform files:
504
499
# 1) MNI -> anat; 2) ATLAS -> MNI
@@ -521,19 +516,20 @@ def _remove_first_mask(in_file):
521
516
mem_gb = 0.3 ,
522
517
)
523
518
519
+ prior_msk = pe .Node (Binarize (thresh_low = atlas_threshold ), name = "prior_msk" )
520
+
524
521
workflow .connect ([
525
522
(inputnode , transform_list , [("std2anat_xfm" , "in2" )]),
526
523
(epi2anat , transform_list , [("forward_transforms" , "in1" )]),
527
524
(transform_list , prior2epi , [("out" , "transforms" )]),
528
525
(sampling_ref , prior2epi , [("out_file" , "reference_image" )]),
529
- (prior2epi , outputnode , [("output_image" , "sd_prior" )]),
526
+ (prior2epi , prior_msk , [("output_image" , "in_file" )]),
527
+ (prior_msk , outputnode , [("out_mask" , "sd_prior" )]),
530
528
]) # fmt:skip
531
529
532
530
else :
533
- # no prior to be used
534
- # MG: Future goal is to allow using alternative mappings
535
- # i.e. in the case of infants, where priors change depending on development
536
- outputnode .inputs .sd_prior = Undefined
531
+ # no prior to be used -> set anatomical mask as prior
532
+ workflow .connect (mask_dtype , "out" , outputnode , "sd_prior" )
537
533
538
534
workflow .connect ([
539
535
(inputnode , epi_reference_wf , [("in_epis" , "inputnode.in_files" )]),
0 commit comments