Morning: Introduction to Python and Jupyter notebooks¶
Lecture by Chris.
Afternoon: Image processing concepts with Python¶
During this part, teaching will be done by live coding (inspired by The Carpentries).
This means the trainer will write and explain computer code, while participants write along, such that they can immediately experience how the code works.
Requirements¶
We’ll make sure you’re already set up during the morning session. Below, for reference, you can find what you need for the afternoon session.
JupyterLab and Conda installed on your machine
A jlab environment
conda create -n jlab jupyterlab nb_conda_kernels(nb_conda_kernels allows JupyterLab to connect to other environments)
A dedicated image processing environment
conda create -n 2026_image_processing -c conda-forge scikit-image scipy seaborn matplotlib tifffile numpy imageio pandas openpyxl ipykernel nbformat(Here, ipykernel is required for the environment to be visible in JupyterLab, nbformat is required to run one notebook from inside another notebook, openpyxl allows panda reading/writing excel files.)
Example images
Copy the
images/folder fromday_1/image_processing/imagesto your local Jupyter notebook folder.
Starting JupyterLab¶
open a terminal
(on macOS/Linux: your regular terminal)
(on Windows: use the Anaconda Prompt)
navigate to the directory with your scripts using
cdmacOS/Linux:
cd /path/to/your/scripts/,Windows:
cd C:\path\to\your\scripts(add
/dif the folder is on another drive, e.g.cd /d D:\scripts)
use the commands
conda activate jlabjupyter-lab.
Content overview¶
There are three ±1 hour sessions this afternoon, with breaks in between. Topics that will be covered are:
Part 1/3 (75 min)
Implement global and local thresholding to segment objects (with the histogram as important tool)
Understand what a convolutional image operation is, understand what the effect of a kernel is, and why to apply it.
Conceptually understand morphology operations (dilation, erosion, skeletonization)
Apply common filters (Gaussian, median, variance) and explain when each is appropriate
Part 2/3 (60 min)
Understand when background processing and correction is important.
Understand and use masks, labels and regions (connected components) to analyze ROIs in the image.
Perform measurements on the segmentations
Part 3/3 (60 min)
Build a simple segmentation workflow combining multiple steps
Evaluate segmentation quality through visual inspection
Imaging data¶
Some example data used in this workshop come from one of the following papers:
The paper Chavez-Abiega et al. presents an image analysis pipeline to analyze KTR signals from single cells (and uses it to study kinase behavior). We’ll use their data, and try to reproduce part of that analysis.
The paper by Wehrens et al. quantifies how stressed E. coli become oddly long shaped, and moreover how, after stress receeded, they recover their familiar rod-shaped sizes.
Other images are generated by the authors unless stated otherwise.
Additional resources¶
Bioimage notebooks:
Scipy and skimage documentation
- Chavez-Abiega, S., Grönloh, M. L. B., Gadella, T. W. J., Bruggeman, F. J., & Goedhart, J. (2022). Single-cell imaging of ERK and Akt activation dynamics and heterogeneity induced by G-protein-coupled receptors. Journal of Cell Science, 135(6). 10.1242/jcs.259685
- Wehrens, M., Ershov, D., Rozendaal, R., Walker, N., Schultz, D., Kishony, R., Levin, P. A., & Tans, S. J. (2018). Size Laws and Division Ring Dynamics in Filamentous Escherichia coli cells. Current Biology, 28(6), 972-979.e5. 10.1016/j.cub.2018.02.006