open-discussion > How to Change the Direction of Overlay's Color?
Showing 1-5 of 5 posts
Aug 2, 2020 05:08 AM | Momo Li
How to Change the Direction of Overlay's Color?
Hi all!
We have a CBF change map where 1) positive values indicate an increase in CBF, 2) 0 indicates no change, and 3) negative values indicate a decrease in CBF. To overlay this CBF change map to MRIcroGL, we split the map into two: the negative and the positive overlays, hoping to use two different colors for the two maps to visually illustrate areas with more increase or decrease in CBF.
We tried a few different colors; it seems like that the colors always go brighter for the more positive values and darker for the more negative values. This scheme works for the positive overlay (the lighter the color, the more increase in CBF, with 0 being the darkest). But when it comes to the negative overlay, it makes the more negative values (which represent more decrease in CBF) darker and 0 the lightest.
I hope to make zero the darkest for both maps, and the greater the change in value (regardless if it's positive or negative), the brighter the color. So my goal is to change the direction of color for the negative overlay. Does anyone know how I can achieve this? Thank you so much!
Best,
Momo
We have a CBF change map where 1) positive values indicate an increase in CBF, 2) 0 indicates no change, and 3) negative values indicate a decrease in CBF. To overlay this CBF change map to MRIcroGL, we split the map into two: the negative and the positive overlays, hoping to use two different colors for the two maps to visually illustrate areas with more increase or decrease in CBF.
We tried a few different colors; it seems like that the colors always go brighter for the more positive values and darker for the more negative values. This scheme works for the positive overlay (the lighter the color, the more increase in CBF, with 0 being the darkest). But when it comes to the negative overlay, it makes the more negative values (which represent more decrease in CBF) darker and 0 the lightest.
I hope to make zero the darkest for both maps, and the greater the change in value (regardless if it's positive or negative), the brighter the color. So my goal is to change the direction of color for the negative overlay. Does anyone know how I can achieve this? Thank you so much!
Best,
Momo
Aug 2, 2020 11:08 AM | Chris Rorden
RE: How to Change the Direction of Overlay's Color?
Momo-
You will want to load your statistical overlay twice. Use one layer to optimize your preferences for positive values, the other to optimize your preferences for negative values.
See the Scripting/Templates/Basic example to show you how to handle this.
1.) Open a background image (e.g. File/OpenStandard/spm152).
2.) Open your overlay (File/AddOverlay)
3.) In the "Overlay" panel, select the positive value threshold (e.g. for the example we set both Darkest and Brightest to +4. This hides values darker than 4 and clamps values greater than 4 to 4. You could also set this to a positive range (+4..+6).
4.) Open another copy of your overlay (File/AddOverlay)
5.) In the "Overlay" panel, select the negative value threshold (e.g. for the example we set both Darkest and Brightest to -4. This hides values brighter than -4 and clamps values less than -4 to -4. You could also set this to a negative range (-4..-6).
import gl
gl.resetdefaults()
#open background image
gl.loadimage('spm152')
#open overlay: show positive regions
gl.overlayload('spmMotor')
gl.minmax(1, 4, 4)
gl.opacity(1,50)
#open overlay: show negative regions
gl.overlayload('spmMotor')
gl.minmax(2, -4, -4)
gl.colorname (2,"3blue")
You will want to load your statistical overlay twice. Use one layer to optimize your preferences for positive values, the other to optimize your preferences for negative values.
See the Scripting/Templates/Basic example to show you how to handle this.
1.) Open a background image (e.g. File/OpenStandard/spm152).
2.) Open your overlay (File/AddOverlay)
3.) In the "Overlay" panel, select the positive value threshold (e.g. for the example we set both Darkest and Brightest to +4. This hides values darker than 4 and clamps values greater than 4 to 4. You could also set this to a positive range (+4..+6).
4.) Open another copy of your overlay (File/AddOverlay)
5.) In the "Overlay" panel, select the negative value threshold (e.g. for the example we set both Darkest and Brightest to -4. This hides values brighter than -4 and clamps values less than -4 to -4. You could also set this to a negative range (-4..-6).
import gl
gl.resetdefaults()
#open background image
gl.loadimage('spm152')
#open overlay: show positive regions
gl.overlayload('spmMotor')
gl.minmax(1, 4, 4)
gl.opacity(1,50)
#open overlay: show negative regions
gl.overlayload('spmMotor')
gl.minmax(2, -4, -4)
gl.colorname (2,"3blue")
Aug 2, 2020 04:08 PM | Momo Li
RE: How to Change the Direction of Overlay's Color?
Hi Chris!
Thank you so much for the fast reply! I am attaching a snapshot of the two overlays' color bars. As you can see, both the positive and negative overlays share the same light to dark scale: the color goes darker as the value goes smaller. I want to reverse the light to dark scale for the negative overlay, make "zero" darkest in both overlays.
I apologize ahead if I did a bad job explaining the plan! Again, thank you so much for the help.
Best,
Momo
Thank you so much for the fast reply! I am attaching a snapshot of the two overlays' color bars. As you can see, both the positive and negative overlays share the same light to dark scale: the color goes darker as the value goes smaller. I want to reverse the light to dark scale for the negative overlay, make "zero" darkest in both overlays.
I apologize ahead if I did a bad job explaining the plan! Again, thank you so much for the help.
Best,
Momo
Aug 2, 2020 06:08 PM | Chris Rorden
RE: How to Change the Direction of Overlay's Color?
Please update to a modern version of my software. For example v1.2.20200707. I am not sure what version you are using, but recent versions
have many new features. I only support the latest version.
Aug 2, 2020 07:08 PM | Momo Li
RE: How to Change the Direction of Overlay's Color?
Got you! I just updated to the latest version and it works
perfectly. Thank you so much!