Skip to content

Commit 57625ee

Browse files
committed
differences for PR #122
1 parent de56883 commit 57625ee

3 files changed

Lines changed: 27 additions & 11 deletions

File tree

fig/layer-rename.png

31.2 KB
Loading

filters-and-thresholding.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,27 @@ Try increasing the 'sigma' value to three and clicking run again:
325325
of 3" width='40%'}
326326

327327
You should see a new 'nuclei_gaussian_σ=3.0' layer that is much more heavily blurred.
328-
If you used the `+`/`-` buttons to set the sigma value, you may see many more
329-
decimal places in the layer name e.g. 'nuclei_gaussian_σ=3.00000000000000'.
330-
If so, double click on the layer name to re-name it to `nuclei_gaussian_σ=3.0`.
331328

332-
What's happening here? What exactly does a gaussian blur do? A gaussian blur is
329+
::::::::::::::::::::::::::::::::::::: callout
330+
331+
## Renaming Layer Names
332+
333+
The Gaussian filter plugin uses the special character `σ` in the layer names.
334+
This naming convention makes it difficult to type layer names in the Napari
335+
console (unless your keyboard has the `σ` character). To make life easier
336+
change the name of the added layer now. Double click on the layer name, delete `σ`
337+
and change it to `sigma`
338+
339+
![](fig/layer-rename.png){alt="Changing the name of an image layer." width='40%'}
340+
341+
342+
Similarly, if you used the `+`/`-` buttons to set the sigma value, you may see excessive
343+
decimal places in the layer name e.g. `nuclei_gaussian_σ=3.00000000000000`.
344+
If so, double click on the layer name to re-name it to `nuclei_gaussian_sigma=3.0`.
345+
346+
:::::::::::::::::::::::::::::::::::::
347+
348+
What's happening here? What exactly does a gaussian blur do? A gaussian blur is
333349
an example of a 'linear filter' which is used to manipulate pixel values in
334350
images. When a filter is applied to an image, each pixel value is replaced by
335351
some combination of the pixel values around it. For example, below is shown a
@@ -521,12 +537,12 @@ Now let's try thresholding our image again. Make sure you set your gaussian blur
521537
sigma to three, then click 'Apply Gaussian Filter'.
522538

523539
Then, we'll apply the same threshold as before, now to the
524-
'nuclei_gaussian_σ=3.0' layer:
540+
'nuclei_gaussian_sigma=3.0' layer:
525541

526542
```python
527543

528544
# Get the image data for the blurred nuclei
529-
blurred = viewer.layers["nuclei_gaussian_σ=3.0"].data
545+
blurred = viewer.layers["nuclei_gaussian_sigma=3.0"].data
530546

531547
# Create mask with a threshold of 8266
532548
blurred_mask = blurred > 8266
@@ -578,7 +594,7 @@ Finally, open the `napari-matplotlib` histogram again with:
578594
the nuclei image after a gaussian blur. The left contrast limit is set
579595
to 0.134."}
580596

581-
Make sure you have 'nuclei_gaussian_σ=3.0' selected in the layer list (should
597+
Make sure you have 'nuclei_gaussian_sigma=3.0' selected in the layer list (should
582598
be highlighted in blue).
583599

584600
You should see that this histogram now runs from 0 to 1, reflecting the new
@@ -588,7 +604,7 @@ threshold between the two peaks - around 0.134:
588604
```python
589605

590606
# Get the image data for the blurred nuclei
591-
blurred = viewer.layers["nuclei_gaussian_σ=3.0"].data
607+
blurred = viewer.layers["nuclei_gaussian_sigma=3.0"].data
592608

593609
# Create mask with a threshold of 0.134
594610
blurred_mask = blurred > 0.134
@@ -633,7 +649,7 @@ clear that some areas are still missed or incorrectly labelled.
633649
## Automated thresholding
634650

635651
First, let's clean up our layer list again. Make sure you only have the
636-
'nuclei', 'mask', 'blurred_mask' and 'nuclei_gaussian_σ=3.0' layers in the
652+
'nuclei', 'mask', 'blurred_mask' and 'nuclei_gaussian_sigma=3.0' layers in the
637653
layer list - select any others and remove them by clicking the ![](
638654
https://raw.githubusercontent.com/napari/napari/main/src/napari/resources/icons/delete.svg
639655
){alt="A screenshot of Napari's delete layer button" height='30px'} icon. Then,
@@ -648,7 +664,7 @@ the most common methods is _Otsu thresholding_, which we will look at now.
648664

649665
Let's go ahead and apply this to our blurred image:
650666

651-
- Select 'nuclei_gaussian_σ=3.0' in the `Image` row
667+
- Select 'nuclei_gaussian_sigma=3.0' in the `Image` row
652668
- Select 'otsu' as the method
653669
- Click the 'Apply Thresholding' button
654670

md5sum.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"episodes/designing-a-light-microscopy-experiment.md" "9a236fbc9a48f560a786077ea9662c9c" "site/built/designing-a-light-microscopy-experiment.md" "2025-11-04"
1313
"episodes/choosing-acquisition-settings.md" "1bf362eeea03fe66d4e170d9803dc649" "site/built/choosing-acquisition-settings.md" "2024-08-16"
1414
"episodes/quality-control-and-manual-segmentation.md" "9b8a54c933bcd6ce1552ffd059c06045" "site/built/quality-control-and-manual-segmentation.md" "2025-06-25"
15-
"episodes/filters-and-thresholding.md" "e25c833b9cc4e93c7fe1ef7b0570ca07" "site/built/filters-and-thresholding.md" "2025-11-21"
15+
"episodes/filters-and-thresholding.md" "eff8ab1ac588ef608cc03ab169b68e5f" "site/built/filters-and-thresholding.md" "2026-06-04"
1616
"episodes/instance-segmentation-and-measurements.md" "e10dc9c644c27e3c40414057432575e8" "site/built/instance-segmentation-and-measurements.md" "2025-11-04"
1717
"episodes/additional-resources.md" "b9945f6270e488fe84524cb86e88485b" "site/built/additional-resources.md" "2026-05-05"
1818
"instructors/instructor-notes.md" "5cf113fd22defb29d17b64597f3c9bc0" "site/built/instructor-notes.md" "2024-08-16"

0 commit comments

Comments
 (0)