Importing NRRD Annotations
You can import Medical Brush segmentations and rotated bounding boxes as pre-annotations for NRRD assets in the Medical Labeling Editor.
Medical Brush segmentations are imported from an NRRD segmentation mask. Rotated bounding boxes are included as objects in the Cloud Import JSON used to add the NRRD asset.
How to Import NRRD Segmentations
Prepare the project ontology
To match the segmentation classes in your NRRD with the segmentation classes on Hub, there are two ways. Either:
you'll make it so that the title of the class on Ango Hub matches the
SegmentX_Namevalue in the header of the NRRD file, oryou'll make it so that that the
schemaIdof the class on Ango Hub matches theSegmentX_IDvalue in the header of the NRRD file.
Ango Hub will first try to match the segment name with the class title, then as fallback it will attempt to match the class schemaId with the segment's ID. If a match for your segment is then still not found, that segment is not imported.
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:
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]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 theSegmentX_LabelValuevalue. In this case, since there is only one segmentation, its index will be 0, so we will look atSegment0_LabelValueonly. In our case, this value is 1. We'll take note of that.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.
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.

Save your category schema by clicking on Save at the bottom of the page.
Upload local NRRD segmentation files
You can upload NRRD segmentation masks directly from your computer and match them to existing NRRD assets by filename.
Name each segmentation file after the external ID of the asset you want to pre-annotate. For example, both
my_asset.seg.nrrdandmy_asset.nrrdmatch an asset whose external ID ismy_asset.nrrd.From your project's Assets tab, click Import.
In the Import Labels tab, drag and drop or select one or more
.nrrdor.seg.nrrdfiles.
You can select multiple segmentation files at once, or select JSON and NRRD files together. Ango Hub uploads the segmentation masks and matches each one to its asset. Notifications summarize files that could not be uploaded or matched.
Import NRRD segmentations from URLs
Use an import JSON when your NRRD segmentation masks are already hosted at accessible URLs.
Create a JSON with this format:
For Segmentations with Publicly Accessible URLs
Where externalId is the external ID of the asset to pre-annotate, and medicalBrushDataUrl is a link to your publicly-accessible NRRD segmentation mask.
For Segmentations in Private Buckets
Integrate your private bucket with Ango Hub by following the instructions in the Storages docs page.
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:
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.
From your project's dashboard, enter the Assets tab, then click on Import. A dialog will pop up.

Drag and drop the JSON you created earlier on the box. Your assets will be prelabeled.
How to Import Rotated Bounding Boxes into NRRD Assets
First, add a Rotated Bounding Box class to the project's category schema. Copy its schemaId from the category schema JSON.
Then, prepare a Cloud Import JSON containing the NRRD asset and an objects array. The schemaId of each object must match the Rotated Bounding Box class in the project. For the canonical annotation schema, see 3D Rotated Bounding Box in the Ango Import Format.
center contains the box center in voxel coordinates. size contains its physical width, height, and depth using the volume's spacing units. quaternion contains its rotation as [x, y, z, w]; the example above has no rotation. See the linked import-format section for field details and the change from the earlier format.
From the project's Assets tab, click Add Data, open the Cloud Storage tab, and upload the JSON. When the NRRD task opens, the box is available in the Axial, Coronal, and Sagittal views and in the 3D Viewer.
Last updated

