Search in sources :

Example 1 with BoostClassifier

use of qupath.opencv.classify.BoostClassifier in project qupath by qupath.

the class LegacyDetectionClassifierCommand method run.

@Override
public void run() {
    if (dialog == null) {
        dialog = new Stage();
        if (qupath != null)
            dialog.initOwner(qupath.getStage());
        dialog.setTitle(name);
        BorderPane pane = new BorderPane();
        RTreesClassifier defaultClassifier = new RTreesClassifier();
        List<OpenCvClassifier<?>> classifierList = Arrays.asList(defaultClassifier, new DTreesClassifier(), new BoostClassifier(), new BayesClassifier(), new KNearestClassifier(), new SVMClassifier(), new NeuralNetworksClassifier());
        Collections.sort(classifierList, (c1, c2) -> c1.getName().compareTo(c2.getName()));
        panel = new ClassifierBuilderPane<>(qupath, classifierList, defaultClassifier);
        pane.setCenter(panel.getPane());
        ScrollPane scrollPane = new ScrollPane(pane);
        scrollPane.setFitToWidth(true);
        scrollPane.setFitToHeight(true);
        dialog.setScene(new Scene(scrollPane));
    }
    dialog.setOnCloseRequest(e -> {
        // If we don't have a classifier yet, just remove completely
        if (panel.getSelectedFeatures().isEmpty()) {
            resetPanel();
            return;
        }
        // If we have a classifier, give option to hide
        DialogButton button = Dialogs.showYesNoCancelDialog("Classifier builder", "Retain classifier for later use?");
        if (button == DialogButton.CANCEL)
            e.consume();
        else if (button == DialogButton.NO) {
            resetPanel();
        }
    });
    dialog.show();
    dialog.setMinWidth(dialog.getWidth());
    if (dialog.getHeight() < javafx.stage.Screen.getPrimary().getVisualBounds().getHeight()) {
        dialog.setMinHeight(dialog.getHeight() / 2);
    }
// if (dialog.getHeight() < javafx.stage.Screen.getPrimary().getVisualBounds().getHeight())
// dialog.setResizable(false);
}
Also used : BoostClassifier(qupath.opencv.classify.BoostClassifier) DialogButton(qupath.lib.gui.dialogs.Dialogs.DialogButton) BorderPane(javafx.scene.layout.BorderPane) DTreesClassifier(qupath.opencv.classify.DTreesClassifier) KNearestClassifier(qupath.opencv.classify.KNearestClassifier) Scene(javafx.scene.Scene) RTreesClassifier(qupath.opencv.classify.RTreesClassifier) BayesClassifier(qupath.opencv.classify.BayesClassifier) SVMClassifier(qupath.opencv.classify.SVMClassifier) NeuralNetworksClassifier(qupath.opencv.classify.NeuralNetworksClassifier) ScrollPane(javafx.scene.control.ScrollPane) Stage(javafx.stage.Stage) OpenCvClassifier(qupath.opencv.classify.OpenCvClassifier)

Aggregations

Scene (javafx.scene.Scene)1 ScrollPane (javafx.scene.control.ScrollPane)1 BorderPane (javafx.scene.layout.BorderPane)1 Stage (javafx.stage.Stage)1 DialogButton (qupath.lib.gui.dialogs.Dialogs.DialogButton)1 BayesClassifier (qupath.opencv.classify.BayesClassifier)1 BoostClassifier (qupath.opencv.classify.BoostClassifier)1 DTreesClassifier (qupath.opencv.classify.DTreesClassifier)1 KNearestClassifier (qupath.opencv.classify.KNearestClassifier)1 NeuralNetworksClassifier (qupath.opencv.classify.NeuralNetworksClassifier)1 OpenCvClassifier (qupath.opencv.classify.OpenCvClassifier)1 RTreesClassifier (qupath.opencv.classify.RTreesClassifier)1 SVMClassifier (qupath.opencv.classify.SVMClassifier)1