Drive SUMA recording image - Improve image size/ quality?

AFNI version info (afni -ver):
Version AFNI_23.0.07 'Commodus

Hi there,

I have been using drive suma to load up some surfaces and make images of them.

When I record the image, using the following code (below) the images made are not very high quality (they seem grainy/ fuzzy/ not sharp), where they look great on the screen.

DriveSuma \
		-echo_edu -npb $portnum \
		-com viewer_cont -autorecord ${base_dir}/${save_img}.jpg \
		-com viewer_cont -key 'Ctrl+r'

The size of the viewer is 1500 x 800 pixels (see below).

setenv SUMA_Position_Original "0 0  1501 800"

I tried changing image format from .JPG to .PNG to see if this helped, but this did not work, suggesting I am doing something else wrong with recording command. The filenames suggest so also. It's adding it's own date/time name to the one I specified (code above).

Wrote image to /scratch/cvl/uqhdemp1/Data/Columns/derivatives/afni//stats.P002_HW.resamp2nn.surf.blur0.roi_bin_mask.niml.dset.png.A.240612_141959.177.jpg

I'm not sure why there are two // in the filename, as when I echo the variable on it's own I get this:

echo ${base_dir}/${save_img}.png
/scratch/cvl/uqhdemp1/Data/Columns/derivatives/afni/stats.P002_HW.resamp2nn.surf.blur0.roi_bin_mask.niml.dset.png

Aside from whatever error I am making with the saving, I guess there is some compression or something happening? As the size of the images is quite small (244kB), where when I take a screenshot, they are much larger (2.4MB). Is there any way to increase the image quality/ file size?

I tried changing the oversampling up to 4 (option + r), but this did not seem to affect the images I made so I think I was using it incorrectly. I wondered if I should change it in the SUMA environment variable (by setenv SUMA_SnapshotOverSampling "4"?)

In sum, please help me make higher quality images with drive suma.

Thank you for your help,

H

Making the suma view window larger with large values in the last two numbers here:

setenv SUMA_Position_Original "0 0  1501 800"

... should be the way to go.

Here is a driver script I made a while back, which I haven't looked at for a while, but it might help. It uses this suma_MNI_N27 data directory as a reference, being run from just outside it:

#!/bin/tcsh

########################################################################
#
# How to: view volumetric ROIs on SUMA surface and snapshot automatically
#
# Open up AFNI, overlay a value dset, no threshold, project into SUMA,
# rotate the brain to sagittal views for each hemisphere, record jpgs.
#
# v1.0, PA Taylor (NIMH, NIH), Nov 17 2017.
#
########################################################################

# ======================= main user settings =========================
#
# MAIN FILES
# sdir      :loc of SUMA surfs+dsets dir, basically from running FS on
#            MNI template brain
# afni_ulay :'ulay' both for AFNI viewing and as 'sv' volume for SUMA
# afni_ulay :'olay' both for AFNI viewing and projecting onto surface
# olay_brik :which olay brick to display
# suma_spec :file that has all SUMA surfaces with multiple viewing
#            states
# suma_sv   :'surfvol' dset: FOV info needed for AFNI+SUMA to talk, so 
#            we just use the ulay or olay dset.
# ---------------------------------------------------------------------

set here = $PWD

#set sdir = "$HOME/.afni/data/suma_MNI_N27"   
set sdir = "$here/suma_MNI_N27"   

set suma_spec     = "std.141.MNI_N27_both.spec"
set suma_nimldset = "std.141.rh.curv.niml.dset"
set suma_sv       = "MNI_N27_SurfVol.nii"

# what to display, and how
set nimldset_br_i = "0"       # which "brick" of inp dset to display
set nimldset_imin = "-0.25"   # lower value of cbar
set nimldset_imax = "0.25"    # upper value of cbar

set dset_cbar = "Reds_and_Blues_Inv" # which cbar

set nimldset_br_t = "0"       # which "brick" of inp dset to threshold
                              # "-1" turns off thr
set nimldset_tval = "0.10"    # threshold value; "-1" turns off thr

cd $sdir

# -------------------- image file parameters -----------------------

# Saved image naming props: directory and file prefix (latter, taken
# from olay filename here)
set image_dir = "$here/MY_ROI_SURF_IMAGES"        
set image_pre = `basename "$suma_nimldset" ".niml.dset"`

