Login  Register

Re: How do I get the pixel coordinate with minimum value?? please help!

Posted by Gabriel Landini on Aug 31, 2014; 12:15am
URL: http://imagej.273.s1.nabble.com/How-do-I-get-the-pixel-coordinate-with-minimum-value-please-help-tp5009425p5009426.html

On Saturday 30 Aug 2014 16:28:53 you wrote:
> I'm at my wits end. I have the following routine which gives me a list of
> pixel values along the line drawn. HOW DO I GET THE PIXEL COORDINATES OF THE
> PIXEL WITH THE LOWEST VALUE? It's been a few days now and I'm no further to
> an answer.

There is no guarantee that there is a lowest pixel value.

Not sure this is the best way, but you can get the coordinates of the
interpolated line (otherwise a line selection has only 2 coordinates):

makeLine(828, 410, 674, 626);
run("Interpolate", "interval=1 adjust");
getSelectionCoordinates(cx,cy);
  run("Clear Results");
  profile = getProfile();
  for (i=0; i<profile.length; i++){
      setResult("Value", i, profile[i]);
      setResult("x", i,cx[i]);
      setResult("y", i,cy[i]);
  }
  updateResults;

There are no details/documentation on the "adjust" option in the interpolate
command, maybe it is not needed.
Regards

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html