|
243 | 243 | "\n", |
244 | 244 | "DICOM ANNs extend the capabilities of [DICOM Structured Report (SR)](https://highdicom.readthedocs.io/en/latest/generalsr.html) documents as they were developed specifically for the storage of a **large number of similar annotations** and corresponding measurements (hence the full name Microscopy Simple **Bulk** Annotations). A popular example are annotations of small structures like cells or cell nuclei.\n", |
245 | 245 | "\n", |
246 | | - "Each ANN object contains one or more \"Annotation Groups\" consisting of many similar graphical annotations, optionally accompanied by one or several numerical measurements belonging to those graphical annotations as well as some required and some optional metadata that describe the contents of the group (see [here](https://highdicom.readthedocs.io/en/latest/package.html#highdicom.ann.AnnotationGroup) for more information).\n", |
| 246 | + "Each ANN object contains one or more \"Annotation Groups\" consisting of many similar graphical annotations, optionally accompanied by one or several numerical measurements belonging to those graphical annotations as well as some required and some optional metadata that describe the contents of the group. These include an annotation group identifier, a human-readable label but also coded values that describe the category and the type of the annotated structure (see [here](https://highdicom.readthedocs.io/en/latest/package.html#highdicom.ann.AnnotationGroup) for a complete documentation). \n", |
247 | 247 | "\n", |
248 | | - "The following code uses the Python library [highdicom](https://github.com/ImagingDataCommons/highdicom) to extract annotation groups and corresponding measurements from a single DICOM ANN.\n", |
| 248 | + "The following code uses the Python library [highdicom](https://github.com/ImagingDataCommons/highdicom) to extract annotation groups, corresponding measurements and metadata from a single DICOM ANN.\n", |
249 | 249 | "\n", |
250 | | - "In highdicom, the annotation data are encoded as a list of numpy arrays, each of the shape (N x D). N is the number of coordinates which depends on the graphic type, e.g. a `POINT` will have one coordinate, while a `POLYGON` has >= 3 coordinates. Coordinates are either defined in the 2D image coordinate system (D=2), or in the frame-of-reference coordinate system (D=3).\n", |
| 250 | + "In highdicom, the graphic annotation data are encoded as a list of numpy arrays, each of the shape (N x D). N is the number of coordinates which depends on the graphic type, e.g. a `POINT` will have one coordinate, while a `POLYGON` has >= 3 coordinates. Coordinates are either defined in the 2D image coordinate system (D=2), or in the frame-of-reference coordinate system (D=3).\n", |
251 | 251 | "\n", |
252 | 252 | "More explanations and guidance through implementation details for ANN objects in highdicom can be found [here](https://highdicom.readthedocs.io/en/latest/ann.html#microscopy-bulk-simple-annotation-ann-objects)." |
253 | 253 | ] |
|
300 | 300 | } |
301 | 301 | ], |
302 | 302 | "source": [ |
| 303 | + "# Most essential metadata of the annotation group can be accessed as follows:\n", |
303 | 304 | "ann_group = ann_groups[0]\n", |
304 | | - "print(f'Label of the annotation group: {ann_group.label}')\n", |
| 305 | + "print(f'Unique identifier of the annotation group: {ann_group.annotation_group_uid}')\n", |
| 306 | + "print(f'Human-readable label of the annotation group: {ann_group.label}')\n", |
| 307 | + "print(f'Coded label of the annotated property category: {ann_group.annotated_property_category}')\n", |
| 308 | + "print(f'Coded label of the annotated property type: {ann_group.annotated_property_category}') \n", |
305 | 309 | "print(f'Graphic type of annotations: {ann_group.graphic_type}')\n", |
306 | 310 | "print(f'Number of annotations: {ann_group.number_of_annotations}')" |
307 | 311 | ] |
|
326 | 330 | } |
327 | 331 | ], |
328 | 332 | "source": [ |
| 333 | + "# The actual graphical annotation can be accessed as follows:\n", |
329 | 334 | "nuclei_annotations = ann_group.get_graphic_data(coordinate_type='2D')\n", |
330 | 335 | "first_ann = nuclei_annotations[0].tolist()\n", |
331 | 336 | "print(f'First annotation: {first_ann}')" |
|
0 commit comments