コード例 #1
0
    def __init__(self, mainOperator, projectFileGroupName):
        # Serialization for the new pipeline (HyTra)
        if WITH_HYTRA:
            slots = [
                SerialDictSlot(mainOperator.Parameters, selfdepends=True),
                SerialDictSlot(mainOperator.EventsVector,
                               transform=str,
                               selfdepends=True),
                SerialDictSlot(mainOperator.FilteredLabels,
                               transform=str,
                               selfdepends=True),
                SerialPickledValueSlot(mainOperator.ExportSettings),
                SerialPickleableSlot(mainOperator.HypothesesGraph,
                                     self.VERSION, None),
                SerialPickleableSlot(mainOperator.ResolvedMergers,
                                     self.VERSION, None)
            ]

        # Serialization for backward compatibility (for tracking with pgmlink)
        # TODO: Remove this section when Windows supports the new pipeline (HyTra)
        else:
            try:
                import pgmlink
            except:
                import pgmlinkNoIlpSolver as pgmlink

            slots = [
                SerialDictSlot(mainOperator.Parameters, selfdepends=True),
                SerialHdf5BlockSlot(mainOperator.OutputHdf5,
                                    mainOperator.InputHdf5,
                                    mainOperator.CleanBlocks,
                                    name="CachedOutput"),
                SerialDictSlot(mainOperator.EventsVector,
                               transform=str,
                               selfdepends=True),
                SerialDictSlot(mainOperator.FilteredLabels,
                               transform=str,
                               selfdepends=True),
                SerialPickledValueSlot(mainOperator.ExportSettings)
            ]

            if 'MergerOutput' in mainOperator.outputs:
                slots.append(
                    SerialHdf5BlockSlot(mainOperator.MergerOutputHdf5,
                                        mainOperator.MergerInputHdf5,
                                        mainOperator.MergerCleanBlocks,
                                        name="MergerCachedOutput"), )

            if 'CoordinateMap' in mainOperator.outputs:
                slots.append(
                    SerialPickleableSlot(mainOperator.CoordinateMap, 1,
                                         pgmlink.TimestepIdCoordinateMap()))

        super(TrackingSerializer, self).__init__(projectFileGroupName,
                                                 slots=slots)
コード例 #2
0
    def __init__(self, mainOperator, projectFileGroupName):
        slots = [
            SerialDictSlot(mainOperator.Parameters, selfdepends=True),
            SerialHdf5BlockSlot(mainOperator.OutputHdf5,
                                mainOperator.InputHdf5,
                                mainOperator.CleanBlocks,
                                name="CachedOutput"),
            SerialDictSlot(mainOperator.EventsVector,
                           transform=str,
                           selfdepends=True),
            SerialDictSlot(mainOperator.FilteredLabels,
                           transform=str,
                           selfdepends=True),
        ]

        if 'MergerOutput' in mainOperator.outputs:
            slots.append(
                SerialHdf5BlockSlot(mainOperator.MergerOutputHdf5,
                                    mainOperator.MergerInputHdf5,
                                    mainOperator.MergerCleanBlocks,
                                    name="MergerCachedOutput"), )

        if 'CoordinateMap' in mainOperator.outputs:
            slots.append(
                SerialPickleableSlot(mainOperator.CoordinateMap, 1,
                                     pgmlink.TimestepIdCoordinateMap()))

        super(TrackingSerializer, self).__init__(projectFileGroupName,
                                                 slots=slots)
