Skip to main content

Multi-Scale Ridge Detector

If you find this project useful, please consider giving it a star so that more people can discover and benefit from it!

Overview

This repository contains the Python implementation of a multi-scale ridge detector designed for identifying and measuring curvilinear structures in images across various fields including medical imaging and remote sensing. For more detailed information, please refer to the following literature:

[1] Steger, Carsten. "An unbiased detector of curvilinear structures." IEEE Transactions on Pattern Analysis and Machine Intelligence, 20(2), pp. 113-125, 1998.

[2] Lindeberg, Tony. "Edge detection and ridge detection with automatic scale selection." International Journal of Computer Vision, 30, pp. 117-156, 1998.

[3] Sato, Yoshinobu, et. al. "Three-dimensional multi-scale line filter for segmentation and visualization of curvilinear structures in medical images." Medical Image Analysis, 2(2), pp. 143-168, 1998.

This Python implementation offers a multi-scale adaptation of the ImageJ ridge detection plugin. The detection is more accuracy compared to the ImageJ plugin (in almost all cases we have tested :)) and faster than another Python implementation ridge-detection.

Installation

Prerequisites

  • Python 3.9 or higher
  • Opencv & scikit-image

Install via pip:

pip install ridge-detector

or

 pip install git+https://github.com/lxfhfut/ridge-detector.git

Usage:

from ridge_detector import RidgeDetector
det = RidgeDetector(line_widths=[1, 2, 3],  # Line widths to detect (default: [1, 2])
                    low_contrast=100,  # Lower bound of intensity contrast (default: 100)
                    high_contrast=200,  # Higher bound of intensity contrast (default: 200)
                    min_len=5, # Ignore ridges shorter than this length (default: 5)
                    max_len=0, # Ignore ridges longer than this length, set to 0 for no limit (default: 0)
                    dark_line=True, # Set to True if detecting black ridges in white background, False otherwise (default: True)
                    estimate_width=True, # Estimate width for each detected ridge point (default: True)
                    extend_line=False, # Tend to preserve ridges near junctions if set to True (default: False)
                    correct_pos=False,  # Correct ridge positions with asymmetric widths if set to True (default: False)
                    )
det.detect_lines("path_to_image_or_image_data_in_numpy_array")
det.show_results()
det.save_results("directory_to_store_results")  # Save the detection results to the specified directory

Demonstrations

Original Ridges & Widths Binary Ridges Binary Widths

Metadata

Release files for ridge-detector 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ridge-detector 0.1.4
File Size Uploaded
ridge_detector-0.1.4.tar.gz 44.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ridge-detector 0.1.4
File Interpreter ABI Platform
ridge_detector-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 87.1 kB

Release files / ridge_detector-0.1.4.tar.gz

Download URL ridge_detector-0.1.4.tar.gz
Size 44.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f72c47bc456cd0df1777219bd7193bd65868143858882abda1356b9afb0df7bb
BLAKE2b-256 checksum
How to use checksums
b56dbc93e561e4fb83a2e12ca0b0de59105b3ee0eaf88a90871361c057bff0ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / ridge_detector-0.1.4-py3-none-any.whl

Download URL ridge_detector-0.1.4-py3-none-any.whl
Size 43.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
596af9a107d5cb3eccd237cbccb100fcc8476e4e41ef276be5d35b582061f984
BLAKE2b-256 checksum
How to use checksums
b1b4c978db1c99aab0cf78beb83f92ab7bbf8528b96e1e902e09590f9e9475ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page