Calculate the radial pixeldistance

3 views (last 30 days)
Hi all,
I have an image which contains spots. I want to calculate radial pixeldistance from the surface and 20 pixels from it. Fact is that the grayscale value will change as we move away from the "spot".
or
calculate the circumferential mineral density (from the "surface" of an osteocyte) as a function of the radial pixeldistance from the osteocytes and up to 20 pixels from the osteocytes.
Does anyone know a solution to this "problem".
/Best regards

Accepted Answer

Image Analyst
Image Analyst on 14 Oct 2014
I've done something similar where I had to find out the dye penetration into the spots as a function of distance into the spots, and give an average dye penetration profile - a 2D plot of basically gray level as a function of distance from the outer edge.
You need to compute the Euclidean Distance Transform with bwdist(). It sounds like you want the gray levels outside the white spots out to a distance of 20 pixels. So take the EDT and threshold it at 20. Now you have an original gray scale image, and an EDT image that says how far the pixel is from any white spot. Now you can just scan the pixels in the EDT image and create a histogram of the gray levels for every distance. Pretty easy. Give it a try.
  9 Comments
Anders Mahler
Anders Mahler on 16 Oct 2014
Hello, i have been looking at your exsample, you are writing about thresholding the EDT at 20, how would you do that? there is no threshold option in the bwdist() funktion?
Image Analyst
Image Analyst on 16 Oct 2014
% Idenfity pixels farther away from any blob than 20
farAwayPixels = edtImage > 20;
thresholdedEDT = edtImage; % Initialize
thresholdedEDT(farAwayPixels) = 0; % Mask it.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!