use of qupath.lib.analysis.features.ObjectMeasurements.ShapeFeatures in project qupath by qupath.
the class Commands method requestShapeFeatures.
private static void requestShapeFeatures(ImageData<?> imageData, Collection<ShapeFeatures> features) {
if (imageData == null)
return;
var featureArray = features.toArray(ShapeFeatures[]::new);
if (featureArray.length == 0)
return;
Collection<PathObject> selected = imageData.getHierarchy().getSelectionModel().getSelectedObjects();
if (selected.isEmpty()) {
Dialogs.showWarningNotification("Shape features", "No objects selected!");
} else {
selected = new ArrayList<>(selected);
String featureString = Arrays.stream(featureArray).map(f -> "\"" + f.name() + "\"").collect(Collectors.joining(", "));
QP.addShapeMeasurements(imageData, selected, featureArray);
imageData.getHistoryWorkflow().addStep(new DefaultScriptableWorkflowStep("Add shape measurements", String.format("addShapeMeasurements(%s)", featureString)));
if (selected.size() == 1)
Dialogs.showInfoNotification("Shape features", "Shape features calculated for one object");
else
Dialogs.showInfoNotification("Shape features", "Shape features calculated for " + selected.size() + " objects");
}
}
Aggregations