open-discussion > MRIcroGL Atlas Colours
Showing 1-3 of 3 posts
Display:
Results per page:
Mar 9, 2021  08:03 PM | Peter Jones - University of cambridge
MRIcroGL Atlas Colours
Thanks for making it so easy to add new Atlases to MRIcroGL. I have some atlases made for MRIcroN which include RGB colour values for regions. I see MRIcroGL works better in that you can use larger integer types. However, it seems that you cannot specify colours for regions. Is that right?

Simon
Mar 9, 2021  09:03 PM | Chris Rorden
RE: MRIcroGL Atlas Colours
MRIcroGL will load a custom color scheme for an atlas if:
 1. The NIfTI intention is "Labels"
 2. There is a 768-byte file with the same name as the atlas but with the extension .lut (e.g. "brodmann.nii -> brodmann.lut")
 3. This lut file lists 256 red, green, blue colors, each color as a UINT8 (byte with value 0..255).
 4. Matlab code below shows how to create a 768-byte binary LUT file
 5. While MRIcroGL can load atlases with more than 255 regions (e.g. UINT16 data with 65535 regions), it currently only allows you to specify 256 unique colors, so the colors get repeated)


function lut768
RGB256 = zeros(256,3);
for i=0:255
RGB256(i+1,:) = [i, 255 - i, randi([0 255], 1)];
end
fnm = 'brodmann.lut';
[p,n] = fileparts(fnm);
fid = fopen(fullfile(p,[n,'.lut']),'wb');
fwrite(fid,RGB256 * 1.0,'uchar');
fclose(fid);
Mar 9, 2021  10:03 PM | Peter Jones - University of cambridge
RE: MRIcroGL Atlas Colours
Thanks a lot. That worked for atlases with up to 256 values. I padded with zeros for values not present.

Simon