tree-disk-rings


Nametree-disk-rings JSON
Version 0.5.1 PyPI version JSON
download
home_pageNone
SummaryA package for tree disk rings detection in images
upload_time2025-02-16 18:07:27
maintainerNone
docs_urlNone
authorTony
requires_python>=3.10
licenseMIT
keywords tree rings image processing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 \
    --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

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. Compile the external C code:
```bash
cd ./externals/devernay_1.0 && make clean && make
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "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/a5/08/c496858d9e9cadcc6e506245153b05090705be0d6c3c8c8cfcdfa3380702/tree_disk_rings-0.5.1.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    --min_chain_length 2 \\\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| `--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 | Collinearity threshold in degrees. Defines the maximum allowable angle between an edge's direction and its gradient. |\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. 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. Compile the external C code:\n```bash\ncd ./externals/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.5.1",
    "project_urls": {
        "Homepage": "https://github.com/tuke307/tree-disk-analyzer",
        "Repository": "https://github.com/tuke307/tree-disk-analyzer"
    },
    "split_keywords": [
        "tree",
        " rings",
        " image processing"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "08ad9a1fcb19601bd73f60a40aeff6e676575b40ed373b5975bf0fbf8a750534",
                "md5": "9d54760f4dc94619e827488dea822dd7",
                "sha256": "170d605c78ca00e286cf6f1a8e86c4f93dbd0a42499404a8d5168d56450024b0"
            },
            "downloads": -1,
            "filename": "tree_disk_rings-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d54760f4dc94619e827488dea822dd7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 106326,
            "upload_time": "2025-02-16T18:07:25",
            "upload_time_iso_8601": "2025-02-16T18:07:25.682401Z",
            "url": "https://files.pythonhosted.org/packages/08/ad/9a1fcb19601bd73f60a40aeff6e676575b40ed373b5975bf0fbf8a750534/tree_disk_rings-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a508c496858d9e9cadcc6e506245153b05090705be0d6c3c8c8cfcdfa3380702",
                "md5": "3bf6ea813ed1d897d543143fcc39ee75",
                "sha256": "b105bdf49a5ecc17481c0290833b31979b8931ec1bfaa0e90cd9c9b196cd8d2e"
            },
            "downloads": -1,
            "filename": "tree_disk_rings-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3bf6ea813ed1d897d543143fcc39ee75",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 92431,
            "upload_time": "2025-02-16T18:07:27",
            "upload_time_iso_8601": "2025-02-16T18:07:27.858138Z",
            "url": "https://files.pythonhosted.org/packages/a5/08/c496858d9e9cadcc6e506245153b05090705be0d6c3c8c8cfcdfa3380702/tree_disk_rings-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-16 18:07:27",
    "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-rings"
}
        
Elapsed time: 5.40475s