I then save these ROIs so that I can add them to a new image to measure the intensity of this new plate. As every plate is not imaged in the exact same position I have been Combining the ROIs, moving them, and then splitting them, all using the ROI manager. But the problem is that after I split the ROIs, FIJI re-labels them and changes their position:
I assume that you perform this workflow using the Fiji / ImageJ
gui, rather than a macro or script.
First, about the labels: When you combine the ROIs (I assume
that you run More >> OR (Combine) from the ROI Manager),
you create a (single) new ROI. This ROI has its own label (just
like other ROIs), but only one – it knows nothing about the labels
of the ROIs from which it was created. (We can discuss how
you could write a script to deal with this, if you want to go that
However, I speculate that you combine / split the ROIs so you
can move them all rigidly together. You can do this by selecting
in the ROI Manager the ROIs you wish to move together as a
group, and then run More >> Translate... from the ROI
Manager. (Selecting no ROIs counts for this purpose as selecting
all of the ROIs.) This will move all of the selected ROIs together
without changing their labels.
Would using More >> Translate.. accomplish what you are
trying to do?
(Note that the ROI Manager has a setting for whether it should label
ROIs with integers or with there names. Run More >> Labels...,
and you can toggle the “Use names as labels” check box.)
As for Fiji “changing the position” of your ROIs after splitting them,
I’m not sure I fully understand. If you move the combined ROI,
then when you split it, the individual ROIs – newly created by the
split – should indeed be moved. But I’m not sure that this is what
you are referring to.
If the split ROIs don’t line up with where they were in the combined
ROI (immediately before splitting), that would be a problem. (And
I don’t think that happens.) If you are having a problem with the
ROIs getting unexpectedly moved, please give us some more
detail about where in your workflow it happens.
My guess is that the effect you observe is not a change in positions but instead a reordering of the rois. This is due to the following: when you split a roi, the new rois will be added in order from top to bottom and left to right using their top-left bounding box coordinates. So, unless the starting array of rois is completely regular, as soon as you combine and split, the order will be messed up.
If the arrangement of the colonies is indeed regular, I would tackle this problem programmatically, generating the array of rois using a Script with some initial input from the user (perhaps a multipoint roi of the array “corners” ) or by detecting most of the colonies and “fitting” a new roi array (though this could be tricky to accomplish). In any case, this would compensate for translation and rotation errors of the images.
Hi mountain_man, sorry for the late reply, but thank you so much for getting back to me. We had tried the translate option in the ROI manager, I just wanted to find something that was easier/faster to use as I had to image so many plates. But before seeing @NicoDF 's answer we had decided to go ahead with this
Hi Nico, so sorry for the late reply. Thank you sooo much for this! This is amazing that you took time out of your day to write up the script for this. I have tried it on 4 plates and it works perfectly. I am honestly so thankful, this will help me so much as we hope to image 100s of plates in the coming months. This is also perfect as it means any rotation of the plate will not affect my measurements