Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify 3-D distance measurement #701

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion _includes/datatypes/inspect_12bit_saturation.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h4 id="saturation_12bit"><a href="#saturation_12bit">Find saturated pixels in an 12-bit image</a></h4>
<h4 id="saturation_12bit"><a href="#saturation_12bit">Inspect a 12-bit image</a></h4>

Saturation, i.e. pixel value at the upper end of the datatype, is a typical problem in fluorescence microscopy images.

Expand Down
2 changes: 1 addition & 1 deletion _includes/datatypes/inspect_8bit_saturation.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h4 id="saturation_8bit"><a href="#saturation_8bit">Find saturated pixels in an 8-bit image</a></h4>
<h4 id="saturation_8bit"><a href="#saturation_8bit">Inspect an 8-bit image</a></h4>

Saturation, i.e. pixel value at the upper end of the datatype, is a typical problem in fluorescence microscopy images.

Expand Down
5 changes: 3 additions & 2 deletions _includes/pixels/pixels_act1_skimage_napari.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@
print(image.min(), image.max())

# %%
# Compute the image histogram
# Compute and show the image histogram
import matplotlib.pyplot as plt
import numpy as np
plt.hist(image.flatten(), bins=np.arange(image.min(), image.max() + 1));
plt.hist(image.flatten(), bins=np.arange(image.min(), image.max() + 1))
plt.show() # instead, we could end the above line with ";"

# %%
# Napari:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,8 @@
print("Calibrated points:\n", points_cal)

# %%
# Compute distance between points in voxel indices
# - Pythagoras: sqrt( (z1-z0)^2 + (y1-y0)^2 + (x1-x0)^2 )
diff_vector = points_cal[1] - points_cal[0]
print("diff_vector:", diff_vector)

# %%
sqr_diff_vector = diff_vector**2
print("sqr_diff_vector:", sqr_diff_vector)

# %%
distance = np.sqrt(sqr_diff_vector.sum())
print("distance:", distance)
# Compute the distance between the first and second point
print("First point:" , points_cal[0])
print("Second point:" , points_cal[1])
from scipy.spatial import distance
distance.euclidean(points_cal[0], points_cal[1])
Loading