Hi Michael,

one reason for the different handling of Image>Transform>Rotate 90°... and flipping might be the following:

Rotation by 90° needs to change the image size (switch the image width&height) for non-square images. Also the spatial calibration needs to be changed if the x&y scales are different.

Flipping operations (as well as "Translate") leave the image size unchanged.

Thus, for the whole image, these are quite different operations.
Nevertheless, if I look at the code, flipping and 90° rotations are in the same class, thus it would not be too difficult to change this, by having a 'roi mode' where the 90° rotations are handled in the same branch as the flipping.

I am not sure whether there are any macros around that rely on flipping always affecting the full image irrespective of any Roi; if so, changing the behavior would break these macros.

---

BTW, one of the not so nice things that also noticed in this respect:
For non-rectangular ROIs, "Flip Horizontally", "Flip Vertically", and "Translate" are restricted to the bounding box, not the actual roi. Rotation by arbitrary angle honors the actual Roi.
(I think that this could be fixed by adding a 'SUPPORTS_MASKING' flag.)

Another thing that I noticed: I would consider it clearer to have Image>Transform>Translate not translating the Overlay when applied to a Roi.


Michael
________________________________________________________________
On 22.07.24 16:59, Cammer, Michael wrote:
I was curious why the behavior varies for different types of ROI rotations.


For instance, this code operates exclusively on the ROI.


makeOval(81, 65, 82, 82);
run("Flip Horizontally");
run("Flip Vertically");

However, this code rotates the entire image.

makeOval(81, 65, 82, 82);
run("Rotate 90 Degrees Right");

I need to rotate the ROI can can do this by duplicating it, rotating it, and pasting it 
back into the original.  Also by creating an ROI that covers the left 2/3 of the field 
and flipping it horizontally because central features don't move when rotated.  The goal 
is to create a "random" distribution with the same density at the real sample.  
When coding this, I found the differences and was curious about them.

Thank you.



Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory

NYU Langone Health, New York, NY  10016

[email protected]<mailto:[email protected]>

http://nyulmc.org/micros  http://microscopynotes.com/

Cell voice (no text) 1-914-309-3270

Office 1-646-501-0567


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

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

Reply via email to