import numpy as np
from skimage.io import imread
from skimage.measure import label
import stackview
import matplotlib.pyplot as plt
The imshow
function serves showing images, similar to matplotlib.pyplot.imshow, just with a little more convenience.
image = imread("data/blobs.tif")
stackview.imshow(image)
You can also activate axes descriptions and a colorbar to better read the values.
stackview.imshow(image, axes=True, colorbar=True)
If you work with colormaps, also pure_...
colormaps introduced in microfilm work.
stackview.imshow(image, axes=True, colorbar=True, colormap='pure_magenta')
Label images are automatically shown with a coloured visualization:
binary = image > 128
labels = label(binary)
stackview.imshow(labels)
You can also overlay images by setting continue_drawing=True
and showing another image using a given alpha
value:
stackview.imshow(image, continue_drawing=True)
stackview.imshow(labels, alpha=0.4)
This might be especially useful when combinging sub-plots using matplotlib.
fig, axs = plt.subplots(1, 3, figsize=(15,15))
stackview.imshow(image, plot=axs[0], title='image', axes=True)
stackview.imshow(labels, plot=axs[1], title='labels')
stackview.imshow(image, plot=axs[2], continue_drawing=True)
stackview.imshow(labels, plot=axs[2], alpha=0.4, title='image + labels')