Skip to content

Repository files navigation

Cell Imaging Analysis Tool

A Python desktop application for analyzing live-cell microscopy videos, from cell segmentation and tracking to fluorescence measurements and interaction analysis.

I built this tool during my software engineering internship to make it easier for researchers to turn microscopy videos into structured quantitative data.

Instead of manually inspecting frames and recording measurements, the application processes the video and produces per-cell measurements that can be exported for further analysis.

What It Does

The application provides a multi-tab interface for:

  • Loading microscopy videos
  • Detecting individual cells
  • Tracking cells across frames
  • Measuring fluorescence intensity
  • Detecting cell-cell interactions
  • Exporting analysis results

The workflow looks roughly like this:

Microscopy Video
       |
       v
Image Preprocessing
       |
       v
Cell Segmentation
       |
       v
Cell Detection
       |
       v
Cell Tracking
       |
       +------> Fluorescence Analysis
       |
       +------> Interaction Detection
       |
       v
Structured CSV Output

Cell Segmentation

Cell detection uses the Cellpose deep learning segmentation model rather than relying entirely on traditional thresholding or watershed methods.

The application primarily uses the Cellpose cyto model, with cyto2 available as a fallback.

OpenCV preprocessing is applied before segmentation to improve the consistency of the input images. This includes CLAHE contrast enhancement to reduce problems caused by uneven illumination.

Optional GPU acceleration is available through CUDA.

Cell Tracking

After cells are detected in each frame, the application tracks them over time using centroid-based matching.

For each detection, the centroid is calculated and compared with detections from the previous frame.

A configurable tracking range determines whether a detection is close enough to continue an existing track.

Frame N                    Frame N+1

   Cell A  ----------------> Cell A
     |                         |
   centroid                  centroid

   Cell B  ----------------> Cell B
     |                         |
   centroid                  centroid

If a detection cannot be matched to an existing track, a new track is created.

This provides a simple way to follow individual cells throughout the video without requiring a much more complicated tracking framework.

Fluorescence Analysis

For every detected cell, the application calculates intensity statistics from the original image rather than the contrast-enhanced version used during preprocessing.

For each cell, the tool records:

  • Mean intensity
  • Maximum intensity
  • Minimum intensity
  • Standard deviation
  • Cell location
  • Frame number
  • Track identifier

Using the original image for these measurements is important because preprocessing can change the underlying intensity values.

Interaction Detection

The application can also analyze spatial relationships between tracked cells to identify potential cell-cell interactions.

Because the cells are already represented as tracked objects with spatial coordinates, interaction analysis can operate on the tracking output rather than repeatedly processing the raw image.

Desktop Application

The interface was built with PyQt5 and organized into separate analysis modules.

Long-running processing tasks are handled in Qt worker threads so that video analysis does not freeze the application interface.

The application uses:

  • QThreadPool
  • QRunnable
  • pyqtSignal
  • Qt signal/slot communication

This allows computationally expensive detection and tracking tasks to run in the background while the researcher continues interacting with the application.

Why Cellpose?

Traditional segmentation approaches such as thresholding and watershed can work well for simple images but become more difficult when cells touch, have irregular shapes, or appear under uneven illumination.

Cellpose provides a more general segmentation approach based on a trained neural network, making it better suited to a tool that needs to work across different microscopy conditions without requiring every experiment to be manually tuned.

Tech Stack

  • Python
  • PyQt5
  • Cellpose
  • OpenCV
  • scikit-image
  • NumPy
  • CUDA
  • CSV

Architecture

The application separates the major stages of the analysis pipeline so that image processing, segmentation, tracking, analysis, and export can be developed independently.

PyQt5 Interface
      |
      +---- Video Processing
      |
      +---- Cell Detection
      |          |
      |          v
      |       Cellpose
      |
      +---- Cell Tracking
      |
      +---- Intensity Analysis
      |
      +---- Interaction Detection
      |
      +---- Data Export

Background processing is handled through Qt's thread pool, with signals used to safely send results and status updates back to the interface.

What I Learned

This project was a good introduction to the gap between an ML model and an actual application.

Getting Cellpose to segment an image is one problem. Building a tool around that output that can track cells, calculate useful measurements, keep the interface responsive, and produce data that researchers can actually use is a much larger engineering problem.

It also gave me hands-on experience with computer vision, scientific image processing, desktop application development, and running ML workloads in a practical research workflow.

About

Desktop computer vision application for segmenting, tracking, and analyzing cells in microscopy videos with Cellpose and OpenCV.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages