How to select an area within a range around identified region?

2 ビュー (過去 30 日間)
Antonios Asiminas
Antonios Asiminas 2021 年 12 月 29 日
コメント済み: Antonios Asiminas 2021 年 12 月 31 日
Hi everyone,
I am working with imaging data and after some thersholding I end up with a BW matrix so I can identify ROIs using regionprops and get a range of parameters for the ROI. So far so good. Now, I would like to quantify the signal within a set distance around each identified ROI (say 5 pixel wide perimeter)
Is there a simple way to do this, or I need to write something from scratch?
Any input is highly appreciated.
Thank you.
  2 件のコメント
KSSV
KSSV 2021 年 12 月 29 日
Pictorial example will help us to help you.
Antonios Asiminas
Antonios Asiminas 2021 年 12 月 31 日
Thank you for the super fast response and apologies for the delayed response. Here is a small piece of an image I am analysing. The yellow are the identified ROIs (true islands in a logical matrix). What I would like to do is selected the pixels that form an area around each identified ROI (roughly drawn by hand in light blue). The input parameter will be pixel distance. DGM looks likes they have provided a possible solution. If you have any other suggestions, that would be very appreciated.
Thank you!

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

採用された回答

DGM
DGM 2021 年 12 月 29 日
編集済み: DGM 2021 年 12 月 29 日
Maybe this is a start
radius = 5; % specify some radius
% an image and a mask of some sort
A = imread('eight.tif');
imshow(A)
objmask = bwareaopen(imfill(A<205,'holes'),100);
imshow(objmask)
% say we pick one object
L = bwlabel(objmask);
thisobj = L == 1;
imshow(thisobj)
% expand the mask and find difference
nearobj = bwdist(thisobj)<radius & ~thisobj;
imshow(nearobj)
This mask can be used to extract the image content in that region for further analysis.
pixelsnearobject = A(nearobj);
The exact needs may complicate matters. If the objects are close enough that the expanded masks intersect neighboring objects, is that still acceptable? If not, you may have to remove all object masks from the current expanded mask.
% example with larger mask radius and neighboring object exclusion
radius = 35;
nearobj = bwdist(thisobj)<radius & ~objmask;
imshow(nearobj)

その他の回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by