use of qupath.lib.gui.viewer.OverlayOptions in project qupath by qupath.
the class PathClassPane method toggleSelectedClassesVisibility.
void toggleSelectedClassesVisibility() {
OverlayOptions overlayOptions = qupath.getViewer().getOverlayOptions();
for (var pathClass : getSelectedPathClasses()) {
overlayOptions.setPathClassHidden(pathClass, !overlayOptions.isPathClassHidden(pathClass));
}
listClasses.refresh();
}
use of qupath.lib.gui.viewer.OverlayOptions in project qupath by qupath.
the class MeasurementMapPane method showMap.
private void showMap() {
String measurement = listMeasurements.getSelectionModel().getSelectedItem();
QuPathViewer viewer = qupath.getViewer();
if (viewer == null || measurement == null)
return;
// Reuse mappers if we can
mapper = mapperMap.get(measurement);
var colorMapper = selectedColorMap.getValue();
if (mapper == null) {
mapper = new MeasurementMapper(colorMapper, measurement, viewer.getHierarchy().getObjects(null, null));
if (mapper.isValid())
mapperMap.put(measurement, mapper);
} else if (colorMapper != null) {
mapper.setColorMapper(colorMapper);
}
if (mapper != null && mapper.isValid()) {
updatingSliders = true;
sliderMin.setMin(Math.min(mapper.getDataMinValue(), mapper.getDisplayMinValue()));
sliderMin.setMax(Math.max(mapper.getDataMaxValue(), mapper.getDisplayMaxValue()));
sliderMin.setValue(mapper.getDisplayMinValue());
sliderMin.setBlockIncrement((sliderMin.getMax() - sliderMin.getMin()) / 100);
sliderMax.setMin(Math.min(mapper.getDataMinValue(), mapper.getDisplayMinValue()));
sliderMax.setMax(Math.max(mapper.getDataMaxValue(), mapper.getDisplayMaxValue()));
sliderMax.setValue(mapper.getDisplayMaxValue());
sliderMax.setBlockIncrement((sliderMax.getMax() - sliderMax.getMin()) / 100);
updatingSliders = false;
}
colorMapKeyImage = createPanelKey(mapper.getColorMapper());
updateColorMapperKey();
mapper.setExcludeOutsideRange(cbExcludeOutside.isSelected());
viewer.forceOverlayUpdate();
updateMapperBrightnessContrast();
OverlayOptions overlayOptions = viewer.getOverlayOptions();
if (overlayOptions != null)
overlayOptions.setMeasurementMapper(mapper);
}
use of qupath.lib.gui.viewer.OverlayOptions in project qupath by qupath.
the class Commands method createMeasurementMapDialog.
/**
* Create a dialog for displaying measurement maps.
* @param qupath the {@link QuPathGUI} instance to which the maps refer
* @return a measurement map dialog
*/
public static Stage createMeasurementMapDialog(QuPathGUI qupath) {
var dialog = new Stage();
if (qupath != null)
dialog.initOwner(qupath.getStage());
dialog.setTitle("Measurement maps");
var panel = new MeasurementMapPane(qupath);
BorderPane pane = new BorderPane();
pane.setCenter(panel.getPane());
Scene scene = new Scene(pane, 300, 400);
dialog.setScene(scene);
dialog.setMinWidth(300);
dialog.setMinHeight(400);
// pane.setMinSize(300, 400);
// dialog.setResizable(false);
dialog.setOnCloseRequest(e -> {
OverlayOptions overlayOptions = qupath.getOverlayOptions();
if (overlayOptions != null)
overlayOptions.resetMeasurementMapper();
dialog.hide();
});
dialog.setOnShowing(e -> {
panel.updateMeasurements();
});
return dialog;
}
Aggregations