# Bounding Box Annotation Editing Tools
A GUI tool for editing and analyzing bounding box annotations of drug images.
## Main Features
### 1. Bounding Box Editor (BBoxEditor)
- Edit COCO format annotation files
- Draw bounding boxes with mouse drag
- Compare and analyze existing annotations
- Manage annotations grouped by drug codes
### 2. Drug Code Viewer (DrugCodeViewer)
- View images and annotations by drug codes
- Analyze bounding box overlaps
- Analyze annotation mismatches
## Installation
### 1. Install from Git
```bash
git clone https://github.com/LEEYH205/bbox-annotation-tools.git
cd drug_obj_detection
pip install -e .
```
### 2. Install from PyPI
```bash
pip install bbox-annotation-tools
```
## Usage
### Quick Start
After installation, you can run the GUI tools directly from the command line:
```bash
# Bounding Box Editor
bbox-editor
# Drug Code Viewer
drug-viewer
```
### Detailed Usage Guide
#### 1. Bounding Box Editor (bbox-editor)
The Bounding Box Editor is designed for editing COCO format annotation files with an intuitive GUI interface.
**Key Features:**
- **Folder Selection**: Choose annotation folders organized by drug categories
- **Drug Code Selection**: Select specific drug codes (K-XXXX format)
- **Annotation List**: Browse through all annotations for the selected drug
- **Interactive Drawing**: Click and drag to create or modify bounding boxes
- **Coordinate Input**: Manually input precise coordinates (X, Y, Width, Height)
- **Reference Display**: Show existing annotations from other drugs in the same folder
- **Save & Navigation**: Save changes and navigate between annotations
**Workflow:**
1. Launch the editor: `bbox-editor`
2. Select annotation folder from the dropdown
3. Choose drug code (e.g., K-1234)
4. Browse annotation list and select an image
5. Edit bounding box by:
- Dragging on the image to create new boxes
- Using coordinate input fields for precise adjustments
- Clicking "Apply Coordinates" to update
6. Save changes with "Save" button
7. Navigate between annotations with "Next"/"Previous" buttons
**Keyboard Shortcuts:**
- `Ctrl+S`: Save current annotation
- `Ctrl+N`: Next annotation
- `Ctrl+P`: Previous annotation
- `Ctrl+Z`: Restore original bounding box
#### 2. Drug Code Viewer (drug-viewer)
The Drug Code Viewer provides a comprehensive view of all annotations organized by drug codes.
**Key Features:**
- **Drug Code Overview**: See all available drug codes and their annotation counts
- **Image Gallery**: Browse all images for a selected drug code
- **Bounding Box Visualization**: Display bounding boxes on images
- **Overlap Analysis**: Identify overlapping bounding boxes
- **Annotation Statistics**: View annotation metadata and statistics
- **Export Capabilities**: Export analysis results
**Workflow:**
1. Launch the viewer: `drug-viewer`
2. Select a drug code from the list
3. Browse through images for that drug code
4. Analyze bounding box positions and overlaps
5. View annotation metadata and statistics
6. Export results if needed
### Advanced Usage
#### Using in Python Scripts
You can also use the tools programmatically in your Python scripts:
```python
from bbox_tools import BBoxEditor, DrugCodeViewer
import tkinter as tk
# Create and run Bounding Box Editor
def run_bbox_editor():
root = tk.Tk()
editor = BBoxEditor(root)
root.mainloop()
# Create and run Drug Code Viewer
def run_drug_viewer():
root = tk.Tk()
viewer = DrugCodeViewer(root)
root.mainloop()
# Run the tools
if __name__ == "__main__":
run_bbox_editor() # or run_drug_viewer()
```
#### Configuration
The tools automatically save your preferences:
- Last used folder and drug code
- Window geometry and settings
- Display preferences
Configuration is stored in `~/.bbox_tools_config.json`
#### Data Format
**Supported Annotation Format:**
- COCO JSON format
- Single annotation per file
- Bounding box coordinates: [x, y, width, height]
**Expected Directory Structure:**
```
annotations/
├── folder1_json/
│ ├── K-1234/
│ │ ├── annotation1.json
│ │ └── annotation2.json
│ └── K-5678/
│ ├── annotation3.json
│ └── annotation4.json
└── folder2_json/
└── K-9999/
└── annotation5.json
```
**Image Requirements:**
- Supported formats: JPG, PNG, BMP, TIFF
- Images should be in a separate directory
- Image filenames must match those referenced in annotation files
### Troubleshooting
**Common Issues:**
1. **"Path not found" error:**
- Ensure annotation and image paths are correctly set
- Check file permissions
2. **Images not loading:**
- Verify image files exist in the specified directory
- Check image format compatibility
3. **Annotations not saving:**
- Ensure write permissions for annotation files
- Check JSON file format validity
4. **GUI not responding:**
- Close and restart the application
- Check system resources
**Getting Help:**
- Check the console output for error messages
- Verify your data format matches the expected structure
- Ensure all dependencies are properly installed
## Project Structure
```
drug_obj_detection/
├── bbox_tools/ # Main package
│ ├── __init__.py # Package initialization
│ ├── bbox_gui_editor.py # Bounding box editor
│ ├── drug_code_viewer.py # Drug code viewer
│ └── config.py # Configuration management
├── tests/ # Test files
│ ├── __init__.py
│ └── test_imports.py
├── .github/workflows/ # GitHub Actions
│ └── build-and-test.yml
├── setup.py # Package configuration
├── pyproject.toml # Modern package configuration
├── requirements.txt # Dependencies
├── README.md # Project description
├── LICENSE # MIT License
├── .gitignore # Git ignore file
├── MANIFEST.in # Package include file
├── build_and_distribute.py # Distribution script
```
## Dependencies
- Python 3.7+
- OpenCV (opencv-python)
- NumPy
- Matplotlib
- Pillow (PIL)
- tkinter (Python built-in library)
## License
MIT License
## Contributing
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## Contact
- Email: ejrdkachry@gmail.com
- Project Link: https://github.com/LEEYH205/bbox-annotation-tools
Raw data
{
"_id": null,
"home_page": "https://github.com/LEEYH205/bbox-annotation-tools",
"name": "bbox-annotation-tools",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "LEEYH205 <ejrdkachry@gmail.com>",
"keywords": "bbox, annotation, computer-vision, image-processing, drug-detection",
"author": "LEEYH205",
"author_email": "LEEYH205 <ejrdkachry@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/49/2d/150e612bc64ff307b783e63e841e36ea9790c253eceec6b90f83b3cbe2d3/bbox_annotation_tools-1.0.2.tar.gz",
"platform": null,
"description": "# Bounding Box Annotation Editing Tools\n\nA GUI tool for editing and analyzing bounding box annotations of drug images.\n\n## Main Features\n\n### 1. Bounding Box Editor (BBoxEditor)\n- Edit COCO format annotation files\n- Draw bounding boxes with mouse drag\n- Compare and analyze existing annotations\n- Manage annotations grouped by drug codes\n\n### 2. Drug Code Viewer (DrugCodeViewer)\n- View images and annotations by drug codes\n- Analyze bounding box overlaps\n- Analyze annotation mismatches\n\n## Installation\n\n### 1. Install from Git\n```bash\ngit clone https://github.com/LEEYH205/bbox-annotation-tools.git\ncd drug_obj_detection\npip install -e .\n```\n\n### 2. Install from PyPI\n```bash\npip install bbox-annotation-tools\n```\n\n## Usage\n\n### Quick Start\n\nAfter installation, you can run the GUI tools directly from the command line:\n\n```bash\n# Bounding Box Editor\nbbox-editor\n\n# Drug Code Viewer\ndrug-viewer\n```\n\n### Detailed Usage Guide\n\n#### 1. Bounding Box Editor (bbox-editor)\n\nThe Bounding Box Editor is designed for editing COCO format annotation files with an intuitive GUI interface.\n\n**Key Features:**\n- **Folder Selection**: Choose annotation folders organized by drug categories\n- **Drug Code Selection**: Select specific drug codes (K-XXXX format)\n- **Annotation List**: Browse through all annotations for the selected drug\n- **Interactive Drawing**: Click and drag to create or modify bounding boxes\n- **Coordinate Input**: Manually input precise coordinates (X, Y, Width, Height)\n- **Reference Display**: Show existing annotations from other drugs in the same folder\n- **Save & Navigation**: Save changes and navigate between annotations\n\n**Workflow:**\n1. Launch the editor: `bbox-editor`\n2. Select annotation folder from the dropdown\n3. Choose drug code (e.g., K-1234)\n4. Browse annotation list and select an image\n5. Edit bounding box by:\n - Dragging on the image to create new boxes\n - Using coordinate input fields for precise adjustments\n - Clicking \"Apply Coordinates\" to update\n6. Save changes with \"Save\" button\n7. Navigate between annotations with \"Next\"/\"Previous\" buttons\n\n**Keyboard Shortcuts:**\n- `Ctrl+S`: Save current annotation\n- `Ctrl+N`: Next annotation\n- `Ctrl+P`: Previous annotation\n- `Ctrl+Z`: Restore original bounding box\n\n#### 2. Drug Code Viewer (drug-viewer)\n\nThe Drug Code Viewer provides a comprehensive view of all annotations organized by drug codes.\n\n**Key Features:**\n- **Drug Code Overview**: See all available drug codes and their annotation counts\n- **Image Gallery**: Browse all images for a selected drug code\n- **Bounding Box Visualization**: Display bounding boxes on images\n- **Overlap Analysis**: Identify overlapping bounding boxes\n- **Annotation Statistics**: View annotation metadata and statistics\n- **Export Capabilities**: Export analysis results\n\n**Workflow:**\n1. Launch the viewer: `drug-viewer`\n2. Select a drug code from the list\n3. Browse through images for that drug code\n4. Analyze bounding box positions and overlaps\n5. View annotation metadata and statistics\n6. Export results if needed\n\n### Advanced Usage\n\n#### Using in Python Scripts\n\nYou can also use the tools programmatically in your Python scripts:\n\n```python\nfrom bbox_tools import BBoxEditor, DrugCodeViewer\nimport tkinter as tk\n\n# Create and run Bounding Box Editor\ndef run_bbox_editor():\n root = tk.Tk()\n editor = BBoxEditor(root)\n root.mainloop()\n\n# Create and run Drug Code Viewer\ndef run_drug_viewer():\n root = tk.Tk()\n viewer = DrugCodeViewer(root)\n root.mainloop()\n\n# Run the tools\nif __name__ == \"__main__\":\n run_bbox_editor() # or run_drug_viewer()\n```\n\n#### Configuration\n\nThe tools automatically save your preferences:\n- Last used folder and drug code\n- Window geometry and settings\n- Display preferences\n\nConfiguration is stored in `~/.bbox_tools_config.json`\n\n#### Data Format\n\n**Supported Annotation Format:**\n- COCO JSON format\n- Single annotation per file\n- Bounding box coordinates: [x, y, width, height]\n\n**Expected Directory Structure:**\n```\nannotations/\n\u251c\u2500\u2500 folder1_json/\n\u2502 \u251c\u2500\u2500 K-1234/\n\u2502 \u2502 \u251c\u2500\u2500 annotation1.json\n\u2502 \u2502 \u2514\u2500\u2500 annotation2.json\n\u2502 \u2514\u2500\u2500 K-5678/\n\u2502 \u251c\u2500\u2500 annotation3.json\n\u2502 \u2514\u2500\u2500 annotation4.json\n\u2514\u2500\u2500 folder2_json/\n \u2514\u2500\u2500 K-9999/\n \u2514\u2500\u2500 annotation5.json\n```\n\n**Image Requirements:**\n- Supported formats: JPG, PNG, BMP, TIFF\n- Images should be in a separate directory\n- Image filenames must match those referenced in annotation files\n\n### Troubleshooting\n\n**Common Issues:**\n\n1. **\"Path not found\" error:**\n - Ensure annotation and image paths are correctly set\n - Check file permissions\n\n2. **Images not loading:**\n - Verify image files exist in the specified directory\n - Check image format compatibility\n\n3. **Annotations not saving:**\n - Ensure write permissions for annotation files\n - Check JSON file format validity\n\n4. **GUI not responding:**\n - Close and restart the application\n - Check system resources\n\n**Getting Help:**\n- Check the console output for error messages\n- Verify your data format matches the expected structure\n- Ensure all dependencies are properly installed\n\n## Project Structure\n\n```\ndrug_obj_detection/\n\u251c\u2500\u2500 bbox_tools/ # Main package\n\u2502 \u251c\u2500\u2500 __init__.py # Package initialization\n\u2502 \u251c\u2500\u2500 bbox_gui_editor.py # Bounding box editor\n\u2502 \u251c\u2500\u2500 drug_code_viewer.py # Drug code viewer\n\u2502 \u2514\u2500\u2500 config.py # Configuration management\n\u251c\u2500\u2500 tests/ # Test files\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u2514\u2500\u2500 test_imports.py\n\u251c\u2500\u2500 .github/workflows/ # GitHub Actions\n\u2502 \u2514\u2500\u2500 build-and-test.yml\n\u251c\u2500\u2500 setup.py # Package configuration\n\u251c\u2500\u2500 pyproject.toml # Modern package configuration\n\u251c\u2500\u2500 requirements.txt # Dependencies\n\u251c\u2500\u2500 README.md # Project description\n\u251c\u2500\u2500 LICENSE # MIT License\n\u251c\u2500\u2500 .gitignore # Git ignore file\n\u251c\u2500\u2500 MANIFEST.in # Package include file\n\u251c\u2500\u2500 build_and_distribute.py # Distribution script\n```\n\n## Dependencies\n\n- Python 3.7+\n- OpenCV (opencv-python)\n- NumPy\n- Matplotlib\n- Pillow (PIL)\n- tkinter (Python built-in library)\n\n## License\n\nMIT License\n\n## Contributing\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## Contact\n\n- Email: ejrdkachry@gmail.com\n- Project Link: https://github.com/LEEYH205/bbox-annotation-tools \n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Bounding Box Annotation Editing and Analysis Tools",
"version": "1.0.2",
"project_urls": {
"Bug Tracker": "https://github.com/LEEYH205/bbox-annotation-tools/issues",
"Homepage": "https://github.com/LEEYH205/bbox-annotation-tools",
"Repository": "https://github.com/LEEYH205/bbox-annotation-tools"
},
"split_keywords": [
"bbox",
" annotation",
" computer-vision",
" image-processing",
" drug-detection"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "68a2ba0b2b355c0df9685a83bd8291a3a04dd4a03e26ae734de7c267bb101443",
"md5": "d520e2f1c54a1504aa81390523ac67fb",
"sha256": "ad55340901ea4079f7c964c3f5883a6a371b690c20fbeb3fe1edcb6e5154f6fb"
},
"downloads": -1,
"filename": "bbox_annotation_tools-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d520e2f1c54a1504aa81390523ac67fb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 21786,
"upload_time": "2025-07-24T05:45:22",
"upload_time_iso_8601": "2025-07-24T05:45:22.640468Z",
"url": "https://files.pythonhosted.org/packages/68/a2/ba0b2b355c0df9685a83bd8291a3a04dd4a03e26ae734de7c267bb101443/bbox_annotation_tools-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "492d150e612bc64ff307b783e63e841e36ea9790c253eceec6b90f83b3cbe2d3",
"md5": "9ccb8ee417250e0ac51d74be88a66c0e",
"sha256": "764ad86402b9b9a129fade91f7078163f5f71fd77c9d5a0680d4173109d92554"
},
"downloads": -1,
"filename": "bbox_annotation_tools-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "9ccb8ee417250e0ac51d74be88a66c0e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 21364,
"upload_time": "2025-07-24T05:45:24",
"upload_time_iso_8601": "2025-07-24T05:45:24.409919Z",
"url": "https://files.pythonhosted.org/packages/49/2d/150e612bc64ff307b783e63e841e36ea9790c253eceec6b90f83b3cbe2d3/bbox_annotation_tools-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-24 05:45:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LEEYH205",
"github_project": "bbox-annotation-tools",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "opencv-python",
"specs": [
[
">=",
"4.5.0"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.19.0"
]
]
},
{
"name": "matplotlib",
"specs": [
[
">=",
"3.3.0"
]
]
},
{
"name": "Pillow",
"specs": [
[
">=",
"8.0.0"
]
]
}
],
"lcname": "bbox-annotation-tools"
}