# Coordinates of Min & max gray value

Hello,
I am hoping to measure the Min & max gray values for each of my selected ROIs and also to measure the x and y coordinates corresponding to the maximum and minimum pixels. Optimally I would be able to go to analyze–>measure and display the maximum pixel value for each selected ROI with the x y coordinates of that maximum pixel. Is there a quick fix for this problem?

Thanks!

Hi,
You can set up measurements (Analyze>Set Measurements…) to get max and min values.
You can then get them with getResults(“Min”, row); for example.
But since many pixels may have these values, there is no easy way to get them. But you can threshold in you ROI mask to get pixels at max or min values.

Nico

Thanks Nico,

I will be performing this for a large number of ROI’s and need the coordinates of the minimum and maximum pixels, I don’t think that thresholding will help me obtain the coordinates, although I may be wrong.

It seems that because several pixels may contribute to the maximum/minimum, there is no easy way to output a single coordinate for each max/min?

If anyone has written a macro that will find the coordinates of the maximum pixel in each selected roi, that would be super helpful!

Thank you

if all your max point are single points, maybe you could use Process>Find Maxima… inside each of your ROIs. When a lower threshold is set (set it to your max value), you can tick Above Lower Threshold and ask for a list of max points.

Nico

Thanks so much Nico! Process>Find Maxima does not seem to display the coordinates of the maximum in each ROI. Perhaps I will need to work with this function, but currently am struggling to make it output the maximum coordinate in each ROI.

Thank you

First, You have to select your ROI.
Then, in Find Maxima, select list as Output type.
This opens a Result table. You can get values with getResults(“X”, num_of_row);, with num_of_row ranging from 0 to nResults()

Nico

Thanks again Nico,

There should be maximum values for 1275 ROIs…

Thanks!

you have to set a lower threshold first (or at least open the threshold tool) to get the option * Above Lower Threshold* thickable.

Nico.

Thanks a bunch Nico! Life saver!

To find minima, you should just be able to invert the image and run Nico’s algorithm again.