Skip to main content

A package for tree disk pith detection in images

Project description

Tree Disk Pith Detection

PyPI - Version

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

Installation

pip install tree-disk-pith

Usage

Python API

import treediskpith

# Configure the analyzer
treediskpith.configure(
    input_image="input/tree-disk4.png",
    save_results=True,
)

# Run the detection
(
    img_in,          # Original input image
    img_pre,         # Preprocessed image
    pith,  # Center of the tree disk
) = treediskpith.run()

Command Line Interface (CLI)

Basic usage:

tree-disk-pith --input_image ./input/tree-disk3.png --new_shape 640 --debug

Save intermediate results:

tree-disk-pith --input_image ./input/tree-disk3.png --new_shape 640 --debug --method apd_pcl --save_results

Advanced usage with custom parameters:

tree-disk-pith \
    --input_image input/tree-disk3.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 - Input image file path
--output_dir str Yes - Output directory path
--method str No apd Detection method to use. Choices are apd, apd_pcl, or apd_dl
--model_path str No - Path to the weights file (required if using apd_dl method)
--percent_lo float No 0.7 percent_lo parameter for the algorithm
--st_w int No 3 st_w parameter for the algorithm
--lo_w int No 3 lo_w parameter for the algorithm
--st_sigma float No 1.2 st_sigma parameter for the algorithm
--new_shape int No 0 New shape for resizing the input image. If 0, no resizing is done
--debug flag No False Enable debug mode to save intermediate images and outputs
--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-pith.git
cd tree-disk-pith
  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. fetch dataset
python fetch_dataset.py
  1. Download pretrained model
python fetch_pretrained_model.py

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_pith-0.1.2.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

tree_disk_pith-0.1.2-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file tree_disk_pith-0.1.2.tar.gz.

File metadata

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

File hashes

Hashes for tree_disk_pith-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cc67a96a81ef929f5ce7318c0e9eb5f858963b152ae1de54ee7700bfa7796c45
MD5 c9a03ebaed732412753cfac961ad1ad0
BLAKE2b-256 b20752c442402312ec7908dcb1ba43c1d3544f4808b46c945742e09d93b9be8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_disk_pith-0.1.2.tar.gz:

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

Attestations:

File details

Details for the file tree_disk_pith-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for tree_disk_pith-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4540df1a76d4dc8cc7f16f3a33dc86201f1f737698e0764d4a030af6426fc82f
MD5 05f97c008df116d651601a80e3c6483e
BLAKE2b-256 3bc84d1842eb1b0dc96ded2a222b96beea2380043d9b59eedc5a4e99543171e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_disk_pith-0.1.2-py3-none-any.whl:

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

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