I am writing about an issue related to copy and pasting an image selection in Fiji
The problem: copying a certain selection from a duplicate back to its original image produces a random displacement of the selection, which results slightly shifted relative to it’s original position.
Below the full details.
I encountered the issue while writing a .ijm macro code that extract internal features of a grayscale image. In particular, the code does the following:
- Open an image containing an object internally divided in areas of specific grayscale intensity, as follow:
* Internal feature 1
* Internal feature 2
* Internal feature 3
* Area outside object (background)
- Make a duplicate
- threshold each particular grayscale intensity (i.e., an internal feature of the main object) on the duplicate image
- Clean, create and extract its selection by using the “Analyze particles…” command from the Analyze menu.
- Threshold the background of the original image, inverse the selection and fill it to create a homogeneous main object
- Repeat steps 3 and 4 for internal features 1 and 2, giving new grayscale intensities
- Finally, copy and past selections of internal features 1 and 2 on the homogeneous main object image obtained on step 5.
It’s important at this stage to remember that the image and its duplicate have the same size.
Now, as one should expect, pasting the selection from the duplicate back to the original image should place the selection exactly on top of its equivalent. Actually, performing a batch processing of multiple sample images of the same size and features produces the issue on a some of them while others are fine.
My thoughts are that the command copy and past selection somehow don’t constrain the exact position of the selection to the whole image canvas, causing the selection to be shifted randomly on pasting.
In attachment you can find two original images, with the first resulting shifted, whereas the second is ok.
The shifting occurs towards the NE and SW corner for two different internal features, respectively.
In my limited experience using Fiji, I do not think is a coding problem, as the actions leading to this issue are merely mechanic.
I am using Fiji on Microsoft Windows 10 Professional
Laptop HP ProBook 640 G2
I stay at your disposal to provide any futher information and insight, and I look forward to this issue to be solved.