help > Overlay about extreme value in a batch
Showing 1-5 of 5 posts
Display:
Results per page:
Jul 10, 2020  02:07 AM | Junhao Luo - Beijing Normal University
Overlay about extreme value in a batch
Hi,
I have a problem about the display of the overlay mapping to a surface when I want to control it in a script,I mean,I don't know the Pascal command to set this parameter.

Actually,I can select the color bar options for extreme values in the GUI,and the directory lists are as follows.
"Options"---->"Extreme Values"
----->"Automatic"
----->"Hide Dark and Bright"
----->"Hide Dark,Show Bright"
----->"Show Dark,Hide Bright"
----->"Show Dark and Bright"

But when I do batch processing in a script,I have't found the command to control the option.The default extreme value option is "Automatic " and I want to change it into "Show Dark and Bright" in a script but not the GUI.
Could you please tell me how I can do it?
I am looking forward to your reply.Thanks.

Yours,
Junhao Luo.

State Key Laboratory of cognitive neuroscience and learning in Beijing Normal University.
Mail:201731430026@mail.bnu.edu.cn
Jul 30, 2020  05:07 PM | Chris Rorden
RE: Overlay about extreme value in a batch
Please try out v1.0.20200729. It includes the new function overlayextreme().


This is described as:


overlayextreme (built-in function):
overlayextreme(layer, mode) -> Behavior of values beyond min..max (-1 automatic, 0 hide dark & bright, 1: hide dark, 2 hide bright, 3 show dark & bright)


So an example would be:

import gl
gl.resetdefaults()
gl.azimuthelevation(70, 15)
gl.meshload('BrainMesh_ICBM152Right.mz3')
gl.overlayload('motor_4t95vol.nii.gz')
gl.overlayminmax(1,2,6)
gl.overlayextreme(1,0)
Jul 30, 2020  08:07 PM | Junhao Luo - Beijing Normal University
RE: Overlay about extreme value in a batch
Thanks for your reply!I am sorry to tell you that it doesn't work.
I use the newest version in MacOS of what you have said but I haven't found the command overlayextreme in the script panel.

I tried to use this command in a script and I can run it successfully.

gl.overlayextreme(1,3)

What surprised me it that I have found the extreme value option has been changed into "Show Dark and Bright" when I checked it in the GUI but the image in the display window doesn't change as expected,I mean, it is still like what it was in default "Automatic".And when I change the extreme value option in the GUI manually it can work.

In conclusion, the command can change the extreme value options formally but it doesn't influence the image in the display window.
Attachment: WechatIMG148.png
Jul 31, 2020  02:07 PM | Chris Rorden
RE: Overlay about extreme value in a batch
I can not replicate your issue. Try the code
import gl
gl.resetdefaults()
gl.azimuthelevation(70, 15)
gl.meshload('BrainMesh_ICBM152Right.mz3')
gl.overlayload('motor_4t95vol.nii.gz')
gl.overlayminmax(1,-2,6)
gl.overlayextreme(1,3)

And see how the image changes as you change the last line:

 gl.overlayextreme(1,-1)
"Automatic" mode hides values less than -2, values greater than 6 are clamped to 6. This mode is dynamic, if the overlayminmax specified two negative values (e.g. gl.overlayminmax(1,-2,-6)) it would behave as "Show Dark, Hide Bright"). 

gl.overlayextreme(1,0)
"Hide Dark and Bright" mode hides values less than -2, hides values greater than 6.

gl.overlayextreme(1,1)
"Hide Dark, Show Bright" mode hides values less than -2, values greater than 6 are clamped to 6.

gl.overlayextreme(1,2)
"Show Dark, Hide Bright" mode clamps values less than -2 to -2, hides values greater than 6.

gl.overlayextreme(1,3)
"Show Dark, Show Bright" mode clamps values less than -2 to -2, clamps values greater than 6 to 6.

In general, if you want to independently control the negative and positive values in a single statistical test, you should load the map twice, and adjust each layer independently. This gives you independent control of the color schemes, and for this situation the "Automatic" mode works nicely. This method is illustrated by the example script you can see by choosing Scripting/Python/basic_paint_surface, which loads the statistical map motor_4t95vol twice, with one layer being positive and the other being negative.

import gl
gl.resetdefaults()
gl.azimuthelevation(70, 15)
gl.meshload('BrainMesh_ICBM152Right.mz3')
gl.overlayload('motor_4t95vol.nii.gz')
gl.overlayminmax(1,2,12)
gl.overlayload('motor_4t95vol.nii.gz')
gl.overlayminmax(2,-1,-2)
gl.colorbarvisible(1)
gl.overlaytransparencyonbackground(25)
gl.meshcurv() 
Aug 1, 2020  03:08 AM | Junhao Luo - Beijing Normal University
RE: Overlay about extreme value in a batch
Oh,thanks!The problem has been solved!