# Tree Disk Pith Detection
[![PyPI - Version](https://img.shields.io/pypi/v/tree-disk-pith)](https://pypi.org/project/tree-disk-pith/)
A Python package for analyzing tree rings in cross-sectional images. Originally forked from [hmarichal93/apd](https://github.com/hmarichal93/apd).
## Installation
```bash
pip install tree-disk-pith
```
## Usage
### Python API
```python
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:
```bash
tree-disk-pith --input_image ./input/tree-disk3.png --new_shape 640 --debug
```
Save intermediate results:
```bash
tree-disk-pith --input_image ./input/tree-disk3.png --new_shape 640 --debug --method apd_pcl --save_results
```
Advanced usage with custom parameters:
```bash
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:
```bash
git clone https://github.com/tuke307/tree-disk-pith.git
cd tree-disk-pith
```
2. Create and activate virtual environment:
```bash
poetry install
poetry shell
```
3. fetch dataset
```bash
python fetch_dataset.py
```
4. Download pretrained model
```bash
python fetch_pretrained_model.py
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tuke307/tree-disk-pith",
"name": "tree-disk-pith",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "tree, pith, image processing",
"author": "Tony",
"author_email": "tonymeissner70@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/78/3d/5fcf5a06d33487c031251435af4464a7f664ecdb656f62a45387a0ab5420/tree_disk_pith-0.1.4.tar.gz",
"platform": null,
"description": "# Tree Disk Pith Detection\n\n[![PyPI - Version](https://img.shields.io/pypi/v/tree-disk-pith)](https://pypi.org/project/tree-disk-pith/)\n\nA Python package for analyzing tree rings in cross-sectional images. Originally forked from [hmarichal93/apd](https://github.com/hmarichal93/apd).\n\n## Installation\n\n```bash\npip install tree-disk-pith\n```\n\n## Usage\n\n### Python API\n\n```python\nimport treediskpith\n\n# Configure the analyzer\ntreediskpith.configure(\n input_image=\"input/tree-disk4.png\",\n save_results=True,\n)\n\n# Run the detection\n(\n img_in, # Original input image\n img_pre, # Preprocessed image\n pith, # Center of the tree disk\n) = treediskpith.run()\n```\n\n### Command Line Interface (CLI)\n\nBasic usage:\n```bash\ntree-disk-pith --input_image ./input/tree-disk3.png --new_shape 640 --debug\n```\n\nSave intermediate results:\n```bash\ntree-disk-pith --input_image ./input/tree-disk3.png --new_shape 640 --debug --method apd_pcl --save_results\n```\n\nAdvanced usage with custom parameters:\n```bash\ntree-disk-pith \\\n --input_image input/tree-disk3.png \\\n --cx 1204 \\\n --cy 1264 \\\n --output_dir custom_output/ \\\n --sigma 4.0 \\\n --th_low 10 \\\n --th_high 25 \\\n --save_results \\\n --debug\n```\n\n## CLI Arguments\n\n| Argument | Type | Required | Default | Description |\n|----------|------|----------|---------|-------------|\n| `--input_image` | str | Yes | - | Input image file path |\n| `--output_dir` | str | Yes | - | Output directory path |\n| `--method` | str | No | apd | Detection method to use. Choices are apd, apd_pcl, or apd_dl |\n| `--model_path` | str | No | - | Path to the weights file (required if using apd_dl method) |\n| `--percent_lo` | float | No | 0.7 | percent_lo parameter for the algorithm |\n| `--st_w` | int | No | 3 | st_w parameter for the algorithm |\n| `--lo_w` | int | No | 3 | lo_w parameter for the algorithm |\n| `--st_sigma` | float | No | 1.2 | st_sigma parameter for the algorithm |\n| `--new_shape` | int | No | 0 | New shape for resizing the input image. If 0, no resizing is done |\n| `--debug` | flag | No | False | Enable debug mode to save intermediate images and outputs |\n| `--save_results` | flag | No | False | Save intermediate images, labelme and config file |\n\n## Development\n\n### Setting up Development Environment\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/tuke307/tree-disk-pith.git\ncd tree-disk-pith\n```\n\n2. Create and activate virtual environment:\n```bash\npoetry install\npoetry shell\n```\n\n3. fetch dataset\n```bash\npython fetch_dataset.py\n```\n\n4. Download pretrained model\n```bash\npython fetch_pretrained_model.py\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A package for tree disk pith detection in images",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/tuke307/tree-disk-pith",
"Repository": "https://github.com/tuke307/tree-disk-pith"
},
"split_keywords": [
"tree",
" pith",
" image processing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "96f3c80a37ffcd015402e86017a1104847b94298080c321c12b8de520e2fe9b6",
"md5": "9a1f0a0ab1314f6810e45012d011d946",
"sha256": "b34bfed797ec1b06d09e19cd544be3b6af66d531995a09ecdd8d898dfc94e145"
},
"downloads": -1,
"filename": "tree_disk_pith-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9a1f0a0ab1314f6810e45012d011d946",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 31102,
"upload_time": "2024-11-10T12:03:08",
"upload_time_iso_8601": "2024-11-10T12:03:08.172378Z",
"url": "https://files.pythonhosted.org/packages/96/f3/c80a37ffcd015402e86017a1104847b94298080c321c12b8de520e2fe9b6/tree_disk_pith-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "783d5fcf5a06d33487c031251435af4464a7f664ecdb656f62a45387a0ab5420",
"md5": "6ca9fc47a4aa9b36e8eb1d7a9160681f",
"sha256": "26d97302c7c243dfc6f9a0df2bd1ef5fc9f41d4be947857e49cfe7fe4684dab0"
},
"downloads": -1,
"filename": "tree_disk_pith-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "6ca9fc47a4aa9b36e8eb1d7a9160681f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 24073,
"upload_time": "2024-11-10T12:03:10",
"upload_time_iso_8601": "2024-11-10T12:03:10.143293Z",
"url": "https://files.pythonhosted.org/packages/78/3d/5fcf5a06d33487c031251435af4464a7f664ecdb656f62a45387a0ab5420/tree_disk_pith-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-10 12:03:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tuke307",
"github_project": "tree-disk-pith",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tree-disk-pith"
}