Skip to content

LaboratoryOpticsBiosciences/THG-segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

THG Image Processing Pipeline

This repository contains code for an image processing pipeline used for analyzing THG (Third Harmonic Generation) microscopy data, as described in our paper [to be added].

Repository Structure

THG-segmentation/
├──data/
├──src/
│   ├── preprocessing.py
│   ├── segmentation.py
│   └── clustering.py
├── .gitignore
├── README.md
├── requirements.txt
└── run_pipeline.py

Installation

  1. Clone the repository:

    git clone https://github.com/LaboratoryOpticsBiosciences/THG-segmentation.git
    cd THG-segmentation
    
  2. Install the required packages:

    pip install -r requirements.txt
    

Usage

Running the Full Pipeline

To run the complete pipeline with all steps:

python run_pipeline.py --input_dir ./data --output_dir ./processed_data --steps preprocess segment cluster

Running Individual Steps

You can run individual steps of the pipeline:

python run_pipeline.py --steps preprocess / segment / cluster

Preprocessing Parameters

The preprocessing step includes several parameters that can be adjusted:

  • --radius: Radius for outlier removal (default: 2)
  • --threshold: Threshold for outlier removal (default: 70)
  • --wradius: Radius ratio for white tophat (default: 0.05, as fraction of image size)
  • --threshold_percentage: Threshold percentage for inpainting (default: 0.999)
  • --use_clahe: Enable CLAHE enhancement (disabled by default)

Example:

python run_pipeline.py --steps preprocess --radius 3 --threshold 65 --wradius 0.06

Dataset

The THG microscopy dataset contains four categories:

  • DIV8_Control (Myelinated)
  • DIV8_LPC (Demyelinated)
  • DIV11_Control (Myelinated)
  • DIV11_LPC (Remyelinated)

Due to the large size of the dataset, it is not included in this repository. Please contact the authors for access to the full dataset.

Pipeline Steps

  1. Preprocessing:

    • Inpainting to remove bright spots
    • White tophat transform to enhance small bright features
    • Outlier removal using a median filter
  2. Segmentation:

    • Hessian eigenvalue-based segmentation to detect fiber-like structures
    • Meijering ridge detection for enhancing neurite structures
    • Small object removal to clean up the segmentation
  3. K-means Clustering:

    • Feature extraction from segmented regions
    • K-means clustering on morphological features
    • Interactive cluster selection to remove outliers
    • Final image reconstruction based on selected clusters

Citation

If you use this code in your research, please cite our paper:

[Citation information will be added]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published