Posted by
Stein Rørvik on
Mar 09, 2018; 8:04am
URL: http://imagej.273.s1.nabble.com/Determining-origin-of-Z-coordinates-tp5020239.html
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.
The easy fix to this would be to allow this third Z parameter in the toScaled and toUnscaled macro commands, for consistency.
Perhaps even better, a getOrigin(x,y,z) command?
Stein
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html