function im = IAS_kernels2RGB(cat,k1,k2,s)
%

[M,N] = size(cat);
im = zeros(k1*M,k2*N,3);
map = [0.7,0.7,0.7; 1,0,0; 0,1,0; 0,0,1; 1,1,0; 1,0,1; 0,1,1];
for m = 1:M
    r = (m-1)*k1 + 1;
    for n = 1:N
        label = 0;
        b = cat(m,n);
        if b==1&s==0
            label = 1;
        elseif b==2&s==0
            label = 2;
        elseif b==3&s==0
            label = 3;
        elseif b==4&s==0
            label = 4;
        elseif b==5&s==0
            label = 5;
        elseif b==6&s==0
            label = 6;
        elseif b==7&s==0
            label = 7;
        elseif s>0&b==s
            label = s;
        end
        c = (n-1)*k2 + 1;
        if label>0
            im(r:r+k1-1,c:c+k2-1,1) = map(label,1);
            im(r:r+k1-1,c:c+k2-1,2) = map(label,2);
            im(r:r+k1-1,c:c+k2-1,3) = map(label,3);
        end
    end
end
