Search code examples
resolutionimagejmeasure

Fiji/ImageJ - Measure tool when x and y resolution of image not equal


I have images with unequal resolution in x and y direction. The pixel height is larger than the pixel width. The pixel width and pixel height are saved in Image > Properties.

When I draw an ellipse on the image and try to use the Analyze > Measure tool I get a '0' for both major and minor axis length for the "Fit ellipse" measurement. I can only get a proper measurement if I remove the scale of the image, or manually change the pixel height and pixel width to an equal number.

I assume this is a bug, but maybe I'm missing something?

As a workaround I was thinking of writing a small macro that saves pixel height and pixel width, then removes the scale of the image, then measures major and minor axis length in pixel and then re-applies pixel height and pixel width to the measurements.

But I can't find the command for reading out the resolution. Any pointers?


Solution

  • The documentation for the Set Measurements... command states in the description of the Fit ellipse parameter:

    Note that ImageJ cannot calculate the major and minor axis lengths if Pixel Aspect Ratio in the Analyze▷Set Scale… dialog is not 1.0.

    Your workaround should work, just use the getPixelSize(unit, pixelWidth, pixelHeight) macro function.