Using BioImage.IO models for image analysis in Galaxy

Overview
Creative Commons License: CC-BY Questions:
  • How can I apply a pre-trained deep learning model to an image?

  • How does the BioImage.IO format integrate with Galaxy?

  • What kind of outputs are generated by the model?

Objectives:
  • Learn how to run a BioImage.IO model using Galaxy

  • Understand how to format image inputs and model axes

  • Interpret and download the model output

Requirements:
Time estimation: 30 minutes
Supporting Materials:
Published: Apr 9, 2025
Last modification: Apr 9, 2025
License: Tutorial Content is licensed under Creative Commons Attribution 4.0 International License. The GTN Framework is licensed under MIT
version Revision: 2

Deep learning models are increasingly used in bioimage analysis to perform processing steps such as segmentation, classification, and restoration tasks (e.g., Moen et al. 2019). The BioImage Model Zoo, (BioImage.IO)(Wei et al. 2021) is a repository that provides access to pre-trained AI models, sharing a common metadata model that allows their reuse in different tools and platforms.

Each model in BioImage.IO is tailored for a specific biological task — for example, segmenting nuclei, detecting mitochondria, or identifying neuronal structures — and trained on specific imaging modalities such as electron or fluorescence microscopy (e.g., von Chamier et al. 2021, Gómez-de-Mariscal et al. 2021).

This tutorial will guide you through the process of applying one of these BioImage.IO models to an input image using Galaxy (Batut et al. 2018). You will learn how to upload and configure the model, set the correct input parameters, and interpret the output files.

+⚠️ As of the version Process image using a BioImage.IO model ( Galaxy version 2.4.1+galaxy2), only the PyTorch-based BioImage.IO models listed in the section below are compatible with the Galaxy tool.

Agenda

In this tutorial, we will cover:

  1. Available BioImage.IO models in Galaxy
  2. Model-specific example
  3. Get data
  4. Run the model on your image
  5. Conclusion

Available BioImage.IO models in Galaxy

Model name Task Imaging modality Sample / species Link
🪴 PlatynereisEMnucleiSegmentationBoundaryModel Nuclei segmentation Electron microscopy Platynereis View model
🪴 PlatynereisEMcellsSegmentationBoundaryModel Cell segmentation Electron microscopy Platynereis View model
🦠 LiveCellSegmentationBoundaryModel Live cell segmentation Phase-contrast Microscopy Various cell types View model
🔬 HyLFM-Net-stat Light field reconstruction Light field and Fluorescence light microscopy Zebrafish View model
🪴 3DUNetArabidopsisApicalStemCells Stem cell segmentation Confocal / light sheet Arabidopsis root View model
🧬 CovidIFCellSegmentationBoundaryModel Cell segmentation Fluorescence light microscopy Infected human cells View model
🧬 NucleiSegmentationBoundaryModel Nucleus segmentation Fluorescence light microscopy Generic / various View model
🧬 HPANucleusSegmentation Nucleus segmentation Immunofluorescence Human Protein Atlas View model
🧠 NeuronSegmentationInEM Neuron segmentation Electron microscopy Brain tissue View model
🧫 HPACellSegmentationModel Cell segmentation Immunofluorescence Human Protein Atlas View model
🧪 MitochondriaEMSegmentationBoundaryModel Mitochondria segmentation Electron microscopy Human View model

Model-specific example

Here we illustrate the type of information that is both useful for understanding the model’s biological context and necessary for using the Galaxy tool — specifically, the input axes and input size parameters.

As an example, we consider the following model: 🧬 NucleiSegmentationBoundaryModel

This model segments nuclei in fluorescence microscopy images. It predicts boundary maps and foreground probabilities for nucleus segmentation, primarily in images stained with DAPI. The outputs are designed to be post-processed with methods such as Multicut or Watershed to achieve instance-level segmentation (object-based segmentation).

You can find similar details for other models directly on BioImage.IO by viewing each model’s card. Look under the “inputs” section of the RDF file to find the required axes and input size values. These parameters are essential for running the model correctly in Galaxy.

Get data

