From a9cf17bd7871c01d9441da7812ae528a764cb24b Mon Sep 17 00:00:00 2001 From: Stephen Thompson Date: Mon, 8 Jun 2026 11:56:40 +0100 Subject: [PATCH 1/4] Consistent layer numberng --- episodes/filetypes-and-metadata.md | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/episodes/filetypes-and-metadata.md b/episodes/filetypes-and-metadata.md index 271cf409..6f79b793 100644 --- a/episodes/filetypes-and-metadata.md +++ b/episodes/filetypes-and-metadata.md @@ -314,13 +314,13 @@ image_layer.scale = (0.35, 0.2047619, 0.2047619) ## Pixel size / scale -Copy and paste the following into Napari's console to get `image_layer_1`, -`image_layer_2` and `image_layer_3` of the yeast image: +Copy and paste the following into Napari's console to get `image_layer_0`, +`image_layer_1` and `image_layer_2` of the yeast image: ```python -image_layer_1 = viewer.layers[0] -image_layer_2 = viewer.layers[1] -image_layer_3 = viewer.layers[2] +image_layer_0 = viewer.layers[0] +image_layer_1 = viewer.layers[1] +image_layer_2 = viewer.layers[2] ``` 1. Check the `.scale` of each layer - are they the same? @@ -340,9 +340,9 @@ their original size in the viewer All layers have the same scale ```python +print(image_layer_0.scale) print(image_layer_1.scale) print(image_layer_2.scale) -print(image_layer_3.scale) ``` ```output [0.35 0.2047619 0.2047619] @@ -352,40 +352,40 @@ print(image_layer_3.scale) ### 2 -![](fig/yeast-exercise-2.png){alt="Yeast image shown in Napari with layer 3 +![](fig/yeast-exercise-2.png){alt="Yeast image shown in Napari with layer 2 twice as big in y and x"} ```python -image_layer_3.scale = (0.35, 0.4, 0.4) +image_layer_2.scale = (0.35, 0.4, 0.4) ``` -You should see that layer 3 becomes about twice as wide and twice as tall as the -other layers. This is because we set the pixel size in y and x (which used to +You should see that layer 2 becomes about twice as wide and twice as tall as the +other layers. This is because we set the pixel size in y and x (which used to be 0.2047619μm) to about twice its original value (now 0.4μm). ### 3 -![](fig/yeast-exercise-3.png){alt="Yeast image shown in Napari with layer 3 +![](fig/yeast-exercise-3.png){alt="Yeast image shown in Napari with layer 2 twice as big in y"} ```python image_layer_3.scale = (0.35, 0.4, 0.2047619) ``` -You should see that layer 3 appears squashed - with the same width as other -layers, but about twice the height. This is because we set the pixel size in y -(which used to be 0.2047619μm) to about twice its original value (now +You should see that layer 2 appears squashed - with the same width as other +layers, but about twice the height. This is because we set the pixel size in y +(which used to be 0.2047619μm) to about twice its original value (now 0.4μm). Bear in mind that setting the pixel sizes inappropriately can lead to stretched or squashed images like this! ### 4 -![](fig/yeast-exercise-4.png){alt="Yeast image shown in Napari with all layers +![](fig/yeast-exercise-4.png){alt="Yeast image shown in Napari with all layers half size in y/x"} We set the pixel size in y/x to half its original value of 0.2047619μm: ```python +image_layer_0.scale = (0.35, 0.10238095, 0.10238095) image_layer_1.scale = (0.35, 0.10238095, 0.10238095) image_layer_2.scale = (0.35, 0.10238095, 0.10238095) -image_layer_3.scale = (0.35, 0.10238095, 0.10238095) ``` ::::::::::::::::::::::::::::::::: From 6d57236f81bbe90944ab86a97f72fcdfb6343cc8 Mon Sep 17 00:00:00 2001 From: Stephen Thompson Date: Mon, 8 Jun 2026 14:54:47 +0100 Subject: [PATCH 2/4] Update episodes/filetypes-and-metadata.md Co-authored-by: Kimberly Meechan <24316371+K-Meech@users.noreply.github.com> --- episodes/filetypes-and-metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/episodes/filetypes-and-metadata.md b/episodes/filetypes-and-metadata.md index 6f79b793..78d2a58c 100644 --- a/episodes/filetypes-and-metadata.md +++ b/episodes/filetypes-and-metadata.md @@ -324,7 +324,7 @@ image_layer_2 = viewer.layers[2] ``` 1. Check the `.scale` of each layer - are they the same? -2. Set the scale of layer 3 to (0.35, 0.4, 0.4) - what changes in the viewer? +2. Set the scale of `image_layer_2` to (0.35, 0.4, 0.4) - what changes in the viewer? 3. Set the scale of layer 3 to (0.35, 0.4, 0.2047619) - what changes in the viewer? 4. Set the scale of all layers so they are half as wide and half as tall as From fbc87f3e237b23760aea1949efa60425ff13048b Mon Sep 17 00:00:00 2001 From: Stephen Thompson Date: Mon, 8 Jun 2026 14:54:59 +0100 Subject: [PATCH 3/4] Update episodes/filetypes-and-metadata.md Co-authored-by: Kimberly Meechan <24316371+K-Meech@users.noreply.github.com> --- episodes/filetypes-and-metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/episodes/filetypes-and-metadata.md b/episodes/filetypes-and-metadata.md index 78d2a58c..4d731bc9 100644 --- a/episodes/filetypes-and-metadata.md +++ b/episodes/filetypes-and-metadata.md @@ -325,7 +325,7 @@ image_layer_2 = viewer.layers[2] 1. Check the `.scale` of each layer - are they the same? 2. Set the scale of `image_layer_2` to (0.35, 0.4, 0.4) - what changes in the viewer? -3. Set the scale of layer 3 to (0.35, 0.4, 0.2047619) - what changes in the +3. Set the scale of `image_layer_2` to (0.35, 0.4, 0.2047619) - what changes in the viewer? 4. Set the scale of all layers so they are half as wide and half as tall as their original size in the viewer From bdd82e9ae3a61032ff01362b6a45db4a150d5755 Mon Sep 17 00:00:00 2001 From: Stephen Thompson Date: Mon, 8 Jun 2026 14:55:27 +0100 Subject: [PATCH 4/4] Update episodes/filetypes-and-metadata.md Co-authored-by: Kimberly Meechan <24316371+K-Meech@users.noreply.github.com> --- episodes/filetypes-and-metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/episodes/filetypes-and-metadata.md b/episodes/filetypes-and-metadata.md index 4d731bc9..da2138e7 100644 --- a/episodes/filetypes-and-metadata.md +++ b/episodes/filetypes-and-metadata.md @@ -368,7 +368,7 @@ be 0.2047619μm) to about twice its original value (now 0.4μm). twice as big in y"} ```python -image_layer_3.scale = (0.35, 0.4, 0.2047619) +image_layer_2.scale = (0.35, 0.4, 0.2047619) ``` You should see that layer 2 appears squashed - with the same width as other layers, but about twice the height. This is because we set the pixel size in y