tree-disk-pith


Nametree-disk-pith JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryA package for tree disk pith detection in images
upload_time2025-02-26 08:57:30
maintainerNone
docs_urlNone
authorTony
requires_python>=3.10
licenseMIT
keywords tree pith image processing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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",
    model_path="models/apd_dl.h5",
    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 --model_path ./models/all_best_yolov8.pt
```

Advanced usage with custom parameters:
```bash
tree-disk-pith \
    --input_image input/tree-disk3.png \
    --model_path ./models/all_best_yolov8.pt \
    --output_dir custom_output/ \
    --new_shape 640 \
    --save_results \
    --debug
```

## CLI Arguments

| Argument | Type | Required | Default | Description |
|----------|------|----------|---------|-------------|
| `--input_image` | str | Yes | - | Input image file path |
| `--output_dir` | str | Yes | ./output | Output directory path |
| `--model_path` | str | No | - | Path to the weights file (required if using apd_dl method) |
| `--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. Create and activate virtual environment:
```bash
poetry config virtualenvs.in-project true
poetry env use python
```

```bash
poetry install
eval $(poetry env activate)
```

2. Running tests:
```bash
pytest
```

3. fetch dataset
```bash
python fetch_dataset.py
```

4. Download pretrained model
```bash
python fetch_pretrained_model.py
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "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/c3/1a/a99a7306d952880371fc17a37dacdd341c47f4201ea1fcb2706f84b3d47c/tree_disk_pith-0.2.0.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    model_path=\"models/apd_dl.h5\",\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 --model_path ./models/all_best_yolov8.pt\n```\n\nAdvanced usage with custom parameters:\n```bash\ntree-disk-pith \\\n    --input_image input/tree-disk3.png \\\n    --model_path ./models/all_best_yolov8.pt \\\n    --output_dir custom_output/ \\\n    --new_shape 640 \\\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 | Output directory path |\n| `--model_path` | str | No | - | Path to the weights file (required if using apd_dl method) |\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. Create and activate virtual environment:\n```bash\npoetry config virtualenvs.in-project true\npoetry env use python\n```\n\n```bash\npoetry install\neval $(poetry env activate)\n```\n\n2. Running tests:\n```bash\npytest\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.2.0",
    "project_urls": {
        "Homepage": "https://github.com/tuke307/tree-disk-analyzer",
        "Repository": "https://github.com/tuke307/tree-disk-analyzer"
    },
    "split_keywords": [
        "tree",
        " pith",
        " image processing"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cbdc5ad40710277add7649a8efbc095c04ec761ed55f0cce59a3bdfbcd3cf8a2",
                "md5": "0d06f7400f3dac93e5d1c95f3bf31009",
                "sha256": "d8da3f63e51af384397d0f6be6c4c62b04fae4f4afb3cbbd89431aab129e56db"
            },
            "downloads": -1,
            "filename": "tree_disk_pith-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0d06f7400f3dac93e5d1c95f3bf31009",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 11365,
            "upload_time": "2025-02-26T08:57:28",
            "upload_time_iso_8601": "2025-02-26T08:57:28.670391Z",
            "url": "https://files.pythonhosted.org/packages/cb/dc/5ad40710277add7649a8efbc095c04ec761ed55f0cce59a3bdfbcd3cf8a2/tree_disk_pith-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c31aa99a7306d952880371fc17a37dacdd341c47f4201ea1fcb2706f84b3d47c",
                "md5": "1286facfca8088243182f6aa4cadd50f",
                "sha256": "23d9147e25358eddf037011a4bb1caf995e31936ad5e0d11c3a3abd66cc2f3ef"
            },
            "downloads": -1,
            "filename": "tree_disk_pith-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1286facfca8088243182f6aa4cadd50f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 8163,
            "upload_time": "2025-02-26T08:57:30",
            "upload_time_iso_8601": "2025-02-26T08:57:30.289002Z",
            "url": "https://files.pythonhosted.org/packages/c3/1a/a99a7306d952880371fc17a37dacdd341c47f4201ea1fcb2706f84b3d47c/tree_disk_pith-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-26 08:57:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tuke307",
    "github_project": "tree-disk-analyzer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tree-disk-pith"
}
        
Elapsed time: 0.54683s