Remove image outside of Contour Plot

1 回表示 (過去 30 日間)
Harry Andrews
Harry Andrews 2018 年 7 月 9 日
コメント済み: Harry Andrews 2018 年 7 月 9 日
The following code gives the attached image.
figure, imshow(NT,'DisplayRange',[]);
hold on
MNSContourThreshold = 0.5*double(MaxNonSpecific)
contour(NT,[MNSContourThreshold MNSContourThreshold], 'color', 'g')
I now want to set every pixel (within the brain image) on the outside of the contour line to 1 (Black).

採用された回答

Image Analyst
Image Analyst 2018 年 7 月 9 日
What exactly does that mean? You mean you want a 1-D list of all pixel values outside one of the contour lines? The contour line at which level? Then do this:
mask = NT < someValue; % or >
pixelValues = NT(mask); % A 1-D list of all pixels below someValue.
Or do you want to mask the image, like you want a 2-D image but want the inside of the contour blackened or set to some other value like 1 or 255 or inf or nan? Like
NT(mask) = someValue; % For example NT(mask) = 0;
  3 件のコメント
Image Analyst
Image Analyst 2018 年 7 月 9 日
Did you try what I said?
mask = NT < MNSContourThreshold;
NT(mask) = 1; % Set to almost black.
If not, why not?
Harry Andrews
Harry Andrews 2018 年 7 月 9 日
Ah you hero, sorted!!! Thank You ❤

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by