Esempio n. 1
0
    def OnChangeFeatures(self, event):
    #---------------------------------------------------------------------------
        from gamera import plugin
        from gamera.core import ONEBIT
        from gamera.core import ImageBase
        from gamera.args import Args, Check

        if self.classifier is None:
            gui.message("No classifier loaded")
            return

        allFeatures = [x[0] for x in plugin.methods_flat_category("Features", ONEBIT)]
        allFeatures.sort()

        existingFeatures = [x[0] for x in ImageBase.get_feature_functions(self.classifier.features)[0]]

        featureControls = []
        for f in allFeatures:
            featureControls.append(Check('', f, default=(f in existingFeatures)))

        dialog = Args(featureControls, name = "Feature selection",
            title="Select the features you want to use for optimization")

        result = dialog.show(self)

        if result is None:
            gui_util.message("No change applied")
            return

        selectedFeatures = [name for check, name in zip(result, allFeatures) if check]
        self.classifier.change_feature_set(selectedFeatures)

        self.UpdatePanels()
Esempio n. 2
0
    def OnChangeFeatures(self, event):
        # ---------------------------------------------------------------------------
        from gamera import plugin
        from gamera.core import ONEBIT
        from gamera.core import ImageBase
        from gamera.args import Args, Check

        if self.classifier == None:
            gui.message("No classifier loaded")
            return

        allFeatures = [x[0] for x in plugin.methods_flat_category("Features", ONEBIT)]
        allFeatures.sort()

        existingFeatures = [x[0] for x in ImageBase.get_feature_functions(self.classifier.features)[0]]

        featureControls = []
        for f in allFeatures:
            featureControls.append(Check("", f, default=(f in existingFeatures)))

        dialog = Args(
            featureControls, name="Feature selection", title="Select the features you want to use for optimization"
        )

        result = dialog.show(self)

        if result == None:
            gui_util.message("No change applied")
            return

        selectedFeatures = [name for check, name in zip(result, allFeatures) if check]
        self.classifier.change_feature_set(selectedFeatures)

        self.UpdatePanels()
Esempio n. 3
0
    def OnCopyClassifier(self, event):
    #---------------------------------------------------------------------------
        from gamera import knn

        if self.classifier is None:
            gui.message("No classifier loaded")
            return

        if self.classifier.is_interactive():
            self.classifier = self.classifier.noninteractive_copy()
        else:
            self.classifier = self.CopyClassifier(self.classifier)
Esempio n. 4
0
    def OnCopyClassifier(self, event):
        # ---------------------------------------------------------------------------
        from gamera import knn

        if self.classifier == None:
            gui.message("No classifier loaded")
            return

        if self.classifier.is_interactive():
            self.classifier = self.classifier.noninteractive_copy()
        else:
            self.classifier = self.CopyClassifier(self.classifier)
Esempio n. 5
0
    def OnResetWeights(self, event):
    #---------------------------------------------------------------------------
        if self.classifier is None:
            gui.message("No classifier loaded")
            return

        weights = self.classifier.get_weights()

        for wIndex in range(len(weights)):
            weights[wIndex] = 1.0

        self.classifier.set_weights(weights)

        self.SetClassifiers()
        self.UpdatePanels()
Esempio n. 6
0
    def OnResetSelections(self, event):
    #---------------------------------------------------------------------------
        if self.classifier is None:
            gui.message("No classifier loaded")
            return

        selections = self.classifier.get_selections()

        for sIndex in range(len(selections)):
            selections[sIndex] = 1

        self.classifier.set_selections(selections)

        self.SetClassifiers()
        self.UpdatePanels()
Esempio n. 7
0
    def OnResetWeights(self, event):
        # ---------------------------------------------------------------------------
        if self.classifier == None:
            gui.message("No classifier loaded")
            return

        weights = self.classifier.get_weights()

        for wIndex in range(len(weights)):
            weights[wIndex] = 1.0

        self.classifier.set_weights(weights)

        self.SetClassifiers()
        self.UpdatePanels()
Esempio n. 8
0
    def OnResetSelections(self, event):
        # ---------------------------------------------------------------------------
        if self.classifier == None:
            gui.message("No classifier loaded")
            return

        selections = self.classifier.get_selections()

        for sIndex in range(len(selections)):
            selections[sIndex] = 1

        self.classifier.set_selections(selections)

        self.SetClassifiers()
        self.UpdatePanels()
Esempio n. 9
0
    def OnLoadSettings(self, event):
    #---------------------------------------------------------------------------
        from gamera import gamera_xml

        if self.classifier is None:
            gui.message("No classifier loaded")
            return

        filename = gui_util.open_file_dialog(self, gamera_xml.extensions)
        if filename is None:
            gui_util.message("Can't open classifier settings xml file")
            return

        self.classifier.load_settings(filename)

        self.UpdatePanels()
Esempio n. 10
0
    def OnLoadSettings(self, event):
        # ---------------------------------------------------------------------------
        from gamera import gamera_xml

        if self.classifier == None:
            gui.message("No classifier loaded")
            return

        filename = gui_util.open_file_dialog(self, gamera_xml.extensions)
        if filename == None:
            gui_util.message("Can't open classifier settings xml file")
            return

        self.classifier.load_settings(filename)

        self.UpdatePanels()