Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 96 additions & 12 deletions topics/imaging/tutorials/imaging-introduction/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ questions:
- "How do I display images in Galaxy?"
- "How do I filter images in Galaxy?"
- "How do I segment simple images in Galaxy?"
- "Can the same image-analysis workflow be reused on data from another discipline, such as Earth observation?"
objectives:
- "How to handle images in Galaxy."
- "How to perform basic image processing in Galaxy."
- "Reuse the same segment-and-count workflow on an Earth-observation image (cross-discipline reuse)."
key_points:
- The **Image Info** tool can provide valuable metadata information of an image.
- TIFF files cannot viewed directly in most web browser, so a visualization plugin must be used.
- For visualization, images with a bit-depth more than 8-bit have to be histogram equalized.
- The same threshold–label–count workflow can be applied across scientific domains — here a cell-counting workflow is reused unchanged to count supraglacial melt ponds in a Sentinel-2 satellite image.
time_estimation: "1H"
follow_up_training:
-
Expand All @@ -30,15 +33,18 @@ contributions:
- thomaswollmann
- shiltemann
- kostrykin
- annefou
funding:
- elixir-europe
- oscars
tags:
- Image segmentation
- Image thresholding
- Conversion
- Object counting
- Overlay
- Fluorescence microscopy
- Earth observation

---

Expand All @@ -56,15 +62,20 @@ This tutorial shows how to use Galaxy to perform basic image analysis tasks such
>
{: .agenda}

The **same** Galaxy image-analysis workflow can be applied to images from very different scientific domains. This tutorial can be followed with a **bioimaging** image (stained cell nuclei under a microscope) or an **Earth-observation** image (supraglacial melt ponds in a Sentinel-2 satellite scene). The analysis steps are identical — only the input image changes, and the meaning of the threshold. Choose the path that interests you most.

{% include _includes/cyoa-choices.html option1="Bioimaging" option2="Earth" default="Bioimaging" text="Pick a dataset: a fluorescence-microscopy image of stained cell nuclei, or a Sentinel-2 water-index image of Greenland supraglacial melt ponds. The workflow is the same for both." %}

# Getting Data

