A MATLAB-based toolkit for processing, aligning, and analyzing lymph node tissue sections from multi-stack microscopy images. This repository provides tools for image alignment, segmentation, and morphological analysis of lymph node structures including lobules and vasculature.
This project facilitates the reconstruction and analysis of lymph node tissue by:
- Aligning multiple image stacks of lymph node sections
- Segmenting tissue structures using advanced thresholding techniques
- Detecting and analyzing lobules and vasculature networks
- MATLAB (R2016b or later recommended)
- Image Processing Toolbox (required for image registration and morphological operations)
- Computer Vision Toolbox (required for
imregtformand related functions)
Main alignment script for registering multiple stacks of lymph node sections. This script:
- Loads and processes two image stacks simultaneously
- Allows interactive selection of reference images from each stack
- Performs rigid image registration using multimodal and monomodal optimization
- Applies transformations to align entire stacks based on reference sections
- Saves aligned images with standardized naming conventions
Usage:
- Run the script in MATLAB
- Select all images for the first stack when prompted
- Enter the section number for the reference (fixed) image
- Select all images for the second stack when prompted
- Enter the section number for the moving image
- Trace regions of interest in both reference images for alignment
- Review aligned results and save outputs
Key Features:
- Interactive region-of-interest selection via freehand tracing
- Automatic scaling and transformation application to full-resolution images
- Visual comparison of aligned images before saving
A utility function for performing trinarisation and hysteresis thresholding on 2D and 3D images. This function is inspired by Peter Kovesi's 2D hysteresis implementation and extends it to 3D using MATLAB's imfill function.
Function Signature:
[tri, hys] = hysteresis3d(img, t1, t2, conn)Parameters:
img- Input image (assumed non-negative)t1- Lower threshold value (fraction between 0-1, e.g., 0.1)t2- Upper threshold value (fraction between 0-1, e.g., 0.9)conn- Connectivity (4 or 8 for 2D; 6, 18, or 26 for 3D)
Returns:
tri- Trinarisation image (values: 0, 1, or 2)hys- Hysteresis image (logical mask)
Example:
[tri, hys] = hysteresis3d(img, 0.25, 0.8, 26);Reference:
For an example of hysteresis used in kidney region segmentation, see: QSM of Kidney, NMR Biomed, 2013 Dec;26(12):1853-63
Supplemental material: http://www.civm.duhs.duke.edu/lx201204/
Script for detecting and segmenting lobules in lymph node tissue sections. This script:
- Processes multi-channel images (purple, red, merged channels)
- Uses hysteresis thresholding for initial segmentation
- Applies morphological operations (dilation, erosion) to refine boundaries
- Identifies and visualizes lobule boundaries
Note: This script contains hardcoded file paths and may need modification for your specific image files.
Script for vasculature detection and segmentation in lymph node tissue. This script:
- Processes multi-channel fluorescence images
- Segments vasculature using hysteresis thresholding
- Filters connected components by area
- Applies morphological smoothing operations
- Overlays detected vasculature boundaries on original images
Note: This script contains hardcoded file paths and may need modification for your specific image files.
-
Image Alignment (
Align_LymphNode_MultiStacks.m)- Align multiple image stacks to create a coherent 3D reconstruction
- Ensure proper spatial registration between sections
-
Structure Segmentation
- Use
lobule.mfor lobule detection - Use
vasC.mfor vasculature detection - Both scripts utilize
hysteresis3d.mfor robust thresholding
- Use
-
Analysis
- Process aligned and segmented images for quantitative analysis
- Extract morphological features from detected structures
- File Paths: Some scripts (
lobule.m,vasC.m) contain hardcoded file paths that should be modified to match your data structure - Image Formats: Scripts are designed to work with TIFF images, but can be adapted for other formats
- Memory Considerations: The alignment script loads entire image stacks into memory; ensure sufficient RAM for large datasets
- Interactive Elements: The alignment script requires user interaction for file selection and region tracing
If you use hysteresis3d.m in your research, please cite:
- Xie, L. (2012). Hysteresis3d: 3D hysteresis thresholding for image segmentation.
Related work: QSM of Kidney, NMR Biomed, 2013 Dec;26(12):1853-63
Coming soon.