-
Notifications
You must be signed in to change notification settings - Fork 3
Q&A: Finding better segmentation settings (Example 3)
See also a similar Q&As here:
- How to find an appropriate segmentation method for my data sets (Example 1)?
- How to find an appropriate segmentation method for my data sets (Example 2)?
This small Q&A shows how to optimize settings to detect cilia from background for an example image submitted by a user.
User question: Hi, Thank you for creating the CiliaQ plugin! It is a fantastic tool that is tremendously useful for my research. Subtract background (10pix), Gaussian blur (0.5pix), and RenyiEntropy thresholding based on max projection has worked really well for most of my dataset, but it seems to be missing some very thin flat cilia in a few of my images. I’ve tried Canny3D and Hysteresis thresholding approaches without success. I wondered if you have any suggestions based on the particular characteristics of the example image I attached. (I am running the algorithm on image stacks but have attached a max projection here to make it small enough to upload). Thanks so much!
Image submitted by the user:
Note: Reuse / reprint of this image is not permitted!
In the following, I document how I searched for and optimized the settings for an exemplary image from a CiliaQ User.
Answer provided on 21st of October 2022.
Hi, thank you very much! I am happy to help you find better settings.
I have looked at your images and tried a few things. I am not sure whether I have found the best possible settings but I will shortly explain what I selected and why.
First of all, I focused at distinguishing the cilia from background. To explore how we can optimize the Subtract Background function to the image I opened it in FIJI, split the channel (Image > Color > Split Channels), zoomed into a challenging region and then went to Image > Subtract Background, checked the preview option and looked at the image region depending on which radius in px I select.
I noticed that when I decrease the radius from 10 to 5 pixels I still get all the cilia, since they are smaller than 10 px in width, but get rid of more background (focus on region down in image).
Verifying how subtracting the background with a 10 px (left) or 5 px (right) radius changes the image.
You may further optimize the radius but I then went for 5 px since I found it to be good. I next pressed OK to apply it and then looked at the image and the Gaussian Blur option. If you look at the very weakly labeled cilia, you can see that a challenge is that their signal is very noisy:
Their labeling seems to be interrupted along the cilium which will later make it hard to detect them from background and may lead into detection of one cilium as multiple fragments. We can increase a bit the LUT to better see this (Image > Adjust > Brightness / Contrast and drag down the maximum).
Now let's launch a manual blur option and see what radius is good as a blur: Process > Filters > Gaussian Blur. Check the preview option and take a look how different blur radii look:
- The CiliaQ default 0.5 px is hardly closing gaps in the cilium labeling in this image:
* Using 1 px improves this. At the same time we see that the background noise also gets reduced which makes the cilium better distinguishable from the background as a consistent object.
* Using 2 px makes it even more smooth
* When setting too high values at some point you cannot see the cilia any more, which is clearly too much then (e.g. 5 px)
Based on these observations I think that a blur value between 1 and 2 might perform relatively good. Note that the blur also widens the cilium a bit compared to the original image, which is however no problem if you only want to extract ciliary length or use intensity parameters for the centreline or the 10% highest pixels in the cilium. However, this may dilute a bit the overall intensity signals you may measure in cilia with CiliaQ later, if you go higher with the blur. But since that applies to all cilia moreover equally I usually do not consider this enlargement of the ciliary mask a problem.
For this example I set it to 1 and pressed OK.
Now we can test different thresholds. Go to Image > Adjust Threshold... Now you have a dialog where you can see how different thresholds perform.
You can see that we get all cilia and a little bit more background with Li. With Otsu we get not the whole cilium but all cilia and no background. So this speaks for using a hysteresis threshold combining Otsu and Li (I decided that also based on looking at the whole image, so please have a look at the whole image as well if you look into such optimizations).
Based on these observations I decided to test the following setting for your image in CiliaQ Preparator:
And in the hysteresis threshold dialog:
I also ran the same setting with a Gaussian Blur of 2 px to see what is better, a Gaussian blur of 1 or 2 px.
Let's explore the results and open the output CQP.tif files. I then colored the segmented channel in cyan (Image > Color > Channels Tool, select More > Cyan there). Now we can well see what the plugin detected (Left: Gaussian Blur 1 px. Right: Gaussian Blur 2 px):
This looks pretty good to me for detecting low-signal and high-signal cilia. Unfortunately we also pick up some background structures but these are to me even by eye hard to distinguish from cilia. Are these cilia? I can't tell. If these are not cilia, I would recommend to still use this settings and then later in CiliaQ Editor remove them (or check their IDs in CiliaQ output files and remove their IDs from the CiliaQ results in the post-hoc analysis).
When comparing the image for a 1 px to a 2 px blur, you can see that the 2 px blur smooths a bit too much and thus we miss one cilium in this image with the 2 px blur (compare upper left in images). Thus, 1 px seems to be even better than 2 px. One may be able to optimize this even more and could also try 1.5 px or testing whether a different threshold than Otsu picks up more cilia while not picking up the image background.
Copyright (C) 2017-2023: Jan N. Hansen.
CiliaQ is part of the following publication: Jan N. Hansen, Sebastian Rassmann, Birthe Stueven, Nathalie Jurisch-Yaksi, Dagmar Wachten. CiliaQ: a simple, open-source software for automated quantification of ciliary morphology and fluorescence in 2D, 3D, and 4D images. Eur. Phys. J. E 44, 18 (2021). https://doi.org/10.1140/epje/s10189-021-00031-y