Export DICOM annotations

❗️

This is a deprecated media type.

Export JSON annotations

# Set the export params to include/exclude certain fields. 
export_params= {
  "attachments": True,
  "metadata_fields": True,
  "data_row_details": True,
  "project_details": True,
  "label_details": True,
  "performance_details": True,
  "interpolated_frames": True
}

# Note: Filters follow AND logic, so typically using one filter is sufficient.
filters= {
  "last_activity_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"],
  "workflow_status": "<wkf-status>"
}

export_task = project.export(params=export_params, filters=filters)
export_task.wait_till_done()


# Return JSON output strings from export task results/errors, one by one:

# Callback used for JSON Converter
def json_stream_handler(output: lb.BufferedJsonConverterOutput):
  print(output.json)


if export_task.has_errors():
  export_task.get_buffered_stream(
  stream_type=lb.StreamType.ERRORS
  ).start(stream_handler=lambda error: print(error))

if export_task.has_result():
  export_json = export_task.get_buffered_stream(
    stream_type=lb.StreamType.RESULT
  ).start(stream_handler=json_stream_handler)

print("file size: ", export_task.get_total_file_size(stream_type=lb.StreamType.RESULT))
print("line count: ", export_task.get_total_lines(stream_type=lb.StreamType.RESULT))
     

Annotation export formats

Polyline

{
  "feature_id": "clftr46h2002014wq1lvtntzi",
  "feature_schema_id": "clftr3ueu061407xe3eam5gfh",
  "name": "line_dicom",
  "value": "line_dicom",
  "annotation_kind": "DICOMPolyline",
  "classifications": [],
  "line": [
    {
      "x": 10.0,
      "y": 10.0
    },
    {
      "x": 200.0,
      "y": 10.0
    },
    {
      "x": 300.0,
      "y": 300.0
    }
  ]
}

Mask

{
  "feature_id": "clftr46h2001z14wqod253zyk",
  "feature_schema_id": "clftr3ueu061207xeeezscu35",
  "name": "segmentation_mask_dicom",
  "value": "segmentation_mask_dicom",
  "annotation_kind": "DICOMSegmentationMask",
  "classifications": [],
  "mask": {
    "url": "https://api.labelbox.com/api/v1/projects/clftr3und00cd07tzalqk2z8b/annotations/clftr46h2001z14wqod253zyk/index/1/mask"
  },
  "composite_mask": {
    "url": "https://api.labelbox.com/api/v1/tasks/cluu2f9wn02m907wc9n9thld2/masks/clftr45oa001x14wqj2jqd42l/index/1",
    "color_rgb": [
      255,
      255,
      255
    ]
  }
}

Sample project export

