Tree Disk Rings
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
- Create and activate virtual environment:
poetry config virtualenvs.in-project true
poetry env use python
poetry install
eval $(poetry env activate)
- Running tests:
pytest
- Compile the external C code:
cd ./externals/devernay_1.0 && make clean && make
Metadata
Release files for tree-disk-rings 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tree_disk_rings-0.6.1.tar.gz | 92.2 kB | With provenance | Details for tree_disk_rings-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tree_disk_rings-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for tree_disk_rings-0.6.1-py3-none-any.whl |
Total release size: 197.8 kB
Release files / tree_disk_rings-0.6.1.tar.gz
| Download URL | tree_disk_rings-0.6.1.tar.gz |
|---|---|
| Size | 92.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e438cef838f7bf6b05cb056fd3c4e419cb2606b1cd4f8da06e26bdcaa52169b7
|
|
BLAKE2b-256 checksum How to use checksums |
cfef65baee35e26ab60d46c36e5d6621f91085e12b651bc50208ca45f545bd3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 3, 2025.
Transparency logRelease files / tree_disk_rings-0.6.1-py3-none-any.whl
| Download URL | tree_disk_rings-0.6.1-py3-none-any.whl |
|---|---|
| Size | 105.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b599fb34350bc51287484748a1fb89b3b7fd134bb441a6f3a98549f029e0c1b2
|
|
BLAKE2b-256 checksum How to use checksums |
5f6891716a13a54f64c7d6b4377125f98b1ce1d9f9142dfcac8f20e62b6be0f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 3, 2025.
Transparency logSecurity for tree-disk-rings 0.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tree_disk_rings-0.6.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 3, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.