APQC Motion Block - No Images

Hi AFNI team,

I am preprocessing resting state data using AFNI_21.2.04. I’ve copied my proc.py command below. In my HTML output there are no images generated in the motion block. While I can generate these images independently using 1dplot it would be handy to have them in the QC output for all participants for the review process. I am attaching the output generate from running the motion blocks of the @ss_review_html script. Do you have any suggestions on what may need to change so that these plots can be generated?

Thank you!
Jenna


++ FOR: motion_sub01_enorm.1D: 1 arrays with 136 pts
++ FOR: outcount_rall.1D: 1 arrays with 136 pts
++ Lists of names and yvars match length
*+ No input x-axis; making values based on length of data: [0..135]
++ Plotting: enorm (~mm)
++ Plotting: outlier frac
Traceback (most recent call last):
  File "/gpfs/runtime/opt/afni/21.2.04/1dplot.py", line 65, in <module>
    ok_fig  = lpod.make_1dplot_figure(bigfig)
  File "/gpfs/rt/7.2/opt/afni/21.2.04/afnipy/lib_plot_1D.py", line 498, in make_1dplot_figure
    bbox_inches='tight')
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 695, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 2062, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 2173, in print_figure
    canvas = self._get_output_canvas(format)
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 2105, in _get_output_canvas
    .format(fmt, ", ".join(sorted(self.get_supported_filetypes()))))
ValueError: Format 'jpg' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz)
++ FOR: dfile_rall.1D: 6 arrays with 136 pts
++ Lists of names and yvars match length
*+ No input x-axis; making values based on length of data: [0..135]
++ Plotting: dP
(mm)
++ Plotting: dL
(mm)
++ Plotting: dS
(mm)
++ Plotting: yaw
(deg)
++ Plotting: pitch
(deg)
++ Plotting: roll
(deg)
Traceback (most recent call last):
  File "/gpfs/runtime/opt/afni/21.2.04/1dplot.py", line 65, in <module>
    ok_fig  = lpod.make_1dplot_figure(bigfig)
  File "/gpfs/rt/7.2/opt/afni/21.2.04/afnipy/lib_plot_1D.py", line 498, in make_1dplot_figure
    bbox_inches='tight')
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 695, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 2062, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 2173, in print_figure
    canvas = self._get_output_canvas(format)
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 2105, in _get_output_canvas
    .format(fmt, ", ".join(sorted(self.get_supported_filetypes()))))
ValueError: Format 'jpg' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz)
++ 3dGrayplot: AFNI version=AFNI_21.2.04 (Jul 28 2021) [64-bit]
 + Loading dataset ./errts.sub01.fanaticor+tlrc.HEAD
 + Number of voxels in mask = 62801
 + 3dGrayplot: Elapsed = 3.5 s
++ pbar name has known extension: jpg
++ My command:
   @chauffeur_afni -ulay mask_epi_anat.sub01+tlrc.HEAD -olay mask_epi_anat.sub01+tlrc.HEAD -box_focus_slices AMASK_FOCUS_OLAY -cbar gray_scale -func_range 3.29 -blowup 1 -set_subbricks 0 0 0 -opacity 9 -pbar_saveim QC_sub01/media/qc_08_mot_grayplot.pbar.jpg -pbar_comm_range for normal distr, bounds of 0.001 prob tail -prefix __tmp_ZXCV_img -save_ftype JPEG -montx 1 -monty 1 -set_xhairs OFF -label_mode 1 -label_size 3 -do_clean

++ Using AFNI ver : AFNI_21.2.04
++ chauffeur ver  : 6.26

------------------ start of optionizing ------------------

++ Found input file:   mask_epi_anat.sub01+tlrc.HEAD
++ Found input file:   mask_epi_anat.sub01+tlrc.HEAD
++ Using blowup factor: 1
++ Using opacity:  9
++ Making temporary work directory to copy vis files: ./__tmp_chauf_YNZcvkMHJbF
++ Converted 0 to labels
++ Final subbrick indices: 0 0 0
++ Copy ulay to visualize (volumetric) within user's range:
++ Ulay to be visualized within user range:
  [0%, 98%] -> [0.000000, 1.000000]
