File size: 3,757 Bytes
55f9952
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
"""
This file contains the masks used in the datasets. The masks are defined as mask dataclasses.

Each mask has the following attributes:
- id: int - the id of the mask
- radlex_name: str - the name of the mask in RadLex
- color: int - the color of the mask
- radlex_id: str - the id of the mask in RadLex
- source_names: dict - the names of the mask in other datasets, meant to be helpful when translating new source dataset masks to UMIE.
"""
from dataclasses import dataclass, field
from typing import Optional


@dataclass
class Mask:
    """This class represents a mask."""

    id: int  # The unique id of the mask in UMIE (also the value of the mask in the mask image)
    radlex_name: str  # The name of the mask in RadLex
    color: int  # The color of the mask in the mask image
    radlex_id: str  # The id of the mask in RadLex
    source_names: Optional[dict] = field(
        default_factory=dict
    )  # How the mask is named in other datasets, key - dataset name, value - source mask name in this dataset


Background = Mask(
    id=0, radlex_name="Background", color=0, radlex_id=""
)  # Actually there is no radlex for backgroud ofc but "Normality descriptor" didnt fit either

Kidney = Mask(
    id=1, radlex_name="Kidney", color=1, radlex_id="RID205", source_names={"kits23": ["kidney"], "ct_org": ["Kidney"]}
)

Neoplasm = Mask(
    id=2,
    radlex_name="Neoplasm",
    color=2,
    radlex_id="RID3957",
    source_names={"kits23": ["kidney tumor"], "brain_tumor_progression": ["Brain tumor"], "lits": ["liver_tumor"]},
)
RenalCyst = Mask(id=3, radlex_name="RenalCyst", color=3, radlex_id="RID35811", source_names={"kits23": ["cyst"]})
ViralInfection = Mask(
    id=4, radlex_name="ViralInfection", color=4, radlex_id="RID4687", source_names={"mos_med_data": ["CT-1"]}
)

Lung = Mask(
    id=5,
    radlex_name="Lung",
    color=5,
    radlex_id="RID1301",
    source_names={
        "ct_org": ["lungs"],
        "chest_xray_masks_and_label": ["Lungs"],
        "finding_and_measuring_lungs": ["lungs"],
    },
)

BoneOrgan = Mask(id=6, radlex_name="BoneOrgan", color=6, radlex_id="RID13197", source_names={"ct_org": ["Bones"]})

Liver = Mask(id=7, radlex_name="Liver", color=7, radlex_id="RID58", source_names={"ct_org": ["liver"]})

UrinaryBladder = Mask(
    id=8, radlex_name="UrinaryBladder", color=8, radlex_id="RID237", source_names={"ct_org": ["bladder"]}
)

Brain = Mask(id=9, radlex_name="Brain", color=9, radlex_id="RID6434", source_names={"ct_org": ["Brain"]})

Nodule = Mask(
    id=10,
    radlex_name="Nodule",
    color=10,
    radlex_id="RID3875",
    source_names={"lidc_idri": ["Nodule>=3mm", "Nodule<3mm"]},
)

Lesion = Mask(
    id=11, radlex_name="Lesion", color=11, radlex_id="RID38780", source_names={"lidc_idri": ["Non-nodule>=3mm"]}
)  # That is not a nodule

CalciumScore = Mask(
    id=12,
    radlex_name="CalciumScore",
    color=12,
    radlex_id="RID28808",
    source_names={"coca": ["coronary_artery_calcium"]},
)

Metastasis = Mask(
    id=13,
    radlex_name="Metastasis",
    color=13,
    radlex_id="RID5231",
    source_names={"brain_met_share": ["brain_metastasis"]},
)

Hemorrhage = Mask(
    id=14,
    radlex_name="Hemorrhage",
    color=14,
    radlex_id="RID4700",
    source_names={"brain_with_intracranial_hemorrhage": ["brain_hemorrhage"]},
)

Calcification = Mask(
    id=15,
    radlex_name="Calcification",
    color=15,
    radlex_id="RID5196",
    source_names={"Chest_X-ray_Abnormalities_Detection": ["Calcification"], "cmmd": ["calcification"]},
)

Mass = Mask(
    id=16,
    radlex_name="Mass",
    color=16,
    radlex_id="RID3874",
    source_names={"ChestX-ray14": ["Mass"], "cmmd": ["mass"]},
)
all_masks = [obj for name, obj in globals().items() if isinstance(obj, Mask)]