Run server-side scripts

The server-side Python scripts on OMERO give an opportunity to run the analysis close to the data.


The server-side Python scripts on OMERO can be accessed via both the OMERO.web and OMERO.insight user interfaces. The scripts are typically uploaded by an administrator or a restricted administrator of the OMERO.server and can be run by any user on the server.

First, we show an example of a server-side script with a customized UI.

Secondly, two examples are presented showing the experience from the user interface of OMERO.web (Batch ROI export and Kymograph).


No specific setup needed.



Example 1

In this example, we create a movie server-side using the script For this script, there is a customized UI for the script that will override the default UI available from the script itself.

  1. Select a time-lapse Image in the OMERO.web client and click on the Publish icon in the toolbar.

  2. Select Make Movie... from the drop-down menu to create a movie from an Image.

  3. Select the format from the Format drop-down.

  4. Use the Frame Rate drop-down to select the frame rate.

  5. Set the desired time interval if appropriate.

  6. Set the desired Z-section interval if appropriate.

  7. Click the button Make Movie to start the movie creation server side.


Example 2

  1. We will now analyse the ROIs created in OMERO.iviewer using a server-side script.

  2. Go to the siRNA-HeLa Dataset and open several images whose name start with VRAQ… in OMERO.iviewer.

  3. We want to measure the distance between Centromeres, stained with ACA in the 4th Channel. Turn on ONLY the 4th channel and open the ROIs tab to on the right-hand pane.

  4. Draw several lines between the centromeres as indicated on the screenshot below. image1a

  5. Try to identify centromere pairs:

    • Select the Line tool and draw a line between the centres of the centromeres.
    • In the ROIs table, in the Comments column, click the 3 dots in the column header and choose to Show Area/Length.
  6. Do the same now on several of the Images whose names start with IN…, which are in the Metaphase state.

  7. Select Dataset siRNA-HeLa.

  8. Click the Script button in the top-right of the page image2a.

  9. Select export_scripts > Batch_ROI_Export…

  10. In the dialog that pops up, click on View Script to view the Python code.

  11. Search for “idr”# to find the code block that selects the filter_channel based on Dataset and Channel names.

  12. Scroll to the bottom of the script to see where the input parameters are defined, such as Data_Type and IDs. Note how these appear in the script dialog and are auto-populated with the currently-selected Datasets or Images.

  13. The script will process all the Images in the selected Dataset and data can be exported as CSV file, with one table row per Shape/Channel.

  14. Click Run Script.

  15. The status of the processing is displayed in the Activities dialog image4a.

  16. When the script has completed, it will show in the Activities dialog and allow you to download the CSV file. Download this and open it, e.g. in Excel, to see the output data for all the shapes.

Example 3

We will now use another server-side script for creating a Kymograph from an Image in OMERO.

  1. Go to the Dataset Kymograph.

  2. Select the Image inside the Dataset.

  3. Double-click to open the Image in OMERO.iviewer and draw one or more lines along microtubules which seems to have the most persistent trafficking of objects along them.

  4. Save the line(s).

  5. Go back to the webclient. Click the Script button in the top-right of the pageimage2a.

  6. Select workshop_scripts > Kymograph…

  7. The script will create a new image (=Kymograph) where the pixels under the line region you have drawn previously will be collated into this image timepoint by timepoint. The row of pixels from the first timepoint will be on the top of the new Kymograph Image.

  8. Note: the direction in which you have drawn the line ROI on the original image matters with respect to the orientation of the stripes composing the Kymograph image. The start of the original line is on the left of the Kymograph Image, the end on the right.

  9. Open the new Kymograph image in OMERO.iviewer.

  10. Find some tracks (typically red stripes going under angles across the image, see screenshot below).

    ../../_images/scripts6.png ../../_images/scripts7.png
  11. Draw some lines over these tracks and save them.

  12. Go back to the webclient, select the Kymograph Image and select the script analysis > Kymograph analysis…

  13. Run this script. The Kymograph analysis script will produce a CSV file attachment on the Kymograph Image.

  14. Open the CSV in Excel for example and verify the speeds of the observed particles in the original image.