Saving images with command lines

Hi experts,

I am trying to save images with following codes and get following error messages. Could you please help to have a look? Many thanks in advance!!


setenv AFNI_NOSPLASH YES
setenv AFNI_SPLASH_MELT NO
setenv AFNI_PBAR_GULLRANGE NO
setenv AFNI_SKIP_DYLD_WARNING YES
afni -yesplugouts $anat $func_glt \
    -com 'SWITCH_UNDERLAY $anat' \
    -com 'SEE_OVERLAY +' \
    -com 'SWITCH_OVERLAY $func_glt' \
    -com 'SET_SUBBRICKS 0 8 9' \
    -com 'OPEN_WINDOW axialimage mont=3x3:11 opacity=6' \
    -com 'OPEN_WINDOW sagittalimage mont=3x3:14 opacity=6' \
    -com 'OPEN_WINDOW coronalimage mont=3x3:17 opacity=6' \
    -com 'SET_XHAIRS OFF' \
    -com 'SET_DICOM_XYZ 0 0 0' \
    -com 'SET_THRESHNEW 0.05 *p' \
    -com 'SET_PBAR_ALL -99 1 Reds_and_Blues_Inv' \
    -com 'SET_FUNC_RANGE 0.005' \
    -com 'SAVE_PNG axialimage Aud_Aget_axi_0.005.png blowup=2' \
    -com 'SAVE_PNG sagittalimage Aud_Aget_sag_0.005.png blowup=2' \
    -com 'SAVE_PNG coronalimage  Aud_Aget_cor_0.005.png blowup=2' 

Precompiled binary macos_10.12_local: Jan 31 2022 (Version AFNI_22.0.04 ‘Hadrian’)

** Version check disabled: AFNI_VERSION_CHECK forbids
Thanks go to MM Klosek for advice and help

Initializing: X11[The X.Org Foundation v 12011000]… Widgets.
Fatal Signal 11 (SIGSEGV) received
Last STATUS: making imag->rowcol
AFNI_make_wid1
AFNI_make_widgets
new_AFNI_controller
MAIN_workprocess
AFNI:main
Bottom of Debug Stack
** AFNI version = AFNI_22.0.04 Compile date = Jan 31 2022
** [[Precompiled binary macos_10.12_local: Jan 31 2022]]
** Program Death **
** If you report this crash to the AFNI message board,
** please copy the error messages EXACTLY, and give
** the command line you used to run the program, and
** any other information needed to repeat the problem.
** You may later be asked to upload data to help debug.
** Crash log is appended to file /Users/xiyuezh/.afni.crashlog
++ AFNI is detached from terminal.

Though you are skipping the DYLD warning, I expect that is the problem. This still requires loading the Xt library, for example, and it still needs to be the correct one. I think this requires having a proper DYLD_LIBRARY_PATH set for tcsh.

  • rick

Hi-

The path stuff still needs to be sorted in setup, but have you seen the @chauffeur_afni functionality here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/auto_image/main_toc.html
… and more specifically here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/auto_image/auto_%40chauffeur_afni.html
?

That would seem to be doing a looot of what you want, and perhaps with a simpler interface. For example, based on your code and this example:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/auto_image/auto_%40chauffeur_afni.html#ex-4-overlay-beta-coefs-and-threshold-with-stats
I wonder if this is close to what you want (just an easier/more extensible interface):


@chauffeur_afni                                                       \
    -ulay             "${anat}"                                       \
    -olay             "${func_glt}"                                   \
    -set_subbricks    0 8 9                                           \
    -func_range       0.005                                           \
    -cbar             Reds_and_Blues_Inv                              \
    -set_dicom_xyz    0 0 0                                           \
    -delta_slices     14 17 11                                        \
    -opacity          6                                               \
    -thr_olay_p2stat  0.05                                            \
    -thr_olay_pside   bisided                                         \
    -prefix           Aud_Aget_axi_0.005                              \
    -set_xhairs       OFF                                             \
    -montx 3 -monty 3                                                 \
    -blowup           2                                               \
    -label_mode 1 -label_size 4

… though, you could use "-box_focus_slices AMASK_FOCUS_ULAY " to pick a zoomed-in autobox within which to make evenly spaced slices, rather than specifying both “-set_dicom_xyz 0 0 0” and “-delta_slices 14 17 11”.

You can also add in the translucent way of thresholding, which I really like, see here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/auto_image/auto_%40chauffeur_afni.html#ex-5-overlay-beta-coefs-and-threshold-translucently-with-stats

–pt

Thank you Taylor. I tried to run this code but got the following errors. Could you please give some advice? Thank you so much!


@chauffeur_afni                                                       \
    -ulay             "${anat}"                                       \
    -olay             "${func_glt}"                                   \
    -set_subbricks    0 8 9                                           \
    -func_range       0.005                                           \
    -cbar             Reds_and_Blues_Inv                              \
    -delta_slices     14 17 11                                        \
    -opacity          6                                               \
    -thr_olay_p2stat  0.05                                            \
    -thr_olay_pside   bisided                                         \
    -prefix           Aud_Aget_axi_0.005                              \
    -set_xhairs       OFF                                             \
    -montx 3 -monty 3                                                 \
    -blowup           2                                               \
    -label_mode 1 -label_size 4
  

[quote=“[1] + Exit 1 Xvfb :186 -screen 0 1024x768x24
– trying to start Xvfb :261
[1] 6045
_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
_XSERVTransSocketUNIXCreateListener: mkdir(/tmp/.X11-unix) failed, errno = 2
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn’t already running(EE)”]
[/quote]

Thank you Taylor. I tried to run this code but got the following errors. Could you please give some advice? Thank you so much!


@chauffeur_afni                                                       \
    -ulay             "${anat}"                                       \
    -olay             "${func_glt}"                                   \
    -set_subbricks    0 8 9                                           \
    -func_range       0.005                                           \
    -cbar             Reds_and_Blues_Inv                              \
    -delta_slices     14 17 11                                        \
    -opacity          6                                               \
    -thr_olay_p2stat  0.05                                            \
    -thr_olay_pside   bisided                                         \
    -prefix           Aud_Aget_axi_0.005                              \
    -set_xhairs       OFF                                             \
    -montx 3 -monty 3                                                 \
    -blowup           2                                               \
    -label_mode 1 -label_size 4
  

[quote=“[1] + Exit 1 Xvfb :186 -screen 0 1024x768x24
– trying to start Xvfb :261
[1] 6045
_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
_XSERVTransSocketUNIXCreateListener: mkdir(/tmp/.X11-unix) failed, errno = 2
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn’t already running(EE)”]
[/quote]

Sure, that is a known occurence to happen.

The solution is here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/auto_image/auto_%40chauffeur_afni.html#troubleshooting
See Issue #1, specifically.

–pt