Intensity
In this chapter, we will work with a hand radiograph from a 2017 Radiological Society of North America competition. X-ray absorption is highest in dense tissue such as bone, so the resulting intensities should be high. Consequently, images like this can be used to predict "bone age" in children.
To start, let's load the image and check its intensity range.
The image datatype determines the range of possible intensities: e.g., 8-bit unsigned integers (uint8
) can take values in the range of 0 to 255. A colorbar can be helpful for connecting these values to the visualized image.
All exercises in this chapter have the following imports:
import imageio
import numpy as np
import matplotlib.pyplot as plt
Diese Übung ist Teil des Kurses
Biomedical Image Analysis in Python
Anleitung zur Übung
- Load the image "hand-xray.jpg" using
imageio
. - Print the image's data type (
dtype
), minimum (min()
) and maximum intensity (max()
). - Plot the image using
plt.imshow()
. Explicitly set the colormap's minimum (0
) and maximum (255
) values using thevmin
andvmax
arguments. - Add a colorbar using
plt.colorbar()
, then render the plot using the custom functionformat_and_render_plot()
. This has been done for you.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Load the hand radiograph
im = ____
print('Data type:', ____)
print('Min. value:', ____)
print('Max value:', ____)
# Plot the grayscale image
____
plt.colorbar()
format_and_render_plot()