use of qupath.opencv.classify.BayesClassifier 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);
}
Aggregations