> On Mar 9, 2018, at 3:04 AM, Stein Rørvik <[hidden email]> wrote:
> ImageJ allows you to define an origin elsewhere than the upper left corner of the image,
> allowing measurements in physical coordinates where applicable.
> This works well for both XY and Z coordinates.
> For example, we can define the origin of the "T1 Head" sample stack as the centre of the middle slice:
> run("T1 Head (2.4M, 16-bits)");
> run("Properties...", "origin=128,128,64");
> What I need to do is to determine the location of this origin later, from a macro.
> For XY, this is easy. I just convert scaled position 0,0 to pixel coordinates:
> x = 0;
> y = 0;
> toUnscaled(x, y);
> print("x: " + x);
> print("y: " + y);
> But how can I get the pixel Z coordinate of the origin?
> toUnscaled(x, y, z) does not work.
Upgrade to the latest daily build (1.52a4) and toUnscaled(x, y, z) will work. Both toScaled() and toUnscaled() now support a third z argument. Here is an updated version of your example: