Paste position becomes wrong in zoomed images if there is no selection

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Paste position becomes wrong in zoomed images if there is no selection

Stein Rørvik
When you run a copy or paste command on an image where there is no selection,
a "Select All" command to create the missing selection is done automatically in both cases.
This behaviour is intended and makes sense.

The issue is that if the zoom level at the image pasted into is above 100%,
the paste position will depend on the image scroll position, if the zoomed image does not fit on screen.
So the implicit "Select All" command is then placed in a wrong position in the destination image,
_unless_ the scroll position is such that the image is exactly centered in the view.

If the image is zoomed out instead of in, there will in most cases be no scroll position in effect
as the image will most likely fit on screen.

Below is a macro reproducing the issue.
The image with "zoom=800 x=200 y=100" gets a wrong paste position,
while the image with "zoom=800 x=360 y=288" is exactly centered and get a correct position.

I think this is a bug; the paste position of an image should not depend on a window view property.

If you have a screen that is big enough to fit a 800% view of this sample image, the bug will not appear.
It will also not appear if you run this in batch mode.

run("Close All");

run("Boats (356K)");
run("Copy");
newImage("Paste at 100% Zoom", "8-bit black", 720, 576, 1);
run("Paste");
run("View 100%");

newImage("Paste at 50% Zoom", "8-bit black", 720, 576, 1);
run("Set... ", "zoom=50 x=200 y=100");
run("Paste");
run("View 100%");

newImage("Paste at 800% Zoom, scrolled", "8-bit black", 720, 576, 1);
run("Set... ", "zoom=800 x=200 y=100");
run("Paste");
run("View 100%");

newImage("Paste at 800% Zoom, centered", "8-bit black", 720, 576, 1);
run("Set... ", "zoom=800 x=360 y=288");
run("Paste");
run("View 100%");

run("Tile");

I am using daily build ImageJ 1.52h with Java 1.6 on Windows 7/64-bit.

Stein


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Paste position becomes wrong in zoomed images if there is no selection

Michael Schmid-3
Hi Stein,

in my view, in most cases this is not a bug but a desired feature:
If I paste something into an image at high magnification, I want to see
what I have pasted. Typically, this is for pasted areas much smaller
than the image size (otherwise I would not use the high magnification).
In such cases, usually I want to move it to some position, so I need to
grab it with the mouse or nudge it with the arrow keys.

I agree that it would make sense to disable that feature if the pasted
image has the same size as the current image or it is larger in both
dimensions. (Maybe even separate behavior for x & y would be nice: E.g.,
if I paste a narrow stripe with the full width of the target image, it
would be nice to have it aligned with the image bonds in x, but placed
at the screen center in y).

By the way, for those who want to understand the relevant code, it is in
ImagePlus.paste(). If the target image has no ROI or the ROI size does
not fit the clipboard size, the center of the currently visible area is
taken as target.


Michael
________________________________________________________________
On 24/09/2018 14:26, Stein Rørvik wrote:

> When you run a copy or paste command on an image where there is no selection,
> a "Select All" command to create the missing selection is done automatically in both cases.
> This behaviour is intended and makes sense.
>
> The issue is that if the zoom level at the image pasted into is above 100%,
> the paste position will depend on the image scroll position, if the zoomed image does not fit on screen.
> So the implicit "Select All" command is then placed in a wrong position in the destination image,
> _unless_ the scroll position is such that the image is exactly centered in the view.
>
> If the image is zoomed out instead of in, there will in most cases be no scroll position in effect
> as the image will most likely fit on screen.
>
> Below is a macro reproducing the issue.
> The image with "zoom=800 x=200 y=100" gets a wrong paste position,
> while the image with "zoom=800 x=360 y=288" is exactly centered and get a correct position.
>
> I think this is a bug; the paste position of an image should not depend on a window view property.
>
> If you have a screen that is big enough to fit a 800% view of this sample image, the bug will not appear.
> It will also not appear if you run this in batch mode.
>
> run("Close All");
>
> run("Boats (356K)");
> run("Copy");
> newImage("Paste at 100% Zoom", "8-bit black", 720, 576, 1);
> run("Paste");
> run("View 100%");
>
> newImage("Paste at 50% Zoom", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=50 x=200 y=100");
> run("Paste");
> run("View 100%");
>
> newImage("Paste at 800% Zoom, scrolled", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=800 x=200 y=100");
> run("Paste");
> run("View 100%");
>
> newImage("Paste at 800% Zoom, centered", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=800 x=360 y=288");
> run("Paste");
> run("View 100%");
>
> run("Tile");
>
> I am using daily build ImageJ 1.52h with Java 1.6 on Windows 7/64-bit.
>
> Stein
>
>
> --
> 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
|

Re: Paste position becomes wrong in zoomed images if there is no selection

Stein Rørvik
Yes, I agree with you that it makes sense to have the paste position the same as the scroll position when pasting something smaller into something bigger. I was only referring to the cases when the paste source image is the same size as the destination image, which would be the case when no selection was made.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
Sent: 24. september 2018 14:53
To: [hidden email]
Subject: Re: Paste position becomes wrong in zoomed images if there is no selection

Hi Stein,

in my view, in most cases this is not a bug but a desired feature:
If I paste something into an image at high magnification, I want to see what I have pasted. Typically, this is for pasted areas much smaller than the image size (otherwise I would not use the high magnification).
In such cases, usually I want to move it to some position, so I need to grab it with the mouse or nudge it with the arrow keys.

I agree that it would make sense to disable that feature if the pasted image has the same size as the current image or it is larger in both dimensions. (Maybe even separate behavior for x & y would be nice: E.g., if I paste a narrow stripe with the full width of the target image, it would be nice to have it aligned with the image bonds in x, but placed at the screen center in y).

By the way, for those who want to understand the relevant code, it is in ImagePlus.paste(). If the target image has no ROI or the ROI size does not fit the clipboard size, the center of the currently visible area is taken as target.


Michael
________________________________________________________________
On 24/09/2018 14:26, Stein Rørvik wrote:

> When you run a copy or paste command on an image where there is no
> selection, a "Select All" command to create the missing selection is done automatically in both cases.
> This behaviour is intended and makes sense.
>
> The issue is that if the zoom level at the image pasted into is above
> 100%, the paste position will depend on the image scroll position, if the zoomed image does not fit on screen.
> So the implicit "Select All" command is then placed in a wrong
> position in the destination image, _unless_ the scroll position is such that the image is exactly centered in the view.
>
> If the image is zoomed out instead of in, there will in most cases be
> no scroll position in effect as the image will most likely fit on screen.
>
> Below is a macro reproducing the issue.
> The image with "zoom=800 x=200 y=100" gets a wrong paste position,
> while the image with "zoom=800 x=360 y=288" is exactly centered and get a correct position.
>
> I think this is a bug; the paste position of an image should not depend on a window view property.
>
> If you have a screen that is big enough to fit a 800% view of this sample image, the bug will not appear.
> It will also not appear if you run this in batch mode.
>
> run("Close All");
>
> run("Boats (356K)");
> run("Copy");
> newImage("Paste at 100% Zoom", "8-bit black", 720, 576, 1);
> run("Paste"); run("View 100%");
>
> newImage("Paste at 50% Zoom", "8-bit black", 720, 576, 1); run("Set...
> ", "zoom=50 x=200 y=100"); run("Paste"); run("View 100%");
>
> newImage("Paste at 800% Zoom, scrolled", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=800 x=200 y=100"); run("Paste"); run("View
> 100%");
>
> newImage("Paste at 800% Zoom, centered", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=800 x=360 y=288"); run("Paste"); run("View
> 100%");
>
> run("Tile");
>
> I am using daily build ImageJ 1.52h with Java 1.6 on Windows 7/64-bit.
>
> Stein
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
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
|

Re: Paste position becomes wrong in zoomed images if there is no selection

Cammer, Michael-2
In reply to this post by Michael Schmid-3
This has always been the behavior.  
Tricks like restoring the selection location before pasting, zooming out before pasting, or in macros/Java getting the ROI location and then placing it would solve the problem.
Cheers-
Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory



-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Michael Schmid
Sent: Monday, September 24, 2018 8:53 AM
To: [hidden email]
Subject: Re: Paste position becomes wrong in zoomed images if there is no selection

Hi Stein,

in my view, in most cases this is not a bug but a desired feature:
If I paste something into an image at high magnification, I want to see
what I have pasted. Typically, this is for pasted areas much smaller
than the image size (otherwise I would not use the high magnification).
In such cases, usually I want to move it to some position, so I need to
grab it with the mouse or nudge it with the arrow keys.

I agree that it would make sense to disable that feature if the pasted
image has the same size as the current image or it is larger in both
dimensions. (Maybe even separate behavior for x & y would be nice: E.g.,
if I paste a narrow stripe with the full width of the target image, it
would be nice to have it aligned with the image bonds in x, but placed
at the screen center in y).

By the way, for those who want to understand the relevant code, it is in
ImagePlus.paste(). If the target image has no ROI or the ROI size does
not fit the clipboard size, the center of the currently visible area is
taken as target.


Michael
________________________________________________________________
On 24/09/2018 14:26, Stein Rørvik wrote:

> When you run a copy or paste command on an image where there is no selection,
> a "Select All" command to create the missing selection is done automatically in both cases.
> This behaviour is intended and makes sense.
>
> The issue is that if the zoom level at the image pasted into is above 100%,
> the paste position will depend on the image scroll position, if the zoomed image does not fit on screen.
> So the implicit "Select All" command is then placed in a wrong position in the destination image,
> _unless_ the scroll position is such that the image is exactly centered in the view.
>
> If the image is zoomed out instead of in, there will in most cases be no scroll position in effect
> as the image will most likely fit on screen.
>
> Below is a macro reproducing the issue.
> The image with "zoom=800 x=200 y=100" gets a wrong paste position,
> while the image with "zoom=800 x=360 y=288" is exactly centered and get a correct position.
>
> I think this is a bug; the paste position of an image should not depend on a window view property.
>
> If you have a screen that is big enough to fit a 800% view of this sample image, the bug will not appear.
> It will also not appear if you run this in batch mode.
>
> run("Close All");
>
> run("Boats (356K)");
> run("Copy");
> newImage("Paste at 100% Zoom", "8-bit black", 720, 576, 1);
> run("Paste");
> run("View 100%");
>
> newImage("Paste at 50% Zoom", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=50 x=200 y=100");
> run("Paste");
> run("View 100%");
>
> newImage("Paste at 800% Zoom, scrolled", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=800 x=200 y=100");
> run("Paste");
> run("View 100%");
>
> newImage("Paste at 800% Zoom, centered", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=800 x=360 y=288");
> run("Paste");
> run("View 100%");
>
> run("Tile");
>
> I am using daily build ImageJ 1.52h with Java 1.6 on Windows 7/64-bit.
>
> Stein
>
>
> --
> ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIDaQ&c=j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=vfUn-WSoz3z11I1Wutm3wYYMExfQInQ6nJuvEPYzlnE&m=z0s-W85o0_1CbC6Uxfv1f6cS7dprvINEFt4HWx62Yto&s=vGFlqTAHzY_tFJbsNcnWh3JpoWKCwvnJ1bSIKCoZeBc&e=
>

--
ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIDaQ&c=j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=vfUn-WSoz3z11I1Wutm3wYYMExfQInQ6nJuvEPYzlnE&m=z0s-W85o0_1CbC6Uxfv1f6cS7dprvINEFt4HWx62Yto&s=vGFlqTAHzY_tFJbsNcnWh3JpoWKCwvnJ1bSIKCoZeBc&e=

------------------------------------------------------------
This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email.
=================================


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Paste position becomes wrong in zoomed images if there is no selection

Wayne Rasband-2
In reply to this post by Stein Rørvik
> On Sep 24, 2018, at 8:26 AM, Stein Rørvik <[hidden email]> wrote:
>
> When you run a copy or paste command on an image where there is no selection,
> a "Select All" command to create the missing selection is done automatically in both cases.
> This behaviour is intended and makes sense.
>
> The issue is that if the zoom level at the image pasted into is above 100%,
> the paste position will depend on the image scroll position, if the zoomed image does not fit on screen.
> So the implicit "Select All" command is then placed in a wrong position in the destination image,
> _unless_ the scroll position is such that the image is exactly centered in the view.

Thanks to Michael Schmid, this bug is fixed in the latest ImageJ daily build (1.52h7). An image pasted into a zoomed image is now centered if it is equal or larger in size than the target image.

-wayne

> If the image is zoomed out instead of in, there will in most cases be no scroll position in effect
> as the image will most likely fit on screen.
>
> Below is a macro reproducing the issue.
> The image with "zoom=800 x=200 y=100" gets a wrong paste position,
> while the image with "zoom=800 x=360 y=288" is exactly centered and get a correct position.
>
> I think this is a bug; the paste position of an image should not depend on a window view property.
>
> If you have a screen that is big enough to fit a 800% view of this sample image, the bug will not appear.
> It will also not appear if you run this in batch mode.
>
> run("Close All");
>
> run("Boats (356K)");
> run("Copy");
> newImage("Paste at 100% Zoom", "8-bit black", 720, 576, 1);
> run("Paste");
> run("View 100%");
>
> newImage("Paste at 50% Zoom", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=50 x=200 y=100");
> run("Paste");
> run("View 100%");
>
> newImage("Paste at 800% Zoom, scrolled", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=800 x=200 y=100");
> run("Paste");
> run("View 100%");
>
> newImage("Paste at 800% Zoom, centered", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=800 x=360 y=288");
> run("Paste");
> run("View 100%");
>
> run("Tile");
>
> I am using daily build ImageJ 1.52h with Java 1.6 on Windows 7/64-bit.
>
> Stein

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Paste position becomes wrong in zoomed images if there is no selection

Stein Rørvik
Thanks, this works great.
Since the paste position is now centred only when the image is same size or bigger, it does not conflict with the existing behaviour of pasting smaller images at the scroll position.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
Sent: 24. september 2018 21:18
To: [hidden email]
Subject: Re: Paste position becomes wrong in zoomed images if there is no selection

> On Sep 24, 2018, at 8:26 AM, Stein Rørvik <[hidden email]> wrote:
>
> When you run a copy or paste command on an image where there is no
> selection, a "Select All" command to create the missing selection is done automatically in both cases.
> This behaviour is intended and makes sense.
>
> The issue is that if the zoom level at the image pasted into is above
> 100%, the paste position will depend on the image scroll position, if the zoomed image does not fit on screen.
> So the implicit "Select All" command is then placed in a wrong
> position in the destination image, _unless_ the scroll position is such that the image is exactly centered in the view.

Thanks to Michael Schmid, this bug is fixed in the latest ImageJ daily build (1.52h7). An image pasted into a zoomed image is now centered if it is equal or larger in size than the target image.

-wayne

> If the image is zoomed out instead of in, there will in most cases be
> no scroll position in effect as the image will most likely fit on screen.
>
> Below is a macro reproducing the issue.
> The image with "zoom=800 x=200 y=100" gets a wrong paste position,
> while the image with "zoom=800 x=360 y=288" is exactly centered and get a correct position.
>
> I think this is a bug; the paste position of an image should not depend on a window view property.
>
> If you have a screen that is big enough to fit a 800% view of this sample image, the bug will not appear.
> It will also not appear if you run this in batch mode.
>
> run("Close All");
>
> run("Boats (356K)");
> run("Copy");
> newImage("Paste at 100% Zoom", "8-bit black", 720, 576, 1);
> run("Paste"); run("View 100%");
>
> newImage("Paste at 50% Zoom", "8-bit black", 720, 576, 1); run("Set...
> ", "zoom=50 x=200 y=100"); run("Paste"); run("View 100%");
>
> newImage("Paste at 800% Zoom, scrolled", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=800 x=200 y=100"); run("Paste"); run("View
> 100%");
>
> newImage("Paste at 800% Zoom, centered", "8-bit black", 720, 576, 1);
> run("Set... ", "zoom=800 x=360 y=288"); run("Paste"); run("View
> 100%");
>
> run("Tile");
>
> I am using daily build ImageJ 1.52h with Java 1.6 on Windows 7/64-bit.
>
> Stein

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

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