Login  Register

Re: Nearest different pixel

Posted by dscho on Sep 17, 2006; 11:03am
URL: http://imagej.273.s1.nabble.com/Nearest-different-pixel-tp3701585p3701586.html

Hi,

On Sun, 17 Sep 2006, Michael Doube wrote:

> I'd like to find the set of distances from each thresholded pixel in an ROI to
> the nearest un-thresholded pixel in the ROI.
>
> The output would be a frequency table; that is, distance vs. count.

You'd make a binary image (Process/Binary/Make Binary) after selecting the
threshold (Image/Adjust/Threshold), calculate the distance map
(Process/Binary/Distance Map) and show the histogram (Analyze/Histogram):

//run("Threshold...");
run("Make Binary", "thresholded remaining black");
run("Distance Map");
//run("Invert");
run("Histogram");

In my test, the Distance Map results were inverted, i.e. 255 where they
should have been 0 and vice versa. If that is the case for you, too, you
have to uncomment the Invert step.

Hth,
Dscho