A package for tree disk rings detection in images
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tree_disk_rings-0.6.0.tar.gz.
File metadata
- Download URL: tree_disk_rings-0.6.0.tar.gz
- Upload date:
- Size: 92.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4f7777a70a21efd77ddb7ce42d3af8a962f4e944973baa31e3743b2ec3a35d8
|
|
| MD5 |
01af61ad7e5b642d17d1cb16d9360878
|
|
| BLAKE2b-256 |
541f8af49cb32245168df0874a296cfdfae57f1c1df40e5c694dd9ee0333cb5b
|
Provenance
The following attestation bundles were made for tree_disk_rings-0.6.0.tar.gz:
Publisher:
publish_rings.yml on tuke307/tree-disk-analyzer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_disk_rings-0.6.0.tar.gz -
Subject digest:
b4f7777a70a21efd77ddb7ce42d3af8a962f4e944973baa31e3743b2ec3a35d8 - Sigstore transparency entry: 172256264
- Sigstore integration time:
-
Permalink:
tuke307/tree-disk-analyzer@95f6055eeacb38d87aea1790aec594c113d05685 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tuke307
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_rings.yml@95f6055eeacb38d87aea1790aec594c113d05685 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tree_disk_rings-0.6.0-py3-none-any.whl.
File metadata
- Download URL: tree_disk_rings-0.6.0-py3-none-any.whl
- Upload date:
- Size: 105.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfafcf7141fe24e1c449f295df2752fd6a242de9a62b6ab0975d4ad546d4ea19
|
|
| MD5 |
c51174a3dbf7f5c1ff035632595723e7
|
|
| BLAKE2b-256 |
35b8104bd18bd59e18f2a0b0f7cdb723535f89f88673a62521493d8039363e7c
|
Provenance
The following attestation bundles were made for tree_disk_rings-0.6.0-py3-none-any.whl:
Publisher:
publish_rings.yml on tuke307/tree-disk-analyzer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tree_disk_rings-0.6.0-py3-none-any.whl -
Subject digest:
cfafcf7141fe24e1c449f295df2752fd6a242de9a62b6ab0975d4ad546d4ea19 - Sigstore transparency entry: 172256267
- Sigstore integration time:
-
Permalink:
tuke307/tree-disk-analyzer@95f6055eeacb38d87aea1790aec594c113d05685 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tuke307
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_rings.yml@95f6055eeacb38d87aea1790aec594c113d05685 -
Trigger Event:
push
-
Statement type: