Importing data & annotations
You can programmatically import data and/or annotations using the SDK with a Python Script. For simple import operations, we recommend using the CLI, which has a simple & optimized interface.
You can import either locally stored data or externally stored data using the SDK using
create_datapoints
.project = redbrick.get_project(org_id, project_id, api_key)
To import locally stored data, create a list of
points
with relative file paths to your locally stored data, and use the redbrick.StorageMethod.REDBRICK
storage ID. points = [{"items": ["path/to/data.nii"], "name": "..."}]
storage_id = redbrick.StorageMethod.REDBRICK
project.upload.create_datapoints(storage_id=storage_id, points=points)
To import data stored in an external storage method, like AWS s3, make sure to use the storage methods Storage ID found on the Storage tab of your RedBrick AI account.
If you want to upload annotations with your data, include the annotation information in the
points
object.points = [
{
"name": "...",
"series": [
{
"items": "path/to/data.nii",
"segmentation": "path/to/segmentation.nii",
"segmentMap": {1: "category-1", 2: "category-2"},
}
],
}
]
project.upload.create_datapoints(storage_id="...", points=points)
Last modified 2mo ago