Skip to main content

A package for tree disk rings detection in images

Project description

Tree Disk Rings

PyPI - Version

A Python package for analyzing tree rings in cross-sectional images. Originally forked from hmarichal93/cstrd_ipol.

Installation

pip install tree-disk-rings

Usage

Python API

import treediskrings

# Configure the analyzer
treediskrings.configure(
    input_image="input/tree-disk4.png",
    cx=1204,
    cy=1264,
    save_results=True,
)

# Run the analysis
(
    img_in,          # Original input image
    img_pre,         # Preprocessed image
    devernay_edges,  # Detected edges
    devernay_curves_f,  # Filtered curves
    devernay_curves_s,  # Smoothed curves
    devernay_curves_c,  # Connected curves
    devernay_curves_p,  # Final processed curves
) = treediskrings.run()

Command Line Interface (CLI)

Basic usage:

tree-disk-rings --input_image input/tree-disk4.png --cx 1204 --cy 1264

Save intermediate results:

tree-disk-rings --input_image input/tree-disk4.png --cx 1204 --cy 1264 --save_results

Advanced usage with custom parameters:

tree-disk-rings \
    --input_image input/F02c.png \
    --cx 1204 \
    --cy 1264 \
    --output_dir custom_output/ \
    --sigma 4.0 \
    --th_low 10 \
    --th_high 25 \
    --min_chain_length 2 \
    --save_results \
    --debug

CLI Arguments

Argument Type Required Default Description
--input_image str Yes - Path to input image
--cx int Yes - Pith x-coordinate
--cy int Yes - Pith y-coordinate
--output_dir str No ./output Output directory path
--sigma float No 3.0 Gaussian kernel parameter for edge detection
--th_low float No 5.0 Low threshold for gradient magnitude
--th_high float No 20.0 High threshold for gradient magnitude
--height int No 0 Height after resizing (0 to keep original)
--width int No 0 Width after resizing (0 to keep original)
--alpha float No 30.0 Collinearity threshold in degrees. Defines the maximum allowable angle between an edge's direction and its gradient.
--nr int No 360 Number of rays
--min_chain_length int No 2 Minimum chain length
--debug flag No False Enable debug mode
--save_results flag No False Save intermediate images, labelme and config file

Development

Setting up Development Environment

  1. Create and activate virtual environment:
poetry config virtualenvs.in-project true
poetry env use python
poetry install
eval $(poetry env activate)
  1. Running tests:
pytest
  1. Compile the external C code:
cd ./externals/devernay_1.0 && make clean && make

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

tree_disk_rings-0.6.1.tar.gz (92.2 kB view details)

Uploaded Source

Built Distribution

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

tree_disk_rings-0.6.1-py3-none-any.whl (105.6 kB view details)

Uploaded Python 3

File details

Details for the file tree_disk_rings-0.6.1.tar.gz.

File metadata

  • Download URL: tree_disk_rings-0.6.1.tar.gz
  • Upload date:
  • Size: 92.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tree_disk_rings-0.6.1.tar.gz
Algorithm Hash digest
SHA256 e438cef838f7bf6b05cb056fd3c4e419cb2606b1cd4f8da06e26bdcaa52169b7
MD5 2d0f86f656e921d1dd1190041e09587b
BLAKE2b-256 cfef65baee35e26ab60d46c36e5d6621f91085e12b651bc50208ca45f545bd3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_disk_rings-0.6.1.tar.gz:

Publisher: publish_rings.yml on tuke307/tree-disk-analyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_disk_rings-0.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tree_disk_rings-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b599fb34350bc51287484748a1fb89b3b7fd134bb441a6f3a98549f029e0c1b2
MD5 187e1febaf92c8b400089bc60a97f86b
BLAKE2b-256 5f6891716a13a54f64c7d6b4377125f98b1ce1d9f9142dfcac8f20e62b6be0f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_disk_rings-0.6.1-py3-none-any.whl:

Publisher: publish_rings.yml on tuke307/tree-disk-analyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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