/Microorganism-Computer-Vision

Computer Vision ๐Ÿฆ  - Analysis of the motion of microorganisms in petri dishes

Primary LanguagePythonApache License 2.0Apache-2.0

Microorganism Computer Vision ๐Ÿงซ

License: Apache 2.0 Python 3.11.5+

A comprehensive computer vision pipeline for analyzing microorganism ๐Ÿฆ  motility patterns and diffusion characteristics.

Deadline: 28th February 2025

๐ŸŒŸ Features

  • Multi-modal Tracking
    • Optical flow-based motion estimation
    • Kalman-filter enhanced object detection
    • Synthetic trajectory generation
  • Advanced Diffusion Analysis
    • 6 statistical hypothesis tests for motility patterns
    • Automated trajectory classification
    • Comprehensive visualization toolkit
  • Scalable Architecture
    • Modular pipeline design
    • Configurable hypothesis parameters
    • Batch processing capabilities

๐Ÿงฉ Diffusion Hypothesis Tests

Our framework implements sophisticated statistical tests to characterize microbial motion:

Hypothesis Test Key Mechanism Biological Relevance
Circular Motion
CircularMotionTest
Curvature analysis + rotation angle detection Magnetotactic bacteria, spiral-seeking organisms
Directional Switching
DirectionalSwitchTest
Fourier analysis of angular changes Run-and-tumble motility (e.g., E. coli)
Gaussian Random Walk
GaussianRandomWalkTest
Kolmogorov-Smirnov normality test Passive diffusion in isotropic environments
MSD Linear Fit
MSDLinearTest
Rยฒ evaluation of mean squared displacement Normal diffusion processes
Persistent Motion
PersistentMotionTest
Velocity autocorrelation analysis Active transport mechanisms
Subdiffusion
SubDiffusionTest
Power law exponent ($\alpha < 1$) detection Crowded environments, viscoelastic media

๐Ÿš€ Installation

# Clone repository
git clone git@github.com:Ophiase/Microorganism-Computer-Vision.git
cd Microorganism-Computer-Vision

# Install dependencies
make pip

# Download sample dataset
make extract

๐Ÿงช Usage

Process real videos:

# Full pipeline execution
make transform      # Preprocess videos
make detection      # Track microorganisms
make render         # Generate gifs
make analysis       # Run statistical tests and graphics

Generate synthetic data:

make synthetic      # Create trajectory datasets
python3 -m script.main --task analysis --video synthetic_brownian
# "brownian" can be replaced by directed, sinusoidal, confined, ctrw, ...

Key Makefile Targets:

detection     # Track objects in videos
render        # Generate trajectory visualizations
analysis      # Perform statistical testing
synthetic     # Generate synthetic trajectories

๐Ÿ“Š Results Interpretation

๐Ÿ“‚ Data Structure

microorganism-cv/
โ”œโ”€โ”€ data/                           # Raw and processed data
โ”‚   โ”œโ”€โ”€ preprocessed/               # Normalized video tensors
โ”‚   โ””โ”€โ”€ tracking/                   # Trajectory datasets
โ”œโ”€โ”€ logic/                          # Core algorithms
โ”‚   โ”œโ”€โ”€ diffusion/                  # Statistical tests
โ”‚   โ”œโ”€โ”€ filters/                    # Image processing
โ”‚   โ””โ”€โ”€ structure/                  # Data models
โ”œโ”€โ”€ script/                         # Pipeline components
โ””โ”€โ”€ visualization/                  # Plotting utilities

๐Ÿ“š Methodology

Our pipeline implements a multi-stage analysis process:

Preprocessing

  • Optical flow estimation
  • Spatial normalization
  • Noise reduction

Object Detection

  • Adaptive thresholding (โŒ not implemented)
  • Connected component analysis
  • Kalman-filter based tracking

Trajectory Analysis

  • MSD calculations
  • Velocity autocorrelation
  • Directional persistence metrics

Statistical Classification

  • Hypothesis testing
  • Confidence interval estimation (โŒ not implemented)
  • Motility pattern classification