Skip to main content

A package for tree ring 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 \
    --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
--root str No Current dir Root directory of the repository
--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 Edge filtering parameter (collinearity threshold)
--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. Clone the repository:
git clone https://github.com/tuke307/tree-disk-rings.git
cd tree-disk-rings
  1. Create and activate virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install development dependencies:
pip install -r requirements.txt
  1. Install the package in editable mode:
pip install -e .
  1. Compile the external C code:
cd ./externas/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.4.2.tar.gz (55.6 kB view details)

Uploaded Source

Built Distribution

tree_disk_rings-0.4.2-py3-none-any.whl (67.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tree_disk_rings-0.4.2.tar.gz
  • Upload date:
  • Size: 55.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tree_disk_rings-0.4.2.tar.gz
Algorithm Hash digest
SHA256 b9cc5eac8579dc76f43c6f3893f16c0656047fa97ac926ffa236a877833ad0b1
MD5 dee0552dbe43421feb2cb7431c97f3dd
BLAKE2b-256 68485e99910b33e3c51c077f880fdf8e96c3a25845d63765e0966d0511a46187

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on tuke307/tree-disk-rings

Attestations:

File details

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

File metadata

File hashes

Hashes for tree_disk_rings-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 91927f81032257e09372ec576a1089c21f9f38738a8ce517958c4f31bc161801
MD5 7952c4c9fafc05a6b3bf4796bdc9ca88
BLAKE2b-256 e0171d79a516c39acbd0b9799a6e305d876c840c7e08b6f834bbc3a63197c813

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on tuke307/tree-disk-rings

Attestations:

Supported by

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