Skip to main content

A comprehensive Python pipeline for detecting, quantifying, and analyzing FISH (Fluorescence In Situ Hybridization) spots in 3D microscopy images using deep learning and chromatic aberration correction.

Project description

Documentation Status

FISH-Dist: Automated 3D Distance Quantification for Confocal FISH Images

FISH-Dist is a Python pipeline for detecting and quantifying FISH (Fluorescence In Situ Hybridization) probes in 3D confocal microscopy images. It is designed for distance measurements between pairs of fluorescent signals across imaging channels.

Overview

FISH-Dist provides:

  • 3D nuclei segmentation (deep learning)
  • FISH spot segmentation (deep learning)
  • Sub-pixel spot localization (3D Gaussian fitting)
  • Spot pairing across channels
  • Chromatic aberration correction (linear/affine)
  • Pairwise inter-spot distance measurements
  • Result visualization and reporting

Install Conda

FISH-Dist requires Conda. If you don’t have it installed:

Download and install Miniconda (lightweight) or Anaconda (full package) from:

💡 Tip: Miniconda is usually faster and smaller; you can always install extra packages later.

Opening the Command Line

FISH-Dist runs from a command-line interface (CLI). The steps to open the terminal depend on your operating system:

Operating System How to open the command line
Windows Press Win + R, type cmd, and hit Enter.
Or search for Command Prompt in the Start menu.
If you installed Anaconda/Miniconda, you can also use Anaconda Prompt.
MacOS Press Cmd + Space, type Terminal, and hit Enter.
Or navigate to Applications → Utilities → Terminal.
Linux Press Ctrl + Alt + T (works in most distributions).
Or search for Terminal in your applications menu.

Verify Conda Installation

After installing Conda, open a terminal (see Opening the Command Line instructions above) and type:

conda --version

You should see something like:

conda 24.10.0

If the command returns command not found, you need to install Conda first.

Installation / Setup (one-time)

In your command line, type the following commands:

# Create and activate the FISH-Dist environment
conda create -y -n FISH_Dist python==3.10.12
conda activate FISH_Dist

# Upgrade pip and install FISH-Dist
pip install --upgrade pip
pip install fishdist

Required Folder Structure

    FISH_Dist_analysis/
    ├── colocs/        
    ├── controls/      
    └── distances/     
Folder Description
colocs/ Colocalization images for computing chromatic aberration.
controls/ Stores registration matrices (.npy) from colocs/.
distances/ Images for measuring distances between genomic loci.

Note: Correction matrices can be reused across multiple datasets acquired under identical microscope settings, provided they are collected within a short time frame to ensure consistent chromatic aberrations.

Example workflow

FISH-Dist operates in two sequential phases. Understanding this order is essential for correct results.

Step 1 — Chromatic aberration correction

  • Acquire colocalization images:

    • 1 nuclear channel
    • 2 (or more) FISH channels targeting the same genomic locus
  • Place images in colocs/.

  • Run the analysis:

conda activate FISH_Dist
python -m fishdist --root-path /path/to/FISH_Dist_analysis
  • Store generated .npy matrices in controls/.

Note: Step 1 only needs to be performed once per microscope setup and imaging configuration, as long as chromatic aberrations remain stable.

Step 2 — Distance Measurement

  • Acquire distance-measurement images:

    • Use the same microscope and imaging settings as for colocalization

    • Acquire images shortly after the colocalization experiment to ensure stable chromatic aberrations

    • Images should contain FISH probes targeting distinct genomic loci

  • Ensure appropriate .npy matrices are in controls/.

  • Place distance images in distances/.

  • Run FISH-Dist:

conda activate FISH_Dist
python -m fishdist --root-path FISH_Dist_analysis
  • Outputs:

    • Processed images → distances/DONE/
    • Distance tables, plots, and reports
  • Quality Control:

    • Verify consistency between affine and linear corrections
    • If inconsistent, repeat Step 1 with newly acquired colocalization images.

