Package org.micromanager.ndviewer.api
Interface ViewerInterface
- All Known Implementing Classes:
NDViewer
public interface ViewerInterface
Interface for external methods of an
NDViewer. The only requirement
is to call newImageArrived method each time a new image is available. It may also
be helpful to call bitDepth before each image arrives to initialize preferred
contrast controls-
Method Summary
Modifier and Type Method Description voidaddControlPanel(ControlsPanelInterface panel)Add a custom JPanel containing controls to the JTabbedPane on the right side of the imagevoidclose()Forces the viewer to close, automatically aborting any acquisition in the processintgetAxisPosition(String axis)Get the position that the scrollbar with the given label is currently atJPanelgetCanvasJPanel()Get reference to the JPanel on which image drawing takes placePoint2D.DoublegetDisplayImageSize()Get the size of the ge displayed on screenmmcorej.org.json.JSONObjectgetDisplaySettingsJSON()Get the JSON represenation of the internal data structure use for saving display and contrast settings.Point2D.DoublegetFullResSourceDataSize()Pixel size of the region currently being displayed in full resolution pixelsdoublegetMagnification()Return ratio beweteen size of pixels on screen and size of full resolution pixels in the iamgePoint2D.DoublegetViewOffset()get the offset of the top left displayed pixel to relative to top left of the full image (in full resolution coordinates)voidinitializeViewerToLoaded(List<String> channelNames, mmcorej.org.json.JSONObject displaySettings, HashMap<String,Integer> axisMins, HashMap<String,Integer> axisMaxs)Initialize all controls needed for a dataset loaded from disk where you're not calling newImageArrived each timevoidnewImageArrived(HashMap<String,Integer> axes, String channelName)Call this whenever a new image arrives to optionally show it, and also so that the size of the scrollbars expandsvoidpan(int dx, int dy)Change the view offset by the specified amountvoidredrawOverlay()trigger redraw of the image overlayvoidsetAxisPosition(String axis, int pos)Set the scrollbar with a given axis label to a positionvoidsetChannelDisplaySettings(String chName, Color c, int bitDepth)Set display settings for channel with the given name.voidsetCustomCanvasMouseListener(CanvasMouseListenerInterface m)Add a custom object to respond to different types of mouse events on the canvasvoidsetOverlay(Overlay overlay)Set a custom overlay object to be displayed on top of the image.voidsetOverlayerPlugin(OverlayerPlugin overlayer)Set a custom object to provide overlaysvoidsetReadTimeMetadataFunction(Function<mmcorej.org.json.JSONObject,Long> fn)Optional: Pass in a function that tells how to extract elapsed ms from image metadata, for display purposesvoidsetReadZMetadataFunction(Function<mmcorej.org.json.JSONObject,Double> fn)Optional: Pass in a function that tells how to extract z position in µm from image tags, for display purposesvoidsetViewOffset(double newX, double newY)set the offset of the top left displayed pixel to relative to top left of the full image (in full resolution coordinates)voidsetWindowTitle(String string)Set the text in the windows framevoidupdate()Redraw current image and any overlayvoidzoom(double factor, Point location)multiply zoom by given factor, centered at location
-
Method Details
-
newImageArrived
Call this whenever a new image arrives to optionally show it, and also so that the size of the scrollbars expands- Parameters:
axes- map of axis labels to integer positions. channel does not need to be included in the axes because it will be automatically inferredchannelName- Name of the channel of the image
-
setChannelDisplaySettings
Set display settings for channel with the given name.- Parameters:
chName-c-bitDepth-
-
setAxisPosition
Set the scrollbar with a given axis label to a position- Parameters:
axis-pos-
-
getAxisPosition
Get the position that the scrollbar with the given label is currently at- Parameters:
axis-- Returns:
-
initializeViewerToLoaded
void initializeViewerToLoaded(List<String> channelNames, mmcorej.org.json.JSONObject displaySettings, HashMap<String,Integer> axisMins, HashMap<String,Integer> axisMaxs)Initialize all controls needed for a dataset loaded from disk where you're not calling newImageArrived each time- Parameters:
channelNames- names of all channelsaxisMins- map of axis names to miniumum extents (can be negative)axisMaxs- map of axis names to maximum extents
-
setWindowTitle
Set the text in the windows frame- Parameters:
string-
-
setReadTimeMetadataFunction
Optional: Pass in a function that tells how to extract elapsed ms from image metadata, for display purposes- Parameters:
fn-
-
setReadZMetadataFunction
Optional: Pass in a function that tells how to extract z position in µm from image tags, for display purposes- Parameters:
fn-
-
getDisplaySettingsJSON
mmcorej.org.json.JSONObject getDisplaySettingsJSON()Get the JSON represenation of the internal data structure use for saving display and contrast settings. This can be used to save them and then re load them later on.- Returns:
-
close
void close()Forces the viewer to close, automatically aborting any acquisition in the process -
update
void update()Redraw current image and any overlay -
getViewOffset
Point2D.Double getViewOffset()get the offset of the top left displayed pixel to relative to top left of the full image (in full resolution coordinates)- Returns:
-
getFullResSourceDataSize
Point2D.Double getFullResSourceDataSize()Pixel size of the region currently being displayed in full resolution pixels- Returns:
-
getMagnification
double getMagnification()Return ratio beweteen size of pixels on screen and size of full resolution pixels in the iamge- Returns:
-
pan
void pan(int dx, int dy)Change the view offset by the specified amount- Parameters:
dx-dy-
-
zoom
multiply zoom by given factor, centered at location- Parameters:
factor-location- location in display pixel coordinates, or null to zoom in on center
-
setViewOffset
void setViewOffset(double newX, double newY)set the offset of the top left displayed pixel to relative to top left of the full image (in full resolution coordinates) -
getCanvasJPanel
JPanel getCanvasJPanel()Get reference to the JPanel on which image drawing takes place- Returns:
-
setCustomCanvasMouseListener
Add a custom object to respond to different types of mouse events on the canvas- Parameters:
m-
-
getDisplayImageSize
Point2D.Double getDisplayImageSize()Get the size of the ge displayed on screen- Returns:
-
setOverlay
Set a custom overlay object to be displayed on top of the image. This method can be called an arbitrary number of times by a customOverlayerPlugin- Parameters:
overlay-
-
setOverlayerPlugin
Set a custom object to provide overlays- Parameters:
overlayer-
-
redrawOverlay
void redrawOverlay()trigger redraw of the image overlay -
addControlPanel
Add a custom JPanel containing controls to the JTabbedPane on the right side of the image- Parameters:
panel-
-