Interface DisplayWindow
- All Superinterfaces:
AutoCloseable, Closeable, DataViewer, EventPublisher
It is not expected that third-party code implement this interface. If you
want to provide your own custom display then you should implement DataViewer instead.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddOverlay(Overlay overlay) Add a graphical overlay.voidadjustZoom(double factor) Multiply the current zoom ratio of the image canvas by the provided factor.voidPerforms a one-shot autoscaling of intensities.voidclose()Close this display window unconditionally.voiddisplayStatusString(String status) Display a custom string in the window.Create a new display window for the same data provider as this one.Deprecated.ij.ImagePlusDeprecated.Directly accessing theImagePlusof an MMStudio display window will generally result in very fragile code.doubleDeprecated.usegetZoom()insteadGet the overlays attached to this display.Get thejava.awt.Windowused for this image display.doublegetZoom()Get the current zoom ratio of the display.booleanTell whether full screen mode is currently enabled.voidremoveOverlay(Overlay overlay) Remove a graphical overlay.booleanClose this display window, giving its owner a chance to cancel closing.voidsetCustomTitle(String title) Add a custom extra string to the title of this display.voidSet the key used to save and restore display settings to the user profile for this display.voidsetFullScreen(boolean enable) Enable or disable full screen mode.voidsetMagnification(double ratio) Deprecated.usesetZoom(double)insteadvoidSets a key that will be used to remember Window position in the profile.voidsetZoom(double ratio) Set the zoom ratio for this display.voidshow()DisplayWindows are not shown by default.voidtoFront()Raise this display window to the front.voidDeprecated.usesetFullScreen(boolean)insteadMethods inherited from interface DataViewer
addListener, compareAndSetDisplayPosition, compareAndSetDisplayPosition, compareAndSetDisplaySettings, getDataProvider, getDatastore, getDisplayedImages, getDisplayPosition, getDisplaySettings, getName, isClosed, isVisible, registerForEvents, removeListener, setDisplayedImageTo, setDisplayPosition, setDisplayPosition, setDisplaySettings, unregisterForEvents
-
Method Details
-
displayStatusString
Display a custom string in the window.The string will remain displayed until this method is called again to change it.
Calls are ignored if the display has closed.
This method can be called from any thread.
- Parameters:
status- String to display in the window.
-
getZoom
double getZoom()Get the current zoom ratio of the display.If the display has closed, the returned value is undefined.
This method can be called from any thread. However, you should call it from the Swing/AWT event dispatch thread if you want to correctly synchronize with other user interface changes.
- Returns:
- the current zoom ratio (1.0 = actual size)
-
getMagnification
-
setZoom
void setZoom(double ratio) Set the zoom ratio for this display.Calls are ignored if the display has closed.
This method can be called from any thread. However, you should call it from the Swing/AWT event dispatch thread if you want to correctly synchronize with other user interface changes.
- Parameters:
ratio- zoom ratio to set (1.0 = actual size)
-
setMagnification
Deprecated.usesetZoom(double)insteadObsolete equivalent ofsetZoom(double).- Parameters:
ratio- Magnification ratio
-
adjustZoom
void adjustZoom(double factor) Multiply the current zoom ratio of the image canvas by the provided factor.This is equivalent to
setZoom(factor * getZoom())if called on the Swing/AWT event dispatch thread.Calls are ignored if the display has closed.
This method can be called from any thread. However, you should call it from the Swing/AWT event dispatch thread if you want to correctly synchronize with other user interface changes.
- Parameters:
factor- the factor to zoom in by
-
autostretch
void autostretch()Performs a one-shot autoscaling of intensities.The intensity range of the currently displayed image is used to set the intensity scaling range for all displayed channels.
Calls are ignored if the display has closed.
This method can be called from any thread. However, you should call it from the Swing/AWT event dispatch thread if you want to correctly synchronize with other user interface changes.
-
addOverlay
Add a graphical overlay.This method can be called from any thread. However, you should call it from the Swing/AWT event dispatch thread if you want to correctly synchronize with other user interface changes.
- Parameters:
overlay- the overlay to add- Throws:
NullPointerException- ifoverlayis null- See Also:
-
removeOverlay
Remove a graphical overlay.This method can be called from any thread. However, you should call it from the Swing/AWT event dispatch thread if you want to correctly synchronize with other user interface changes.
- Parameters:
overlay- the overlay to remove- See Also:
-
getOverlays
-
getImagePlus
Deprecated.Directly accessing theImagePlusof an MMStudio display window will generally result in very fragile code. Consider accessing image data throughDataViewer.getDataProvider(). For drawing overlay graphics, seeaddOverlay(Overlay).Return the ImageJImagePlusobject used by the display window.Note that the
ImagePlusmay be replaced with a new one during the lifetime of the display window.It is recommended that this method be called on the Swing/AWT event dispatch thread. If you call it from another thread, make sure that your thread is not obstructing the event dispatch thread (i.e. the event dispatch thread is not waiting for your thread to finish something).
- Returns:
- the
ImagePlusused by the window, which may be aCompositeImage, ornullif none has been created or if the display has closed.
-
requestToClose
boolean requestToClose()Close this display window, giving its owner a chance to cancel closing.For example, the owner may prompt the user to save the data associated with this display. Special display windows may perform other actions.
Calls are ignored if the display has already closed.
- Returns:
- true if the display is closed, or was already closed; false if it remains open
-
close
void close()Close this display window unconditionally.This will skip such actions as prompting the user to save the data. Special display windows may skip other special actions.
Calls are ignored if the display has already closed.
This method can be called from any thread. However, you should call it from the Swing/AWT event dispatch thread if you want to correctly synchronize with other user interface changes. In particular, the display may not have closed yet at the moment this method returns if called on another thread.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
setFullScreen
void setFullScreen(boolean enable) Enable or disable full screen mode.Calls are ignored if the display has closed.
This method can be called from any thread. However, you should call it from the Swing/AWT event dispatch thread if you want to correctly synchronize with other user interface changes.
- Parameters:
enable- whether to enable or disable full screen mode
-
isFullScreen
boolean isFullScreen()Tell whether full screen mode is currently enabled.It is recommended that this method be called on the Swing/AWT event dispatch thread. If you call it from another thread, make sure that your thread is not obstructing the event dispatch thread (i.e. the event dispatch thread is not waiting for your thread to finish something).
- Returns:
- whether full screen mode is enabled (
falseif the display has closed
-
toggleFullScreen
Deprecated.usesetFullScreen(boolean)insteadEnable or disable full screen mode.Calls are ignored if the display has closed.
-
duplicate
DisplayWindow duplicate()Create a new display window for the same data provider as this one.This method can be called from any thread. However, you should call it from the Swing/AWT event dispatch thread if you want to correctly synchronize with other user interface changes.
- Returns:
- the new display window
-
toFront
void toFront()Raise this display window to the front.Calls are ignored if the display has closed.
This method can be called from any thread. However, you should call it from the Swing/AWT event dispatch thread if you want to correctly synchronize with other user interface changes.
-
getWindow
Get thejava.awt.Windowused for this image display.You should not access the contents of the returned window, but you can set its on-screen position and size, etc.
If the display is in full screen mode, this method returns the original (hidden) window, not the window used for full-screen display.
It is recommended that this method be called on the Swing/AWT event dispatch thread. If you call it from another thread, make sure that your thread is not obstructing the event dispatch thread (i.e. the event dispatch thread is not waiting for your thread to finish something).
- Returns:
- the
java.awt.Windowused by this image display - Throws:
IllegalStateException- if the display has closed
-
getAsWindow
Deprecated.usegetWindow()insteadGet thejava.awt.Windowused for this image display.- Returns:
- the
java.awt.Windowused by this image display, ornullif the display has been closed
-
setCustomTitle
Add a custom extra string to the title of this display.The usual format for the window title is "#number: name (zoom ratio) (saved status)". If you call this method, then the name part will be replaced by your custom title. You can call this method with a null argument to revert to the default title, which is what
DataViewer.getName()returns.Calls are ignored if the display has closed.
This method can be called from any thread.
- Parameters:
title- a custom window title, ornullto revert to the default
-
setDisplaySettingsProfileKey
Set the key used to save and restore display settings to the user profile for this display.- Parameters:
key- String to use as the key for saving and restoring
-
setWindowPositionKey
Sets a key that will be used to remember Window position in the profile.- Parameters:
key- Key to use for positioning the DisplayWindow. if called before showing the DisplayWindow, the DisplayWindow will be positioned at the remembered position.
-
show
void show()DisplayWindows are not shown by default. Call this function after construction, and after attaching listeners as needed, to show the Window.
-
getWindow()instead