# size of the image window (bigger -> higher res), given as:
#       leftcorner_X  leftcorner_Y  windowwidth_X  windowwith_Y
setenv SUMA_Position_Original "50 50 1500 1500" #"50 50 3500 3500"
#setenv SUMA_Light0Position "10 1 1"

# --------------------- preliminary settings -----------------------

# port number for AFNI+SUMA to talk to each other
set portnum = `afni -available_npb_quiet`

# boring stuff.
setenv AFNI_ENVIRON_WARNINGS       NO
setenv AFNI_PBAR_FULLRANGE         NO
setenv SUMA_DriveSumaMaxCloseWait  20
setenv SUMA_DriveSumaMaxWait       10

setenv SUMA_AutoRecordPrefix "${image_dir}/${image_pre}"
#setenv SUMA_SnapshotOverSampling $OVERSAMP

# ========================= run SUMA ============================

# --------------------- SUMA setup------------------------------

suma                                                            \
    -echo_edu                                                   \
    -npb $portnum                                               \
    -niml                                                       \
    -spec  $suma_spec                                           \
    -sv    $suma_sv     &

echo "++ more sleepy time..."
sleep 3

# for Macness (or madness, or the same thing...)
DriveSuma                                            \
    -echo_edu                                        \
    -npb $portnum                                    \
    -com surf_cont -view_surf_cont y

echo "++ more sleepy time..."
sleep 2

DriveSuma                                            \
    -echo_edu                                        \
    -npb $portnum                                    \
    -com surf_cont -load_dset $suma_nimldset         \
    -com surf_cont -switch_cmap "$dset_cbar"         \
    -view_surf_cont y

# set brick of dset to look at
# set range of values for cbar
# set brick of dset to thr at
# set threshold value
DriveSuma                                            \
    -echo_edu                                        \
    -npb $portnum                                    \
    -com surf_cont -I_sb  "$nimldset_br_i"           \
    -I_range "$nimldset_imin" "$nimldset_imax"       \
    -T_sb   "$nimldset_br_t"                         \
    -T_val  "$nimldset_tval"

# '.' keypress to go through spec file list to surf type 
#     we want for image
# brain looks left.
DriveSuma                                              \
    -echo_edu                                          \
    -npb $portnum                                      \
    -com viewer_cont -key '.' -key '.'                 \
    -com  viewer_cont  -key ctrl+left 

sleep 3

# In order, turn *OFF* visibility of the:  
#    crosshair, selector node, selector faceset, and label
DriveSuma                                              \
    -echo_edu                                          \
    -npb $portnum                                      \
    -com viewer_cont -key 'F3' -key 'F4' -key 'F5' -key 'F9'

# Sagittal profile,  SNAP
DriveSuma                                              \
    -npb $portnum                                      \
    -com viewer_cont -key 'Ctrl+left'                  \
    -com viewer_cont -key 'Ctrl+r'

sleep 1

# same hemi, SNAP
DriveSuma                                              \
    -npb $portnum                                      \
    -com viewer_cont -key 'Ctrl+right'                 \
    -com viewer_cont -key 'Ctrl+r'

sleep 1

# front cor profile, SNAP
DriveSuma                                              \
    -npb $portnum                                      \
    -com viewer_cont -key 'Ctrl+up'                    \
    -com viewer_cont -key 'Ctrl+r'

sleep 1

# back cor profile, SNAP
DriveSuma                                              \
    -npb $portnum                                      \
    -com viewer_cont -key 'Ctrl+down'                  \
    -com viewer_cont -key 'Ctrl+r'

sleep 1

# Close everything down!  Optionally, can leave AFNI+SUMA running, if
# you preferred.
#@Quiet_Talkers -npb_val $portnum


echo "++ DONE!"

If you change the size of the SUMA_Position_Original numbers, you get a larger screenshot (more pixels per image); when you shrink that to comparable sizes in your image, the larger one has effectively higher res. I just verified that works, trying either 500x500 or 1500x1500. The number of pixels in the corresponding outputs were 496x467 and 1496x1351, respectively:
std.141.rh.curv.A.240612_071932.506

--pt