notmatthancock / pylidc

An object relational mapping for the LIDC dataset using sqlalchemy.
https://pylidc.github.io
Other
105 stars 41 forks source link

Annotation slice number #65

Closed longchingkwok331 closed 7 months ago

longchingkwok331 commented 7 months ago

image

Hi, there a GUI for visualizing the scans and some meta information by using _scan.visualize(annotationgroups=nods)

However, is it possible to extract the information about the slice number of annotation e.g. nodule 1, near slice 25 how can I extract this information using the pulidc functions?

Thank you

notmatthancock commented 7 months ago

this example snippet might help:

import numpy as np
import pylidc

scan = pylidc.query(pylidc.Scan).first()
annotation_groups = scan.cluster_annotations()

for group in annotation_groups:
    print(np.mean([annotation.contour_slice_indices.mean() for annotation in group]))

# prints: 
# 25.375
# 46.5
# 47.5
# 67.625

You can also use the Annotation.centroid and Annotation.contours_matrix properties.

longchingkwok331 commented 7 months ago

thank you very much