Summary

Colocalization images → colocs/ → Correction (.npy)
                                     ↓
                                 controls/
                                     ↓
Distance images → distances/ → Distance measurements → Check for consistency

Default Channel Convention

By default, FISH-Dist assumes the following channel layout in 3D confocal microscopy images:

Channel Purpose
0 Nucleus (used for nuclear segmentation)
1 Reference FISH channel (channel used for aligning all other channels to)
2 Second FISH channel (used for colocalization with the reference channel or for distance measurements)

Note:
If your datasets follow this channel order and you use the same channel configuration for both colocalization and distance measurements, no configuration file is required. You can run the pipeline using only the command-line interface.

Configuration File (Optional)

By default, FISH-Dist follows the Default Channel Convention; if your data follow this channel order and you are not modifying any parameters, no configuration file is required.

When is a configuration file required?

A JSON configuration file becomes necessary if you want to:

  • Use a different channel order
  • Analyze more than two FISH channels
  • Change thresholds or analysis parameters
  • Use custom segmentation models
  • Enable or disable specific pipeline steps
  • Re-run only part of the pipeline (e.g. skip registration or Gaussian fitting)

For a full description of all available parameters and advanced examples, see 👉 Advanced settings (configuration file)

Uninstall

To completely remove the FISH_Dist environment and all its dependencies, run:

conda remove --name FISH_Dist --all

Citation

If you use this FISH-Dist, please cite the associated manuscript. TODO.

License

This project is licensed under the BSD 3-Clause License - see the LICENSE.txt file for details.

3rd Party Licenses

⚠️ IMPORTANT: If you disagree with any of the licenses below, uninstall FISH-Dist. Review all licenses of third-party dependencies.

Library name Use Link License
tensorflow Deep learning library https://pypi.org/project/tensorflow/ Apache 2.0
segmentation-models Models https://pypi.org/project/segmentation-models/ MIT
matplotlib Plots images and graphs https://pypi.org/project/matplotlib/ PSF
numpy Array/Image computing https://pypi.org/project/numpy/ BSD
scikit-image Image processing https://pypi.org/project/scikit-image/ BSD (Modified BSD)
scipy Great library to work with numpy arrays https://pypi.org/project/scipy/ BSD
pandas Data analysis toolkit https://pypi.org/project/pandas/ BSD (BSD-3-Clause)
BAtoolset Compilation of functions I find useful https://github.com/baigouy/BAtoolset BSD-2-Clause license
EPySeg A deep learning and image processing package for segmentation and analysis https://github.com/baigouy/EPySeg BSD
affine_matrix_from_points C. Gohlke code to calculate the affine transform between two sets of points https://github.com/cgohlke/transformations/blob/deb1a195dab70f0f36365a104f9b70505e37b473/transformations/transformations.py#L920 BSD 3-Clause

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fishdist-0.0.9.tar.gz (64.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fishdist-0.0.9-py3-none-any.whl (66.8 kB view details)

Uploaded Python 3

File details

Details for the file fishdist-0.0.9.tar.gz.

File metadata

  • Download URL: fishdist-0.0.9.tar.gz
  • Upload date:
  • Size: 64.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for fishdist-0.0.9.tar.gz
Algorithm Hash digest
SHA256 03cf968317f2a96e5581c24e280c8ce458492d287e2042b2005ff246127c007e
MD5 3c1aeb94b9dc09736b50b66247b599a8
BLAKE2b-256 5cb9b7b8ffc6cb9057299c731d8fc9bf89887b2768c2df4aef72fdfd04683699

See more details on using hashes here.

File details

Details for the file fishdist-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: fishdist-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 66.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for fishdist-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 657447ecb65068d0a308a01d4993eb965496c8f25edd8a694036c3b2de70a55f
MD5 1c06081381517429b1b92d332a1dfa91
BLAKE2b-256 8fd142b43f722eac909c9fe50fcce31c2aaa174407f8f0f79e3d7356cf0046b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page