Skip to content

Commit

Permalink
Added (missing) part about measuring the nucleus axis
Browse files Browse the repository at this point in the history
this has been missing from the skimage activity.
  • Loading branch information
k-dominik committed Apr 28, 2024
1 parent 0733674 commit 0c3dbf9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
napari_viewer.add_image(image, scale=voxel_size)

# %%
# Napari GUI: Change the axes order using the corresponding button.
# Napari GUI: Change the viewer dimension order using the corresponding button.
# Napari GUI: Use the 3D viewer button to render the image in 3D.

# %%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# Let's add spatial calibration using the x&y voxel_size from the 2D image
# and also add a z scaling
voxel_size_image_3D = [0.52, voxel_size_image_2D[1], voxel_size_image_2D[0]]
units_image_3D = ["um","um","um"]
units_image_3D = ["um", "um", "um"]

# %%
# Inspect the metadata for the 3D image
Expand All @@ -49,13 +49,11 @@
print("Units: ", units_image_3D)

# %%
# Open napari and add the images with their voxel sizes as scaling
# Open napari and add the 3D image with voxel_size
napari_viewer = Viewer()
napari_viewer.add_image(image_2D, scale=voxel_size_image_2D, name='image_2D')
napari_viewer.add_image(image_3D, scale=voxel_size_image_3D, name='image_3D')

# %%
# Napari GUI: Change the axes order using the corresponding button.
# Napari GUI: Use the 3D viewer button to render the image in 3D.

# %%
Expand All @@ -71,3 +69,21 @@

# %%
# Open the above file in FIJI and verify image scales were properly saved.

# %%
# Measure the length of the nucleus (as exercise)
# Napari GUI: use the `New points layer button` to create a new points layer.
# Napari GUI: use `Add points` to add two points along the longest axis

# %%
# points = napari_viewer.layers['Points'].data
# scale = napari_viewer.layers['Points'].scale
# points_cal = points * scale
# print("Points :\n", points)
# print("Calibrated points :\n", points_cal)

# %%
# diff_vector = points_cal[1] - points_cal[0]
# sqr_diff_vector = diff_vector ** 2
# distance = np.sqrt(sqr_diff_vector.sum())
# print('Distance:', distance)

0 comments on commit 0c3dbf9

Please sign in to comment.