Login  Register

Re: tounscaled(x,y) function and Invert Y Coordinates

Posted by Krs5 on Mar 10, 2017; 5:45pm
URL: http://imagej.273.s1.nabble.com/tounscaled-x-y-function-and-Invert-Y-Coordinates-tp5017924p5018284.html

Replacing

toUnscaled(PosX, PosY);

with run("Set Scale...", "distance=0"); works correct

Kees


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of nstifani
Sent: 10 March 2017 17:30
To: [hidden email]
Subject: Re: tounscaled(x,y) function and Invert Y Coordinates

I apologize for not following the best practives earlier:

- toUnscaled() does not take in account Y-inverted coordinates


See the code below for an example:
 

run("Bridge (174K)"); // Open sample Image

makePoint(200, 100); // Make a point at Pixel X200 Y100

// Use  non inverted Y coordinates
run("Set Measurements...", "area mean standard modal min centroid center perimeter bounding fit shape feret's integrated median skewness kurtosis area_fraction stack display redirect=None decimal=9");

run("Clear Results");
run("Measure");
PosX=getResult("X");
PosY=getResult("Y");
run("Clear Results");
print("\\Clear");
print("PosX_Pixel: "+PosX);
print("PosY_Pixel: "+PosY);

toUnscaled(PosX, PosY) // Unscaled pixels should give same value since iumage has no scale

print("PosX_Pixel_Unscaled: "+PosX);
print("PosY_Pixel_Unscaled: "+PosY);





//Invert the Y coordinates
run("Set Measurements...", "area mean standard modal min centroid center perimeter bounding fit shape feret's integrated median skewness kurtosis area_fraction stack display invert redirect=None decimal=9");

run("Clear Results");
run("Measure");
PosX=getResult("X");
PosY=getResult("Y");
run("Clear Results");
print("PosX_Pixel_Inverted: "+PosX);
print("PosY_Pixel_Inverted: "+PosY);

toUnscaled(PosX, PosY) // Unscaled pixels should give same value since iumage has no scale

print("PosX_Pixel_Inverted_Unscaled: "+PosX);
print("PosY_Pixel_Inverted_Unscaled: "+PosY);





--
View this message in context: http://imagej.1557.x6.nabble.com/tounscaled-x-y-function-and-Invert-Y-Coordinates-tp5017924p5018283.html
Sent from the ImageJ mailing list archive at Nabble.com.

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

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