Skip to main content

DicomAnnotationData Objects

@dataclass(frozen=True)
class DicomAnnotationData()

multiframe_frame_number

only present for multi-frame DICOMs

CocoExporter Objects

class CocoExporter()
This class is intentionally designed in a modular fashion to facilitate extensibility. You are encouraged to subclass this exporter and modify any of the custom functions. While return types are provided for convenience, they can also be subclassed to suit your specific requirements. All functions that could be static are intentionally not made static, allowing you the option to access the self object at any time.

get_categories

def get_categories() -> List[Dict[str, Any]]
This does not translate classifications as they are not part of the Coco spec.

get_images

def get_images() -> List[Dict[str, Any]]
All the data is in the specific label_row

get_polyline

def get_polyline(object_: Dict, image_id: int, size: Size,
                 object_answers: Dict, object_actions: Dict) -> CocoAnnotation
Polylines are technically not supported in COCO, but here we use a trick to allow a representation.

join_polyline_from_polygon

@staticmethod
def join_polyline_from_polygon(polygon: List[float]) -> List[float]
Essentially a trick to represent a polyline in coco. We pretend for this to be a polygon and join every coordinate from the end back to the beginning, so it will essentially be an area-less polygon. This function technically changes the input polygon in place.

add_unselected_attributes

def add_unselected_attributes(feature_hash: str,
                              attributes_dict: Dict[str, Optional[bool]],
                              match_dynamic_attributes: bool) -> None
Attributes which have never been selected will not show up in the actions map. They will need to be added separately. NOTE: this assumes uniqueness of features. Quite an edge case but if it ever comes up it needs to be solved somewhere here.