Segment using Groovy script


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 Auto Threshold and Analyze particles plugins 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.




We will now repeat the manual analysis Manual Segmentation 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