How to calculate multiple diameter calculation across an image?

I have an image that I convert from a .mat file (size of .mat file is 406x512x380 double) below.
I need to calculate the diameter and it's change across the length of the image measured by the x-axis value (at each section -4, -2, 0, 2, 4 mm) what is the diameter? Here is my current code right now using imdistline() but clearly that is not the most effective when setting multiple locations.
%% pick frame of choice and run grid overlay %%
img = 40;
image = figure('Color', 'k');imagesc(X_1,Z_1,10*log10(R1_contrast(:,:,img)),[115 145]); colormap(gray); % setting colormap to gray
ax = gca;
%axis equal;
h=xlabel('Lateral (mm)'); %or h=get(gca,'xlabel')
set(h, 'FontSize', 16);
set(h,'FontWeight','bold'); %bold font
z=ylabel('Depth (mm)');
set(z, 'FontSize', 16);
set(z, 'FontWeight', 'bold');
box(ax,'off');
set(gca, 'XColor', 'white'); % set x-axis color to white
set(gca, 'YColor', 'white');
set(gca, 'FontWeight', 'bold');
grid on;
axis image;
set(gca, 'GridColor','r', 'GridAlpha',1);
set(gca, 'Layer','top');
imdistline();

4 commentaires

Image Analyst
Image Analyst le 2 Mai 2020
Modifié(e) : Image Analyst le 2 Mai 2020
Diameter of what? I don't see any distinct circles on your image. And attach your original image, not a screenshot. Like R1_contrast or whatever we'd need to run your code.
Shelby Hedges
Shelby Hedges le 2 Mai 2020
Modifié(e) : Shelby Hedges le 2 Mai 2020
I tried to demonstrate what the diameter would be with the imdistlin (top white band and bottom white band when looking at the depth axis). I attached the .fig and .png file - sorry for that. The R1_Contrast file is too large to upload.
That does me no good. Can't you attach the image you displayed with imshow()? Without all the red lines, axes, etc.
Yes - that was for demonstration purposes. Attached is the original .fig .png files (thanks for your patience/help). Newish to Matlab.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by