open-discussion > RE: MRIcroGL Atlas Colours
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);

Threaded View

TitleAuthorDate
Peter Jones Mar 9, 2021
RE: MRIcroGL Atlas Colours
Chris Rorden Mar 9, 2021
Peter Jones Mar 9, 2021