コード例 #1
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)
コード例 #2
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)
コード例 #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),
        ]

        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)
コード例 #4
0
    def __init__(self, operator, projectFileGroupName):
        slots = [
            SerialBlockSlot(operator.LabelImage,
                            operator.LabelImageCacheInput,
                            operator.CleanLabelBlocks,
                            name='LabelImage_v2',
                            subname='labelimage{:03d}',
                            selfdepends=False,
                            shrink_to_bb=False,
                            compression_level=1),
            SerialDictSlot(operator.FeatureNamesVigra),
            SerialDictSlot(operator.FeatureNamesDivision),
            SerialObjectFeaturesSlot(operator.BlockwiseRegionFeaturesVigra,
                                     operator.RegionFeaturesCacheInputVigra,
                                     operator.RegionFeaturesCleanBlocksVigra,
                                     name="RegionFeaturesVigra"),
            SerialObjectFeaturesSlot(
                operator.BlockwiseRegionFeaturesDivision,
                operator.RegionFeaturesCacheInputDivision,
                operator.RegionFeaturesCleanBlocksDivision,
                name="RegionFeaturesDivision"),
        ]

        super(TrackingFeatureExtractionSerializer,
              self).__init__(projectFileGroupName, slots=slots)
コード例 #5
0
    def __init__(self, topGroupName, operator):
        serialSlots = [SerialDictSlot(operator.BlockShape3dDict, selfdepends=True),
                       SerialDictSlot(operator.HaloPadding3dDict, selfdepends=True)]

        super(BlockwiseObjectClassificationSerializer, self ).__init__(topGroupName,
                                                              slots=serialSlots,
                                                              operator=operator)
コード例 #6
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)
コード例 #7
0
    def __init__(self, mainOperator, projectFileGroupName):
        # Serialization for the new pipeline (HyTra)
        if WITH_HYTRA:
            slots = [
                SerialDictSlot(mainOperator.Parameters, 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)
コード例 #8
0
    def __init__(self,
                 workflow,
                 title,
                 is_batch=False,
                 default_export_filename=''):
        self.export_op = None
        self._default_export_filename = default_export_filename

        self.__topLevelOperator = OpMultiLaneWrapper(
            OpTrackingBaseDataExport,
            parent=workflow,
            promotedSlotNames=set(['RawData', 'Inputs', 'RawDatasetInfo']))

        extra_serial_slots = [
            SerialSlot(self.topLevelOperator.SelectedPlugin),
            SerialSlot(self.topLevelOperator.SelectedExportSource),
            SerialDictSlot(self.topLevelOperator.AdditionalPluginArguments)
        ]
        self._serializers = [
            DataExportSerializer(self.topLevelOperator, title,
                                 extra_serial_slots)
        ]

        super(TrackingBaseDataExportApplet, self).__init__(workflow,
                                                           title,
                                                           isBatch=is_batch)
コード例 #9
0
    def __init__(
        self,
        workflow,
        title,
        is_batch: bool = False,
        default_export_filename: str = "",
        pluginExportFunc: Optional[PluginExportCallable] = None,
    ):
        self.export_op = None
        self._default_export_filename = default_export_filename

        self.__topLevelOperator = OpMultiLaneWrapper(
            OpTrackingBaseDataExport,
            parent=workflow,
            promotedSlotNames=set(["RawData", "Inputs", "RawDatasetInfo"]))

        extra_serial_slots = [
            SerialSlot(self.topLevelOperator.SelectedPlugin),
            SerialSlot(self.topLevelOperator.SelectedExportSource),
            SerialDictSlot(self.topLevelOperator.AdditionalPluginArguments),
        ]
        self._serializers = [
            DataExportSerializer(self.topLevelOperator, title,
                                 extra_serial_slots)
        ]
        self._pluginExportFunc = pluginExportFunc

        super(TrackingBaseDataExportApplet, self).__init__(workflow,
                                                           title,
                                                           isBatch=is_batch)
コード例 #10
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)
コード例 #11
0
    def __init__(self, topLevelOperator, projectFileGroupName):
        self.VERSION = 1

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

        super(NNClassificationSerializer,
              self).__init__(projectFileGroupName, slots)
