How can I track cells when they keep linking together?

1 visualización (últimos 30 días)
Nathan Costin
Nathan Costin el 3 de Ag. de 2016
I have created some code that analyses each frame of a tif video to plot the centroid of each cell. To allow the splitting up of cells that appear to be joined together due to post processing I have used a line element that is one pixel long. The issue I am having is that even with this structuring element 3 or more bacteria are still considered as one cell, and when I up the length of the element to 2 pixels the image loses too much detail. Some ideas that I have had to change this is calculate the average cell size and say that any cell larger than twice this (to allow for splitting) plus a standard deviation needs to be cut up, but I don't know how I can cut the cells up. If anyone could shed some light on this that would be great!
bac_pics = tiffread('bacvid1.tif'); %imports the tif file
mean_area = [];
for i = 1:numel(bac_pics) %sets up a loop to run for every frame in the video
bac_frame = bac_pics(i).data; %for each loop the fram is named bac_frame
dimensions = size(bac_frame); %finds the sizes of the image
log_filt = fspecial('log'); %creates a filter in the form of a Lorentzian of a Gaussian
bac_frame_filt = imfilter(bac_frame, log_filt); %puts the filter over the image
bw_bac = im2bw(bac_frame_filt , graythresh(bac_frame)); %the image is converted into a bianry image using a limit obatined from a function that uses Otsu's Method
eroder = strel('line', 1, 90); %creates a circular structring element to erode the image later with radius 1
bw_bac_eroded = imopen(bw_bac, eroder); %gets rid of the connecting parts of bacteria
imshow(bac_frame)
baccenter = regionprops(bw_bac_eroded, 'Centroid');%finds the center of each cell
centroids = cat(1, baccenter.Centroid);
centroiddata = regionprops('table', bw_bac_eroded, 'Centroid'); %Prints out the locations of the centroids into tables
area_data = cell2mat(struct2cell(regionprops(bw_bac_eroded, 'Area'))); %finds the area sizes of the data
area_data_mean = mean2(area_data); %finds the mean of the area sizes
mean_area = [mean_area; area_data_mean]; %compiles these means into a list so they can be averaged
hold on
plot(centroids(:,1),centroids(:,2), 'b*')
hold off
end
mean2(mean_area)
std(mean_area(:))

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by