@@ -166,11 +166,6 @@ def init_pet_wf(
166
166
all_metadata = [config .execution .layout .get_metadata (file ) for file in pet_series ]
167
167
168
168
nvols , mem_gb = estimate_pet_mem_usage (pet_file )
169
- if nvols <= 1 - config .execution .sloppy :
170
- config .loggers .workflow .warning (
171
- f'Too short PET series (<= 5 timepoints). Skipping processing of <{ pet_file } >.'
172
- )
173
- return
174
169
175
170
config .loggers .workflow .debug (
176
171
'Creating pet processing workflow for <%s> (%.2f GB / %d frames). '
@@ -755,81 +750,82 @@ def init_pet_wf(
755
750
(pet_ref_tacs_wf , ds_ref_tacs , [('outputnode.timeseries' , 'in_file' )]),
756
751
]) # fmt:skip
757
752
758
- pet_confounds_wf = init_pet_confs_wf (
759
- mem_gb = mem_gb ['largemem' ],
760
- metadata = all_metadata [0 ],
761
- freesurfer = config .workflow .run_reconall ,
762
- regressors_all_comps = config .workflow .regressors_all_comps ,
763
- regressors_fd_th = config .workflow .regressors_fd_th ,
764
- regressors_dvars_th = config .workflow .regressors_dvars_th ,
765
- name = 'pet_confounds_wf' ,
766
- )
767
-
768
- ds_confounds = pe .Node (
769
- DerivativesDataSink (
770
- base_directory = petprep_dir ,
771
- desc = 'confounds' ,
772
- suffix = 'timeseries' ,
773
- ),
774
- name = 'ds_confounds' ,
775
- run_without_submitting = True ,
776
- mem_gb = config .DEFAULT_MEMORY_MIN_GB ,
777
- )
778
- ds_confounds .inputs .source_file = pet_file
779
-
780
- workflow .connect ([
781
- (inputnode , pet_confounds_wf , [
782
- ('t1w_tpms' , 'inputnode.t1w_tpms' ),
783
- ('t1w_mask' , 'inputnode.t1w_mask' ),
784
- ]),
785
- (pet_fit_wf , pet_confounds_wf , [
786
- ('outputnode.pet_mask' , 'inputnode.pet_mask' ),
787
- ('outputnode.petref' , 'inputnode.petref' ),
788
- ('outputnode.motion_xfm' , 'inputnode.motion_xfm' ),
789
- ('outputnode.petref2anat_xfm' , 'inputnode.petref2anat_xfm' ),
790
- ]),
791
- (pet_native_wf , pet_confounds_wf , [
792
- ('outputnode.pet_native' , 'inputnode.pet' ),
793
- ]),
794
- (pet_confounds_wf , ds_confounds , [
795
- ('outputnode.confounds_file' , 'in_file' ),
796
- ('outputnode.confounds_metadata' , 'meta_dict' ),
797
- ]),
798
- ]) # fmt:skip
799
-
800
- if spaces .get_spaces (nonstandard = False , dim = (3 ,)):
801
- carpetplot_wf = init_carpetplot_wf (
802
- 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' ],
803
756
metadata = all_metadata [0 ],
804
- cifti_output = config .workflow .cifti_output ,
805
- 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' ,
806
762
)
807
763
808
- if config .workflow .cifti_output :
809
- workflow .connect (
810
- pet_grayords_wf , 'outputnode.cifti_pet' , carpetplot_wf , 'inputnode.cifti_pet' ,
811
- ) # fmt:skip
812
-
813
- def _last (inlist ):
814
- 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
815
775
816
776
workflow .connect ([
817
- (inputnode , carpetplot_wf , [
818
- ('mni2009c2anat_xfm' , 'inputnode.std2anat_xfm' ),
777
+ (inputnode , pet_confounds_wf , [
778
+ ('t1w_tpms' , 'inputnode.t1w_tpms' ),
779
+ ('t1w_mask' , 'inputnode.t1w_mask' ),
819
780
]),
820
- (pet_fit_wf , carpetplot_wf , [
781
+ (pet_fit_wf , pet_confounds_wf , [
821
782
('outputnode.pet_mask' , 'inputnode.pet_mask' ),
783
+ ('outputnode.petref' , 'inputnode.petref' ),
784
+ ('outputnode.motion_xfm' , 'inputnode.motion_xfm' ),
822
785
('outputnode.petref2anat_xfm' , 'inputnode.petref2anat_xfm' ),
823
786
]),
824
- (pet_native_wf , carpetplot_wf , [
787
+ (pet_native_wf , pet_confounds_wf , [
825
788
('outputnode.pet_native' , 'inputnode.pet' ),
826
789
]),
827
- (pet_confounds_wf , carpetplot_wf , [
828
- ('outputnode.confounds_file' , 'inputnode.confounds_file ' ),
829
- ('outputnode.crown_mask ' , 'inputnode.crown_mask ' ),
790
+ (pet_confounds_wf , ds_confounds , [
791
+ ('outputnode.confounds_file' , 'in_file ' ),
792
+ ('outputnode.confounds_metadata ' , 'meta_dict ' ),
830
793
]),
831
794
]) # fmt:skip
832
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
+
833
829
# Fill-in datasinks of reportlets seen so far
834
830
for node in workflow .list_node_names ():
835
831
if node .split ('.' )[- 1 ].startswith ('ds_report' ):
0 commit comments