コード例 #12
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",
                                 subname="Forest{:04d}"),
            SerialDictSlot(operator.CachedProbabilities,
                           operator.InputProbabilities,
                           transform=int),
        ]

        super(ObjectClassificationSerializer, self ).__init__(topGroupName,
                                                              slots=serialSlots,
                                                              operator=operator)
コード例 #13
0
 def __init__(self, mainOperator, projectFileGroupName):
     slots = [
         SerialDictSlot(mainOperator.Parameters, selfdepends=True),
         #                  SerialSlot(mainOperator.Output, selfdepends=True),
         SerialHdf5BlockSlot(mainOperator.OutputHdf5,
                             mainOperator.InputHdf5,
                             mainOperator.CleanBlocks,
                             name="CachedOutput"),
     ]
     super(TrackingSerializer, self).__init__(projectFileGroupName,
                                              slots=slots)
コード例 #14
0
    def __init__(self, operator, projectFileGroupName):
        slots = [
            SerialHdf5BlockSlot(operator.LabelOutputHdf5,
                                operator.LabelInputHdf5,
                                operator.CleanLabelBlocks,
                                name="LabelImage"),
            SerialDictSlot(operator.FeatureNamesVigra, transform=str),
            SerialDictSlot(operator.FeatureNamesDivision, transform=str),
            SerialObjectFeaturesSlot(operator.BlockwiseRegionFeaturesVigra,
                                     operator.RegionFeaturesCacheInputVigra,
                                     operator.RegionFeaturesCleanBlocksVigra,
                                     name="RegionFeaturesVigra"),
            SerialObjectFeaturesSlot(
                operator.BlockwiseRegionFeaturesDivision,
                operator.RegionFeaturesCacheInputDivision,
                operator.RegionFeaturesCleanBlocksDivision,
                name="RegionFeaturesDivision"),
        ]

        super(TrackingFeatureExtractionSerializer,
              self).__init__(projectFileGroupName, slots=slots)
コード例 #15
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)
コード例 #16
0
 def __init__(self, operator, projectFileGroupName):
     slots = [
         SerialDictSlot(operator.FeatureNames),
         SerialEdgeLabelsDictSlot(operator.EdgeLabelsDict),
         SerialRagSlot(operator.Rag, operator.opRagCache,
                       operator.Superpixels),
         SerialCachedDataFrameSlot(operator.opEdgeFeaturesCache.Output,
                                   operator.opEdgeFeaturesCache,
                                   name="EdgeFeatures"),
         SerialClassifierSlot(operator.opClassifierCache.Output,
                              operator.opClassifierCache)
     ]
     super(EdgeTrainingSerializer, self).__init__(projectFileGroupName,
                                                  slots=slots)
コード例 #17
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)
コード例 #18
0
    def __init__(self, operator, projectFileGroupName):
        slots = [
            SerialHdf5BlockSlot(operator.LabelOutputHdf5,
                                operator.LabelInputHdf5,
                                operator.CleanLabelBlocks,
                                name="LabelImage"),
            SerialDictSlot(operator.Features, transform=str),
            SerialObjectFeaturesSlot(operator.BlockwiseRegionFeatures,
                                     operator.RegionFeaturesCacheInput,
                                     operator.RegionFeaturesCleanBlocks,
                                     name="RegionFeatures"),
        ]

        super(ObjectExtractionSerializer, self).__init__(projectFileGroupName,
                                                         slots=slots)
