Segment using Groovy script =========================== 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 *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. Setup ----- - Install Fiji on the local machine with the OMERO.insight-ij plugin. The installation instructions can be found at :doc:`installation`. Resources --------- - Data: Samples images from the Image Data Resource (IDR) `idr0021 `_. - `Java API documentation `__. - Script: Groovy script for automatic segmentation of images from OMERO using Fiji - :download:`analyse_dataset_save_rois_and_summary_table.groovy <../scripts/groovy/analyse_dataset_save_rois_and_summary_table.groovy>`. Step-by-Step ------------ We will now repeat the manual analysis :doc:`threshold_manual` 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. #. In your browser, go to the server address provided. #. Log in using the credentials provided. #. Make sure you are selecting your own data. Select the Dataset **A-Fiji-dataset**. #. Launch Fiji. #. Go to *File > New > Script...*. #. A dialog pops up. In the *Language* menu, select *Groovy*. #. Copy, into the text script editor of Fiji, :download:`analyse_dataset_save_rois_and_summary_table.groovy <../scripts/groovy/analyse_dataset_save_rois_and_summary_table.groovy>`. #. You will be asked to enter your login credentials when you run the script. #. Click *Run*. #. Return to OMERO.web and open an Image from this Dataset in OMERO.iviewer. #. 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. #. In the *Settings* tab, turning channels on/off will also show/hide ROIs assigned to those channels. #. 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| .. |image1| image:: images/threshold_script2.png :width: 1.89583in :height: 0.36458in