The dataset required for this tutorial is available from [Zenodo]({{ page.zenodo_link }}) and
contains a screen of [DAPI](https://en.wikipedia.org/wiki/DAPI) stained [HeLa](https://en.wikipedia.org/wiki/HeLa) nuclei ([more information]({{ page.zenodo_link }})). We will use a sample image from this dataset for training basic image processing skills in Galaxy.
Our objective is to automatically count the objects contained in an image — **cell nuclei** in a microscopy image, or **melt ponds** in a satellite image. In order to achieve this, we will enhance the quality of the image, automatically detect the objects, and segment and count them.

Our objective is to automatically count the number of cells contained in this image. In order to achieve this, we will enhance the quality of the image, automatically detect the nuclei and segment the nuclei and count them.
<div class="Bioimaging" markdown="1">

The dataset required for the bioimaging path is available from [Zenodo]({{ page.zenodo_link }}) and
contains a screen of [DAPI](https://en.wikipedia.org/wiki/DAPI) stained [HeLa](https://en.wikipedia.org/wiki/HeLa) nuclei ([more information]({{ page.zenodo_link }})). We will use a sample image from this dataset for training basic image processing skills in Galaxy.

> <hands-on-title>Data upload</hands-on-title>
> <hands-on-title>Data upload — bioimaging</hands-on-title>
>
> 1. If you are logged in, create a new history for this tutorial
>
Expand All @@ -91,6 +102,44 @@ Our objective is to automatically count the number of cells contained in this im
> {% snippet faqs/galaxy/datasets_rename.md %}
{: .hands_on}

</div>

<div class="Earth" markdown="1">

The dataset for the Earth-observation path is a single-band 16-bit **water-index image** derived from a Sentinel-2 satellite scene of the Greenland ice sheet, in which supraglacial melt ponds appear as bright objects.

> <hands-on-title>Data upload — Earth observation</hands-on-title>
>
> 1. If you are logged in, create a new history for this tutorial
>
> {% snippet faqs/galaxy/histories_create_new.md %}
>
> 2. Import the Sentinel-2 melt-pond water-index image from [Zenodo](https://doi.org/10.5281/zenodo.20960690).
> - **Important:** Choose the type of data as `tiff`.
>
> ```
> https://zenodo.org/records/20960690/files/melt_ponds_water_index.tif
> ```
>
> {% snippet faqs/galaxy/datasets_import_via_link.md %}
>
> 3. Rename {% icon galaxy-pencil %} the dataset to `input.tiff`
>
> {% snippet faqs/galaxy/datasets_rename.md %}
{: .hands_on}

> <comment-title> Counting melt ponds with a cell-counting workflow </comment-title>
>
> In the Earth-observation path we reuse this **same** segment-and-count workflow — built to count stained cell nuclei — to count **supraglacial melt ponds** on the Greenland ice sheet. This is a cross-discipline experiment from the [OSCARS](https://oscars-project.eu)–FIESTA project. Why does it work? Melt ponds have a high ice-adapted water index, so in a water-index image they appear as **bright blobs on a darker background** — morphologically much like the bright nuclei the workflow was built for. The same threshold–label–count steps that count nuclei count melt ponds; only the *index* and the *meaning of the threshold* are domain-specific.
{: .comment}

> <comment-title> How the satellite image was prepared </comment-title>
>
> The image is a single-band ice-adapted normalised-difference water index, NDWI<sub>ice</sub> = (blue − red)/(blue + red) (Williamson et al. 2018, [doi:10.5194/tc-12-3045-2018](https://doi.org/10.5194/tc-12-3045-2018)), computed from a Sentinel-2 Level-2A scene (tile T22WEV, 2019-07-23) over the south-west Greenland ablation zone and rescaled to 16-bit so that melt ponds are bright. The preprocessing notebooks, the full Galaxy run provenance, the validation against an independently published lake map, and a citable archive are in the [OSCARS-FIESTA example repository](https://github.com/annefou/fiesta-galaxy-meltponds-eo).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [GTN Lint] <GTN:004> reported by reviewdog 🐶
This looks like a DOI which could be better served by using the built-in Citations mechanism. You can use https://doi2bib.org to convert your DOI into a .bib formatted entry, and add to your tutorial.md

Suggested change
> The image is a single-band ice-adapted normalised-difference water index, NDWI<sub>ice</sub> = (blue − red)/(blue + red) (Williamson et al. 2018, [doi:10.5194/tc-12-3045-2018](https://doi.org/10.5194/tc-12-3045-2018)), computed from a Sentinel-2 Level-2A scene (tile T22WEV, 2019-07-23) over the south-west Greenland ablation zone and rescaled to 16-bit so that melt ponds are bright. The preprocessing notebooks, the full Galaxy run provenance, the validation against an independently published lake map, and a citable archive are in the [OSCARS-FIESTA example repository](https://github.com/annefou/fiesta-galaxy-meltponds-eo).
> The image is a single-band ice-adapted normalised-difference water index, NDWI<sub>ice</sub> = (blue − red)/(blue + red) (Williamson et al. 2018{% cite ... %})), computed from a Sentinel-2 Level-2A scene (tile T22WEV, 2019-07-23) over the south-west Greenland ablation zone and rescaled to 16-bit so that melt ponds are bright. The preprocessing notebooks, the full Galaxy run provenance, the validation against an independently published lake map, and a citable archive are in the [OSCARS-FIESTA example repository](https://github.com/annefou/fiesta-galaxy-meltponds-eo).

{: .comment}

</div>


# Image Metadata Extraction

Expand All @@ -110,7 +159,7 @@ Now, we can extract metadata from an image.
> >
> > > <solution-title></solution-title>
> > > 1. TIFF
> > > 2. 1344x1024
> > > 2. 1344x1024 (bioimaging path) or 1000x1000 (Earth-observation path)
> > > 3. 16
> > {: .solution }
> {: .question}
Expand All @@ -130,14 +179,20 @@ Not all tools can handle all image formats. Especially proprietary microscope im

Your image should look something like this:

<div class="Bioimaging" markdown="1">
![raw input image](../../images/imaging-introduction/viz_input.png){: width="75%"}
</div>

<div class="Earth" markdown="1">
![raw melt-pond water-index image](../../images/imaging-introduction/melt_ponds_input.png){: width="75%"}
</div>

> <question-title></question-title>
>
> You can observe that the image content is barely visible. Why?
>
> > <solution-title></solution-title>
> > The original image is 16-bit and the intensity values of the image (33069 to 36863) are spread over a very small fraction (only about 6%) of the intensity values that can be represented using 16 bits (0 to 65535, where 0 corresponds to black and 65535 corresponds to white). Therefore, for improved visibility the intensity histogram of the image should be normalized first.
> > The image is 16-bit, but its intensity values occupy only a small fraction of the range that 16 bits can represent (0 to 65535, where 0 corresponds to black and 65535 corresponds to white). Therefore, for improved visibility the intensity histogram of the image should be normalized first.
> {: .solution }
{: .question}

Expand All @@ -155,9 +210,15 @@ Next we will normalize the histogram to improve the contrast. We do this using a

Your image should now look something like this:

<div class="Bioimaging" markdown="1">
![viz_normalized output image](../../images/imaging-introduction/viz_normalized.png){: width="75%"}
</div>

<div class="Earth" markdown="1">
![normalised melt-pond water index](../../images/imaging-introduction/melt_ponds_normalized.png){: width="75%"}
</div>

We can now clearly make out the presence of the stained nuclei. Next we will automatically detect these features and segment the image.
We can now clearly make out the objects of interest (the stained nuclei, or the melt ponds). Next we will automatically detect these features and segment the image.

# Image Filtering

Expand All @@ -177,14 +238,22 @@ Specific features of interest (e.g., edges, noise) can be enhanced or suppressed
> 5. Click on the **visualise icon** {% icon galaxy-visualise %} of the file to visually inspect the image and compare the result with `input_normalized`. You can observe that `input_smoothed_normalized` has significantly reduced noise.
{: .hands_on}

<div class="Bioimaging" markdown="1">
Your image should now look something like this:

![viz_smoothed_normalized output image](../../images/imaging-introduction/viz_smoothed_normalized.png){: width="75%"}
</div>

<div class="Earth" markdown="1">
Your image should now look something like this:

![smoothed normalised melt-pond water index](../../images/imaging-introduction/melt_ponds_smoothed_normalized.png){: width="75%"}
</div>


# Segmentation

Objects of interest like nuclei can be segmented by using a smoothed image and thresholding. Moreover, the results can be overlayed with the original image.
Objects of interest like nuclei (or melt ponds) can be segmented by using a smoothed image and thresholding. Moreover, the results can be overlayed with the original image.

> <hands-on-title>Segment image</hands-on-title>
>
Expand All @@ -211,9 +280,14 @@ Objects of interest like nuclei can be segmented by using a smoothed image and t
> > > - {% icon param-file %} *"Input image"*: `input_segmented_labeled` file (output of {% tool [Convert binary image to label map](toolshed.g2.bx.psu.edu/repos/imgteam/binary2labelimage/ip_binary_to_labelimage/0.5+galaxy0) %})
> > > - *"Histogram equalization algorithm"*: `CLAHE`
> > >
> > > The information contained in the original image has now become visible to the human eye:
> > > The information contained in the original image has now become visible to the human eye.
> > >
> > > Bioimaging path:
> > > ![normalized viz_segmented file](../../images/imaging-introduction/viz_segmented.png)
> > >
> > > Earth-observation path:
> > > ![normalized melt-pond label map](../../images/imaging-introduction/melt_ponds_segmented.png)
> > >
> > {: .solution }
> {: .question}
>
Expand All @@ -235,20 +309,30 @@ Objects of interest like nuclei can be segmented by using a smoothed image and t
> > How many objects were segmented?
> >
> > > <solution-title></solution-title>
> > > The {% tool [Count objects in label map](toolshed.g2.bx.psu.edu/repos/imgteam/count_objects/ip_count_objects/0.0.5-2) %} tool counted 425 objects.
> > > The {% tool [Count objects in label map](toolshed.g2.bx.psu.edu/repos/imgteam/count_objects/ip_count_objects/0.0.5-2) %} tool counted:
> > > - **Bioimaging path:** 425 nuclei.
> > > - **Earth-observation path:** 13 melt ponds — the major supraglacial lakes. A single Gaussian-smoothing + Otsu pass detects the large lakes; the full workflow in the [example repository](https://github.com/annefou/fiesta-galaxy-meltponds-eo) (median denoising and the literature water-index threshold) resolves the smaller ponds too, about 90 in this scene.
> > {: .solution }
> {: .question}
{: .hands_on}

The resulting image should look something like this:

<div class="Bioimaging" markdown="1">
![segmentation mask output image](../../images/imaging-introduction/viz_segmentation_mask.png){: width="75%"}

We see the segmentation mask overlayed; each detected object (nucleus) is labeled with its ID value.
</div>

<div class="Earth" markdown="1">
![melt-pond segmentation overlay](../../images/imaging-introduction/melt_ponds_segmentation_mask.png){: width="75%"}

We see the detected supraglacial melt ponds outlined (red contours) on the water-index image.
</div>

We see that with the help of just a few simple steps, we were able to detect the locations of the stained nuclei, and count them.
We see that with the help of just a few simple steps, we were able to detect the locations of the objects of interest, and count them — the **same** workflow, whether the objects are stained cell nuclei or supraglacial melt ponds.

# Conclusion


In this exercise you imported images into Galaxy, extracted meta information from an image, learned how to visualize microscopy images, filtered the image, and segmented cells using Galaxy.
In this exercise you imported images into Galaxy, extracted meta information from an image, learned how to visualize images, filtered the image, and segmented and counted objects using Galaxy. You also saw that the very same workflow transposes across scientific disciplines — from counting cell nuclei in a microscope image to counting supraglacial melt ponds in a satellite image — when the input is described precisely (a single-channel image in which the objects of interest are the bright peaks of an index).