Azzera filtri
Azzera filtri

Opening and finding distance between circles in multiple images from a Tiff Stack

1 visualizzazione (ultimi 30 giorni)
I am trying to write a code that would allow me to calculate the distance between circles in 100 images all from one .tif file. I was able to get the code to work for the first image in the stack, and am now stuck on how to get the code to look at the other 99 images in the stack. Any ideas?
Also, after computing the distance on all of the images, I want matlab to give me a matrix with all of the data, how do I do that?
Here is what I have so far:
a = imread('My_image.tif');
bw = a > 40000;
imshow(bw)
[centersBright,radiiBright,metricBright] = imfindcircles(bw,[20 25], ...
'ObjectPolarity','bright','Sensitivity',0.92,'EdgeThreshold',0.1);
stats = regionprops('table',bw,'Centroid',...
'MajorAxisLength','MinorAxisLength');
centers = stats.Centroid;
distance = pdist2(centers(1,:),centers(2,:));

Risposta accettata

Pujitha Narra
Pujitha Narra il 26 Feb 2020
Hi,
You can use indexing along with 'imread' like this:
a = imread('My_image.tif', i); % ith image in the stack
Using this with a loop would help.
For the second part, you could use concatenation like this:
distance = [];
% Calculate the values for a new image
distance = [distance; new_values]; % Concatenate it the existing data
Hope that helps!

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by