コード例 #3
0
    def __init__(self, topLevelOperator, projectFileGroupName):
        slots = [
            SerialDictSlot(topLevelOperator.Parameters, selfdepends=True),
            SerialHdf5BlockSlot(topLevelOperator.OutputHdf5,
                                topLevelOperator.InputHdf5,
                                topLevelOperator.CleanBlocks,
                                name="CachedOutput"),
            SerialDictSlot(topLevelOperator.EventsVector,
                           transform=str,
                           selfdepends=True),
            SerialDictSlot(topLevelOperator.FilteredLabels,
                           transform=str,
                           selfdepends=True),
            SerialSlot(topLevelOperator.DivisionWeight),
            SerialSlot(topLevelOperator.DetectionWeight),
            SerialSlot(topLevelOperator.TransitionWeight),
            SerialSlot(topLevelOperator.AppearanceWeight),
            SerialSlot(topLevelOperator.DisappearanceWeight),
            SerialSlot(topLevelOperator.MaxNumObjOut)
        ]

        if 'MergerOutput' in topLevelOperator.outputs:
            slots.append(
                SerialHdf5BlockSlot(topLevelOperator.MergerOutputHdf5,
                                    topLevelOperator.MergerInputHdf5,
                                    topLevelOperator.MergerCleanBlocks,
                                    name="MergerCachedOutput"), )

        if 'CoordinateMap' in topLevelOperator.outputs:
            slots.append(
                SerialPickleableSlot(topLevelOperator.CoordinateMap, 1,
                                     pgmlink.TimestepIdCoordinateMap()))

        super(StructuredTrackingSerializer,
              self).__init__(projectFileGroupName, slots=slots)
コード例 #4
0
    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)
コード例 #5
0
    def __init__(self, topLevelOperator, projectFileGroupName):

        if WITH_HYTRA:
            slots = [
                SerialDictSlot(topLevelOperator.Parameters, selfdepends=True),
                SerialDictSlot(topLevelOperator.FilteredLabels,
                               transform=str,
                               selfdepends=True),
                SerialPickledValueSlot(topLevelOperator.ExportSettings),
                SerialPickledValueSlot(topLevelOperator.HypothesesGraph),
                SerialPickledValueSlot(topLevelOperator.ResolvedMergers),
                SerialSlot(topLevelOperator.DivisionWeight),
                SerialSlot(topLevelOperator.DetectionWeight),
                SerialSlot(topLevelOperator.TransitionWeight),
                SerialSlot(topLevelOperator.AppearanceWeight),
                SerialSlot(topLevelOperator.DisappearanceWeight),
                SerialSlot(topLevelOperator.MaxNumObjOut)
            ]
        else:
            try:
                import pgmlink
            except:
                import pgmlinkNoIlpSolver as pgmlink

            slots = [
                SerialDictSlot(topLevelOperator.Parameters, selfdepends=True),
                SerialHdf5BlockSlot(topLevelOperator.OutputHdf5,
                                    topLevelOperator.InputHdf5,
                                    topLevelOperator.CleanBlocks,
                                    name="CachedOutput"),
                SerialDictSlot(topLevelOperator.EventsVector,
                               transform=str,
                               selfdepends=True),
                SerialDictSlot(topLevelOperator.FilteredLabels,
                               transform=str,
                               selfdepends=True),
                SerialSlot(topLevelOperator.DivisionWeight),
                SerialSlot(topLevelOperator.DetectionWeight),
                SerialSlot(topLevelOperator.TransitionWeight),
                SerialSlot(topLevelOperator.AppearanceWeight),
                SerialSlot(topLevelOperator.DisappearanceWeight),
                SerialSlot(topLevelOperator.MaxNumObjOut)
            ]

            if 'MergerOutput' in topLevelOperator.outputs:
                slots.append(
                    SerialHdf5BlockSlot(topLevelOperator.MergerOutputHdf5,
                                        topLevelOperator.MergerInputHdf5,
                                        topLevelOperator.MergerCleanBlocks,
                                        name="MergerCachedOutput"), )

            if 'CoordinateMap' in topLevelOperator.outputs:
                slots.append(
                    SerialPickleableSlot(topLevelOperator.CoordinateMap, 1,
                                         pgmlink.TimestepIdCoordinateMap()))

        super(StructuredTrackingSerializer,
              self).__init__(projectFileGroupName,
                             slots=slots,
                             operator=topLevelOperator)
