LoslegenKostenlos loslegen

Create a mask

Masks are the primary method for removing or selecting specific parts of an image. They are binary arrays that indicate whether a value should be included in an analysis. Typically, masks are created by applying one or more logical operations to an image.

For this exercise, try to use a simple intensity threshold to differentiate between skin and bone in the hand radiograph. (im has been equalized to utilize the whole intensity range.)

Below is the histogram of im colored by the segments we will plot.

Histogram of equalized foot x-ray

Diese Übung ist Teil des Kurses

Biomedical Image Analysis in Python

Kurs anzeigen

Anleitung zur Übung

  • Create a bone mask by selecting pixels with intensities greater than or equal to 145.
  • Create a skin mask by selecting pixels with intensities greater than or equal to 45 and less than 145.
  • Plot the skin and bone masks in grayscale.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Create skin and bone masks
mask_bone = ____
mask_skin = ____

# Plot the skin (0) and bone (1) masks
fig, axes = plt.subplots(1,2)
axes[0].imshow(____)
axes[1].imshow(____)
format_and_render_plot()
Code bearbeiten und ausführen