Package qupath.lib.gui.charts
Class PathObjectScatterChart
java.lang.Object
- All Implemented Interfaces:
Styleable,EventTarget
An interactive
ScatterChart implementation for showing large(ish) numbers of PathObject,
optionally linked to a QuPathViewer.
A goal of this class is to reduce expensive chart manipulations, such as adding and removing data points. Instead, data points are reused and updated where possible.
Additionally, the maximum number of data points can be specified, so that the chart can automatically randomly subsample points to show only some.
- Since:
- v0.6.0
-
Property Summary
PropertiesTypePropertyDescriptionGet a property representing whether to use the entire dataset when calculating axis limits automatically.Get a property representing the maximum number of points that the plot will display.Get a property representing the opacity of all data points.Get a property representing the radius of all data points.Get a property representing the random number generator's seed for subsampling.Properties inherited from class javafx.scene.chart.XYChart
alternativeColumnFillVisible, alternativeRowFillVisible, data, horizontalGridLinesVisible, horizontalZeroLineVisible, verticalGridLinesVisible, verticalZeroLineVisibleProperties inherited from class javafx.scene.chart.Chart
animated, legend, legendSide, legendVisible, title, titleSideProperties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible -
Nested Class Summary
Nested classes/interfaces inherited from class javafx.scene.chart.XYChart
XYChart.Data<X,Y>, XYChart.Series<X, Y> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSeed value to use to specify that no shuffling should be applied before displaying the objects.Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZEFields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
ConstructorsConstructorDescriptionPathObjectScatterChart(QuPathViewer viewer) Create an interactive scatter plot using the current viewer -
Method Summary
Modifier and TypeMethodDescriptionGet a property representing whether to use the entire dataset when calculating axis limits automatically.protected voiddataItemAdded(XYChart.Series<Number, Number> series, int itemIndex, XYChart.Data<Number, Number> item) protected voiddataItemRemoved(XYChart.Data<Number, Number> item, XYChart.Series<Number, Number> series) booleanGet the value ofautorangeToFullDataProperty()intGet the value ofmaxPointsProperty()doubleGet the value opointOpacityProperty()doubleGet the value ofpointOpacityProperty()intGet the value ofrngSeedProperty().Get a property representing the maximum number of points that the plot will display.Get a property representing the opacity of all data points.Get a property representing the radius of all data points.voidRecalculate the values of all data points.Get a property representing the random number generator's seed for subsampling.voidsetAutorangeToFullData(boolean useFullData) Set the value ofautorangeToFullDataProperty().voidsetData(Collection<? extends qupath.lib.objects.PathObject> pathObjects, Function<qupath.lib.objects.PathObject, Number> xFun, Function<qupath.lib.objects.PathObject, Number> yFun) Set the data to display in the plot.voidsetDataFromTable(Collection<? extends qupath.lib.objects.PathObject> pathObjects, PathTableData<qupath.lib.objects.PathObject> model, String xMeasurement, String yMeasurement) Set the data to display in the plot from a table model.voidsetMaxPoints(int maxPoints) Set the value ofmaxPointsProperty().voidsetPointOpacity(double pointOpacity) Set the value ofpointOpacityProperty().voidsetPointRadius(double radius) Set the value ofpointOpacityProperty()voidsetRngSeed(int rngSeed) Set the value ofrngSeedProperty().protected voidprotected voidMethods inherited from class javafx.scene.chart.ScatterChart
dataItemChanged, layoutPlotChildren, seriesAdded, seriesRemovedMethods inherited from class javafx.scene.chart.XYChart
alternativeColumnFillVisibleProperty, alternativeRowFillVisibleProperty, currentDisplayedExtraValueProperty, currentDisplayedXValueProperty, currentDisplayedYValueProperty, dataProperty, getClassCssMetaData, getCssMetaData, getCurrentDisplayedExtraValue, getCurrentDisplayedXValue, getCurrentDisplayedYValue, getData, getDisplayedDataIterator, getDisplayedSeriesIterator, getPlotChildren, getVerticalGridLinesVisible, getXAxis, getYAxis, horizontalGridLinesVisibleProperty, horizontalZeroLineVisibleProperty, isAlternativeColumnFillVisible, isAlternativeRowFillVisible, isHorizontalGridLinesVisible, isHorizontalZeroLineVisible, isVerticalZeroLineVisible, layoutChartChildren, removeDataItemFromDisplay, removeSeriesFromDisplay, seriesChanged, setAlternativeColumnFillVisible, setAlternativeRowFillVisible, setCurrentDisplayedExtraValue, setCurrentDisplayedXValue, setCurrentDisplayedYValue, setData, setHorizontalGridLinesVisible, setHorizontalZeroLineVisible, setVerticalGridLinesVisible, setVerticalZeroLineVisible, verticalGridLinesVisibleProperty, verticalZeroLineVisiblePropertyMethods inherited from class javafx.scene.chart.Chart
animate, animatedProperty, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getAnimated, getChartChildren, getLegend, getLegendSide, getTitle, getTitleSide, isLegendVisible, layoutChildren, legendProperty, legendSideProperty, legendVisibleProperty, requestChartLayout, setAnimated, setLegend, setLegendSide, setLegendVisible, setTitle, setTitleSide, shouldAnimate, titleProperty, titleSidePropertyMethods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthPropertyMethods inherited from class javafx.scene.Parent
getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsMethods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
autorangeToFullData
Get a property representing whether to use the entire dataset when calculating axis limits automatically. This is useful whenever we are subsampling data points.- See Also:
-
maxPoints
Get a property representing the maximum number of points that the plot will display. Subsampling will be used to ensure only this number of points or fewer are displayed.- See Also:
-
rngSeed
Get a property representing the random number generator's seed for subsampling. The default value is #NO_SHUFFLE_SEED which indicates no shuffling should be performed.- See Also:
-
pointOpacity
Get a property representing the opacity of all data points. Making points translucent can be helpful when there are a lot of them.- See Also:
-
pointRadius
Get a property representing the radius of all data points.- See Also:
-
-
Field Details
-
NO_SHUFFLE_SEED
public static final int NO_SHUFFLE_SEEDSeed value to use to specify that no shuffling should be applied before displaying the objects.- See Also:
-
-
Constructor Details
-
PathObjectScatterChart
Create an interactive scatter plot using the current viewer- Parameters:
viewer- The QuPath viewer.
-
-
Method Details
-
setAutorangeToFullData
public void setAutorangeToFullData(boolean useFullData) Set the value ofautorangeToFullDataProperty().- Parameters:
useFullData- whether to use the full data when setting the axis autorange
-
autorangeToFullDataProperty
Get a property representing whether to use the entire dataset when calculating axis limits automatically. This is useful whenever we are subsampling data points.- Returns:
- whether to use the full data when setting the axis autorange
- See Also:
-
getAutorangeToFullData
public boolean getAutorangeToFullData()Get the value ofautorangeToFullDataProperty()- Returns:
- whether to use the full data when setting the axis autorange
-
setMaxPoints
public void setMaxPoints(int maxPoints) Set the value ofmaxPointsProperty().- Parameters:
maxPoints- the maximum number of elements
-
maxPointsProperty
Get a property representing the maximum number of points that the plot will display. Subsampling will be used to ensure only this number of points or fewer are displayed.- Returns:
- the maximum number of points to show
- See Also:
-
getMaxPoints
public int getMaxPoints()Get the value ofmaxPointsProperty()- Returns:
- the maximum number of points to show
-
setRngSeed
public void setRngSeed(int rngSeed) Set the value ofrngSeedProperty().- Parameters:
rngSeed- the random number generator seed to use
-
rngSeedProperty
Get a property representing the random number generator's seed for subsampling. The default value is #NO_SHUFFLE_SEED which indicates no shuffling should be performed.- Returns:
- the rng seed property
- See Also:
-
getRngSeed
public int getRngSeed()Get the value ofrngSeedProperty().- Returns:
- the random number generator
-
setPointOpacity
public void setPointOpacity(double pointOpacity) Set the value ofpointOpacityProperty().- Parameters:
pointOpacity- the new point opacity
-
pointOpacityProperty
Get a property representing the opacity of all data points. Making points translucent can be helpful when there are a lot of them.- Returns:
- the point opacity property
- See Also:
-
getPointOpacity
public double getPointOpacity()Get the value opointOpacityProperty()- Returns:
- the point opacity property
-
setPointRadius
public void setPointRadius(double radius) Set the value ofpointOpacityProperty()- Parameters:
radius- the point radius
-
pointRadiusProperty
Get a property representing the radius of all data points.- Returns:
- the point radius property
- See Also:
-
getPointRadius
public double getPointRadius()Get the value ofpointOpacityProperty()- Returns:
- the point radius
-
updateLegend
protected void updateLegend()- Overrides:
updateLegendin classXYChart<Number,Number>
-
refreshData
public void refreshData()Recalculate the values of all data points. This may be useful when measurements or classifications may have changed. -
setData
public void setData(Collection<? extends qupath.lib.objects.PathObject> pathObjects, Function<qupath.lib.objects.PathObject, Number> xFun, Function<qupath.lib.objects.PathObject, Number> yFun) Set the data to display in the plot.- Parameters:
pathObjects- the objects to displayxFun- a function to extract the x value to plotyFun- a function to extract the y value to plot
-
setDataFromTable
public void setDataFromTable(Collection<? extends qupath.lib.objects.PathObject> pathObjects, PathTableData<qupath.lib.objects.PathObject> model, String xMeasurement, String yMeasurement) Set the data to display in the plot from a table model.This calls
setData(Collection, Function, Function)in addition to setting the x and y labels.- Parameters:
pathObjects- the objects to displaymodel- the table model containing the measurementsxMeasurement- the column to use for x valuesyMeasurement- the column to use for y values
-
dataItemAdded
protected void dataItemAdded(XYChart.Series<Number, Number> series, int itemIndex, XYChart.Data<Number, Number> item) - Overrides:
dataItemAddedin classScatterChart<Number,Number>
-
dataItemRemoved
protected void dataItemRemoved(XYChart.Data<Number, Number> item, XYChart.Series<Number, Number> series) - Overrides:
dataItemRemovedin classScatterChart<Number,Number>
-
updateAxisRange
protected void updateAxisRange()- Overrides:
updateAxisRangein classXYChart<Number,Number>
-