Segment OMERO data using the Scripting editor in Fiji

Description

The following workflows should work in Fiji, after these have been correctly set up with the OMERO plugin for Fiji/ImageJ.

Using the Scripting editor of Fiji, we will show:

  • How to connect to OMERO using the JAVA API.
  • How to load all the images within a given Dataset.
  • How to load the images in ImageJ using Bio-Formats.
  • How to analyze the images using Thresholding and Analyze Particles plugin in ImageJ within a script.
  • How to save the segmented ROIs as polygons in OMERO.
  • How to collect the measurement associated to the ROIs and
    • Save them as an OMERO.table and link the table to the Dataset.
    • Save them as a CSV file and link it to the Dataset.

Setup

Resources

Step-by-Step

We will now repeat the manual analysis Segment manually OMERO data using Fiji/ImageJ on a Dataset using the scripting facility available in Fiji.

Let’s go over the script to understand the logic and see how it matches the UI steps.

This script explores the JAVA API using Groovy.

It will process all the Images in the specified Dataset, applying threshold, analyzing particles and saving ROIs back in OMERO i.e. we reproduce in a script the manual steps recorded. Further, it will create a CSV and OMERO.table to be attached to that Dataset in OMERO.

  1. In your browser, go to the server address provided.

  2. Log in using the credentials provided.

  3. Make sure you are selecting your own data. Select the Dataset A-Fiji-dataset.

  4. Launch Fiji.

  5. Go to File > New > Script….

  6. A dialog pops up. In the Language menu, select Groovy.

  7. Copy, into the text script editor of Fiji, analyse_dataset_save_rois_and_summary_table.groovy.

  8. You will be asked to enter your login credentials when you run the script.

  9. Click Run.

  10. Return to OMERO.web and open an Image from this Dataset in OMERO.iviewer.

  11. Click the ROIs tab to see the added ROIs. Note that the ROIs have been assigned a Channel index to indicate which Channel they were derived from.

  12. In the Settings tab, turning channels on/off will also show/hide ROIs assigned to those channels.

  13. Open the image in OMERO.figure for a quick publication by going to Info tab in iviewer and clicking on OMERO.figure in the Open with line.image1

  14. The script idr0021.groovy was used previously to run on the whole idr0021 Project and produce the resulting CSV file. We can now download this file from OMERO and open it in Microsoft Excel.

  15. In Excel, select the Dataset column and the column bounding_box and then click on Insert > X Y Scatter > Scatterimage2. Depending on the version of Excel you are using, this option might not be available.

    image3

  1. This will create a scatter plot. Right-click into the Chart now and select Change chart type > Statistical > Box and Whisker.