4444
4545def init_syn_sdc_wf (
4646 * ,
47- atlas_threshold = 3 ,
4847 sloppy = False ,
4948 debug = False ,
5049 name = "syn_sdc_wf" ,
5150 omp_nthreads = 1 ,
5251 laplacian_weight = None ,
53- sd_prior = True ,
5452 ** kwargs ,
5553):
5654 """
@@ -59,10 +57,6 @@ def init_syn_sdc_wf(
5957 SyN deformation is restricted to the phase-encoding (PE) direction.
6058 If no PE direction is specified, anterior-posterior PE is assumed.
6159
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-
6660 Workflow Graph
6761 .. workflow ::
6862 :graph2use: orig
@@ -73,9 +67,6 @@ def init_syn_sdc_wf(
7367
7468 Parameters
7569 ----------
76- atlas_threshold : :obj:`float`
77- Exclude from the registration metric computation areas with average distortions
78- below this threshold (in mm).
7970 sloppy : :obj:`bool`
8071 Whether a fast (less accurate) configuration of the workflow should be applied.
8172 debug : :obj:`bool`
@@ -150,16 +141,15 @@ def init_syn_sdc_wf(
150141 workflow = Workflow (name = name )
151142 workflow .__desc__ = f"""\
152143 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.
154145The 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].
157147Registration is performed with `antsRegistration`
158148(ANTs { ants_version or "-- version unknown" } ), and
159149the 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.
162151"""
152+
163153 inputnode = pe .Node (niu .IdentityInterface (INPUT_FIELDS ), name = "inputnode" )
164154 outputnode = pe .Node (
165155 niu .IdentityInterface (
@@ -211,10 +201,11 @@ def init_syn_sdc_wf(
211201
212202 epi_umask = pe .Node (Union (), name = "epi_umask" )
213203 moving_masks = pe .Node (
214- niu .Merge (3 ),
204+ niu .Merge (2 ),
215205 name = "moving_masks" ,
216206 run_without_submitting = True ,
217207 )
208+ moving_masks .inputs .in1 = "NULL"
218209
219210 fixed_masks = pe .Node (
220211 niu .Merge (2 ),
@@ -287,7 +278,7 @@ def init_syn_sdc_wf(
287278 (inputnode , amask2epi , [("epi_mask" , "reference_image" )]),
288279 (inputnode , zooms_bmask , [("anat_mask" , "input_image" )]),
289280 (inputnode , fixed_masks , [("anat_mask" , "in1" ),
290- ("anat_mask " , "in2" )]),
281+ ("sd_prior " , "in2" )]),
291282 (inputnode , anat_dilmsk , [("anat_mask" , "in_file" )]),
292283 (inputnode , warp_dir , [("anat_ref" , "fixed_image" )]),
293284 (inputnode , anat_merge , [("anat_ref" , "in1" )]),
@@ -298,9 +289,7 @@ def init_syn_sdc_wf(
298289 (inputnode , epi_umask , [("epi_mask" , "in1" )]),
299290 (lap_anat , lap_anat_norm , [("output_image" , "in_file" )]),
300291 (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" )]),
304293 (clip_epi , epi_merge , [("out_file" , "in1" )]),
305294 (clip_epi , lap_epi , [("out_file" , "op1" )]),
306295 (clip_epi , zooms_epi , [("out_file" , "in_file" )]),
@@ -339,6 +328,7 @@ def init_syn_sdc_wf(
339328
340329def init_syn_preprocessing_wf (
341330 * ,
331+ atlas_threshold = 3 ,
342332 debug = False ,
343333 name = "syn_preprocessing_wf" ,
344334 omp_nthreads = 1 ,
@@ -359,6 +349,9 @@ def init_syn_preprocessing_wf(
359349
360350 Parameters
361351 ----------
352+ atlas_threshold : :obj:`float`
353+ Mask excluding areas with average distortions below this threshold (in mm)
354+ on the prior.
362355 debug : :obj:`bool`
363356 Whether a fast (less accurate) configuration of the workflow should be applied.
364357 name : :obj:`str`
@@ -499,6 +492,8 @@ def _remove_first_mask(in_file):
499492 sampling_ref = pe .Node (GenerateSamplingReference (), name = "sampling_ref" )
500493
501494 if sd_prior :
495+ from niworkflows .interfaces .nibabel import Binarize
496+
502497 # Mapping & preparing prior knowledge
503498 # Concatenate transform files:
504499 # 1) MNI -> anat; 2) ATLAS -> MNI
@@ -521,19 +516,20 @@ def _remove_first_mask(in_file):
521516 mem_gb = 0.3 ,
522517 )
523518
519+ prior_msk = pe .Node (Binarize (thresh_low = atlas_threshold ), name = "prior_msk" )
520+
524521 workflow .connect ([
525522 (inputnode , transform_list , [("std2anat_xfm" , "in2" )]),
526523 (epi2anat , transform_list , [("forward_transforms" , "in1" )]),
527524 (transform_list , prior2epi , [("out" , "transforms" )]),
528525 (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" )]),
530528 ]) # fmt:skip
531529
532530 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" )
537533
538534 workflow .connect ([
539535 (inputnode , epi_reference_wf , [("in_epis" , "inputnode.in_files" )]),
0 commit comments