<commit_before>from collections import OrderedDict
  
class SubtypingParameters(object):
    """ Class that stores the structure required for Chest Subtyping training
    """
    # MAIN TYPES (Label, abbreviation, color)
    """ Allowed region types """
    __types__ = OrderedDict()
    __types__[84] = ["ILD", "ILD", (1, 0.525, 0)]
    __types__[4] = ["Emphysema", "Emphysema", (0.24, 0.74, 1)]
    __types__[2] = ["Airway", "Airway", (0.097, 0.173, 1)]
    __types__[86] = ["Nodule", "Nodule", (0.49, 0, 0.88)]
    __types__[1] = ["Normal parenchyma", "Normal", (0.28, 0.77, 0.22)]

    @property
    def mainTypes(self):
        return self.__types__

    # SUBTYPES
    """ Allowed tissue types """
    __subtypes__ = OrderedDict()
    __subtypes__[0]  = ("Any", "")
    # ILD
    __subtypes__[85] = ("Subpleural line", "SpL")
    __subtypes__[6] = ("Reticular", "Ret")
    __subtypes__[7] = ("Nodular", "Nodr")
    __subtypes__[5] = ("Ground glass", "GG")
    __subtypes__[37] = ("Honeycombing", "Hon")
    __subtypes__[26] = ("Centrilobular nodule", "Cen")
    __subtypes__[86] = ("Nodule", "Nod")
    __subtypes__[34] = ("Linear scar", "Lin")
    # Emphysema
    __subtypes__[67] = ("Paraseptal", "PSE")
    __subtypes__[68] = ("Centrilobular", "CLE")
    __subtypes__[69] = ("Panlobular", "PLE")
    __subtypes__[10] = ("Mild paraseptal", "Mild PSE")
    __subtypes__[11] = ("Moderate paraseptal", "Mod PSE")
    __subtypes__[12] = ("Severe paraseptal", "Sev PSE")
    __subtypes__[16] = ("Mild centrilobular", "Mild CLE")
    __subtypes__[17] = ("Moderate centrilobular", "Mod CLE")
    __subtypes__[18] = ("Severe centrilobular", "Sev CLE")
    __subtypes__[19] = ("Mild panlobular", "Mild PLE")
    __subtypes__[20] = ("Moderate panlobular", "Mod PLE")
    __subtypes__[21] = ("Severe panlobular", "Sev PLE")
    # Bronchiestatic
    __subtypes__[77] = ("Bronchiectatic", "BE")
    __subtypes__[78] = ("Not bronchiectatic", "non-BE")
    # Nodule
    __subtypes__[87] = ("Benign nodule", "BN")
    __subtypes__[88] = ("Malign nodule", "Tumor")


    @property
    def subtypes(self):
        return self.__subtypes__

    # ARTIFACTS
    __artifacts__ = OrderedDict()
    __artifacts__[0] = ("No artifact", "")
    __artifacts__[1] = ("Undefined", "Artifact")
    __artifacts__[4] = ("Motion", "Motion")

    @property
    def artifacts(self):
        return self.__artifacts__



    """ Allowed combinations"""
    TYPE_ID = 0                 # Type (0-255)
    SUBTYPE_ID = 1              # Subtype (0-255)

    __allowedCombinations__ = ( \
        # ILD
        (84, 0),
        (84, 85),
        (84, 6),
        (84, 7),
        (84, 5),
        (84, 37),
        (84, 26),
        (84, 86),
        (84, 34),
        # EMPHYSEPMA
        (4, 0),
        (4, 67),
        (4, 68),
        (4, 69),
        (4, 10),
        (4, 11),
        (4, 12),
        (4, 16),
        (4, 17),
        (4, 18),
        (4, 19),
        (4, 20),
        (4, 21),
        # AIRWAY
        (2, 0),
        (2, 77),
        (2, 78),
        # NODULE
        (86, 0),
        (86, 87),
        (86, 88),
        # ARTIFACT
        #(95, 0),
        # NORMAL
        (1, 0))


    def getMainTypes(self):
        """ Return all the main types
        :return: Ordered dict of main types<commit_msg>ENH: Added Cystic and Fibronodular to ILD subtypes<commit_after>from collections import OrderedDict
  
class SubtypingParameters(object):
    """ Class that stores the structure required for Chest Subtyping training
    """
    # MAIN TYPES (Label, abbreviation, color)
    """ Allowed region types """
    __types__ = OrderedDict()
    __types__[84] = ["ILD", "ILD", (1, 0.525, 0)]
    __types__[4] = ["Emphysema", "Emphysema", (0.24, 0.74, 1)]
    __types__[2] = ["Airway", "Airway", (0.097, 0.173, 1)]
    __types__[86] = ["Nodule", "Nodule", (0.49, 0, 0.88)]
    __types__[1] = ["Normal parenchyma", "Normal", (0.28, 0.77, 0.22)]

    @property
    def mainTypes(self):
        return self.__types__

    # SUBTYPES
    """ Allowed tissue types """
    __subtypes__ = OrderedDict()
    __subtypes__[0]  = ("Any", "")
    # ILD
    __subtypes__[85] = ("Subpleural line", "SpL")
    __subtypes__[6] = ("Reticular", "Ret")
    __subtypes__[7] = ("Nodular", "Nodr")
    __subtypes__[5] = ("Ground glass", "GG")
    __subtypes__[37] = ("Honeycombing", "Hon")
    __subtypes__[26] = ("Centrilobular nodule", "Cen")
    __subtypes__[86] = ("Nodule", "Nod")
    __subtypes__[34] = ("Linear scar", "Lin")
    __subtypes__[35] = ("Cyst", "Cyst")
    __subtypes__[90] = ("Fibronodular", "Fib")
    # Emphysema
    __subtypes__[67] = ("Paraseptal", "PSE")
    __subtypes__[68] = ("Centrilobular", "CLE")
    __subtypes__[69] = ("Panlobular", "PLE")
    __subtypes__[10] = ("Mild paraseptal", "Mild PSE")
    __subtypes__[11] = ("Moderate paraseptal", "Mod PSE")
    __subtypes__[12] = ("Severe paraseptal", "Sev PSE")
    __subtypes__[16] = ("Mild centrilobular", "Mild CLE")
    __subtypes__[17] = ("Moderate centrilobular", "Mod CLE")
    __subtypes__[18] = ("Severe centrilobular", "Sev CLE")
    __subtypes__[19] = ("Mild panlobular", "Mild PLE")
    __subtypes__[20] = ("Moderate panlobular", "Mod PLE")
    __subtypes__[21] = ("Severe panlobular", "Sev PLE")
    # Bronchiestatic
    __subtypes__[77] = ("Bronchiectatic", "BE")
    __subtypes__[78] = ("Not bronchiectatic", "non-BE")
    # Nodule
    __subtypes__[87] = ("Benign nodule", "BN")
    __subtypes__[88] = ("Malign nodule", "Tumor")


    @property
    def subtypes(self):
        return self.__subtypes__

    # ARTIFACTS
    __artifacts__ = OrderedDict()
    __artifacts__[0] = ("No artifact", "")
    __artifacts__[1] = ("Undefined", "Artifact")
    __artifacts__[4] = ("Motion", "Motion")

    @property
    def artifacts(self):
        return self.__artifacts__



    """ Allowed combinations"""
    TYPE_ID = 0                 # Type (0-255)
    SUBTYPE_ID = 1              # Subtype (0-255)

    __allowedCombinations__ = ( \
        # ILD
        (84, 0),
        (84, 85),
        (84, 6),
        (84, 7),
        (84, 5),
        (84, 37),
        (84, 26),
        (84, 86),
        (84, 34),
        (84, 35),
        (84, 90),
        # EMPHYSEPMA
        (4, 0),
        (4, 67),
        (4, 68),
        (4, 69),
        (4, 10),
        (4, 11),
        (4, 12),
        (4, 16),
        (4, 17),
        (4, 18),
        (4, 19),
        (4, 20),
        (4, 21),
        # AIRWAY
        (2, 0),
        (2, 77),
        (2, 78),
        # NODULE
        (86, 0),
        (86, 87),
        (86, 88),
        # ARTIFACT
        #(95, 0),
        # NORMAL
        (1, 0))


    def getMainTypes(self):
        """ Return all the main types
        :return: Ordered dict of main types
{'fraction_non_alphanumeric': 0.17559171597633136, 'fraction_numerical': 0.06035502958579882, 'mean_word_length': 2.4077620967741935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5558153', 'n_tokens_mistral': 2858, 'n_tokens_neox': 2542, 'n_words': 582}