{
  "data_row": {
    "id": "clftqkks0004g075we24j7za1",
    "global_key": "sample-dicom-1.dcm",
    "row_data": "https://storage.googleapis.com/labelbox-datasets/dicom-sample-data/sample-dicom-1.dcm",
    "details": {
      "dataset_id": "clftqkjaz1f1g07y3519udly1",
      "dataset_name": "dicom_demo_dataset",
      "created_at": "2023-03-29T13:42:10.000+00:00",
      "updated_at": "2023-03-29T13:42:10.000+00:00",
      "last_activity_at": "2023-03-29T13:57:25.000+00:00",
      "created_by": "[email protected]"
    }
  },
  "media_attributes": {
    "mime_type": "application/dicom"
  },
  "attachments": [],
  "metadata_fields": [],
  "projects": {
    "clftr3und00cd07tzalqk2z8b": {
      "name": "dicom_project_demo",
      "labels": [
        {
          "label_kind": "DICOM",
          "version": "1.0.0",
          "id": "clftr46hg002114wq5dfz8nj4",
          "label_details": {
            "created_at": "2023-03-29T13:57:25.000+00:00",
            "updated_at": "2023-03-29T13:57:25.000+00:00",
            "created_by": "[email protected]",
            "content_last_updated_at": "2023-03-29T13:57:24.947+00:00",
            "reviews": []
          },
          "performance_details": {
            "seconds_to_create": 0,
            "seconds_to_review": 0,
            "skipped": false
          },
          "annotations": {
            "groups": {
              "Axial": {
                "name": "Axial",
                "classifications": [],
                "frames": {
                  "1": {
                    "objects": {
                      "clftr46h2001z14wqod253zyk": {
                        "feature_id": "clftr46h2001z14wqod253zyk",
                        "feature_schema_id": "clftr3ueu061207xeeezscu35",
                        "name": "segmentation_mask_dicom",
                        "value": "segmentation_mask_dicom",
                        "annotation_kind": "DICOMSegmentationMask",
                        "classifications": [],
                        "mask": {
                          "url": "https://api.labelbox.com/api/v1/projects/clftr3und00cd07tzalqk2z8b/annotations/clftr46h2001z14wqod253zyk/index/1/mask"
                        },
                        "composite_mask": {
                          "url": "https://api.labelbox.com/api/v1/tasks/cluu2f9wn02m907wc9n9thld2/masks/clftr45oa001x14wqj2jqd42l/index/1",
                          "color_rgb": [
                            255,
                            255,
                            255
                          ]
                        }
                      },
                      "clftr46h2002014wq1lvtntzi": {
                        "feature_id": "clftr46h2002014wq1lvtntzi",
                        "feature_schema_id": "clftr3ueu061407xe3eam5gfh",
                        "name": "line_dicom",
                        "value": "line_dicom",
                        "annotation_kind": "DICOMPolyline",
                        "classifications": [],
                        "line": [
                          {
                            "x": 10.0,
                            "y": 10.0
                          },
                          {
                            "x": 200.0,
                            "y": 20.0
                          },
                          {
                            "x": 250.0,
                            "y": 250.0
                          }
                        ]
                      }
                    },
                    "classifications": []
                  },
                  "5": {
                    "objects": {
                      "clftr46h2001z14wqod253zyk": {
                        "feature_id": "clftr46h2001z14wqod253zyk",
                        "feature_schema_id": "clftr3ueu061207xeeezscu35",
                        "name": "segmentation_mask_dicom",
                        "value": "segmentation_mask_dicom",
                        "annotation_kind": "DICOMSegmentationMask",
                        "classifications": [],
                        "mask": {
                          "url": "https://api.labelbox.com/api/v1/projects/clftr3und00cd07tzalqk2z8b/annotations/clftr46h2001z14wqod253zyk/index/5/mask"
                        },
                        "composite_mask": {
                          "url": "https://api.labelbox.com/api/v1/tasks/cluu2f9wn02m907wc9n9thld2/masks/clftr45oa001x14wqj2jqd42l/index/5",
                          "color_rgb": [
                            255,
                            255,
                            255
                          ]
                        }
                      }
                    },
                    "classifications": []
                  },
                  "20": {
                    "objects": {
                      "clftr46h2002014wq1lvtntzi": {
                        "feature_id": "clftr46h2002014wq1lvtntzi",
                        "feature_schema_id": "clftr3ueu061407xe3eam5gfh",
                        "name": "line_dicom",
                        "value": "line_dicom",
                        "annotation_kind": "DICOMPolyline",
                        "classifications": [],
                        "line": [
                          {
                            "x": 10.0,
                            "y": 10.0
                          },
                          {
                            "x": 200.0,
                            "y": 10.0
                          },
                          {
                            "x": 300.0,
                            "y": 300.0
                          }
                        ]
                      }
                    },
                    "classifications": []
                  }
                }
              },
              "Sagittal": {
                "name": "Sagittal",
                "classifications": [],
                "frames": {}
              },
              "Coronal": {
                "name": "Coronal",
                "classifications": [],
                "frames": {}
              }
            },
            "segments": {
              "Axial": {
                "clftr46h2001z14wqod253zyk": [
                  [
                    1,
                    1
                  ],
                  [
                    5,
                    5
                  ]
                ],
                "clftr46h2002014wq1lvtntzi": [
                  [
                    1,
                    1
                  ],
                  [
                    20,
                    20
                  ]
                ]
              },
              "Sagittal": {},
              "Coronal": {}
            },
            "classifications": [],
            "key_frame_feature_map": {
              "clftr46h2001z14wqod253zyk": {
                "Axial": {
                  "1": true,
                  "5": true
                },
                "Coronal": {},
                "Sagittal": {}
              },
              "clftr46h2002014wq1lvtntzi": {
                "Axial": {
                  "1": true,
                  "20": true
                },
                "Coronal": {},
                "Sagittal": {}
              }
            }
          }
        }
      ],
      "project_details": {
        "ontology_id": "clftr3ue6061107xee0xp3v6l",
        "task_name": "Done",
        "batch_id": "9a35aca0-ce39-11ed-bcf8-d178e6a2361d",
        "batch_name": "first-batch-dicom-demo",
        "workflow_status": "DONE",
        "priority": 5,
        "consensus_expected_label_count": 1,
        "workflow_history": []
      }
    }
  }
}