-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhrCi2cIm.m
24 lines (22 loc) · 988 Bytes
/
hrCi2cIm.m
1
function cIm = hrCi2cIm(hrCi)% HRCI2CIM Transforms a 2D high-res (24 bits) classification image (hrCi)% into a uint8 color image (cIm). The color image can then be saved in % your favorite image format without loss of information (e.g., TIF). % E.g., Ci = rand(256,256);% hrCi = round((256^3 - 1) * Ci);% cIm = hrCi2cIm(hrCi);% % See also DEMOSTAT4CI, CIM2HRCI% % The Stat4Ci toolbox is free (http://mapageweb.umontreal.ca/gosselif/stat4ci.html); if you use % it in your research, please, cite us:% Chauvin, A., Worsley, K. J., Schyns, P. G., Arguin, M. & Gosselin, F. (2004). A sensitive % statistical test for smooth classification images.% % Alan Chauvin & FrŽdŽric Gosselin ([email protected]), 20/08/2004tIm(:,:,3) = mod(hrCi, 256);tIm(:,:,2) = mod(hrCi - squeeze(tIm(:,:,3)), 256^2);tIm(:,:,1) = mod(hrCi - squeeze(tIm(:,:,3)) - squeeze(tIm(:,:,2)), 256^3);tIm(:,:,2) = tIm(:,:,2) / 256;tIm(:,:,1) = tIm(:,:,1) / 256^2;cIm = uint8(tIm);