Ango Hub Docs
Open Ango HubContact iMerit
  • Ango Hub Documentation
  • Video Guides
  • Changelog
  • FAQs & Troubleshooting
  • All Keyboard and Mouse Shortcuts
  • Core Concepts
    • Assets
    • Attachments
    • Batches
    • Benchmarks
    • Category Schema (Ontologies)
    • Frame Interpolation
    • Geofencing
    • Idle Time Detection & Time Tracking
    • Instructions
    • Issues
      • Issue Error Codes
    • Label Validation
    • Labeler Performance
    • Labeling
    • Labeling Queue
    • Multiple Classification
    • Notifications
    • Organizations
    • Projects
    • Requeuing
    • Reviewing
    • Review Queue
    • Skipping
    • Stage History
    • Tasks
    • Usage
    • User Roles
    • Workflow
      • Complete
      • Consensus
      • Hold
      • Label
      • Logic
      • Plugin
      • Review
      • Start
      • Webhook
  • Labeling
    • Managing Users in Projects
      • Profile Page
    • Managing the Project Ontology
    • Labeling Editor Interface
      • Audio Labeling Editor
      • Image Labeling Editor
      • Video Labeling Editor
      • DICOM Labeling Editor
      • Medical Labeling Editor
        • 3D Bounding Box
        • Fill Between Slices
        • Island Tools
        • Line (Tape Measure)
        • Smoothing
      • PDF Labeling Editor
      • Text (NER) Labeling Editor
      • LLM Chat Labeling Editor
      • Markdown Labeling Editor
      • 3D Multi-Sensor Fusion Labeling Editor
    • Labeling Classes
      • Tools
        • Bounding Box
        • Brush
        • Entity
        • Message
        • Nested Classifications
        • PCT
        • PDF Tool
        • Point
        • Polygon
        • Polyline
        • Rotated Bounding Box
        • Segmentation
        • Spline
        • Voxel Brush
      • Classification
        • Checkbox
        • Multiple Dropdown
        • Radio
        • Rank
        • Single Dropdown
        • Text
        • Tree Dropdown Tools (Single and Multiple Selection)
      • Relation
        • Single Relation
        • Group Relation
    • Magnetic Lasso
    • Performance & Compatibility Considerations
  • Data
    • Data in Ango Hub
      • Embedding Private Bucket Files in MD Assets
    • Importing Assets
      • Asset Builder
      • Bundled Assets
        • Importing Multiple Images as One Multi-Page Asset
        • Importing Multiple Single-Frame DICOM Files as One Multi-Page Asset
        • Importing multiple DICOM files to be annotated and displayed at once
        • Importing Multiple Single-Frame DICOM Files as a DICOM Series
        • Importing Multiple Markdown Files as One Multi-Page Asset
      • File Explorer
      • Supported Asset File Types & Codecs
      • Importing Cloud (Remote) Assets
      • Importing From Local Machine
      • Creating and Importing LLM Chat Assets
      • Importing Data in the 3D Multi-Sensor Fusion Labeling Tool
      • Bulk Importing Markdown/HTML Assets
      • Importing Attachments during Asset Import
      • Importing Annotations during Asset Import
      • contextData: Adding Extra Data to Assets
      • Importing Reference Images as Overlay
      • Importing Reference Medical Data During Asset Import
    • Importing and Exporting Annotations
      • Importing Annotations
        • Ango Import Format
        • Importing Brush Traces
        • Importing NRRD Annotations
      • Exporting Annotations
        • Ango Export Format
          • Asset
            • Task
              • Tools
              • Classifications
              • Relations
          • Stage History
    • Adding and Managing LLMs
    • Storages
      • Set up a storage integration with Azure
      • Set up a storage integration with AWS S3
      • Set up a storage integration with MinIO and S3-compatible custom storage services
      • Set up a storage integration with GCP (Google Cloud Platform)
      • Set up CORS
      • Validating Storage Integrations
    • Purging Data from Ango Hub
  • Plugins
    • Overview of Plugins in Ango Hub
      • Installing Plugins
      • Plugin Setting Presets
      • Monitoring Plugin Progress
    • First-Party Plugins
      • Ango Export Converter Plugins
      • Asset Converter Plugins
      • Ango to Mask Converter
      • Batch Assignment
      • ChatGPT
      • Column-Agnostic Markdown Generator
      • CSV Export for Classification
      • DALL-E
      • DALL-E (Model Plugin)
      • File Explorer Plugin
      • General Object Detector
      • General Object Segmenter
      • Markdown Generator
      • One-Click Segmentation
      • Open World Object Detection
      • Optical Character Recognition
      • TPT Export
      • YOLO | Instance Segmentation
      • YOLO | Pose Estimation
      • YOLO | Object Detection
      • YOLO | Image Classification
    • Plugin Developer Documentation
      • Export Plugins
      • Batch Model Plugins
      • Model Plugins
      • File Explorer Plugins
      • Markdown Generator Plugins
      • Plugin Logger
      • [WIP] Deploying your Plugin
      • Plugin 'Host' Information
  • SDK
    • SDK Documentation
      • Project Level SDK Functions
        • add_members_to_project
        • assign_batches
        • assign_task
        • create_attachment
        • create_batch
        • create_issue
        • create_label_set
        • create_project
        • delete_issue
        • export
        • exportV3
        • get_assets
        • get_batches
        • get_issues
        • get_metrics
        • get_project
        • get_project_performance
        • get_task
        • get_tasks
        • get_task_history
        • import_labels
        • list_projects
        • requeue_tasks
        • rerun_webhook
        • update_workflow_stages
        • upload_files
        • upload_files_cloud
        • upload_files_with_asset_builder
        • upload_chat_assets
      • Organization Level SDK Functions
        • create_storage
        • delete_organization_invites
        • delete_organization_members
        • delete_storage
        • get_organization_invites
        • get_organization_members
        • get_storages
        • invite_members_to_org
        • update_organization_members_role
    • SDK - Useful Snippets
    • SDK Changelog
  • API
    • API Documentation
  • How-To
    • Add Members
      • Add multiple users to a project
    • Annotate
      • Annotate 3D Point Cloud Files on Ango Hub
      • Perform targeted OCR on images
    • Export Data
      • Automatically send Ango Hub Webhook contents to Google Sheets, Email, Slack, and more with Zapier
      • Download a JSON of your project ontology
      • Download DICOM Segmentation Masks
      • Download your annotations in the COCO, KITTI, or YOLO format
      • Download your Segmentation Masks
      • Get your export as separate JSON files for each asset
    • Manage a Project
      • Get your API Key
      • Get your Organization ID
      • Mute your notifications
      • Open an asset provided the Asset ID
      • Pre-label assets
      • Share a filtered view of the Tasks table with others
      • Transfer project ontologies between projects
      • Transfer project workflows between projects
    • Perform Model Evaluation on Ango Hub
  • Troubleshooting
    • I get a "0 Tasks Labeled" alert when trying to pre-label tasks
    • I get a 'The data couldn't be loaded properly' error when opening certain assets
    • I get a "Unknown Classification" warning when opening a task
  • Feature Availability Status for projects of the 3D Multi-Sensor Fusion type
  • Comparison between QuickServe and Ango Hub
  • Changes from Ango Hub Legacy
  • Video V2 Breaking Changes and Transition
  • Data Access, Storage, and Security
  • Two-Factor Authentication
  • Single Sign-On (SSO) Support
  • Customer Support
  • Ango Hub Status Page
