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
- 
Property SummaryPropertiesTypePropertyDescriptionGet 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.Show z-projection overlay options, where relevant
- 
Method SummaryModifier 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 thesynchronizeViewersproperty.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 theactiveViewerproperty.booleansetGridSize(int nRows, int nCols) Set the grid to have a specific number of rows and columns.voidsetSynchronizeViewers(boolean synchronizeViewers) Sets the value of thesynchronizeViewersproperty.Show the cursor location.Show the overview image.Show the scalebar.Show z-projection overlay options, where relevantvoidsplitViewer(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- 
showOverviewShow the overview image.- See Also:
 
- 
showLocationShow the cursor location.- See Also:
 
- 
showScalebarShow the scalebar.- See Also:
 
- 
showZProjectControlsShow z-projection overlay options, where relevant- See Also:
 
- 
imageDataRead-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.- See Also:
 
- 
activeViewerGet 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).- See Also:
 
- 
synchronizeViewers- See Also:
 
 
- 
- 
Method Details- 
createCreate a new instance- Parameters:
- qupath-
- Returns:
 
- 
refreshTitlespublic 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.
- 
getAllViewersGet an observable list of viewers. Note that the list is unmodifiable; viewers should be added or removed through other methods in thie class.- Returns:
 
- 
getOverlayOptionsGet the overlay options shared by all viewers created by this manager.- Returns:
 
- 
showOverviewPropertyShow the overview image.- Returns:
 
- 
showLocationPropertyShow the cursor location.- Returns:
 
- 
showScalebarPropertyShow the scalebar.- Returns:
 
- 
showZProjectControlsPropertyShow z-projection overlay options, where relevant- Returns:
 
- 
matchResolutionspublic void matchResolutions()Match the display resolutions (downsamples) of all viewers to match the current viewer. This uses calibrated pixel size information if available.
- 
setActiveViewerSets the value of theactiveViewerproperty.- 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).
- Parameters:
- viewer- the value for the- activeViewerproperty
- See Also:
 
- 
imageDataPropertyRead-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.- Returns:
 
- 
getActiveViewerGet the value ofactiveViewerProperty().- Returns:
 
- 
activeViewerPropertyGet 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).- Returns:
- See Also:
 
- 
getRegionGet the region node that can be added to a scene graph to display the viewers.- Returns:
 
- 
repaintAllViewerspublic void repaintAllViewers()Request that all viewers are repainted as soon as possible.
- 
createViewerCreate 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:
 
- 
removeRowTry 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
 
- 
removeColumnTry 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
 
- 
setGridSizepublic 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
- 
resetGridSizepublic void resetGridSize()
- 
imageDataChangedpublic 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 interface- QuPathViewerListener
- Parameters:
- viewer- the viewer whose image has changed
- imageDataOld- the image previously open in the viewer
- imageDataNew- the image now open in the viewer
 
- 
visibleRegionChangedDescription copied from interface:QuPathViewerListenerCalled when the visible region has changed in a viewer.- Specified by:
- visibleRegionChangedin interface- QuPathViewerListener
- 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.
 
- 
getSynchronizeViewerspublic boolean getSynchronizeViewers()Gets the value of thesynchronizeViewersproperty.- Property description:
- Returns:
- the value of the synchronizeViewersproperty
- See Also:
 
- 
setSynchronizeViewerspublic void setSynchronizeViewers(boolean synchronizeViewers) Sets the value of thesynchronizeViewersproperty.- Property description:
- Parameters:
- synchronizeViewers- the value for the- synchronizeViewersproperty
- See Also:
 
- 
synchronizeViewersProperty- Returns:
- the synchronizeViewersproperty
- See Also:
 
- 
selectedObjectChangedDescription copied from interface:QuPathViewerListenerCalled when the primary selected object has changed in a viewer.- Specified by:
- selectedObjectChangedin interface- QuPathViewerListener
- Parameters:
- viewer- the viewer
- pathObjectSelected-
 
- 
applyLastAnnotationToActiveViewerpublic boolean applyLastAnnotationToActiveViewer()
- 
viewerClosedDescription copied from interface:QuPathViewerListenerCalled when a viewer is closed.- Specified by:
- viewerClosedin interface- QuPathViewerListener
- Parameters:
- viewer- the viewer that has been closed.
 
- 
detachActiveViewerFromGridpublic void detachActiveViewerFromGrid()Detach the currently active viewer from the viewer grid, if possible.
- 
attachActiveViewerToGridpublic void attachActiveViewerToGrid()Insert the currently active viewer back into the viewer grid.- See Also:
 
- 
detachViewerFromGridDetach 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:
 
- 
attachViewerToGridAttach 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-
 
 
-