(
self, stats_name: str = DataStatsKeys.LABEL_STATS, average: bool | None = True, do_ccp: bool | None = True
)
| 719 | """ |
| 720 | |
| 721 | def __init__( |
| 722 | self, stats_name: str = DataStatsKeys.LABEL_STATS, average: bool | None = True, do_ccp: bool | None = True |
| 723 | ): |
| 724 | self.summary_average = average |
| 725 | self.do_ccp = do_ccp |
| 726 | |
| 727 | report_format: dict[str, Any] = { |
| 728 | LabelStatsKeys.LABEL_UID: None, |
| 729 | LabelStatsKeys.IMAGE_INTST: None, |
| 730 | LabelStatsKeys.LABEL: [{LabelStatsKeys.PIXEL_PCT: None, LabelStatsKeys.IMAGE_INTST: None}], |
| 731 | } |
| 732 | if self.do_ccp: |
| 733 | report_format[LabelStatsKeys.LABEL][0].update( |
| 734 | {LabelStatsKeys.LABEL_SHAPE: None, LabelStatsKeys.LABEL_NCOMP: None} |
| 735 | ) |
| 736 | |
| 737 | super().__init__(stats_name, report_format) |
| 738 | self.update_ops(LabelStatsKeys.IMAGE_INTST, SummaryOperations()) |
| 739 | |
| 740 | # label-0-'pixel percentage' |
| 741 | id_seq = ID_SEP_KEY.join([LabelStatsKeys.LABEL, "0", LabelStatsKeys.PIXEL_PCT]) |
| 742 | self.update_ops_nested_label(id_seq, SampleOperations()) |
| 743 | # label-0-'image intensity' |
| 744 | id_seq = ID_SEP_KEY.join([LabelStatsKeys.LABEL, "0", LabelStatsKeys.IMAGE_INTST]) |
| 745 | self.update_ops_nested_label(id_seq, SummaryOperations()) |
| 746 | # label-0-shape |
| 747 | id_seq = ID_SEP_KEY.join([LabelStatsKeys.LABEL, "0", LabelStatsKeys.LABEL_SHAPE]) |
| 748 | self.update_ops_nested_label(id_seq, SampleOperations()) |
| 749 | # label-0-ncomponents |
| 750 | id_seq = ID_SEP_KEY.join([LabelStatsKeys.LABEL, "0", LabelStatsKeys.LABEL_NCOMP]) |
| 751 | self.update_ops_nested_label(id_seq, SampleOperations()) |
| 752 | |
| 753 | def __call__(self, data: list[dict]) -> dict: |
| 754 | """ |
nothing calls this directly
no test coverage detected