Powered by GitBook
On this page
  1. Data
  2. Importing and Exporting Annotations
  3. Importing Annotations

Importing Brush Traces

PreviousAngo Import FormatNextImporting NRRD Annotations

Last updated 6 months ago

You may import PNG masks as pre-labels for the in Ango Hub.

How to Import Masks as Brush Annotations

1. Verify Brush Tool Classes

Navigate to Settings > Category Schema in your project to ensure that the necessary Brush tool classes are available in the project.

2. Assign Colors

  • For instance segmentation tasks, randomly assign a unique RGB color value to each instance in your mask.

  • For semantic segmentation tasks, randomly assign a unique RGB color value to each class in your mask.

3. Prepare Masks

Prepare the masks you intend to import. Ensure the masks meet the following criteria:

  • The imported mask must be a 4-channel RGBA image

  • The width and height of the mask image must match the image asset's dimensions

  • The background value of the mask must be solid white and transparent

    • Example: (RGBA: 255, 255, 255, 0)

  • Use randomly assigned unique colors in the previous step, with fully opaque (255) alpha channel. Make sure that the mask’s foreground brush content must match the exact color values of the "brush" field in the JSON file.

    • Example:

      • Mask Image: (RGBA: 244, 67, 54, 255),

      • JSON File: "brush": [244, 67, 54]

The following would be a valid PNG mask:

