labelroi


Namelabelroi JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryAdd your description here
upload_time2025-08-06 15:49:10
maintainerNone
docs_urlNone
authorTalmo Pereira
requires_python>=3.11
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # labelroi

A Qt-based application for drawing and labeling polygon/polyline ROIs (Regions of Interest) on images and videos.

## Features

- **Image and Video Support**: Load images (PNG, JPG, JPEG, BMP, TIFF) or MP4 videos (displays first frame)
- **ROI Drawing**: Draw polygon ROIs by clicking vertices, or polylines for open shapes
- **ROI Naming**: Double-click on any ROI to add or edit its name
- **Smooth Navigation**: Pan and zoom with mouse/trackpad gestures
- **ROI Management**: View ROI properties, delete individual ROIs, or clear all
- **YAML Export/Import**: Save ROIs to YAML files for later use or sharing
- **Geometry Analysis**: Automatic calculation of area, perimeter, and vertex count using Shapely

## Installation

### Prerequisites

Install [uv](https://github.com/astral-sh/uv) if you haven't already:

```bash
# On macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Or with pip
pip install uv
```

### Install from Source

1. Clone the repository:
```bash
git clone https://github.com/talmolab/labelroi.git
cd labelroi
```

2. Install the package using uv:
```bash
uv pip install -e .
```

This will install labelroi and all its dependencies in editable mode.

## Usage

### Command Line Interface

Launch the application with:
```bash
labelroi
```

Or open with a specific image/video:
```bash
labelroi path/to/image.png
labelroi path/to/video.mp4
```

### Drawing ROIs

1. Click **"Start Drawing ROI"** button
2. **Left-click** to add vertices to your polygon
3. Either:
   - Click on the first vertex (green dot) to close the polygon
   - **Right-click** to finish as a polyline (open shape)
4. Repeat to draw multiple ROIs (each gets a unique color)

### ROI Naming

- **Double-click** on any ROI to add or edit its name
- Names appear as white labels on the ROI
- Clear the name to remove the label

### Navigation Controls

**Mouse/Trackpad:**
- **Scroll wheel**: Zoom in/out
- **Pinch gesture**: Zoom in/out
- **Middle-click + drag**: Pan around
- **Ctrl + Left-click + drag**: Pan around
- **Alt + Double-click**: Reset zoom

**Keyboard:**
- **Arrow keys** or **WASD**: Pan
- **+/=**: Zoom in
- **-**: Zoom out
- **0** or **Home**: Reset zoom
- **F1** or **H**: Show help

### Saving and Loading ROIs

ROIs are automatically saved with the same name as your image/video file with a `.rois.yml` suffix:
- Image: `my_image.png` → ROIs: `my_image.rois.yml`
- Video: `my_video.mp4` → ROIs: `my_video.rois.yml`

Click **"Save ROIs to YAML"** to save your ROIs. They will automatically load when you open the same image/video again.

### YAML Format

The ROIs are saved in a human-readable YAML format:

```yaml
image_file: /path/to/image.png
roi_count: 2
rois:
  - id: 1
    name: "Region A"
    type: polygon
    coordinates:
      - [100.5, 200.3]
      - [150.2, 250.7]
      - [100.8, 300.1]
    color: "#1f77b4"
    properties:
      vertex_count: 3
      perimeter: 172.5
      area: 1250.3
  - id: 2
    name: "Line B"
    type: polyline
    coordinates:
      - [200.0, 100.0]
      - [300.0, 150.0]
    color: "#ff7f0e"
    properties:
      vertex_count: 2
      perimeter: 111.8
```

## Development

### Running from Source

```bash
# Clone and enter directory
git clone https://github.com/talmolab/labelroi.git
cd labelroi

# Install in development mode
uv pip install -e .

# Run the application
python src/labelroi/labelroi.py
```

### Dependencies

- **numpy**: Array operations
- **matplotlib**: Visualization and plotting
- **shapely**: Geometry operations
- **qtpy**: Qt compatibility layer
- **PyQt5**: Qt backend (can also use PyQt6, PySide2, or PySide6)
- **sleap-io**: Video file loading
- **PyYAML**: YAML file I/O

## License

See LICENSE file for details.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## Issues

If you encounter any problems, please file an issue at https://github.com/talmolab/labelroi/issues
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "labelroi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": null,
    "author": "Talmo Pereira",
    "author_email": "Talmo Pereira <talmo@talmolab.org>",
    "download_url": "https://files.pythonhosted.org/packages/06/71/e8542f5140e31a29d6765b075b47e5ddb18f8fd1df788f5874d1197fea32/labelroi-0.1.0.tar.gz",
    "platform": null,
    "description": "# labelroi\n\nA Qt-based application for drawing and labeling polygon/polyline ROIs (Regions of Interest) on images and videos.\n\n## Features\n\n- **Image and Video Support**: Load images (PNG, JPG, JPEG, BMP, TIFF) or MP4 videos (displays first frame)\n- **ROI Drawing**: Draw polygon ROIs by clicking vertices, or polylines for open shapes\n- **ROI Naming**: Double-click on any ROI to add or edit its name\n- **Smooth Navigation**: Pan and zoom with mouse/trackpad gestures\n- **ROI Management**: View ROI properties, delete individual ROIs, or clear all\n- **YAML Export/Import**: Save ROIs to YAML files for later use or sharing\n- **Geometry Analysis**: Automatic calculation of area, perimeter, and vertex count using Shapely\n\n## Installation\n\n### Prerequisites\n\nInstall [uv](https://github.com/astral-sh/uv) if you haven't already:\n\n```bash\n# On macOS/Linux\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n# Or with pip\npip install uv\n```\n\n### Install from Source\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/talmolab/labelroi.git\ncd labelroi\n```\n\n2. Install the package using uv:\n```bash\nuv pip install -e .\n```\n\nThis will install labelroi and all its dependencies in editable mode.\n\n## Usage\n\n### Command Line Interface\n\nLaunch the application with:\n```bash\nlabelroi\n```\n\nOr open with a specific image/video:\n```bash\nlabelroi path/to/image.png\nlabelroi path/to/video.mp4\n```\n\n### Drawing ROIs\n\n1. Click **\"Start Drawing ROI\"** button\n2. **Left-click** to add vertices to your polygon\n3. Either:\n   - Click on the first vertex (green dot) to close the polygon\n   - **Right-click** to finish as a polyline (open shape)\n4. Repeat to draw multiple ROIs (each gets a unique color)\n\n### ROI Naming\n\n- **Double-click** on any ROI to add or edit its name\n- Names appear as white labels on the ROI\n- Clear the name to remove the label\n\n### Navigation Controls\n\n**Mouse/Trackpad:**\n- **Scroll wheel**: Zoom in/out\n- **Pinch gesture**: Zoom in/out\n- **Middle-click + drag**: Pan around\n- **Ctrl + Left-click + drag**: Pan around\n- **Alt + Double-click**: Reset zoom\n\n**Keyboard:**\n- **Arrow keys** or **WASD**: Pan\n- **+/=**: Zoom in\n- **-**: Zoom out\n- **0** or **Home**: Reset zoom\n- **F1** or **H**: Show help\n\n### Saving and Loading ROIs\n\nROIs are automatically saved with the same name as your image/video file with a `.rois.yml` suffix:\n- Image: `my_image.png` \u2192 ROIs: `my_image.rois.yml`\n- Video: `my_video.mp4` \u2192 ROIs: `my_video.rois.yml`\n\nClick **\"Save ROIs to YAML\"** to save your ROIs. They will automatically load when you open the same image/video again.\n\n### YAML Format\n\nThe ROIs are saved in a human-readable YAML format:\n\n```yaml\nimage_file: /path/to/image.png\nroi_count: 2\nrois:\n  - id: 1\n    name: \"Region A\"\n    type: polygon\n    coordinates:\n      - [100.5, 200.3]\n      - [150.2, 250.7]\n      - [100.8, 300.1]\n    color: \"#1f77b4\"\n    properties:\n      vertex_count: 3\n      perimeter: 172.5\n      area: 1250.3\n  - id: 2\n    name: \"Line B\"\n    type: polyline\n    coordinates:\n      - [200.0, 100.0]\n      - [300.0, 150.0]\n    color: \"#ff7f0e\"\n    properties:\n      vertex_count: 2\n      perimeter: 111.8\n```\n\n## Development\n\n### Running from Source\n\n```bash\n# Clone and enter directory\ngit clone https://github.com/talmolab/labelroi.git\ncd labelroi\n\n# Install in development mode\nuv pip install -e .\n\n# Run the application\npython src/labelroi/labelroi.py\n```\n\n### Dependencies\n\n- **numpy**: Array operations\n- **matplotlib**: Visualization and plotting\n- **shapely**: Geometry operations\n- **qtpy**: Qt compatibility layer\n- **PyQt5**: Qt backend (can also use PyQt6, PySide2, or PySide6)\n- **sleap-io**: Video file loading\n- **PyYAML**: YAML file I/O\n\n## License\n\nSee LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Issues\n\nIf you encounter any problems, please file an issue at https://github.com/talmolab/labelroi/issues",
    "bugtrack_url": null,
    "license": null,
    "summary": "Add your description here",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f2602a951a8b00f8260c654e43702a92724f95a1d5b8f5fe9a7eaf6f5abbcf07",
                "md5": "21f548d617c588b961bc92e5ecffd2e7",
                "sha256": "a0b548888cc71be29ffc4bafc772b60e99b67b97580b800746bd34aa34952bbd"
            },
            "downloads": -1,
            "filename": "labelroi-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "21f548d617c588b961bc92e5ecffd2e7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 15380,
            "upload_time": "2025-08-06T15:49:09",
            "upload_time_iso_8601": "2025-08-06T15:49:09.876806Z",
            "url": "https://files.pythonhosted.org/packages/f2/60/2a951a8b00f8260c654e43702a92724f95a1d5b8f5fe9a7eaf6f5abbcf07/labelroi-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0671e8542f5140e31a29d6765b075b47e5ddb18f8fd1df788f5874d1197fea32",
                "md5": "b5a050e53133ec10f127057aea89da46",
                "sha256": "de537cd8af29894c61bb9fb07c8ebf109610e2535a8f865e9ce8382e9712688c"
            },
            "downloads": -1,
            "filename": "labelroi-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b5a050e53133ec10f127057aea89da46",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 14205,
            "upload_time": "2025-08-06T15:49:10",
            "upload_time_iso_8601": "2025-08-06T15:49:10.692478Z",
            "url": "https://files.pythonhosted.org/packages/06/71/e8542f5140e31a29d6765b075b47e5ddb18f8fd1df788f5874d1197fea32/labelroi-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-06 15:49:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "labelroi"
}
        
Elapsed time: 3.05585s