A comprehensive web application for error detection and proofreading in image segmentation workflows. EHTool integrates error detection capabilities with advanced proofreading tools to help users identify and correct segmentation errors efficiently.
- Error Detection Workflow: Identify and categorize segmentation errors with lazy loading for large datasets
- Standalone Proofreading Workflow: Direct image editing and mask correction with full PFTool functionality
- Integrated Proofreading: Seamlessly edit incorrect layers from error detection workflow
- Load and analyze 2D/3D image datasets (TIFF, PNG, JPG, JPEG)
- Interactive layer-by-layer error detection
- Lazy loading with pagination - Only loads 12 layers per page for better performance
- Categorize layers as: Correct, Incorrect, or Unsure
- Batch operations for efficient labeling
- Progress tracking and statistics
- nnUNet-style mask naming support (masks matching images without "_0000" suffix)
- Real-time mask editing with paint and erase tools
- Adjustable brush sizes (1-64 pixels)
- Custom circular cursor that shows brush size
- Keyboard shortcuts for efficient editing
- Layer navigation for 3D datasets
- Undo/Redo support for all operations
- Automatic mask generation and saving
- Modern, responsive web interface
- Intuitive navigation between workflows
- Real-time progress tracking
- Comprehensive keyboard shortcuts
- Custom cursor preview for paint/erase tools
- Layer-by-layer navigation controls
- Python 3.9 or higher
- pip (Python package manager)
- Modern web browser (Chrome, Firefox, Safari, Edge)
- 8GB+ RAM recommended for large datasets
- Clone or download the repository:
git clone <repository-url>
cd online-error-handling-tool- Create a virtual environment (recommended):
# On macOS/Linux
python3 -m venv venv
source venv/bin/activate
# On Windows
python -m venv venv
venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the application:
python app.py- Open your browser: Navigate to:
http://localhost:5004
The application will start and you'll see the landing page where you can choose your workflow.
online-error-handling-tool/
βββ app.py # Main Flask application entry point
βββ requirements.txt # Python dependencies
βββ README.md # This file
β
βββ routes/ # Flask route handlers
β βββ landing.py # Home page and main navigation
β βββ detection_workflow.py # Error detection workflow routes
β βββ proofreading_workflow.py # Standalone proofreading routes
β βββ proofreading.py # Integrated proofreading routes
β βββ detection.py # Detection page logic
β βββ review.py # Review and statistics
β βββ export.py # Export functionality
β
βββ backend/ # Core backend modules
β βββ session_manager.py # Session state management
β βββ data_manager.py # Data loading and processing
β βββ volume_manager.py # Volume and mask operations
β βββ utils.py # Shared utility functions
β βββ ai/ # AI model integration
β βββ error_detection.py # Error detection logic
β
βββ templates/ # HTML templates
β βββ base.html # Base template
β βββ landing.html # Home page
β βββ detection_load.html # Data loading interface
β βββ detection.html # Error detection interface
β βββ proofreading_load.html # Proofreading data loading
β βββ proofreading_selection.html # Layer selection for proofreading
β βββ proofreading_standalone.html # Standalone proofreading editor
β βββ proofreading.html # Integrated proofreading editor
β
βββ static/ # Static assets
βββ css/ # Stylesheets
βββ js/ # JavaScript files
- Launch EHTool: Open your browser to
http://localhost:5004 - Choose Workflow:
- Click "Error Detection" to identify incorrect segmentation layers
- Click "Proofreading" for direct image/mask editing
- Load Dataset: Upload files or provide local file paths
- Start Working: Begin your workflow
-
Option A - Upload Files:
- Click "Choose File" under Image
- Upload image file(s) or folder
- Optionally upload corresponding mask files
- Supports: TIFF, PNG, JPG, JPEG formats
-
Option B - File Paths:
- Enter the path to your image file or folder
- Enter mask path (optional - will create empty masks if not provided)
- Supports local paths and relative paths
- nnUNet support: If mask names match image names without "_0000", they'll be automatically paired
- Lazy Loading: Only the first 12 layers load initially for faster startup
- Navigate: Use pagination controls to load more layers (12 per page)
- Categorize Layers:
- Click "Correct" for properly segmented layers
- Click "Incorrect" for layers needing correction
- Click "Unsure" for layers requiring review
- Batch Operations: Select multiple layers and label them at once
- Progress Tracking: View statistics showing completed vs. remaining layers
- Click "Edit Selected Layers" to open the integrated proofreading editor
- Navigate between incorrect layers using arrow buttons or keyboard
- Edit masks using paint/erase tools
- Mark layers as "Corrected" when done
- Changes are automatically saved
- Upload or provide path to image files
- Upload or provide path to mask files (optional)
- Supports single files, folders, or multi-file image stacks
- Automatically handles 2D images and 3D stacks
-
Select Tool:
- Click ποΈ Paint to add mask areas (or press
P) - Click π§½ Erase to remove mask areas (or press
E)
- Click ποΈ Paint to add mask areas (or press
-
Adjust Brush Size:
- Use the "Paint Brush" slider (1-64 pixels)
- Use the "Erase Brush" slider (1-64 pixels)
- Circular cursor preview shows brush size in real-time
-
Edit:
- Click and drag on the canvas to paint or erase
- Use Undo (β/Ctrl+Z) to revert changes
- Use Redo (β/Ctrl+Shift+Z) to reapply changes
- Toggle mask visibility with "Hide Mask" button
- Use β/β buttons or arrow keys (
A/D) to move between slices - Use the slice number input to jump to a specific slice
- Current slice and total slices are displayed
- Click "Save" button (or β/Ctrl+S)
- Mask is saved to the original location or alongside image file
- For folder-based datasets, masks are saved as
{image_name}_mask.{ext} - Original file format is preserved
This workflow is accessed from the Error Detection interface when you have incorrect layers.
- Select Layers: Click "Edit Selected Layers" from the error detection page
- Navigate: Use slice controls or keyboard (
A/D) to move between incorrect layers - Edit: Use the same paint/erase tools as standalone proofreading
- Mark Corrected: Click "Mark as Corrected" to return the layer to review
- Continue: Automatically navigate to next incorrect layer or return to selection
Aorβ- Previous layer/sliceDorβ- Next layer/sliceβ/Ctrl + S- Save current work
P- Switch to Paint modeE- Switch to Erase modeβ/Ctrl + Z- Undo last actionβ/Ctrl + Shift + ZorY- Redo action
β/Ctrl + Mouse Scroll- Zoom in/out- Canvas automatically centers on zoom
- Images: TIFF, TIFF stack, PNG, JPG, JPEG
- Masks: TIFF, PNG, JPG, JPEG
- 3D Data: Multi-page TIFF files, folder of 2D images
- nnUNet: Automatic pairing of masks with names matching images without "_0000"
- Session-based state management - Work is saved in browser session
- Automatic data clearing between workflows
- Lazy loading - Only loads visible layers (12 per page in detection)
- Memory-efficient processing for large datasets
- Separate storage for each workflow (no interference)
- Frontend: HTML5, CSS3, Vanilla JavaScript
- Backend: Flask (Python 3.9+)
- Image Processing: OpenCV, PIL/Pillow, NumPy, Tifffile, scikit-image, scipy
- State Management: Custom session manager
- Check Python version: Run
python --version(need 3.9+) - Check dependencies: Run
pip install -r requirements.txtagain - Port in use: Change port in
app.pyif 5004 is unavailable - Firewall: Ensure firewall allows local connections
- File paths: Check paths are correct and accessible
- Permissions: Ensure files/folders are readable
- Format support: Verify file format is supported (TIFF, PNG, JPG, JPEG)
- Size limits: Very large files (>2GB) may need more RAM
- Browser console: Check browser console (F12) for error messages
- Large datasets: Use lazy loading (only 12 layers per page in detection)
- Memory: Close other applications to free RAM
- 3D stacks: Consider splitting into smaller chunks
- Permissions: Check write permissions for save directory
- Path validity: Ensure save path exists and is writable
- Format: Original format is preserved when saving
- Browser console: Check for error messages
- β Use TIFF format for best performance with large datasets
- β Enable lazy loading in detection workflow (default: 12 layers/page)
- β Close other applications when working with large datasets
- β Batch operations for labeling multiple layers at once
- β Use keyboard shortcuts for faster editing
- β Chrome/Edge (recommended) - Best performance
- β Firefox - Full support
- β Safari - Full support (Mac)
β οΈ Internet Explorer - Not supported
EHTool maintains separate data storage for different workflows to prevent interference:
- Error Detection:
DETECTION_*config variables - Standalone Proofreading:
PROOFREADING_*config variables - Integrated Proofreading:
INTEGRATED_*config variables - Landing Page:
LANDING_*config variables
Use the "Reset" button on the landing page to clear all workflow data.
- Session Data: Complete workflow state with all annotations
- Annotations: Layer classifications (Correct/Incorrect/Unsure)
- Statistics: Progress and accuracy metrics
- Proofreading Queue: List of incorrect layers for review
- Edited Masks: All corrected mask files in original format
- β‘ Lazy Loading - Faster startup for large datasets (12 layers per page)
- π― nnUNet Support - Automatic mask pairing for nnUNet-preprocessed data
- π§ Code Refactoring - Consolidated duplicate code, improved consistency
- π Bug Fixes - Fixed mask update inconsistencies, improved error handling
- βοΈ Performance Improvements - Optimized memory usage, faster rendering
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Test thoroughly
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built on Flask web framework
- Image processing with OpenCV, PIL/Pillow, NumPy, Tifffile, scikit-image, scipy
- UI/UX inspired by modern web applications
- Keyboard shortcuts optimized for productivity
For issues, questions, or feature requests:
- Check the Troubleshooting section above
- Review browser console for error messages
- Check file permissions and paths
- Ensure all dependencies are installed
EHTool - Making error detection and proofreading efficient and intuitive! π―