You can use the following Python script to convert an RGB mask with a solid black background into the required RGBA format:

import numpy as np
from skimage import io

def rgb_mask_to_rgba_mask(input_mask_path, output_mask_path):
    input_mask = io.imread(input_mask_path)
    output_mask = np.zeros((input_mask.shape[0], input_mask.shape[1], 4), dtype=np.uint8)

    mask_flat = input_mask.reshape(-1, 3)
    unique_colors = np.unique(mask_flat, axis=0)

    for color in unique_colors:
        if np.array_equal(color, [0, 0, 0]):
            indices = np.where(np.all(input_mask == color, axis=-1))
            output_mask[indices] = np.array([255, 255, 255, 0], dtype=np.uint8)
        else:
            indices = np.where(np.all(input_mask == color, axis=-1))
            output_mask[indices] = np.array(list(color) + [255], dtype=np.uint8)

    io.imsave(output_mask_path, output_mask)

4. Prepare JSON File

Prepare the JSON to import to Hub, in the following format:

Where externalId is the external ID of the asset to pre-annotate, brushDataUrl is a link to your publicly accessible PNG mask, and tools is the list of instances available in the mask with randomly assigned unique RGB color information ("brush") and the "schemaId" of each class.

For Brush Traces with Publicly Accessible URLs

[
  {
    "externalId": "0a6e52c9-1eda-426f-8bcb-e6b1cd45668c.png",
    "brushDataUrl": "https://domain.s3.eu-central-1.amazonaws.com/brush-import-samples/0a6e52c9-1eda-426f-8bcb-e6b1cd45668c.png",
    "tools": [{"brush": [244, 67, 54], "schemaId": "29fde0dbe3eca1115f18368"}]
  },
  {
    "externalId": "0e9ee946-ebaa-4847-99ee-ce7386795333.png",
    "brushDataUrl": "https://domain.s3.eu-central-1.amazonaws.com/brush-import-samples/0e9ee946-ebaa-4847-99ee-ce7386795333.png",
    "tools": [{"brush": [244, 67, 54], "schemaId": "29fde0dbe3eca1115f18368"}]
  },
  {
    "externalId": "0eaf2333-5533-4353-ac3d-55774b6adb47.png",
    "brushDataUrl": "https://domain.s3.eu-central-1.amazonaws.com/brush-import-samples/0eaf2333-5533-4353-ac3d-55774b6adb47.png",
    "tools": [{"brush": [244, 67, 54], "schemaId": "29fde0dbe3eca1115f18368"}]
  },
  {
    "externalId": "0ebf0551-6c2d-4b6e-9a46-d5e1a5f22e72.png",
    "brushDataUrl": "https://domain.s3.eu-central-1.amazonaws.com/brush-import-samples/0ebf0551-6c2d-4b6e-9a46-d5e1a5f22e72.png",
    "tools": [{"brush": [244, 67, 54], "schemaId": "29fde0dbe3eca1115f18368"}]
  }
]

If your masks are stored in a cloud storage service, ensure the bucket's CORS settings are set properly, or your masks will not be visible on Hub.

For Brush Traces in Private Buckets

  • Navigate to your organization's Organization page, then navigate to the Storages tab.

  • Copy the ID of the storage where your brush traces are stored.

  • Prepare a JSON with the following format:

[
  {
    "externalId": "0a6e52c9-1eda-426f-8bcb-e6b1cd45668c.png",
    "brushDataUrl": "https://url.com/e6b1cd45668c.png?storageId=<YOUR_STORAGE_ID>",
    "tools": [{"brush": [244, 67, 54], "schemaId": "29fde0dbe3eca1115f18368"}]
  },
  {
    "externalId": "0e9ee946-ebaa-4847-99ee-ce7386795333.png",
    "brushDataUrl": "https://url.com/ce7386795333.png?storageId=<YOUR_STORAGE_ID>",
    "tools": [{"brush": [244, 67, 54], "schemaId": "29fde0dbe3eca1115f18368"}]
  }
]

5. Import Annotations

In your project, navigate to the Assets tab and ensure that the assets you wish to prelabel are in the Start stage, then click on Import. Drag and drop the JSON file you have just prepared. Your assets will be pre-labeled.

on how to set up CORS in such a way that your masks will be visible.

Integrate your private bucket with Ango Hub by following the instructions on the docs page.

To programmatically import brush traces, you can use the function available in our SDK.

Brush labeling tool
Here is a guide
Storages
import_labels
6KB
brush-import-docs.png
image