コード例 #6
0
    def __init__(self, mainOperator, projectFileGroupName):
        # Serialization for the new pipeline (HyTra)
        slots = [
            SerialDictSlot(mainOperator.Parameters, selfdepends=True),
            SerialDictSlot(mainOperator.FilteredLabels,
                           transform=str,
                           selfdepends=True),
            SerialPickleableSlot(mainOperator.ExportSettings, self.VERSION,
                                 None),
            SerialPickleableSlot(mainOperator.HypothesesGraph, self.VERSION,
                                 None),
            SerialPickleableSlot(mainOperator.ResolvedMergers, self.VERSION,
                                 None)
        ]

        super(TrackingSerializer, self).__init__(projectFileGroupName,
                                                 slots=slots)
コード例 #7
0
    def __init__(self, topLevelOperator, projectFileGroupName):
        self.VERSION = 1

        slots = [
            SerialPickleableSlot(topLevelOperator.FullModel, version=1),
            SerialDictSlot(topLevelOperator.ModelPath),
        ]

        super(NNClassificationSerializer,
              self).__init__(projectFileGroupName, slots)
コード例 #8
0
    def __init__(self, topLevelOperator, projectFileGroupName):
        self.VERSION = 1  # Make sure to bump the version in case you make any changes in the serialization
        try:
            slots = [ SerialDictSlot(topLevelOperator.Parameters, selfdepends=True),
                      SerialDictSlot(topLevelOperator.FilteredLabels, transform=str, selfdepends=True),
                      SerialPickleableSlot(topLevelOperator.ExportSettings, version=self.VERSION),
                      SerialPickleableSlot(topLevelOperator.HypothesesGraph, version=self.VERSION),
                      SerialPickleableSlot(topLevelOperator.LearningHypothesesGraph, version=self.VERSION),
                      SerialPickleableSlot(topLevelOperator.ResolvedMergers, version=self.VERSION),
                      SerialSlot(topLevelOperator.DivisionWeight),
                      SerialSlot(topLevelOperator.DetectionWeight),
                      SerialSlot(topLevelOperator.TransitionWeight),
                      SerialSlot(topLevelOperator.AppearanceWeight),
                      SerialSlot(topLevelOperator.DisappearanceWeight),
                      SerialSlot(topLevelOperator.MaxNumObjOut)
            ]
        except:
            slots = [ SerialDictSlot(topLevelOperator.Parameters, selfdepends=True),
                      SerialDictSlot(topLevelOperator.FilteredLabels, transform=str, selfdepends=True),
                      SerialPickleableSlot(topLevelOperator.ExportSettings, version=self.VERSION),
                      SerialPickleableSlot(topLevelOperator.ResolvedMergers, version=self.VERSION),
                      SerialSlot(topLevelOperator.DivisionWeight),
                      SerialSlot(topLevelOperator.DetectionWeight),
                      SerialSlot(topLevelOperator.TransitionWeight),
                      SerialSlot(topLevelOperator.AppearanceWeight),
                      SerialSlot(topLevelOperator.DisappearanceWeight),
                      SerialSlot(topLevelOperator.MaxNumObjOut)
            ]

        super(StructuredTrackingSerializer, self ).__init__(projectFileGroupName, slots=slots, operator=topLevelOperator)
コード例 #9
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)
コード例 #10
0
    def __init__(self, topGroupName, operator):
        self.VERSION = 1  # Make sure to bump the version in case you make any changes in the serialization
        serialSlots = [
            SerialDictSlot(operator.SelectedFeatures),
            SerialListSlot(operator.LabelNames),
            SerialListSlot(operator.LabelColors,
                           transform=lambda x: tuple(x.flat)),
            SerialListSlot(operator.PmapColors,
                           transform=lambda x: tuple(x.flat)),
            SerialDictSlot(operator.LabelInputs, transform=int),
            SerialClassifierSlot(operator.Classifier,
                                 operator.classifier_cache,
                                 name="ClassifierForests"),
            SerialDictSlot(operator.CachedProbabilities,
                           operator.InputProbabilities,
                           transform=int),
            SerialSlot(operator.MaxNumObj),
            SerialPickleableSlot(operator.ExportSettings, self.VERSION, None)
        ]

        super(ObjectClassificationSerializer, self).__init__(topGroupName,
                                                             slots=serialSlots,
                                                             operator=operator)