# Tree Disk Rings
[![PyPI - Version](https://img.shields.io/pypi/v/tree-disk-rings)](https://pypi.org/project/tree-disk-rings/)
A Python package for analyzing tree rings in cross-sectional images. Originally forked from [hmarichal93/cstrd_ipol](https://github.com/hmarichal93/cstrd_ipol).
## Installation
```bash
pip install tree-disk-rings
```
## Usage
### Python API
```python
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:
```bash
tree-disk-rings --input_image input/tree-disk4.png --cx 1204 --cy 1264
```
Save intermediate results:
```bash
tree-disk-rings --input_image input/tree-disk4.png --cx 1204 --cy 1264 --save_results
```
Advanced usage with custom parameters:
```bash
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:
```bash
git clone https://github.com/tuke307/tree-disk-rings.git
cd tree-disk-rings
```
2. Create and activate virtual environment:
```bash
poetry install
poetry shell
```
3. Compile the external C code:
```bash
cd ./externas/devernay_1.0 && make clean && make
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tuke307/tree-disk-rings",
"name": "tree-disk-rings",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "tree, rings, image processing",
"author": "Tony",
"author_email": "tonymeissner70@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/17/02/7a572f06d1e4a12f231a12b182d71ea47069657fbaa813c4b0ba84ea01d4/tree_disk_rings-0.4.6.tar.gz",
"platform": null,
"description": "# Tree Disk Rings\n\n[![PyPI - Version](https://img.shields.io/pypi/v/tree-disk-rings)](https://pypi.org/project/tree-disk-rings/)\n\nA Python package for analyzing tree rings in cross-sectional images. Originally forked from [hmarichal93/cstrd_ipol](https://github.com/hmarichal93/cstrd_ipol).\n\n## Installation\n\n```bash\npip install tree-disk-rings\n```\n\n## Usage\n\n### Python API\n\n```python\nimport treediskrings\n\n# Configure the analyzer\ntreediskrings.configure(\n input_image=\"input/tree-disk4.png\",\n cx=1204,\n cy=1264,\n save_results=True,\n)\n\n# Run the analysis\n(\n img_in, # Original input image\n img_pre, # Preprocessed image\n devernay_edges, # Detected edges\n devernay_curves_f, # Filtered curves\n devernay_curves_s, # Smoothed curves\n devernay_curves_c, # Connected curves\n devernay_curves_p, # Final processed curves\n) = treediskrings.run()\n```\n\n### Command Line Interface (CLI)\n\nBasic usage:\n```bash\ntree-disk-rings --input_image input/tree-disk4.png --cx 1204 --cy 1264\n```\n\nSave intermediate results:\n```bash\ntree-disk-rings --input_image input/tree-disk4.png --cx 1204 --cy 1264 --save_results\n```\n\nAdvanced usage with custom parameters:\n```bash\ntree-disk-rings \\\n --input_image input/F02c.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 | - | Path to input image |\n| `--cx` | int | Yes | - | Pith x-coordinate |\n| `--cy` | int | Yes | - | Pith y-coordinate |\n| `--output_dir` | str | No | `./output` | Output directory path |\n| `--root` | str | No | Current dir | Root directory of the repository |\n| `--sigma` | float | No | 3.0 | Gaussian kernel parameter for edge detection |\n| `--th_low` | float | No | 5.0 | Low threshold for gradient magnitude |\n| `--th_high` | float | No | 20.0 | High threshold for gradient magnitude |\n| `--height` | int | No | 0 | Height after resizing (0 to keep original) |\n| `--width` | int | No | 0 | Width after resizing (0 to keep original) |\n| `--alpha` | float | No | 30.0 | Edge filtering parameter (collinearity threshold) |\n| `--nr` | int | No | 360 | Number of rays |\n| `--min_chain_length` | int | No | 2 | Minimum chain length |\n| `--debug` | flag | No | False | Enable debug mode |\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-rings.git\ncd tree-disk-rings\n```\n\n2. Create and activate virtual environment:\n```bash\npoetry install\npoetry shell\n```\n\n3. Compile the external C code:\n```bash\ncd ./externas/devernay_1.0 && make clean && make\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A package for tree disk rings detection in images",
"version": "0.4.6",
"project_urls": {
"Homepage": "https://github.com/tuke307/tree-disk-rings",
"Repository": "https://github.com/tuke307/tree-disk-rings"
},
"split_keywords": [
"tree",
" rings",
" image processing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "67442ad40f19340757d2dc0d630de0fff2b691a0d534e0cdf42549db13ce679c",
"md5": "8a7bad4caedf0d39c8a0df4fc4ae082e",
"sha256": "3f0bbccffb85970c132ac9c250964d0695814a4c0c252e9a9ce2c3cc8c9cbf96"
},
"downloads": -1,
"filename": "tree_disk_rings-0.4.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8a7bad4caedf0d39c8a0df4fc4ae082e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 79851,
"upload_time": "2024-11-10T14:45:21",
"upload_time_iso_8601": "2024-11-10T14:45:21.845677Z",
"url": "https://files.pythonhosted.org/packages/67/44/2ad40f19340757d2dc0d630de0fff2b691a0d534e0cdf42549db13ce679c/tree_disk_rings-0.4.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "17027a572f06d1e4a12f231a12b182d71ea47069657fbaa813c4b0ba84ea01d4",
"md5": "9afee048f4bd84755465586295d0b382",
"sha256": "8a71a3c8b47ed097e05af7d41c0029d89f5de4da8fb18ae94a0cac5f279a3e6f"
},
"downloads": -1,
"filename": "tree_disk_rings-0.4.6.tar.gz",
"has_sig": false,
"md5_digest": "9afee048f4bd84755465586295d0b382",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 68702,
"upload_time": "2024-11-10T14:45:23",
"upload_time_iso_8601": "2024-11-10T14:45:23.396800Z",
"url": "https://files.pythonhosted.org/packages/17/02/7a572f06d1e4a12f231a12b182d71ea47069657fbaa813c4b0ba84ea01d4/tree_disk_rings-0.4.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-10 14:45:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tuke307",
"github_project": "tree-disk-rings",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tree-disk-rings"
}