Beginner: help on saving an overlay!


#1

I am a very new user of Fiji and cannot work out how to save selections as an overlay so that I can re-open my images and edit them at a later date.

I am using the freehand tool to select 4 objects in my image and using MEASURE to analyse their circularity. Each selection was in ROI manager and I used FROM ROI MANAGER to create an overlay. When I saved, closed and re-opened the image again, TO ROI MANAGER would not bring up my overlays.

I am sure I am just doing something wrong as I have read that you should be able to do this easily. Any guidance would be very much appreciated!


#2

Hi Jenna, welcome to the forum :slight_smile:

Which format did you save the images in? Formats like JPEG or PNG will not include overlays, try saving as Tiff. (You can also save the ROIs from the ROI manager and reinitialize them at a later time (just drag-drop the .roi file to Fiji))

Hope this helps,

Sverre


#3

Hi Sverre,

Thank you very much.

All my images are already in tif format. Maybe I should try saving the ROIs directly from the ROI manager. What format should I save that in?

Many thanks for your help,

JD


#4

Strange, overlays should be saved in tif files. Can you try running this short macro and opening the saved Test.tif? To run the macro, copy paste the below code to the New >> Script… window, select Language IJ1 macro and click Run.

newImage("Test", "8-bit random", 256, 256, 1);
selectWindow("Test");
makeRectangle(61, 78, 137, 103);
roiManager("Add");
run("From ROI Manager");
saveAs("Tiff");
run("Close");

Just click more >> save in the ROImanager, it will save as a zip if there are several rois or as .roi if there is only one.


#5

Okay so I just ran that and saved the file that came up at a result, however when I re-open the image and tried TO ROI MANAGER, it again says ‘overlay required’.

I just tried this method though and I can reload the ROI’s this way, so maybe I will just have to save my ROIs separately to my images in this manner?


#6

Okay, I don’t know why it doesn’t work. Are you using an up to date version of Fiji? I don’t see how it should affect such an old function, but you never know. Any ideas @imagejan, @stelfrich?

You can do this in the meantime, but I am sure the users I tagged above can solve this issue easily!

Best,

Sverre


#7

I only downloaded it a few days ago but I’ve just ran the updater just incase and it says I am up to date.

Okay thank you very much!

Kind regards,
JD


#8

Could you check if you are using SCIFIO for file I/O, @J000D97? You can find that option at Edit > Options > ImageJ2 > Use SCIFIO. Is it, by chance, enabled?

Best,
Stefan


#9

I have just checked and it is not enabled.

Regards,
JD


#10

Could you upload the TIFF file that @Sverre’s script has produced to the forum? I’d like to see whether it contains any overlay or not…


#11

I’ve just tried to upload it and the message: ‘Sorry, but we couldn’t determine the size of the image. Maybe your image is corrupted?’ comes up.


#12

Oh, I wasn’t aware that this image would trigger “security measures”. Does your institution host a file sharing service to which you could upload the file, or maybe Dropbox, GDrive, et al?

Also, how do you open the image? Drag and drop onto the toolbar, or via File > Open?


#13

I think that message was just part of imagej as I was not on my institution’s network when I tried to upload that.

Yes I could do this. Would that help?

I use bio-formats importer. Is there a better way I should be opening the images?


#14

Oh, that might actually explain the issue. ImageJ has built-in support for TIFF files, i.e. saving via File > Save As… > Tiff and opening via File > Open…. The Bio-Formats Importer and Exporter use a different implementation. They do not mix well.

So you should either use File > Save As… > Tiff with File > Open… OR Plugins > Bio-Formats > Bio-Formats Exporter and Plugins > Bio-Formats > Bio-Formats Importer with the following settings:

For the exporter, check Export ROIs:
bioformats-export-rois

For the import, select Display ROIs and select Overlay:

Does it work if don’t mix the two?


#15

Ah okay, I will try this! Would you recommend File > Save As … > Tiff and File > Open or the import/export pathways?

Should I try with @Sverre’s script?


#16

I just tried @Sverre’s script again but re-opening the image by File > Open and the overlay was there this time :slight_smile: I’m assuming this would be the same if I try my own images by saving the ROIs as an overlay and then re-opening in this way?

Or is it better to go through the Bio-format route?


#17

In some cases the ImageJ implementation (File > Save As … > Tiff) will be faster than the Bio-Formats implementation. With Bio-Formats, however, you’ll keep most of the meta information about the acquisition setup and settings. If you know the relationship between the TIFF files and the raw input files with the meta information (so you can go back and look smth up), I’d go for ImageJ’s built-in implementation.

I hope so (and I am quite confident) :wink:


#18

Sorry can you please explain a bit more what you mean by this?

Okay thank you!!


#19

TIFF is a flexible image format that can not only contain pixels/intensities, but also additional information like scale information (X microns/px) or calibration. You can also store overlays in the header part of TIFF file (and it works… hopefully).

Bio-Formats is “The solution for reading proprietary microscopy image data and metadata”. So whenever you use Bio-Formats to open a file that has been generated on a microscope with a vendor software, they are translating information that the vendor puts in its file formats to a standardized form. So opening a vendor file with Bio-Formats and saving it to OME-TIFF will store information, like excitation wavelengths, objectives used during acquisition, temporal information, etc., in a standardized form in the file. This way, you can later re-open that file and take a look at which excitation wavelength the third channel was acquired.

Check the Display OME-XML metadata box to see the information in the standardized form:

http://forum.imagej.net/uploads/default/optimized/2X/c/cef4cf41f1cda645a1ce16be054139a3a3927824_1_690x415.png

Saving your files as plain TIFFs will store some of the meta data, like calibration but not something like excitation wavelength. If you wanted to get that information, you’d have to go back to the original file and open it with Bio-Formats.

Does that make sense?


#20

Yes I think so, thank you!

It was very kind of you and @Sverre to help me, thank you both very much.