Exemple #1
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)
Exemple #2
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)
Exemple #3
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),
            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)
    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)),
                 SerialPickledValueSlot(operator.Bookmarks),
                 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)
Exemple #5
0
    def __init__(self, topGroupName, operator):
        serialSlots = [
            SerialDictSlot(operator.SelectedFeatures, transform=str),
            SerialListSlot(operator.LabelNames, transform=str),
            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),
            #SerialDictSlotWithoutDeserialization(operator.Probabilities, operator, transform=str)
            SerialPickledValueSlot(operator.ExportSettings)
        ]

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