help > Scripting in mricroGL importing image error
Showing 1-2 of 2 posts
Display:
Results per page:
May 15, 2021  02:05 PM | Molly Rowlands
Scripting in mricroGL importing image error
Hello, 

I'm trying to make a script in mricroGL, based off of the inbuilt mosaic2 template. I am getting the following error message: 

SyntaxError: EOL while scanning string literal
Python Engine Failed

Below is the code. The issue seems to be with retrieving the overlays. 

import gl
gl.resetdefaults()
gl.backcolor(255, 255, 255)
#open background image
gl.loadimage('spm152')
#open overlay 1: NTT SDM FWE 05 corr
gl.overlayload('/Users/a----------/Desktop/quick access/MyTNTest_z_tfceCorrected_p_0.00500_1_p.nii.gz)
gl.minmax(1, 4, 4)
gl.opacity(0,4)
#open overlay 2: EXT learning uncorr 005SDM
gl.overlayload('/Users/a----------/Desktop/quick access/MyTest1_z_uncorrected_p_0.00500_1.nii.gz')
gl.minmax(2, -4, -4)
gl.colorname (2,"3blue")
gl.colorbarposition(0)
#"a"xial, "c"oronal and "s"agittal "r"enderings
gl.mosaic("A R 0 C R 0 S R 0; A R -0 C R -0 S R -0");

Best, 
Molly
May 16, 2021  02:05 PM | Chris Rorden
RE: Scripting in mricroGL importing image error
The line
  gl.overlayload('/Users/a----------/Desktop/quick access/MyTNTest_z_tfceCorrected_p_0.00500_1_p.nii.gz)
should read
 gl.overlayload('/Users/a----------/Desktop/quick access/MyTNTest_z_tfceCorrected_p_0.00500_1_p.nii.gz')

Explanation: in Python you begin and end a string with a quote or double quote, e.g. 
 gl.overlayload('~/stat.nii')
or
 gl.overlayload("~/stat.nii")

By the way, the Python interpreter should tell you the line for the error, and the line/column of the current cursor location is shown at the top of the scripting window. In the screenshot included the error is on line four, and the cursor is on column 21 of line 4. This can help you troubleshoot errors.