@@ -298,7 +298,8 @@ def extract_subrois(timeseries_file, label_file, indices):
298
298
data = img .get_data ()
299
299
roiimg = nb .load (label_file )
300
300
rois = roiimg .get_data ()
301
- out_ts_file = os .path .join (os .getcwd (), 'subcortical_timeseries.txt' )
301
+ prefix = split_filename (timeseries_file )[1 ]
302
+ out_ts_file = os .path .join (os .getcwd (), '%s_subcortical_ts.txt' % prefix )
302
303
with open (out_ts_file , 'wt' ) as fp :
303
304
for fsindex in indices :
304
305
ijk = np .nonzero (rois == fsindex )
@@ -849,12 +850,28 @@ def get_names(files, suffix):
849
850
850
851
######
851
852
853
+ substitutions = [('_target_subject_' , '' ),
854
+ ('_filtermotart_cleaned_bp_trans_masked' , '' ),
855
+ ('_filtermotart_cleaned_bp' , '' )
856
+ ]
857
+ regex_subs = [('_ts_masker.*/sar' , '/smooth/' ),
858
+ ('_ts_masker.*/ar' , '/unsmooth/' ),
859
+ ('_combiner.*/sar' , '/smooth/' ),
860
+ ('_combiner.*/ar' , '/unsmooth/' ),
861
+ ('_aparc_ts.*/sar' , '/smooth/' ),
862
+ ('_aparc_ts.*/ar' , '/unsmooth/' ),
863
+ ('_getsubcortts.*/sar' , '/smooth/' ),
864
+ ('_getsubcortts.*/ar' , '/unsmooth/' ),
865
+ ('series/sar' , 'series/smooth/' ),
866
+ ('series/ar' , 'series/unsmooth/' ),
867
+ ('_inverse_transform./' , '' ),
868
+ ]
852
869
# Save the relevant data into an output directory
853
870
datasink = Node (interface = DataSink (), name = "datasink" )
854
871
datasink .inputs .base_directory = sink_directory
855
872
datasink .inputs .container = subject_id
856
- datasink .inputs .substitutions = [( '_target_subject_' , '' )]
857
- # datasink.inputs.regexp_substitutions = (r'(/_.*(\d+/))', r'/run\2')
873
+ datasink .inputs .substitutions = substitutions
874
+ datasink .inputs .regexp_substitutions = regex_subs # (r'(/_.*(\d+/))', r'/run\2')
858
875
wf .connect (realign , 'realignment_parameters' , datasink , 'resting.qa.motion' )
859
876
wf .connect (art , 'norm_files' , datasink , 'resting.qa.art.@norm' )
860
877
wf .connect (art , 'intensity_files' , datasink , 'resting.qa.art.@intensity' )
@@ -867,8 +884,8 @@ def get_names(files, suffix):
867
884
wf .connect (filter1 , 'out_pf' , datasink , 'resting.qa.compmaps.@mc_pF' )
868
885
wf .connect (filter2 , 'out_f' , datasink , 'resting.qa.compmaps' )
869
886
wf .connect (filter2 , 'out_pf' , datasink , 'resting.qa.compmaps.@p' )
870
- wf .connect (bandpass , 'out_files' , datasink , 'resting.timeseries.bandpassed' )
871
- wf .connect (smooth , 'smoothed_files' , datasink , 'resting.timeseries.smoothed' )
887
+ wf .connect (bandpass , 'out_files' , datasink , 'resting.timeseries.@ bandpassed' )
888
+ wf .connect (smooth , 'smoothed_files' , datasink , 'resting.timeseries.@ smoothed' )
872
889
wf .connect (createfilter1 , 'out_files' ,
873
890
datasink , 'resting.regress.@regressors' )
874
891
wf .connect (createfilter2 , 'out_files' ,
@@ -884,8 +901,8 @@ def get_names(files, suffix):
884
901
datasink2 = Node (interface = DataSink (), name = "datasink2" )
885
902
datasink2 .inputs .base_directory = sink_directory
886
903
datasink2 .inputs .container = subject_id
887
- datasink2 .inputs .substitutions = [( '_target_subject_' , '' )]
888
- # datasink2.inputs.regexp_substitutions = (r'(/_.*(\d+/))', r'/run\2')
904
+ datasink2 .inputs .substitutions = substitutions
905
+ datasink2 .inputs .regexp_substitutions = regex_subs # (r'(/_.*(\d+/))', r'/run\2')
889
906
wf .connect (combiner , 'out_file' ,
890
907
datasink2 , 'resting.parcellations.grayo.@surface' )
891
908
return wf
0 commit comments