@@ -199,12 +199,41 @@ def init_infant_anat_wf(
199
199
cifti_output = cifti_output ,
200
200
)
201
201
202
- # Multiple anatomical files -> generate average reference
202
+ # Derivatives used based on the following truth table:
203
+ # |--------|--------|---------------------------------|------------------|
204
+ # | Has T1 | Has T2 | M-CRIB-S surface reconstruction | Derivatives Used |
205
+ # |--------|--------|---------------------------------|------------------|
206
+ # | Yes | No | No | T1 |
207
+ # | Yes | Yes | No | T1 |
208
+ # | No | Yes | No | T2 |
209
+ # | Yes | Yes | Yes | T2 |
210
+
211
+ recon_method = config .workflow .surface_recon_method
203
212
t1w_mask = bool (derivatives .t1w_mask )
204
213
t1w_aseg = bool (derivatives .t1w_aseg )
205
214
t2w_mask = bool (derivatives .t2w_mask )
206
215
t2w_aseg = bool (derivatives .t2w_aseg )
207
216
217
+ # The T2 derivatives are only prioritized first if MCRIBS reconstruction is to be used.
218
+ if recon_method == "mcribs" :
219
+ if t2w_aseg :
220
+ t1w_aseg = False
221
+ if t2w_mask :
222
+ t1w_mask = False
223
+
224
+ if t1w_mask :
225
+ t2w_mask = False
226
+ if t1w_aseg :
227
+ t2w_aseg = False
228
+
229
+ config .loggers .workflow .debug (
230
+ "Derivatives used:\n <T1 mask %s>\n <T1 aseg %s>\n <T2 mask %s>\n <T2 aseg %s>" ,
231
+ t1w_mask ,
232
+ t1w_aseg ,
233
+ t2w_mask ,
234
+ t2w_aseg ,
235
+ )
236
+
208
237
t1w_template_wf = init_anat_template_wf (
209
238
contrast = "T1w" ,
210
239
num_files = num_t1w ,
@@ -425,11 +454,11 @@ def init_infant_anat_wf(
425
454
if not freesurfer :
426
455
return wf
427
456
428
- if config . workflow . surface_recon_method == 'freesurfer' :
457
+ if recon_method == 'freesurfer' :
429
458
from smriprep .workflows .surfaces import init_surface_recon_wf
430
459
431
460
surface_recon_wf = init_surface_recon_wf (omp_nthreads = omp_nthreads , hires = hires )
432
- elif config . workflow . surface_recon_method == 'infantfs' :
461
+ elif recon_method == 'infantfs' :
433
462
from .surfaces import init_infantfs_surface_recon_wf
434
463
435
464
# if running with precomputed aseg, or JLF, pass the aseg along to FreeSurfer
@@ -439,7 +468,7 @@ def init_infant_anat_wf(
439
468
use_aseg = use_aseg ,
440
469
)
441
470
442
- elif config . workflow . surface_recon_method == 'mcribs' :
471
+ elif recon_method == 'mcribs' :
443
472
from nipype .interfaces .ants import DenoiseImage
444
473
445
474
from .surfaces import init_mcribs_sphere_reg_wf , init_mcribs_surface_recon_wf
@@ -471,7 +500,7 @@ def init_infant_anat_wf(
471
500
else :
472
501
raise NotImplementedError
473
502
474
- if config . workflow . surface_recon_method in ('freesurfer' , 'infantfs' ):
503
+ if recon_method in ('freesurfer' , 'infantfs' ):
475
504
from smriprep .workflows .surfaces import init_sphere_reg_wf
476
505
477
506
# fsaverage to fsLR
@@ -553,7 +582,7 @@ def init_infant_anat_wf(
553
582
init_anat_fsLR_resampling_wf ,
554
583
)
555
584
556
- is_mcribs = config . workflow . surface_recon_method == "mcribs"
585
+ is_mcribs = recon_method == "mcribs"
557
586
# handles morph_grayords_wf
558
587
anat_fsLR_resampling_wf = init_anat_fsLR_resampling_wf (cifti_output , mcribs = is_mcribs )
559
588
anat_derivatives_wf .get_node ('inputnode' ).inputs .cifti_density = cifti_output
0 commit comments