How to detect bright thick fibers around boundary?

1 次查看(过去 30 天)
I need to extract bright thick fibers that are surrounding the cell. In this image:
1 - Copy.jpg
The bright thick fiber that I am talking is:
Inked1 - Copy_LI.jpg
I need to find if that exists, and if yes what is the length of that structure or what proportion of perimeter is that structure and how thick it is. This structure in biology is called cell lamellopodia.
I need to do it automated in the macro as I have many images.

回答(2 个)

Mahesh Taparia
Mahesh Taparia 2020-2-7
Hi Zeynab
By looking at the image and size of fibers, a possible approach could be the threshold-based approach to segment the fiber. It can be done using ‘a’ component of ‘lab’ color space and select some threshold to discriminate the fiber. Consider the code below:
I=imread('image.jpeg');
Lab=rgb2lab(I);
a=Lab(:,:,2);
figure;imagesc(a)
c=a<-47; %selection of threshold, can try with other value / method
figure;imshow(I.*(uint8(c)))
Although c contains fiber and some small components of image, by using regionprops command we can find the area of each component which is the pixel count of each component. The fiber will have the maximum area, so selecting the max area component will give the fiber’s pixel count.
stats = regionprops('table',c,'Centroid','Area')
fiber_part=max(stats.Area);
fractional_area= fiber_part/(size(I,1)*size(I,2));
For more information, you can refer to the documentation page of regionprops.
  2 个评论
Mahesh Taparia
Mahesh Taparia 2020-2-10
Hi
By component, I mean the independent, non touching part/ area of image which remained after doing thresholding, i.e after the following line
c=a<-47; %selection of threshold, can try with other value / method
figure;imshow(I.*(uint8(c)))
You can take threshold of some other channel/ color space also. For this, you can try with 'Color Thresholder' app of MATLAB to decide.

请先登录,再进行评论。


Image Analyst
Image Analyst 2020-2-10
Zeynab, you need to segment out the lamellopodia. You can do this simply by thresholding the green channel. Then, get the area of the blob. Assuming it's roughly rectangular, you can say that the area is the length times average width. To get the average width, you can use the bwdist() function, which will give you the radius at every point. Take the average radius along the centerline and multiply by 2 to get the average width. Then the length is just area/width.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clearvars;
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 16;
folder = pwd;
baseFileName = '1 - Copy.jpeg';
% baseFileName = 'IMG_Segment_Success.JPEG';
fullFileName = fullfile(folder, baseFileName);
rgbImage = imread(fullFileName);
% Display the original image.
subplot(2, 3, 1);
imshow(rgbImage, []);
axis('on', 'image');
caption = sprintf('Original Color Image\n"%s"', baseFileName);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
hp = impixelinfo(); % Set up status line to see values when you mouse over the image.
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0.05 1 0.95]);
% Get rid of tool bar and pulldown menus that are along top of figure.
% set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by Image Analyst', 'NumberTitle', 'Off')
% Get the green image.
grayImage = rgbImage(:, :, 2);
% Display the image.
subplot(2, 3, 2);
imshow(grayImage, []);
axis('on', 'image');
caption = sprintf('Green Channel of \n"%s"', baseFileName);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
hp = impixelinfo(); % Set up status line to see values when you mouse over the image.
subplot(2, 3, 3);
imhist(grayImage);
grid on;
title('Histogram of Green Channel', 'FontSize', fontSize, 'Interpreter', 'None');
% Get a binary image.
mask = grayImage > 110;
% Take only the largest blob. Use 4-connectivity.
mask = bwareafilt(mask, 1, 4);
% Display the original image.
subplot(2, 3, 4);
imshow(mask, []);
axis('on', 'image');
caption = sprintf('Binary Image\n"%s"', baseFileName);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
% To find the average length and width we need to get the Euclidean distance transform and the skeleton of it.
edtImage = bwdist(~mask);
% Display the image.
subplot(2, 3, 5);
imshow(edtImage, []);
axis('on', 'image');
caption = sprintf('Distance Transform');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
hp = impixelinfo(); % Set up status line to see values when you mouse over the image.
skeletonImage = bwmorph(mask, 'skel', inf);
% Display the image.
subplot(2, 3, 6);
imshow(skeletonImage, []);
axis('on', 'image');
caption = sprintf('Skeleton');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
% Extract the distance along the skeleton to get the radius at every point along the centerline.
% Multiply the radius by two to get the width.
meanWidth = 2 * mean(edtImage(skeletonImage)) % In pixels
% Now get the area
area = sum(mask(:)) % Or bwarea(mask) if you want - they use different algorithms.
% Get the mean length. Assume the blob is a rectangle so the length
% is the area divided by the mean width.
blobLength = area / meanWidth
% Put up a title on subplot #4 with the length and width/
subplot(2, 3, 4);
caption = sprintf('Mask. Average width = %.2f, length = %.2f', meanWidth, blobLength);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
0001 Screenshot.png
You can see that the average width is 4.74 pixels and the length is 295.58 pixels.

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by