@@ -750,81 +750,82 @@ def init_pet_wf(
750
750
(pet_ref_tacs_wf , ds_ref_tacs , [('outputnode.timeseries' , 'in_file' )]),
751
751
]) # fmt:skip
752
752
753
- pet_confounds_wf = init_pet_confs_wf (
754
- mem_gb = mem_gb ['largemem' ],
755
- metadata = all_metadata [0 ],
756
- freesurfer = config .workflow .run_reconall ,
757
- regressors_all_comps = config .workflow .regressors_all_comps ,
758
- regressors_fd_th = config .workflow .regressors_fd_th ,
759
- regressors_dvars_th = config .workflow .regressors_dvars_th ,
760
- name = 'pet_confounds_wf' ,
761
- )
762
-
763
- ds_confounds = pe .Node (
764
- DerivativesDataSink (
765
- base_directory = petprep_dir ,
766
- desc = 'confounds' ,
767
- suffix = 'timeseries' ,
768
- ),
769
- name = 'ds_confounds' ,
770
- run_without_submitting = True ,
771
- mem_gb = config .DEFAULT_MEMORY_MIN_GB ,
772
- )
773
- ds_confounds .inputs .source_file = pet_file
774
-
775
- workflow .connect ([
776
- (inputnode , pet_confounds_wf , [
777
- ('t1w_tpms' , 'inputnode.t1w_tpms' ),
778
- ('t1w_mask' , 'inputnode.t1w_mask' ),
779
- ]),
780
- (pet_fit_wf , pet_confounds_wf , [
781
- ('outputnode.pet_mask' , 'inputnode.pet_mask' ),
782
- ('outputnode.petref' , 'inputnode.petref' ),
783
- ('outputnode.motion_xfm' , 'inputnode.motion_xfm' ),
784
- ('outputnode.petref2anat_xfm' , 'inputnode.petref2anat_xfm' ),
785
- ]),
786
- (pet_native_wf , pet_confounds_wf , [
787
- ('outputnode.pet_native' , 'inputnode.pet' ),
788
- ]),
789
- (pet_confounds_wf , ds_confounds , [
790
- ('outputnode.confounds_file' , 'in_file' ),
791
- ('outputnode.confounds_metadata' , 'meta_dict' ),
792
- ]),
793
- ]) # fmt:skip
794
-
795
- if spaces .get_spaces (nonstandard = False , dim = (3 ,)):
796
- carpetplot_wf = init_carpetplot_wf (
797
- mem_gb = mem_gb ['resampled' ],
753
+ if nvols > 1 : # run these only if 4-D PET
754
+ pet_confounds_wf = init_pet_confs_wf (
755
+ mem_gb = mem_gb ['largemem' ],
798
756
metadata = all_metadata [0 ],
799
- cifti_output = config .workflow .cifti_output ,
800
- name = 'carpetplot_wf' ,
757
+ freesurfer = config .workflow .run_reconall ,
758
+ regressors_all_comps = config .workflow .regressors_all_comps ,
759
+ regressors_fd_th = config .workflow .regressors_fd_th ,
760
+ regressors_dvars_th = config .workflow .regressors_dvars_th ,
761
+ name = 'pet_confounds_wf' ,
801
762
)
802
763
803
- if config .workflow .cifti_output :
804
- workflow .connect (
805
- pet_grayords_wf , 'outputnode.cifti_pet' , carpetplot_wf , 'inputnode.cifti_pet' ,
806
- ) # fmt:skip
807
-
808
- def _last (inlist ):
809
- return inlist [- 1 ]
764
+ ds_confounds = pe .Node (
765
+ DerivativesDataSink (
766
+ base_directory = petprep_dir ,
767
+ desc = 'confounds' ,
768
+ suffix = 'timeseries' ,
769
+ ),
770
+ name = 'ds_confounds' ,
771
+ run_without_submitting = True ,
772
+ mem_gb = config .DEFAULT_MEMORY_MIN_GB ,
773
+ )
774
+ ds_confounds .inputs .source_file = pet_file
810
775
811
776
workflow .connect ([
812
- (inputnode , carpetplot_wf , [
813
- ('mni2009c2anat_xfm' , 'inputnode.std2anat_xfm' ),
777
+ (inputnode , pet_confounds_wf , [
778
+ ('t1w_tpms' , 'inputnode.t1w_tpms' ),
779
+ ('t1w_mask' , 'inputnode.t1w_mask' ),
814
780
]),
815
- (pet_fit_wf , carpetplot_wf , [
781
+ (pet_fit_wf , pet_confounds_wf , [
816
782
('outputnode.pet_mask' , 'inputnode.pet_mask' ),
783
+ ('outputnode.petref' , 'inputnode.petref' ),
784
+ ('outputnode.motion_xfm' , 'inputnode.motion_xfm' ),
817
785
('outputnode.petref2anat_xfm' , 'inputnode.petref2anat_xfm' ),
818
786
]),
819
- (pet_native_wf , carpetplot_wf , [
787
+ (pet_native_wf , pet_confounds_wf , [
820
788
('outputnode.pet_native' , 'inputnode.pet' ),
821
789
]),
822
- (pet_confounds_wf , carpetplot_wf , [
823
- ('outputnode.confounds_file' , 'inputnode.confounds_file ' ),
824
- ('outputnode.crown_mask ' , 'inputnode.crown_mask ' ),
790
+ (pet_confounds_wf , ds_confounds , [
791
+ ('outputnode.confounds_file' , 'in_file ' ),
792
+ ('outputnode.confounds_metadata ' , 'meta_dict ' ),
825
793
]),
826
794
]) # fmt:skip
827
795
796
+ if spaces .get_spaces (nonstandard = False , dim = (3 ,)):
797
+ carpetplot_wf = init_carpetplot_wf (
798
+ mem_gb = mem_gb ['resampled' ],
799
+ metadata = all_metadata [0 ],
800
+ cifti_output = config .workflow .cifti_output ,
801
+ name = 'carpetplot_wf' ,
802
+ )
803
+
804
+ if config .workflow .cifti_output :
805
+ workflow .connect (
806
+ pet_grayords_wf , 'outputnode.cifti_pet' , carpetplot_wf , 'inputnode.cifti_pet' ,
807
+ ) # fmt:skip
808
+
809
+ def _last (inlist ):
810
+ return inlist [- 1 ]
811
+
812
+ workflow .connect ([
813
+ (inputnode , carpetplot_wf , [
814
+ ('mni2009c2anat_xfm' , 'inputnode.std2anat_xfm' ),
815
+ ]),
816
+ (pet_fit_wf , carpetplot_wf , [
817
+ ('outputnode.pet_mask' , 'inputnode.pet_mask' ),
818
+ ('outputnode.petref2anat_xfm' , 'inputnode.petref2anat_xfm' ),
819
+ ]),
820
+ (pet_native_wf , carpetplot_wf , [
821
+ ('outputnode.pet_native' , 'inputnode.pet' ),
822
+ ]),
823
+ (pet_confounds_wf , carpetplot_wf , [
824
+ ('outputnode.confounds_file' , 'inputnode.confounds_file' ),
825
+ ('outputnode.crown_mask' , 'inputnode.crown_mask' ),
826
+ ]),
827
+ ]) # fmt:skip
828
+
828
829
# Fill-in datasinks of reportlets seen so far
829
830
for node in workflow .list_node_names ():
830
831
if node .split ('.' )[- 1 ].startswith ('ds_report' ):
0 commit comments