open-discussion > Colors do not display correctly
Showing 1-3 of 3 posts
May 8, 2020 02:05 PM | Chuanji Gao
Colors do not display correctly
Hi Chris,
I hope you are well.
I'm trying to display four different images with different colors on the brain.
However, I noticed the colors did not display as I specified.
The color of first image is correct, but the colors for the other three images switched for some reason.
For example, I specified image 3 color to be green, but the resulting image showed its color as blue.
I haven't figured why, I appreciate if you can help.
The code used is below:
I also attached the image I got.
import gl
gl.resetdefaults()
#open background image
gl.loadimage('spm152')
gl.overlayloadsmooth(1)
#open overlay: show positive regions
gl.overlayload('C:\\Users\\CHUANJI\\Desktop\\SnPM_thresh1.nii')
gl.minmax(1, 0.01,0.1)
gl.colorname(1,'red')
gl.colorfromzero(1,1)
gl.overlayload('C:\\Users\\CHUANJI\\Desktop\\SnPM_thresh2.nii')
gl.minmax(2, 0.01,0.1)
gl.colorname(2,'hot')
gl.colorfromzero(2,1)
gl.overlayload('C:\\Users\\CHUANJI\\Desktop\\SnPM_thresh3.nii')
gl.minmax(3, 0.01,0.1)
gl.colorname(3,'green')
gl.colorfromzero(3,1)
gl.overlayload('C:\\Users\\CHUANJI\\Desktop\\SnPM_thresh4.nii')
gl.minmax(4, 0.01,0.1)
gl.colorname(4,'blue')
gl.colorfromzero(4,1)
#gl.hiddenbycutout(1,1)
#cutout (l, a, s, r, p, i: float) Selects a sector to remove from rendering view.
#gl.cutout(1,0.5,0.5,0.5,0,1)
gl.azimuthelevation(60,30)
gl.shadername('OverlaySurface')
gl.backcolor(255,255,255)
I hope you are well.
I'm trying to display four different images with different colors on the brain.
However, I noticed the colors did not display as I specified.
The color of first image is correct, but the colors for the other three images switched for some reason.
For example, I specified image 3 color to be green, but the resulting image showed its color as blue.
I haven't figured why, I appreciate if you can help.
The code used is below:
I also attached the image I got.
import gl
gl.resetdefaults()
#open background image
gl.loadimage('spm152')
gl.overlayloadsmooth(1)
#open overlay: show positive regions
gl.overlayload('C:\\Users\\CHUANJI\\Desktop\\SnPM_thresh1.nii')
gl.minmax(1, 0.01,0.1)
gl.colorname(1,'red')
gl.colorfromzero(1,1)
gl.overlayload('C:\\Users\\CHUANJI\\Desktop\\SnPM_thresh2.nii')
gl.minmax(2, 0.01,0.1)
gl.colorname(2,'hot')
gl.colorfromzero(2,1)
gl.overlayload('C:\\Users\\CHUANJI\\Desktop\\SnPM_thresh3.nii')
gl.minmax(3, 0.01,0.1)
gl.colorname(3,'green')
gl.colorfromzero(3,1)
gl.overlayload('C:\\Users\\CHUANJI\\Desktop\\SnPM_thresh4.nii')
gl.minmax(4, 0.01,0.1)
gl.colorname(4,'blue')
gl.colorfromzero(4,1)
#gl.hiddenbycutout(1,1)
#cutout (l, a, s, r, p, i: float) Selects a sector to remove from rendering view.
#gl.cutout(1,0.5,0.5,0.5,0,1)
gl.azimuthelevation(60,30)
gl.shadername('OverlaySurface')
gl.backcolor(255,255,255)
May 8, 2020 06:05 PM | Chris Rorden
RE: Colors do not display correctly
Note that first few color table names are preceded by a number,
this allows them to be at the top of an alphabetical list. So
instead of 'red'/'green'/'blue'/hot you want to specify
'1red','2green','3blue','4hot'. So for your script:
gl.colorname(1,'1red')
...
gl.colorname(2,'4hot')
...
gl.colorname(3,'2green')
...
gl.colorname(4,'3blue')
gl.colorname(1,'1red')
...
gl.colorname(2,'4hot')
...
gl.colorname(3,'2green')
...
gl.colorname(4,'3blue')
May 8, 2020 06:05 PM | Chuanji Gao
RE: Colors do not display correctly
Ah I see. I just tried and now it worked perfectly. Thank you very
much Chris!
and thanks for the helpful tools, as always.
and thanks for the helpful tools, as always.