AFNI proc creates empty qc_12_mot_grayplot.jpg (0 bytes) after preprocessing

AFNI version info (AFNI_26.1.04 'Balbinus'; Mac M1 26.5.1 (25F80)):

I just preprocessed two runs of one subject via AFNI proc (after a long time not using AFNI proc and after recently updating AFNI). Everything is good except that, while in both runs AFNI proc creates the file qc_12_mot_grayplot.jpg, the file actually remains empty with zero bytes, hence it of course doesn’t show up in the QC index html.

afni_system_check.py -check_all

yields no errors and everything is installed properly. I have matplotlib etc. installed.

Also, the output.proc didn't seem to complain concerning the grayplot "++ APQC create: qc_12_mot_grayplot" with no error message as far as I can see. What might be interesting is that in the media folder of QC, qc_21_warns_press.dat and qc_22_warns_sat_4095.dat are also zero byte files.

Is this a simple and common bug easy to fix, or probably something more complicated? Any ideas where to start looking to fix this?

Thanks,

Philipp

Hi, Philipp-

The grayplot thing will happen sometimes when dependencies are not all installed.

Can you please go into your AP results directory and run:

apqc_make_tcsh.py -do_log -run

... and send me the log_apqc_tcsh.txt that that should create? It logs the stdout and stderr of programs run during the APQC HTML-generating process.

And could you please send me the system check (like, the ASC.txt file created by running):

afni_system_check.py -check_all > ASC.txt

?

thanks,
pt

Hi,

I send you both the log_apqc_tcsh.txt and the ASC.txt.

Philipp

Hi, Philipp-

Great, thanks.

And just to be sure, what was your AP command that was run, which produced this error?

thanks,
pt

The following was my AP code:

runs=(Rest Movie)

dir_sswarper=/volumes/sandisk1/sam_dataset/Processed/sswarper/Sam

for run in $runs; do

	mkdir -p /volumes/sandisk1/Sam_dataset/Processed/Preprocessing_${run}/Sam
	dir_func=/volumes/sandisk1/sam_dataset/raw/sam/functional_${run}
	dir_out=/volumes/sandisk1/sam_dataset/Processed/Preprocessing_${run}/sam

	cd $dir_out

	afni_proc.py \
	-subj_id Sam_${run} \
	-out_dir $dir_out/Results \
	-dsets $dir_func/${run}_Sam+orig \
	-blocks despike tshift align tlrc volreg mask scale regress \
	-copy_anat $dir_sswarper/anatSS.Sam.nii \
	-anat_has_skull no \
	-align_unifize_epi local \
	-align_opts_aea -cost lpc+ZZ \
					-giant_move \
					-check_flip \
	-volreg_align_e2a \
	-volreg_align_to MIN_OUTLIER \
	-volreg_tlrc_warp -tlrc_base MNI152_2009_template_SSW.nii.gz \
	-tlrc_NL_warp \
	-tlrc_NL_warped_dsets \
		$dir_sswarper/anatQQ.Sam.nii \
		$dir_sswarper/anatQQ.Sam.aff12.1D \
		$dir_sswarper/anatQQ.Sam_WARP.nii \
	-volreg_post_vr_allin yes \
	-volreg_pvra_base_index MIN_OUTLIER \
	-mask_segment_anat yes \
	-mask_segment_erode yes \
	-regress_polort 2 \
	-regress_anaticor \
	-regress_ROI CSFe \
	-regress_apply_mot_types demean deriv \
	-regress_motion_per_run \
	-regress_censor_motion 0.4 \
	-regress_skip_first_outliers 5 \
	-html_review_style pythonic \
	-execute
done

Hi, Philipp-

Sorry for the delay in replying here.

I have found the cause of the issue. The APQC HTML maker did not deal well with having only motion censoring and no outlier-based censoring included; when one is done, most often people do both (like including -regress_censor_outliers 0.05, for censoring if an EPI volume has more than 5% outliers in a brainmask at a given time), and the code didn't handle not having the two options used.

But there is no reason why only one censoring option can't be applied, and so I have now fixed the code to handle this. We aim to do a build this evening, so you should have the updated code available by tomorrow. (And either way, you still could consider adding in the outlier-based censoring requirement, too.)

Thanks for mentioning this issue, so we could fix it.

--pt

ps: in case it is useful, here is a vertically-aligned version of your code posted above, just because I find it an easier style to read and understand for editing:

#!/bin/bash

runs=(Rest Movie)

dir_sswarper=/volumes/sandisk1/sam_dataset/Processed/sswarper/Sam

for run in $runs; do

	mkdir -p /volumes/sandisk1/Sam_dataset/Processed/Preprocessing_${run}/Sam
	dir_func=/volumes/sandisk1/sam_dataset/raw/sam/functional_${run}
	dir_out=/volumes/sandisk1/sam_dataset/Processed/Preprocessing_${run}/sam

	cd $dir_out

	afni_proc.py                                                               \
	    -subj_id                      Sam_${run}                               \
	    -out_dir                      $dir_out/Results                         \
	    -dsets                        $dir_func/${run}_Sam+orig                \
	    -blocks                       despike tshift align tlrc volreg mask    \
	                                  scale regress                            \
	    -copy_anat                    $dir_sswarper/anatSS.Sam.nii             \
	    -anat_has_skull               no                                       \
	    -align_unifize_epi            local                                    \
	    -align_opts_aea               -cost lpc+ZZ                             \
	                                  -giant_move                              \
	                                  -check_flip                              \
	    -volreg_align_e2a                                                      \
	    -volreg_align_to              MIN_OUTLIER                              \
	    -volreg_tlrc_warp                                                      \
	    -tlrc_base                    MNI152_2009_template_SSW.nii.gz          \
	    -tlrc_NL_warp                                                          \
	    -tlrc_NL_warped_dsets         $dir_sswarper/anatQQ.Sam.nii             \
	                                  $dir_sswarper/anatQQ.Sam.aff12.1D        \
	                                  $dir_sswarper/anatQQ.Sam_WARP.nii        \
	    -volreg_post_vr_allin         yes                                      \
	    -volreg_pvra_base_index       MIN_OUTLIER                              \
	    -mask_segment_anat            yes                                      \
	    -mask_segment_erode           yes                                      \
	    -regress_polort               2                                        \
	    -regress_anaticor                                                      \
	    -regress_ROI                  CSFe                                     \
	    -regress_apply_mot_types      demean deriv                             \
	    -regress_motion_per_run                                                \
	    -regress_censor_motion        0.4                                      \
	    -regress_skip_first_outliers  5                                        \
	    -html_review_style            pythonic                                 \
	    -execute
done

Thank you, Paul.

Seems like my wicked scripts can at least indirectly contribute to AFNI.