Package qupath.lib.gui.viewer
Class ViewerManager
java.lang.Object
qupath.lib.gui.viewer.ViewerManager
- All Implemented Interfaces:
EventListener,QuPathViewerListener
Class to manage multiple
QuPathViewer instances in a UI region.- Since:
- v0.5.0
- Author:
- Pete Bankhead
-
Property Summary
PropertiesTypePropertyDescriptionGet a read-only property representing the currently active viewer.Read-only property containing the image open within the currently-active viewer.Show the cursor location.Show the overview image.Show the scalebar. -
Method Summary
Modifier and TypeMethodDescriptionGet a read-only property representing the currently active viewer.voidaddColumn(QuPathViewer viewer) voidaddRow(QuPathViewer viewer) booleanvoidInsert the currently active viewer back into the viewer grid.voidattachViewerToGrid(QuPathViewer viewer) Attach the specified viewer to the viewer grid, if possible.static ViewerManagerCreate a new instanceprotected QuPathViewerPlusCreate a viewer, adding it to the stored array but not adding it to any component (which is left up to the calling code to handle)voidDetach the currently active viewer from the viewer grid, if possible.voiddetachViewerFromGrid(QuPathViewer viewer) Detach the specified viewer from the viewer grid, if possible.Get the value ofactiveViewerProperty().Get an observable list of viewers.Get the overlay options shared by all viewers created by this manager.Get the region node that can be added to a scene graph to display the viewers.booleanGets the value of the property synchronizeViewers.voidimageDataChanged(QuPathViewer viewer, ImageData<BufferedImage> imageDataOld, ImageData<BufferedImage> imageDataNew) Called with the image data within a viewer has changed.Read-only property containing the image open within the currently-active viewer.voidMatch the display resolutions (downsamples) of all viewers to match the current viewer.voidRequest that viewers refresh their titles.booleanremoveColumn(QuPathViewer viewer) Try to remove the column containing the specified viewer, notifying the user if this isn't possible.booleanremoveRow(QuPathViewer viewer) Try to remove the row containing the specified viewer, notifying the user if this isn't possible.voidRequest that all viewers are repainted as soon as possible.voidvoidselectedObjectChanged(QuPathViewer viewer, PathObject pathObjectSelected) Called when the primary selected object has changed in a viewer.voidsetActiveViewer(QuPathViewer viewer) Sets the value of the property activeViewer.booleansetGridSize(int nRows, int nCols) Set the grid to have a specific number of rows and columns.voidsetSynchronizeViewers(boolean synchronizeViewers) Sets the value of the property synchronizeViewers.Show the cursor location.Show the overview image.Show the scalebar.voidsplitViewer(QuPathViewer viewer, boolean splitVertical) voidviewerClosed(QuPathViewer viewer) Called when a viewer is closed.voidvisibleRegionChanged(QuPathViewer viewer, Shape shape) Called when the visible region has changed in a viewer.
-
Property Details
-
showOverview
Show the overview image. -
showLocation
Show the cursor location. -
showScalebar
Show the scalebar. -
imageData
Read-only property containing the image open within the currently-active viewer. To change the open image data, you should do so directly within the viewer. -
activeViewer
Get a read-only property representing the currently active viewer. Only one viewer can be active, and this should not be null (i.e. the list ofgetAllViewers()should never be empty). -
synchronizeViewers
-
-
Method Details
-
create
Create a new instance- Parameters:
qupath-- Returns:
-
refreshTitles
public void refreshTitles()Request that viewers refresh their titles. This is only really needed for detached viewers, so that they are notified of any changes to the image name. -
getAllViewers
Get an observable list of viewers. Note that the list is unmodifiable; viewers should be added or removed through other methods in thie class.- Returns:
-
getOverlayOptions
Get the overlay options shared by all viewers created by this manager.- Returns:
-
showOverviewProperty
Show the overview image. -
showLocationProperty
Show the cursor location. -
showScalebarProperty
Show the scalebar. -
matchResolutions
public void matchResolutions()Match the display resolutions (downsamples) of all viewers to match the current viewer. This uses calibrated pixel size information if available. -
setActiveViewer
Sets the value of the property activeViewer.- Property description:
- Get a read-only property representing the currently active viewer.
Only one viewer can be active, and this should not be null (i.e. the list of
getAllViewers()should never be empty).
-
imageDataProperty
Read-only property containing the image open within the currently-active viewer. To change the open image data, you should do so directly within the viewer. -
getActiveViewer
Get the value ofactiveViewerProperty().- Returns:
-
activeViewerProperty
Get a read-only property representing the currently active viewer. Only one viewer can be active, and this should not be null (i.e. the list ofgetAllViewers()should never be empty). -
getRegion
Get the region node that can be added to a scene graph to display the viewers.- Returns:
-
repaintAllViewers
public void repaintAllViewers()Request that all viewers are repainted as soon as possible. -
createViewer
Create a viewer, adding it to the stored array but not adding it to any component (which is left up to the calling code to handle)- Returns:
-
removeRow
Try to remove the row containing the specified viewer, notifying the user if this isn't possible.- Parameters:
viewer-- Returns:
- true if the row was removed, false otherwise
-
removeColumn
Try to remove the column containing the specified viewer, notifying the user if this isn't possible.- Parameters:
viewer-- Returns:
- true if the column was removed, false otherwise
-
setGridSize
public boolean setGridSize(int nRows, int nCols) Set the grid to have a specific number of rows and columns.- Parameters:
nRows-nCols-- Returns:
-
addRow
-
addColumn
-
splitViewer
-
resetGridSize
public void resetGridSize() -
imageDataChanged
public void imageDataChanged(QuPathViewer viewer, ImageData<BufferedImage> imageDataOld, ImageData<BufferedImage> imageDataNew) Description copied from interface:QuPathViewerListenerCalled with the image data within a viewer has changed.- Specified by:
imageDataChangedin interfaceQuPathViewerListener- Parameters:
viewer- the viewer whose image has changedimageDataOld- the image previously open in the viewerimageDataNew- the image now open in the viewer
-
visibleRegionChanged
Description copied from interface:QuPathViewerListenerCalled when the visible region has changed in a viewer.- Specified by:
visibleRegionChangedin interfaceQuPathViewerListener- Parameters:
viewer- the viewer whose visible region has changed.shape- shape representing the new visible region (in image pixel coordinates). This is rectangular, but may also be rotated.
-
getSynchronizeViewers
public boolean getSynchronizeViewers()Gets the value of the property synchronizeViewers.- Property description:
-
setSynchronizeViewers
public void setSynchronizeViewers(boolean synchronizeViewers) Sets the value of the property synchronizeViewers.- Property description:
-
synchronizeViewersProperty
-
selectedObjectChanged
Description copied from interface:QuPathViewerListenerCalled when the primary selected object has changed in a viewer.- Specified by:
selectedObjectChangedin interfaceQuPathViewerListener- Parameters:
viewer- the viewer
-
applyLastAnnotationToActiveViewer
public boolean applyLastAnnotationToActiveViewer() -
viewerClosed
Description copied from interface:QuPathViewerListenerCalled when a viewer is closed.- Specified by:
viewerClosedin interfaceQuPathViewerListener- Parameters:
viewer- the viewer that has been closed.
-
detachActiveViewerFromGrid
public void detachActiveViewerFromGrid()Detach the currently active viewer from the viewer grid, if possible. -
attachActiveViewerToGrid
public void attachActiveViewerToGrid()Insert the currently active viewer back into the viewer grid.- See Also:
-
detachViewerFromGrid
Detach the specified viewer from the viewer grid, if possible. This will remove the viewer from the grid, and create a new window to contain it.- Parameters:
viewer-- See Also:
-
attachViewerToGrid
Attach the specified viewer to the viewer grid, if possible. It will be inserted in place of the first available empty viewer slot. If no empty slots are available, an error will be shown.- Parameters:
viewer-
-