Coloring only specific pixels

前端 未结 2 1352
清歌不尽
清歌不尽 2021-01-24 02:25

I have a matrix representing an image of brain with each (i,j) position having a value between 0 and 1. I am applying a color map, so that those pixels with value 1 are red and

2条回答
  •  伪装坚强ぢ
    2021-01-24 02:51

    Here is another option, create a 3-layers array replicating your grayscale brain image (imagesc will scale each layer similarly resulting in equal r, g, and b values -> levels of gray).

    GrayBckgnd = repmat(brain, [1, 1, 3]);
    data = …
    

    Then overlay it with the activity data:

    imagesc(GrayBcknd);
    hold on;
    DataImg = imagesc(data);
    set(DataImg, 'AlphaData', im2double(data>0.8));
    colormap jet; % or any other colormap.
    

提交回复
热议问题