This repository contains the code for a Cellpose-SAM & pyLMD project dedicated to automating cell boundary and reference point detection in microscopic images used for Laser Capture Microdissection (LMD).
The primary function of this repository is to identify the boundaries of target cells and detect precise reference points from laser engraved 'T' structures and is designed to enhance the reproducibility of the LMD workflow.
-
Fiducial Marking
Burn fiducial T-marks into tissue sections using LMD laser. -
Image Acquisition
Acquire fluorescence microscopy images. -
Segmentation (Computational part 1)
Perform Cellpose-SAM segmentation to delineate cell boundaries. -
Filtering (Computational part 1)
Apply intensity and overlap filtering to refine segmentation results. -
Fiducial Detection (Computational part 2)
Detect fiducials via FFT-based template matching. -
Data Export (Computational part 2)
Determine and export contours and coordinates via pyLMD as XML. -
Software Integration
Import XML into Leica LMD software. -
Alignment & Excision
Align fiducials and perform precise laser excision. -
Validation
Validate excision results microscopically.
This project exclusively uses the Pixi package manager to guarantee a reliable and isolated Python environment. Install Instructions
-
Clone the repository:
git clone https://github.com/Immunodynamics-Engel-Lab/lmd-imageanalysis.git cd lmd-imageanalysis -
Initialize the Pixi Environment:
Pixi reads the required dependencies from the
pixi.tomlfile and creates a ready-to-use virtual environment.pixi install
The analysis pipeline is contained in the lmd_nb.py script. This file is a Jupyter Notebook utilizing the Jupytext percent format, which allows it to be edited easily in any text editor while preserving its executable notebook structure.
Before running the pipeline, you must configure the parameters and channel mapping within the lmd_nb.py script:
- Channel Configuration: The fluorescence channel assignments must be set to match your input image data.
- Default Setup: The notebook is currently defaulted to: Marker (Ch 0), Autofluorescence (Ch 1), and DAPI (Ch 2). Adjust these channel indices (0-indexed) at the beginning of
lmd_nb.pyas needed.
- Default Setup: The notebook is currently defaulted to: Marker (Ch 0), Autofluorescence (Ch 1), and DAPI (Ch 2). Adjust these channel indices (0-indexed) at the beginning of
- Parameter Adjustment: Parameters for specific processing steps can be adjusted directly before their corresponding notebook cells in
lmd_nb.py.
Once configured, execute the pipeline using the following command:
pixi run python lmd_nb.pyExample data for testing the in silico workflow is available on Zenodo
The workflow is available through Zenodo and WorkflowHub
All resources are publicly accessible and distributed under open licenses where applicable.
Prof. Dr. Daniel R. Engel: Department of Immunodynamics, Institute of Experimental Immunology and Imaging, University Hospital Essen, Essen, Germany