Fiji-assisted batch analysis using tags in OMERO

Let’s explore a discrete example!

Assumption: We have collected images in OMERO, organized into 6 datasets, with each dataset containing 30 images. The six datasets reflect experiments, each of which contains images from compound-treated biological samples and control samples (solvent only). That means: 10 images show solvent-control-treated only, 10 images show samples treated with compound X, and 10 images show cells treated with compound Y.

In this scenario, each image can be accessed through its position in the dataset and its file name, which includes tokenization to indicate the month of acquisition, the internally defined experiment index (here: A), the compound or solvent treatment, and an integer counting the images (1-10).

Example: 202508_Cells_ExpA_CmpX (1)

This image shows cells from the sample used in experiment A, and is a representative of the group of samples treated with Compound X. To fully understand how the sample for the microscopy session was prepared, we would depend on further details. These details can be in the form of structured annotations such as Key-Value Pairs, a detailed description such as a methods section, or an attached or linked sample preparation protocol. For the purpose here, we omit those details such as treatment time, compound concentration, etc. We only need to know:

Channel 1 contains the signal from the DAPI channel, effectively showing the nuclei of the cell.

Channel 2 contains the signal from a cytsolic protein that may or may not be affected by the compound treatments.

A direct way to access all images in a dataset is provided by using the unique ID of the dataset. In this example, the Dataset A has the unique ID 4245.

Let’s assume that we intend to run a Fiji-macro-based image analysis workflow on all images in the dataset. We use code in the Fiji macro language that allows us to retrieve all the image IDs from the images belonging to the dataset with the ID 4245. Of course, we could also create an INPUT prompt window allowing us to type in the dataset ID manually each time we run the macro. Using the OMERO macro extension by Pouchin et al., the code piece to identify all image IDs inside the dataset (with the prompted dataset ID saved as the variable “dataset_id”) looks like this:

The code in the lowest line is used to create an array out of the image IDs retrieved from the dataset ID. The array contains the first image ID under the index [0], the second under the index [1], and so on. Thus, each image ID is associated with an index position. This code has the purpose to later run an analysis workflow consecutively over each image using the index positions in the array. The details are not shown here.

Now, what if we don’t want to access all images in a dataset, but rather all images treated with Compound Y across all six datasets (A-F)? On a normal file system, many researchers would now tend to reorganize their folder hierarchy or even make copy of the data to retrieve all images from samples treated with compound Y side by side. But we can do better. In OMERO, we cannot use the dataset IDs, because they would also include the other images (Compound X and solvent control). But we can use Tags in OMERO, a structured form of metadata annotation. We need to annotate all data from the samples treated with Compound Y with a unique Tag, for example, the Tag “CmpdY”. Across all six datasets, 60 images will then contain the Tag “CmpdY”. We can use this tag in the Macro code of the OMERO Macro Extension, just like we did before for dataset IDs. If we prompt for the Tag name with an input window, we type in “CmpdY” to store this name under the variable “tagname”:

In contrast to the example before, this code uses the Tag name (CmpdY) instead of the Tag ID. It is also possible to retrieve directly the Tag ID from OMERO.web as an input and thus skip the first line of code in this example. The end result is the same as above: The images that we want to analyze are sorted into an array, which we can use to analyze them one after the other in a batch processing workflow.

Bottom line: Increase your flexibility and retain full provenance of your image analysis using Fiji in combination with OMERO.

The macro code shown in this example is not sufficient to execute the code, because here we only focus on the pieces relevant to identifying images based on either a dataset ID or on a Tag (ID) and sort the images into an array for further processing. What is not shown is the connection to OMERO, the input prompting window, the actual image analysis steps, saving results back into OMERO, and closing the connection to the OMERO server eventually.

Of note, this example is selectively showing a workflow in Fiji, but similar concepts hold true for other software as well, for example, python-based image analysis in Jupyter Notebook.

For further details, please review the training material from I3D:bio’s or NFDI4BIOIMAGE’s workshops on using image analysis with OMERO:

Review the details for the OMERO Macro Extension for Fiji using the original paper by Pouchin et al.: https://doi.org/10.12688/f1000research.110385.2

Do you need a general introduction to bioimage analysis including how to use Fiji Macro language and Python-based data science on bioimaging data?
Here, we highly recommend the introductory online lecture by Robert Haase on YouTube.

Back to: Bioimage Analysis