def catgFile2Segmentation(self):
        """Sync category info from EISegMed3D.json to segmentation

        match by labelValue
        - create if missing
        - correct name if segmentation differes from EISegMed3D.json
        """
        if self._syncingCatg:
            return
        self._syncingCatg = True

        # 1. get info from config file
        name2value = self.getCatgFromFile()
        value2name = {value: name for name, value in name2value.items()}

        # 2. set segmentation's names
        segmentValues = []
        for segment in self.segments:
            labelValue = segment.GetLabelValue()
            segmentValues.append(labelValue)
            name = value2name.get(labelValue, None)
            if name is not None:
                segment.SetName(name)

        # 3. create missing categories
        for labelValue in set(value2name.keys()) - set(segmentValues):
            segmentId = self.segmentation.AddEmptySegment(
                "", value2name[labelValue])
            self.segmentation.GetSegment(segmentId).SetLabelValue(labelValue)

        self._syncingCatg = False
Sync category info from EISegMed3D.json to segmentation

        match by labelValue
        - create if missing
        - correct name if segmentation differes from EISegMed3D.json
        
EISeg/med3d/EISegMed3D/EISegMed3D.py