Hands On: Data Upload
  1. Create a new history for this tutorial.

  2. Download the following image and import it into your Galaxy history. For the purpose of this tutorial, we will use one image to test only one of the 11 available models:

    If you are importing the image via URL:

    • Copy the link location
    • Click galaxy-upload Upload Data at the top of the tool panel

    • Select galaxy-wf-edit Paste/Fetch Data
    • Paste the link(s) into the text field

    • Press Start

    • Close the window

    If you are importing the image from the shared data library:

    As an alternative to uploading the data from a URL or your computer, the files may also have been made available from a shared data library:

    1. Go into Libraries (left panel)
    2. Navigate to the correct folder as indicated by your instructor.
      • On most Galaxies tutorial data will be provided in a folder named GTN - Material –> Topic Name -> Tutorial Name.
    3. Select the desired files
    4. Click on Add to History galaxy-dropdown near the top and select as Datasets from the dropdown menu
    5. In the pop-up window, choose

      • “Select history”: the history you want to import the data to (or create a new one)
    6. Click on Import

  3. Rename the datasets appropriately if needed (e.g. "BioImage.IO model", "Test image")

  4. Confirm the datatypes are correct (pt for the model, tiff or png for the image)

    • Click on the galaxy-pencil pencil icon for the dataset to edit its attributes
    • In the central panel, click galaxy-chart-select-data Datatypes tab on the top
    • In the galaxy-chart-select-data Assign Datatype, select datatypes from “New type” dropdown
      • Tip: you can start typing the datatype into the field to filter the dropdown menu
    • Click the Save button

  5. Import the BioImage.IO model from the Galaxy file repository:

    • Click on Upload Data
    • Go to the ** Choose from repository** tab
    • Navigate to: ML modelsbioimaging-models
    • Select the desired model file (for this tutorial, choose nucleisegmentationboundarymodel.pt)
    • Click Import to add it to your history

    If you are importing the model from the shared data library:

    As an alternative to uploading the data from a URL or your computer, the files may also have been made available from a shared data library:

    1. Go into Libraries (left panel)
    2. Navigate to the correct folder as indicated by your instructor.
      • On most Galaxies tutorial data will be provided in a folder named GTN - Material –> Topic Name -> Tutorial Name.
    3. Select the desired files
    4. Click on Add to History galaxy-dropdown near the top and select as Datasets from the dropdown menu
    5. In the pop-up window, choose

      • “Select history”: the history you want to import the data to (or create a new one)
    6. Click on Import

Run the model on your image

Hands On: Run BioImage.IO model
  1. Process image using a BioImage.IO model ( Galaxy version 2.4.1+galaxy1) with the following parameters:
    • param-file “BioImage.IO model”: nucleisegmentationboundarymodel.pt
    • param-file “Input image”: test_image_nuclei.png
    • param-text “Size of the input image”: 256,256,1,1
    • param-select “Axes of the input image”: bcyx
    Comment: Axes and size

    The input axes define the order of image dimensions expected by the model:

    • b: batch
    • c: channel
    • y: vertical axis
    • x: horizontal axis

    The input size must match that order. For example: 256,256,1,1 = 256 px height (y), 256 px width (x), 1 channel (c), and 1 image (b).

    This information is provided in the model’s RDF file on BioImage.IO.

The model will process the input image and generate two outputs:

  • Two predicted images (written in one TIFF file)
  • A predicted tensor matrix (.npy)

Below is a visualization of the two predicted images generated by the 🧬 NucleiSegmentationBoundaryModel. 👉 See tip below for how to properly visualize the output.

Example of tiff output from nuclei segmentation model. Open image in new tab

Figure 1: Predicted output – Nucleus Segmentation

Galaxy provides a basic preview using its .tiff visualization tool. However, BioImage.IO models sometimes produce tiff files with several predicted images residing in the same tiff file.

To properly explore the results, it is recommended to click on the visualize icon in the output file, this will give you the option to display the dataset using the Avivator tool.

Inspect output with Avivator. Open image in new tab

Figure 2: Visualize your Tiff output with Avivator in Galaxy

An alternative is to download the file and open it locally using image analysis tools such as Fiji/ImageJ, napari, or QuPath.

Question: Check your understanding
  1. Why do the image axes matter when using a model?
  2. What happens if the image size does not match the model input?
  3. What are TIFF and NPY formats?
  4. How can you interpret the output of the model, and what does it tell you about your input image?
  1. Because deep learning models are trained on specific image shapes and dimensions; mismatches will cause errors or wrong results.
  2. The model will fail to run or produce invalid output.
  3. TIFF (.tif) is a standard format for storing image data, commonly used in microscopy and bioimaging. It can be easily viewed and interpreted visually. NPY (.npy) is a binary format used by NumPy to store arrays. In this case, it contains the raw prediction tensor produced by the model, which can be useful for further analysis or visualization with Python tools.
  4. The model generates a predicted image that highlights or segments specific structures (e.g. nuclei, cells, mitochondria) based on what it learned during training. By comparing the output image to the input, users can see which regions were detected or classified, helping to extract biological meaning from the raw data.

Conclusion

In this tutorial, you learned how to run a BioImage.IO model on a biological image using Galaxy. By uploading a compatible model and image, setting the appropriate size and axes, and running the tool, you obtained both a predicted image and a tensor matrix representing the model output.

This provides a fast, reproducible way to apply deep learning models in the context of bioimage analysis — all within Galaxy.