Search in sources :

Example 6 with OverlayOptions

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();
}
Also used : OverlayOptions(qupath.lib.gui.viewer.OverlayOptions)

Example 7 with OverlayOptions

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);
}
Also used : OverlayOptions(qupath.lib.gui.viewer.OverlayOptions) MeasurementMapper(qupath.lib.gui.tools.MeasurementMapper) QuPathViewer(qupath.lib.gui.viewer.QuPathViewer)

Example 8 with OverlayOptions

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;
}
Also used : BorderPane(javafx.scene.layout.BorderPane) OverlayOptions(qupath.lib.gui.viewer.OverlayOptions) Stage(javafx.stage.Stage) Scene(javafx.scene.Scene) MeasurementMapPane(qupath.lib.gui.panes.MeasurementMapPane)

Aggregations

OverlayOptions (qupath.lib.gui.viewer.OverlayOptions)8 PathObject (qupath.lib.objects.PathObject)3 Rectangle (java.awt.Rectangle)2 BufferedImage (java.awt.image.BufferedImage)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 TMACoreObject (qupath.lib.objects.TMACoreObject)2 PathObjectHierarchy (qupath.lib.objects.hierarchy.PathObjectHierarchy)2 RegionRequest (qupath.lib.regions.RegionRequest)2 ROI (qupath.lib.roi.interfaces.ROI)2 CompositeImage (ij.CompositeImage)1 IJ (ij.IJ)1 ImageJ (ij.ImageJ)1 ImagePlus (ij.ImagePlus)1 Overlay (ij.gui.Overlay)1 Roi (ij.gui.Roi)1 Interpreter (ij.macro.Interpreter)1 AlphaComposite (java.awt.AlphaComposite)1 Composite (java.awt.Composite)1 Shape (java.awt.Shape)1