tounscaled(x,y) function and Invert Y Coordinates

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

tounscaled(x,y) function and Invert Y Coordinates

nstifani
This post was updated on .
Hello

I would like to report an issue when using Inverted Y coordinates and calling.
toUnscaled(X,Y);

For some reasons the Y values are changed even if the image has no scale.

The walkaround is to call
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");

prior to
run("Measure");
to obtain non inverted Y coordinates
Then call
toUnscaled(X,Y);
and Finally Invert the coordinates
Y=getHeight()-Y;
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

nstifani
Anyone has any hint about this issue ie: unscale inverted Y coordinates giving aberrant result in Images with no scale?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

ctrueden
Hi Nicolas,

Could you please create a Minimal, Complete, Verifiable Example (MCVE;
http://imagej.net/Bug_reporting_best_practices) demonstrating the issue?
This makes it much easier for us to understand what goes wrong, and to test
any potential fixes.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Fri, Mar 10, 2017 at 10:32 AM, nstifani <[hidden email]> wrote:

> Anyone has any hint about this issue ie: unscale inverted Y coordinates
> giving aberrant result in Images with no scale?
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.
> com/tounscaled-x-y-function-and-Invert-Y-Coordinates-
> tp5017924p5018280.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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

nstifani
This post was updated on .
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:
 
<code>
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 image has no scale

print("PosX_Pixel_Inverted_Unscaled: "+PosX);
print("PosY_Pixel_Inverted_Unscaled: "+PosY);
</code>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Straatman, Kees (Dr.)
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

nstifani
Hi Kees

Thanks for your reply.
Yet this

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

Would remove any scale currently in the image right?

Loading...