++ 3dcalc: AFNI version=AFNI_21.2.04 (Jul 28 2021) [64-bit]
++ Authored by: A cast of thousands
++ Output dataset ././__tmp_chauf_YNZcvkMHJbF/tmp_ulay.nii
++ 3dcalc: AFNI version=AFNI_21.2.04 (Jul 28 2021) [64-bit]
++ Authored by: A cast of thousands
++ Output dataset ././__tmp_chauf_YNZcvkMHJbF/tmp_olay.nii
++ User-entered function range value value (3.29)
++ Dimensions (xyzt): 64 76 64 1
++ (initial) Slice spacing ordered (x,y,z) is:  64 76 64
++ 3dAutomask: AFNI version=AFNI_21.2.04 (Jul 28 2021) [64-bit]
++ Authored by: Emperor Zhark
++ 3dAutobox: AFNI version=AFNI_21.2.04 (Jul 28 2021) [64-bit]
++ Auto bbox: x=0..63  y=0..75  z=0..63
++ THD_zeropad: all pad values are zero - just copying dataset
++ 3dAutobox: output dataset = ./__tmp_chauf_YNZcvkMHJbF/ulay_box_0.nii
++ 3dmaskdump: AFNI version=AFNI_21.2.04 (Jul 28 2021) [64-bit]
++ Executing 3dcalc()
 argv[0]=3dcalc argv[1]=-a argv[2]=./__tmp_chauf_YNZcvkMHJbF/ulay_box_0.nii[0] argv[3]=-expr argv[4]=a argv[5]=-byte argv[6]=-session argv[7]=/tmp argv[8]=-prefix argv[9]=3dcalc_XYZ_uh_XsyAJiXcm1HNaMN9hUQ argv[10]=-verbose
++ 3dcalc: AFNI version=AFNI_21.2.04 (Jul 28 2021) [64-bit]
++ Authored by: A cast of thousands
++ Computing sub-brick 0
++ Scaling output to type byte brick(s)
++ Sub-brick 0: no scale factor
++ Computing output statistics
++ Output dataset /tmp/3dcalc_XYZ_uh_XsyAJiXcm1HNaMN9hUQ+tlrc.BRIK
++ 311296 voxels in the entire dataset (no mask)
++ 1 voxels in the boxes and/or balls
++ Using only the boxes+balls mask
++ How many coors? 3
++ Will have the ref box central coors : SET_DICOM_XYZ 1.5 19.5 19.5
++ Will have the ref box central gapord: 64 76 64

------------------- end of optionizing -------------------

 -- trying to start Xvfb :535 
[1] 121869

+++ Command Echo:
   afni -q -no1D -noplugins -no_detach -com SWITCH_UNDERLAY tmp_ulay.nii -com SWITCH_OVERLAY  tmp_olay.nii -com SEE_OVERLAY     + -com OPEN_WINDOW sagittalimage opacity=9 mont=1x1:64:0:black crop=0:0,0:0 -com OPEN_WINDOW coronalimage  opacity=9 mont=1x1:76:0:black crop=0:0,0:0 -com OPEN_WINDOW axialimage    opacity=9 mont=1x1:64:0:black crop=0:0,0:0 -com SET_PBAR_ALL    -99 1 gray_scale -com PBAR_SAVEIM QC_sub01/media/qc_08_mot_grayplot.pbar.jpg dim=64x512H -com SET_SUBBRICKS   0 0 0 -com SET_ULAY_RANGE A.all 0.000000 1.000000 -com SET_FUNC_RANGE  3.29 -com SET_THRESHNEW   0 * -com SET_FUNC_ALPHA  No -com SET_FUNC_BOXED  No -com SET_FUNC_RESAM  NN.NN -com SET_XHAIRS      OFF -com SET_XHAIR_GAP   -1 -com SET_DICOM_XYZ 1.5 19.5 19.5 -com SAVE_JPEG sagittalimage ./__tmp_ZXCV_img.sag blowup=1 -com SAVE_JPEG coronalimage  ./__tmp_ZXCV_img.cor blowup=1 -com SAVE_JPEG axialimage    ./__tmp_ZXCV_img.axi blowup=1 -com QUITT ./__tmp_chauf_YNZcvkMHJbF 

+/gpfs/data/hoh23/jblujus/Redundancy/derivatives/AFNI_03_Proc_DerivCensBPOut/sub01/sub01.results/__tmp_chauf_YNZcvkMHJbF++ Writing palette image to QC_sub01/media/qc_08_mot_grayplot.pbar.jpg
++ Writing one 76x64 image to filter '/gpfs/runtime/opt/afni/21.2.04/cjpeg -quality 95 > ./__tmp_ZXCV_img.sag.jpg'
++ Writing one 64x64 image to filter '/gpfs/runtime/opt/afni/21.2.04/cjpeg -quality 95 > ./__tmp_ZXCV_img.cor.jpg'
++ Writing one 64x76 image to filter '/gpfs/runtime/opt/afni/21.2.04/cjpeg -quality 95 > ./__tmp_ZXCV_img.axi.jpg'

AFNI QUITTs!

+* Removing temporary image directory './__tmp_chauf_YNZcvkMHJbF'.

[1]  + Done                          Xvfb :535 -screen 0 1024x768x24

++ DONE (good exit)
   see: ./__tmp_ZXCV_img*

