Links

Importing Annotations Guide

You can import all annotation types that are supported in RedBrick AI, including segmentations, classifications, bounding boxes, and more. Imported annotations will appear automatically on your annotator's interface.
Annotations and images must be imported together at the start.
If you want to add annotations programmatically to images that have already been uploaded, please use the programmatic label & review.
Annotation import is only supported through the SDK and CLI.
That is, you cannot use the direct upload UI to import annotations, and you must use the items list with the SDK/CLI to provide the required metadata along with annotations.
To import images along with segmentations, you must provide us with:
  1. 1.
    Images in any supported format and NIftI segmentation files.
  2. 2.
    An items list that provides a mapping of:
    • Segmentation files to volumes so that segmentations are applied to correct images.
    • Values within segmentation file to taxonomy categories.
Once you've prepared the items list in the format defined below, you can import the images and annotations using the create_datapoints SDK method or CLI upload method.

Items list for importing segmentations

You can find the full format reference here. In this section, we will focus on importing segmentations. In the examples below, pay attention to the following fields:
  1. 1.
    segmentations: The segmentation files to be applied to the task.
  2. 2.
    segmentMap: Map the values present in the segmentation files to their corresponding taxonomy categories.

I: One segmentation file per task

1
{
2
"name": "...",
3
"series": [
4
{
5
"items": ["instance-01.dcm", "instance-02.dcm", ...],
6
"segmentations": "segmentation.nii.gz",
7
8
// Read more about "segmentMap"
9
"segmentMap": {
10
"1": "category-a",
11
"2": "category-b"
12
}
13
}
14
]
15
}

II: Multiple segmentation files per task

Sometimes, segmentations for a single volume are stored in multiple segmentation files, but these segmentation files are not binary masks. In this case, follow the format below.
{
"name": "...",
"series": [
{
"items": ["instance-01.dcm", "instance-02.dcm", ...],
// Read more about "segmentations"
"segmentations": ["segmentation-1.nii.gz", "segmentation-2.nii.gz"]
// Read more about "segmentMap"
"segmentMap": {
"1": "category-a",
"2": "category-b"
}
}
]
}

Common mistakes for I and II.

  • The values 1 and 2 must be present in either segmentation-1.nii.gz or segmentation-2.nii.gz.
  • Values in segmentation-1.nii.gz & segmentation-2.nii.gz that are not in segmentMapwill not map to any taxonomy category. This will result in uneditable, view-only annotations.
  • All values in segmentation.nii.gz that are not in segmentMap will not be mapped to any taxonomy category in the editor.

III: Multiple binary segmentation files per task

A common pattern is to store each segmentation instance in a separate NIfTI file as a binary mask. In the example below, all non-zero values in segmentation-1.nii.gz are meant to correspond to the taxonomy category category-a.
{
"name": "...",
"series": [
{
"items": ["instance-01.dcm", "instance-02.dcm", ...],
// Read more about "segmentations"
"segmentations": ["path/segmentation-1.nii.gz", "path/segmentation-2.nii.gz"]
"segmentMap": {
// Read more about "1"
"1": {
// Read more about "category"
"category": "category-a",
// Read more about "mask"
"mask": "path/segmentation-1.nii.gz",
},
"2": {
"category": "category-b",
"mask": "path/segmentation-2.nii.gz"
},
// Read more about "binaryMask"
"binaryMask": true,
}
}
]
}