def __init__(self, operator, projectFileGroupName):
        self.VERSION = 1
        self._serialClassifierSlot = SerialClassifierSlot(
            operator.Classifier,
            operator.classifier_cache,
            name="ClassifierForests")
        slots = [
            SerialListSlot(operator.LabelNames),
            SerialListSlot(operator.LabelColors,
                           transform=lambda x: tuple(x.flat)),
            SerialListSlot(operator.PmapColors,
                           transform=lambda x: tuple(x.flat)),
            SerialPickleableSlot(operator.Bookmarks, self.VERSION),
            BackwardsCompatibleLabelSerialBlockSlot(
                operator.LabelImages,
                operator.LabelInputs,
                operator.NonzeroLabelBlocks,
                name="LabelSets",
                subname="labels{:03d}",
                selfdepends=False,
                shrink_to_bb=True,
            ),
            SerialClassifierFactorySlot(operator.ClassifierFactory),
            self._serialClassifierSlot,
        ]

        super(PixelClassificationSerializer,
              self).__init__(projectFileGroupName, slots, operator)
Example #2
0
    def __init__(self, operator, projectFileGroupName):
        self._serialClassifierSlot =  SerialClassifierSlot(operator.Classifier,
                                                           operator.classifier_cache,
                                                           name="ClassifierForests")
        slots = [SerialListSlot(operator.LabelNames,
                                transform=str),
                 SerialListSlot(operator.LabelColors, transform=lambda x: tuple(x.flat)),
                 SerialListSlot(operator.PmapColors, transform=lambda x: tuple(x.flat)),
                 SerialBlockSlot(operator.LabelImages,
                                 operator.LabelInputs,
                                 operator.NonzeroLabelBlocks,
                                 name='LabelSets',
                                 subname='labels{:03d}',
                                 selfdepends=False,
                                 shrink_to_bb=True),
                 SerialClassifierFactorySlot(operator.ClassifierFactory),
                 self._serialClassifierSlot ]

        super(PixelClassificationSerializer, self).__init__(projectFileGroupName, slots, operator)
Example #3
0
    def __init__(self, operator, projectFileGroupName):
        self.VERSION = 1  # Make sure to bump the version in case you make any changes in the serialization
        self._serialClassifierSlot = SerialClassifierSlot(
            operator.Classifier,
            operator.classifier_cache,
            name="ClassifierForests")
        slots = [
            SerialListSlot(operator.LabelNames),
            SerialListSlot(operator.LabelColors,
                           transform=lambda x: tuple(x.flat)),
            SerialListSlot(operator.PmapColors,
                           transform=lambda x: tuple(x.flat)),
            SerialPickleableSlot(operator.Bookmarks, self.VERSION),
            SerialBlockSlot(
                operator.LabelImages,
                operator.LabelInputs,
                operator.NonzeroLabelBlocks,
                name="LabelSets",
                subname="labels{:03d}",
                selfdepends=False,
                shrink_to_bb=True,
            ),
            SerialClassifierFactorySlot(operator.ClassifierFactory),
            self._serialClassifierSlot,
            SerialBlockSlot(
                operator.opSupervoxelFeaturesAndLabels.SupervoxelFeatures,
                operator.opSupervoxelFeaturesAndLabels.
                CacheSupervoxelFeaturesInput,
                operator.opSupervoxelFeaturesAndLabels.
                SupervoxelFeaturesCleanBlocks,
            ),
            SerialBlockSlot(
                operator.opSupervoxelFeaturesAndLabels.SupervoxelLabels,
                operator.opSupervoxelFeaturesAndLabels.
                CacheSupervoxelLabelsInput,
                operator.opSupervoxelFeaturesAndLabels.
                SupervoxelLabelsCleanBlocks,
            ),
        ]

        super(VoxelSegmentationSerializer,
              self).__init__(projectFileGroupName, slots, operator)