++ FOR: motion_sub01_enorm.1D: 1 arrays with 136 pts
++ FOR: outcount_rall.1D: 1 arrays with 136 pts
*+ No ylabels entered
*+ No input x-axis; making values based on length of data: [0..135]
++ Will scale each time series by censor_hline
++ Apply scale: 3.33333333333
++ Apply scale: 10.0
++ Will apply same y-axis range '[0.0, 3.0]' to all dsets
++ Plotting: 
++ Plotting: 
Traceback (most recent call last):
  File "/gpfs/runtime/opt/afni/21.2.04/1dplot.py", line 65, in <module>
    ok_fig  = lpod.make_1dplot_figure(bigfig)
  File "/gpfs/rt/7.2/opt/afni/21.2.04/afnipy/lib_plot_1D.py", line 495, in make_1dplot_figure
    plt.savefig( bf.fname, dpi=bf.dpi, facecolor=bf.bkgd_color)
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 695, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 2062, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 2173, in print_figure
    canvas = self._get_output_canvas(format)
  File "/gpfs/runtime/opt/matplotlib/2.2.4/lib/python2.7/site-packages/matplotlib-2.2.4-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 2105, in _get_output_canvas
    .format(fmt, ", ".join(sorted(self.get_supported_filetypes()))))
ValueError: Format 'jpg' is not supported (supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz)
djpeg: can't open __tmp_img_enorm.jpg
pnmcat: Error reading magic number from Netpbm image stream.  Most often, this means your input file is empty.
Empty input file

+* Removing temporary files '__tmp_gluing*'


++ DONE! Image output:
       QC_sub01/media/qc_08_mot_grayplot.jpg

rm: cannot remove \u2018__tmp_img_enorm.jpg\u2019: No such file or directory


afni_proc.py                                                                                                           	 \
                 -subj_id sub01 -script proc.sub01 -scr_overwrite -out_dir sub01.results     \
                 -blocks despike tshift align tlrc volreg blur mask scale                               \
                     regress                                                                                            	\
                 -radial_correlate_blocks tcat volreg                                                             \
                 -copy_anat ${ss_dir}/anatSS.sub01.nii                                                         \
                 -anat_has_skull no                                                                                      \
                 -anat_follower anat_w_skull anat  ${ss_dir}/anatU.sub01.nii                       \
                 -anat_follower_ROI aaseg anat ${fs_dir}/aparc.a2009s+aseg.nii.gz           \
                 -anat_follower_ROI aeseg epi ${fs_dir}/aparc.a2009s+aseg.nii.gz            \
                 -anat_follower_ROI FSvent epi ${fs_dir}/fs_ap_latvent.nii.gz                     \
                 -anat_follower_ROI FSWe epi ${fs_dir}/fs_ap_wm.nii.gz                            \
                 -anat_follower_erode FSvent FSWe                                                            \
                 -dsets ${raw_epi}                                                                                      \
                 -tcat_remove_first_trs 4                                                                               \
                 -tshift_opts_ts -tpattern altplus						      \
                 -align_opts_aea -cost lpc+ZZ -giant_move -check_flip                                   \
                 -tlrc_base MNI152_2009_template_SSW.nii.gz                                              \
                 -tlrc_NL_warp                                                                                          \
                 -tlrc_NL_warped_dsets ${ss_dir}/anatQQ.sub01.nii ${ss_dir}/anatQQ.sub01.aff12.1D                     \
                     ${ss_dir}/anatQQ.sub01_WARP.nii                                                               \
                 -volreg_align_to MIN_OUTLIER                                                                       \
                 -volreg_align_e2a                                                                                      \
                 -volreg_tlrc_warp                                                                                      \
                 -blur_size 4                                                                                           \
                 -mask_epi_anat yes                                                                                     \
                 -regress_motion_per_run                                                                                \
                 -regress_ROI_PC FSvent 3                                                                               \
                 -regress_ROI_PC_per_run FSvent                                                                     \
                 -regress_make_corr_vols aeseg FSvent                                                             \
                 -regress_anaticor_fast                                                                                 \
                 -regress_anaticor_label FSWe                                                                           \
                 -regress_censor_motion 0.3										\
 	      	 -regress_censor_outliers 0.1										\
		 -regress_bandpass 0.01 0.1                                                                             \
                 -regress_apply_mot_types demean deriv                                                            \
                 -regress_est_blur_epits                                                                                \
                 -regress_est_blur_errts                                                                                \
                 -html_review_style pythonic

Hi, Jenna-

I would guess a dependency is missing from the install instructs (e.g. libjpeg62, if you were using Ubuntu 20.04). What is your OS?
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/index.html
I would copy+paste the block of necessary dependencies under “Install prerequisite packages” is whatever OS you are using.

Checking the “afni_system_check.py -check_all” might also show an issue—hopefully not after making sure the dependencies work.

There is a script to just redo the APQC for one or more subjs, too, so you don’t have to reprocess all of them, for this kind of issue.

–pt