9
9
.. autofunction:: init_ica_aroma_wf
10
10
11
11
"""
12
+ from os import getenv
12
13
from nipype .pipeline import engine as pe
13
14
from nipype .interfaces import utility as niu , fsl
14
15
from nipype .algorithms import confounds as nac
@@ -245,8 +246,9 @@ def init_bold_confs_wf(
245
246
acompcor .inputs .repetition_time = metadata ['RepetitionTime' ]
246
247
247
248
# Global and segment regressors
249
+ signals_class_labels = ["csf" , "white_matter" , "global_signal" ]
248
250
mrg_lbl = pe .Node (niu .Merge (3 ), name = 'merge_rois' , run_without_submitting = True )
249
- signals = pe .Node (SignalExtraction (class_labels = [ "csf" , "white_matter" , "global_signal" ] ),
251
+ signals = pe .Node (SignalExtraction (class_labels = signals_class_labels ),
250
252
name = "signals" , mem_gb = mem_gb )
251
253
252
254
# Arrange confounds
@@ -270,8 +272,10 @@ def init_bold_confs_wf(
270
272
TSV2JSON (index_column = 'component' , output = None ,
271
273
additional_metadata = {'Method' : 'aCompCor' }, enforce_case = True ),
272
274
name = 'acc_metadata_fmt' )
273
- mrg_conf_metadata = pe .Node (niu .Merge (2 ), name = 'merge_confound_metadata' ,
275
+ mrg_conf_metadata = pe .Node (niu .Merge (3 ), name = 'merge_confound_metadata' ,
274
276
run_without_submitting = True )
277
+ mrg_conf_metadata .inputs .in3 = {label : {'Method' : 'Mean' }
278
+ for label in signals_class_labels }
275
279
mrg_conf_metadata2 = pe .Node (DictMerge (), name = 'merge_confound_metadata2' ,
276
280
run_without_submitting = True )
277
281
@@ -648,7 +652,7 @@ def init_ica_aroma_wf(metadata, mem_gb, omp_nthreads,
648
652
649
653
outputnode = pe .Node (niu .IdentityInterface (
650
654
fields = ['aroma_confounds' , 'aroma_noise_ics' , 'melodic_mix' ,
651
- 'nonaggr_denoised_file' ]), name = 'outputnode' )
655
+ 'nonaggr_denoised_file' , 'aroma_metadata' ]), name = 'outputnode' )
652
656
653
657
select_std = pe .Node (KeySelect (
654
658
fields = ['bold_mask_std' , 'bold_std' ]),
@@ -687,6 +691,13 @@ def _getusans_func(image, thresh):
687
691
ica_aroma_confound_extraction = pe .Node (ICAConfounds (err_on_aroma_warn = err_on_aroma_warn ),
688
692
name = 'ica_aroma_confound_extraction' )
689
693
694
+ ica_aroma_metadata_fmt = pe .Node (
695
+ TSV2JSON (index_column = 'IC' , output = None , enforce_case = True ,
696
+ additional_metadata = {'Method' : {
697
+ 'Name' : 'ICA-AROMA' ,
698
+ 'Version' : getenv ('AROMA_VERSION' , 'n/a' )}}),
699
+ name = 'ica_aroma_metadata_fmt' )
700
+
690
701
ds_report_ica_aroma = pe .Node (
691
702
DerivativesDataSink (desc = 'aroma' , keep_dtype = True ),
692
703
name = 'ds_report_ica_aroma' , run_without_submitting = True ,
@@ -732,10 +743,13 @@ def _getbtthresh(medianval):
732
743
(ica_aroma , ica_aroma_confound_extraction , [('out_dir' , 'in_directory' )]),
733
744
(inputnode , ica_aroma_confound_extraction , [
734
745
('skip_vols' , 'skip_vols' )]),
746
+ (ica_aroma_confound_extraction , ica_aroma_metadata_fmt , [
747
+ ('aroma_metadata' , 'in_file' )]),
735
748
# output for processing and reporting
736
749
(ica_aroma_confound_extraction , outputnode , [('aroma_confounds' , 'aroma_confounds' ),
737
750
('aroma_noise_ics' , 'aroma_noise_ics' ),
738
751
('melodic_mix' , 'melodic_mix' )]),
752
+ (ica_aroma_metadata_fmt , outputnode , [('output' , 'aroma_metadata' )]),
739
753
(ica_aroma , add_non_steady_state , [
740
754
('nonaggr_denoised_file' , 'bold_cut_file' )]),
741
755
(select_std , add_non_steady_state , [
0 commit comments