コード例 #19
0
    def __init__(self, operator, projectFileGroupName):
        slots = [
            SerialDictSlot(operator.Crops),
            SerialSlot(operator.MinValueT, selfdepends=True),
            SerialSlot(operator.MaxValueT, selfdepends=True),
            SerialSlot(operator.MinValueX, selfdepends=True),
            SerialSlot(operator.MaxValueX, selfdepends=True),
            SerialSlot(operator.MinValueY, selfdepends=True),
            SerialSlot(operator.MaxValueY, selfdepends=True),
            SerialSlot(operator.MinValueZ, selfdepends=True),
            SerialSlot(operator.MaxValueZ, selfdepends=True),
        ]

        super(CropSelectionSerializer, self).__init__(projectFileGroupName,
                                                      slots=slots)
コード例 #20
0
    def __init__(self, operator, projectFileGroupName):
        slots = [
            SerialSlot(operator.CurOperator, selfdepends=True),
            SerialSlot(operator.MinSize, selfdepends=True),
            SerialSlot(operator.MaxSize, selfdepends=True),
            SerialSlot(operator.HighThreshold, selfdepends=True),
            SerialSlot(operator.LowThreshold, selfdepends=True),
            SerialSlot(operator.SingleThreshold, selfdepends=True),
            SerialDictSlot(operator.SmootherSigma, selfdepends=True),
            SerialSlot(operator.Channel, selfdepends=True),
            SerialHdf5BlockSlot(operator.OutputHdf5,
                                operator.InputHdf5,
                                operator.CleanBlocks,
                                name="CachedThresholdOutput")
        ]

        super(self.__class__, self).__init__(projectFileGroupName, slots=slots)
コード例 #21
0
    def __init__(self, operator, projectFileGroupName):
        slots = [
            SerialBlockSlot(operator.LabelImage,
                            operator.LabelImageCacheInput,
                            operator.CleanLabelBlocks,
                            name='LabelImage_v2',
                            subname='labelimage{:03d}',
                            selfdepends=False,
                            shrink_to_bb=False,
                            compression_level=1),
            SerialDictSlot(operator.Features, transform=str),
            SerialObjectFeaturesSlot(operator.BlockwiseRegionFeatures,
                                     operator.RegionFeaturesCacheInput,
                                     operator.RegionFeaturesCleanBlocks,
                                     name="RegionFeatures"),
        ]

        super(ObjectExtractionSerializer, self).__init__(projectFileGroupName,
                                                         slots=slots)
コード例 #22
0
    def __init__(self, operator, projectFileGroupName):
        slots = [
            SerialSlot(operator.CurOperator, selfdepends=True),
            SerialSlot(operator.MinSize, selfdepends=True),
            SerialSlot(operator.MaxSize, selfdepends=True),
            SerialSlot(operator.HighThreshold, selfdepends=True),
            SerialSlot(operator.LowThreshold, selfdepends=True),
            SerialDictSlot(operator.SmootherSigma, selfdepends=True),
            SerialSlot(operator.Channel, selfdepends=True),
            SerialSlot(operator.CoreChannel, selfdepends=True),
            SerialBlockSlot(operator.CachedOutput,
                            operator.CacheInput,
                            operator.CleanBlocks,
                            name='CachedThresholdLabels',
                            subname='threshold{:03d}',
                            selfdepends=False,
                            shrink_to_bb=False,
                            compression_level=1)
        ]

        super(self.__class__, self).__init__(projectFileGroupName, slots,
                                             operator)
コード例 #23
0
ファイル: testSerializer.py プロジェクト: syaffa/ilastik
 def __init__(self, operator, groupName):
     self.ss = SerialDictSlot(operator.InputDict)
     super(TestSerialDictSlot.SerializerForOpWithDictSlot,
           self).__init__(groupName, [self.ss])
コード例 #24
0
 def serialize(self, group):
     #if self.slot.ready() and self.mainOperator._predict_enabled:
     return SerialDictSlot.serialize(self, group)
コード例 #25
0
 def serialize(self, group):
     #if self.slot.ready() and self.mainOperator._predict_enabled:
     return SerialDictSlot.serialize(self, group)