© 2021 Tom Röschinger. This work is licensed under a Creative Commons Attribution License CC-BY 4.0. All code contained herein is licensed under an MIT license
This notebook is heavily inspired by this lesson by Justin Bois.
# Always good to have this
import os
# For numerical computation
import numpy as np
import pandas as pd
# For plotting
import matplotlib.pyplot as plt
import seaborn as sns
import colorcet as cc
# For image analysis
import skimage.io
import skimage.filters
import skimage.morphology
import skimage.segmentation
import skimage.measure
import scipy.ndimage
# This enables high resolution graphics inline
%config InlineBackend.figure_format = 'retina'
sns.set()
First we need to import the image and load it using skimage
.
file = "../../data/VeroCells-24hSARS-CoV2_i013.tif"
im = skimage.io.imread(file)
We are going to plot a lot of images in this notebook, so let's write a short function that returns an image given a 2D array.
def plot_image(im, cmap=plt.cm.Greys_r, scale=1):
"Returns a image representation of a 2D array"
fig, ax = plt.subplots(figsize=(scale*8, scale*8))
ax.imshow(im, cmap=cmap, aspect=1)
ax.grid(False)
return ax
plot_image(im);