Import DICOM data

How to import DICOM data and sample import formats.

With our DICOM editor, we support the following data modalities:

  • Computerized tomography (CT)
  • Magnetic resonance imaging (MRI)
  • Ultrasound

If you have a project to annotate 2D modalities - like X-rays - please use our image editor.

Parameters

Supported file format: DCM (multi-frame only)

Import methods:

  • IAM Delegated Access
  • Signed URLs (https URLs only)
ParameterRequiredDescription
row_dataYeshttps path to a cloud-hosted DICOM file. This must be a multi-frame DICOM file if you want to load multiple frames to the DICOM editor.
For IAM Delegated Access, this URL must be in virtual-hosted-style format. For older regions, your S3 bucket may be in https://<bucket-name>.s3.<region>.amazonaws.com/<key> format. If your object URLs are formatted this way, make sure they are in the virtual-hosted-style format before importing.
global_keyNoUnique user-generated file name or ID for the file. Global keys are enforced to be unique in your org. Data rows will not be imported if its global keys are duplicated to existing data rows.
media_typeNo"DICOM" (optional media type to provide better validation and error messaging)
metadata_fieldsNoSee Metadata.
attachmentsNoSee Attachments and Asset overlays.

Import format

[
  {
    "row_data": "https://lb-test-data.s3.us-west-1.amazonaws.com/dicom-samples/sample-dicom-1.dcm",
    "global_key": "https://lb-test-data.s3.us-west-1.amazonaws.com/dicom-samples/sample-dicom-1.dcm",
    "media_type": "DICOM",
    "metadata_fields": [{"name": "<metadata_field_name>", "value": "tag_string"}],
    "attachments": [{"type": "VIDEO", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/drone_video.mp4" }]
  },
  {
    "row_data": "https://lb-test-data.s3.us-west-1.amazonaws.com/dicom-samples/sample-dicom-2.dcm",
    "global_key": "https://lb-test-data.s3.us-west-1.amazonaws.com/dicom-samples/sample-dicom-2.dcm",
    "media_type": "DICOM",
    "metadata_fields": [{"name": "<metadata_field_name>", "value": "tag_string"}],
    "attachments": [{"type": "TEXT_URL", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/text_attachment.txt"}]
  }
]
[
  {
    "row_data": "https://storage.googleapis.com/labelbox-datasets/dicom-sample-data/sample-dicom-1.dcm",
    "global_key": "https://storage.googleapis.com/labelbox-datasets/dicom-sample-data/sample-dicom-1.dcm",
    "media_type": "DICOM",
    "metadata_fields": [{"schema_id": "cko8s9r5v0001h2dk9elqdidh", "value": "tag_string"}],
    "attachments": [{"type": "VIDEO", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/drone_video.mp4" }]
  },
  {
    "row_data": "https://storage.googleapis.com/labelbox-datasets/dicom-sample-data/sample-dicom-2.dcm",
    "global_key": "https://storage.googleapis.com/labelbox-datasets/dicom-sample-data/sample-dicom-2.dcm",
    "media_type": "DICOM",
    "metadata_fields": [{"schema_id": "cko8s9r5v0001h2dk9elqdidh", "value": "tag_string"}],
    "attachments": [{"type": "TEXT_URL", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/text_attachment.txt"}]
  }
]

Python example

from labelbox import Client
from uuid import uuid4 ## to generate unique IDs
import datetime 

client = Client(api_key="<YOUR_API_KEY>")

dataset = client.create_dataset(name="Bulk import example - DICOM")

assets = [
  {
    "row_data": "https://storage.googleapis.com/labelbox-datasets/dicom-sample-data/sample-dicom-1.dcm",
    "global_key": "https://storage.googleapis.com/labelbox-datasets/dicom-sample-data/sample-dicom-1.dcm",
    "media_type": "DICOM",
    "metadata_fields": [{"name": "<metadata_field_name>", "value": "tag_string"}],
    "attachments": [{"type": "VIDEO", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/drone_video.mp4" }]
  },
  {
    "row_data": "https://storage.googleapis.com/labelbox-datasets/dicom-sample-data/sample-dicom-2.dcm",
    "global_key": "https://storage.googleapis.com/labelbox-datasets/dicom-sample-data/sample-dicom-2.dcm",
    "media_type": "DICOM",
    "metadata_fields": [{"name": "<metadata_field_name>", "value": "tag_string"}],
    "attachments": [{"type": "TEXT_URL", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/text_attachment.txt"}]
  }
]

task = dataset.create_data_rows(assets)
task.wait_till_done()
print(task.errors)