Links

Import data & annotations

You can easily import large amounts of data from the command line interface. Before following this guide, make sure to set up credentials for the CLI.

Importing locally stored data

Make sure your data is stored within the correct folder structure as defined in our documentation. You can only upload a single data type in one upload operation - see the supported file types here.
$ redbrick upload path/to/data/ --type DICOM3D

Group images by study

To group your images by study (look here for examples), do the following:
$ redbrick upload path/to/data/ --as-study

Upload video frames

To upload a video by uploading individual frames, do the following:
$ redbrick upload path/to/videoframes/ --as-frames --type VIDEOFRAMES

Importing externally stored data

To import data stored externally, for example, in AWS s3, you must specify the storage ID (you can get your storage systems storage ID from the Storage tab on the RedBrick AI platform).
Prepare an Items List containing references to your externally stored files.
$ redbrick upload items.json --storage STORAGEID # replace STORAGEID with your Storage ID

Import annotations

To import annotations with your data, you must create an Items List that contains annotation information in the annotation format.
Please note that you can only import an Items File containing annotations using the SDK & CLI. We do not support importing JSON Items Files containing segmentations, through the UI.
The file paths within the Items List can point to locally stored data or data in your external storage. If your image data is stored externally, make sure to provide the Storage ID with --storage.If your annotation files are stored externally, make sure to provide the Storage ID with --label-storage.
Here is a sample Items List that contains annotation information:
1
[
2
{
3
"name": "study1",
4
"series": [
5
{
6
"items": "series1.nii",
7
"name": "series1",
8
"segmentations": "series1_seg.nii"
9
},
10
{
11
"items": "series2.nii",
12
"name": "series2",
13
"segmentations": "series2_seg.nii"
14
}
15
],
16
"segmentMap": {
17
"1": {
18
"category": "necrosis"
19
},
20
"2": {
21
"category": "edema"
22
},
23
"3": {
24
"category": "non-enhancing tumor"
25
},
26
"4": {
27
"category": "enhancing tumor"
28
}
29
}
30
},
31
{
32
"name": "study2",
33
"series": [
34
{
35
"items": "series1.nii",
36
"name": "series1",
37
"segmentations": "series1_seg.nii"
38
},
39
{
40
"items": "series2.nii",
41
"name": "series2",
42
"segmentations": "series2_seg.nii"
43
}
44
],
45
"segmentMap": {
46
"1": {
47
"category": "necrosis"
48
},
49
"2": {
50
"category": "edema"
51
},
52
"3": {
53
"category": "non-enhancing tumor"
54
},
55
"4": {
56
"category": "enhancing tumor"
57
}
58
}
59
},
60
]

Import locally stored annotations with locally stored images

$ redbrick upload path/to/items.json # items.json must have local file paths.

Import locally stored annotations with externally stored images

The following command will upload your annotation files (stored locally), and your image files (stored in STORAGEID):
$ redbrick upload path/to/items.json --storage STORAGEID

Import externally stored annotations and externally stored images

If you annotation files are also stored externally, you can run the following:
$ redbrick upload path/to/items.json --storage STORAGEID --label-storage LABELSTORAGEID

GitHub example

You can follow along with this Jupyter notebook to upload the Brain Brats data along with the annotations.