Importing NRRD Annotations

If you have access to the New Medical Labeling Editor, you may import existing segmentations in the NRRD format, created, for example, using 3D Slicer.

The New Medical Labeling editor is currently in closed beta and not publicly available. Please contact us at info [at] ango.ai if you wish to gain access and provide feedback.

The editor is not yet suitable for production purposes.

How to Import NRRD Segmentations

Prepare the project ontology

In short, to match the segmentation classes in your NRRD with the segmentation classes on Hub, you'll have to make sure that the schemaId of the class on Hub matches the SegmentX_LabelValue value in the header of the NRRD file.

For example, imagine the NRRD segmentation you wish to import has one segmentation class, and you wish for this class to be paired with a class on Ango Hub. This is how you would go about it:

  1. Open the Segmentation NRRD you wish to import into Ango Hub with a text editor. The first few lines (e.g. the file header) will likely look something like this:

[more ...]
space origin: (100.331,-86.50509999999997,88.181799999999967)
Segment0_Color:=0.501961 0.682353 0.501961
Segment0_ColorAutoGenerated:=1
Segment0_Extent:=40 207 13 235 0 90
Segment0_ID:=Segment_1
Segment0_LabelValue:=1
Segment0_Layer:=0
Segment0_Name:=Segment_1
Segment0_NameAutoGenerated:=1
Segment0_Tags:=Segmentation.Status:inprogress|TerminologyEntry:Segmentation category and type - 3D Slicer General Anatomy list~SCT^85756007^Tissue~SCT^85756007^Tissue~^^~Anatomic codes - DICOM master list~^^~^^|
[... more]
  1. Each segmentation class in the NRRD is represented by metadata starting with the prefix SegmentX, where X is an index starting from 0. All metadata pertaining to a class will have the same index. What we care about is the SegmentX_LabelValue value. In this case, since there is only one segmentation, its index will be 0, so we will look at Segment0_LabelValue only. In our case, this value is 1. We'll take note of that.

  2. In the project where you'd like to import the NRRD segmentation, go to the Settings tab, then to the Category Schema section. Create a new Medical Brush tool. By default, schema IDs for Medical Brush tools start at 1, so in this case, since the schema ID matches the number we took note of earlier, there would be no need to change the schema ID.

  3. If we did need to change the schema ID, then we would click on the Show JSON button (1) and change the ID from the JSON that appears to match SegmentX_LabelValue's value.

  1. Save your category schema by clicking on Save at the bottom of the page.

Prepare the JSON

  1. Create a JSON with this format:

[
  {
    "data": "https://my-bucket.com/asset.nrrd",
    "externalId": "asset_external_id"
    "medicalBrushDataUrl": "https://medical.url/sample-segmentation.nrrd"
  },
  {
    "data": "https://my-bucket.com/asset.nrrd",
    "externalId": "asset_external_id"
    "medicalBrushDataUrl": "https://medical.url/sample-segmentation.nrrd"
  }
]

The JSON will be a list of objects, where each object represents an asset-segmentation pair. The data and externalId fields are used by Hub to understand to which asset the prelabels will be imported. You do not need to provide both, either of them is enough.

Upload the JSON

  1. From your project's dashboard, enter the Assets tab, then click on Import. A dialog will pop up.

  1. Drag and drop the JSON you created earlier on the box. Your assets will be prelabeled.

Last updated