Package org.micromanager.ndviewer.main
Class NDViewer
java.lang.Object
org.micromanager.ndviewer.main.NDViewer
- All Implemented Interfaces:
ViewerInterface
public class NDViewer extends Object implements ViewerInterface
-
Field Summary
Fields Modifier and Type Field Description protected DataSourceInterfacedataSource_protected DataViewCoordsviewCoords_ -
Constructor Summary
Constructors Constructor Description NDViewer(DataSourceInterface cache, ViewerAcquisitionInterface acq, mmcorej.org.json.JSONObject summaryMD, double pixelSize, boolean rgb) -
Method Summary
Modifier and Type Method Description voidabortAcquisition()voidaddControlPanel(ControlsPanelInterface panel)Add a custom JPanel containing controls to the JTabbedPane on the right side of the imagevoidchannelSetActive(String channelName, boolean selected)voidclose()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 atViewerCanvasgetCanvas()JPanelgetCanvasJPanel()Get reference to the JPanel on which image drawing takes placeIntegergetChannelIndex(String channel)StringgetChannelName(int position)Iterable<String>getChannels()StringgetCurrentT()StringgetCurrentZPosition()Point2D.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.DisplaySettingsgetDisplaySettingsObject()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 iamgedoublegetPixelSize()static PreferencesgetPreferences()mmcorej.org.json.JSONObjectgetSummaryMD()Point2D.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 dispSettings, 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 timebooleanisAcquisitionPaused()booleanisCompositMode()booleanisImageXYBounded()voidnewImageArrived(HashMap<String,Integer> axesPositions, String channelName)Signal to viewer that a new image is availablevoidonAnimationToggle(AxisScroller scoller, boolean animate)voidonCanvasResize(int w, int h)voidonContrastUpdated()voidonScollersAdded()voidonScollPositionChanged(AxisScroller scroller, int value)voidpan(int dx, int dy)Change the view offset by the specified amountvoidredrawOverlay()trigger redraw of the image overlayvoidrequestToClose()Called when window is x-ed out by uservoidsetAnimateFPS(double doubleValue)voidsetAxisPosition(String axis, int position)Set the scrollbar with a given axis label to a positionvoidsetChannelColor(String channel, Color c)voidsetChannelDisplaySettings(String channel, Color c, int bitDepth)Set display settings for channel with the given name.voidsetCompositeMode(boolean selected)voidsetCustomCanvasMouseListener(CanvasMouseListenerInterface m)Add a custom object to respond to different types of mouse events on the canvasvoidsetImageEvent(HashMap<String,Integer> axes, boolean fromHuman)Called when scrollbars movevoidsetOverlay(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 s)Set the text in the windows framevoidshowFolder()voidshowScaleBar(boolean selected)voidshowTimeLabel(boolean selected)voidshowZPositionLabel(boolean selected)voidsuperlockAllScrollers()voidtogglePauseAcquisition()voidunlockAllScroller()voidupdate()Redraw current image and any overlayvoidzoom(double factor, Point mouseLocation)multiply zoom by given factor, centered at location
-
Field Details
-
Constructor Details
-
NDViewer
public NDViewer(DataSourceInterface cache, ViewerAcquisitionInterface acq, mmcorej.org.json.JSONObject summaryMD, double pixelSize, boolean rgb)
-
-
Method Details
-
setReadTimeMetadataFunction
Description copied from interface:ViewerInterfaceOptional: Pass in a function that tells how to extract elapsed ms from image metadata, for display purposes- Specified by:
setReadTimeMetadataFunctionin interfaceViewerInterface
-
setReadZMetadataFunction
Description copied from interface:ViewerInterfaceOptional: Pass in a function that tells how to extract z position in µm from image tags, for display purposes- Specified by:
setReadZMetadataFunctionin interfaceViewerInterface
-
setChannelDisplaySettings
Description copied from interface:ViewerInterfaceSet display settings for channel with the given name.- Specified by:
setChannelDisplaySettingsin interfaceViewerInterface
-
setChannelColor
-
isImageXYBounded
public boolean isImageXYBounded() -
getDisplaySettingsJSON
public mmcorej.org.json.JSONObject getDisplaySettingsJSON()Description copied from interface:ViewerInterfaceGet 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.- Specified by:
getDisplaySettingsJSONin interfaceViewerInterface- Returns:
-
getPreferences
-
pan
public void pan(int dx, int dy)Description copied from interface:ViewerInterfaceChange the view offset by the specified amount- Specified by:
panin interfaceViewerInterface
-
onScollersAdded
public void onScollersAdded() -
onScollPositionChanged
-
zoom
Description copied from interface:ViewerInterfacemultiply zoom by given factor, centered at location- Specified by:
zoomin interfaceViewerInterfacemouseLocation- location in display pixel coordinates, or null to zoom in on center
-
onCanvasResize
public void onCanvasResize(int w, int h) -
initializeViewerToLoaded
public void initializeViewerToLoaded(List<String> channelNames, mmcorej.org.json.JSONObject dispSettings, HashMap<String,Integer> axisMins, HashMap<String,Integer> axisMaxs)Description copied from interface:ViewerInterfaceInitialize all controls needed for a dataset loaded from disk where you're not calling newImageArrived each time- Specified by:
initializeViewerToLoadedin interfaceViewerInterface- Parameters:
channelNames- names of all channelsaxisMins- map of axis names to miniumum extents (can be negative)axisMaxs- map of axis names to maximum extents
-
channelSetActive
-
setWindowTitle
Description copied from interface:ViewerInterfaceSet the text in the windows frame- Specified by:
setWindowTitlein interfaceViewerInterface
-
newImageArrived
Signal to viewer that a new image is available- Specified by:
newImageArrivedin interfaceViewerInterface- Parameters:
axesPositions- Hashmap of axis labels to positionschannelName-
-
setAxisPosition
Description copied from interface:ViewerInterfaceSet the scrollbar with a given axis label to a position- Specified by:
setAxisPositionin interfaceViewerInterface
-
setImageEvent
Called when scrollbars move -
onContrastUpdated
public void onContrastUpdated() -
onAnimationToggle
-
update
public void update()Description copied from interface:ViewerInterfaceRedraw current image and any overlay- Specified by:
updatein interfaceViewerInterface
-
getCanvas
-
superlockAllScrollers
public void superlockAllScrollers() -
unlockAllScroller
public void unlockAllScroller() -
showFolder
public void showFolder() -
setAnimateFPS
public void setAnimateFPS(double doubleValue) -
abortAcquisition
public void abortAcquisition() -
togglePauseAcquisition
public void togglePauseAcquisition() -
isAcquisitionPaused
public boolean isAcquisitionPaused() -
setOverlay
Description copied from interface:ViewerInterfaceSet 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- Specified by:
setOverlayin interfaceViewerInterface
-
redrawOverlay
public void redrawOverlay()Description copied from interface:ViewerInterfacetrigger redraw of the image overlay- Specified by:
redrawOverlayin interfaceViewerInterface
-
getMagnification
public double getMagnification()Description copied from interface:ViewerInterfaceReturn ratio beweteen size of pixels on screen and size of full resolution pixels in the iamge- Specified by:
getMagnificationin interfaceViewerInterface- Returns:
-
getPixelSize
public double getPixelSize() -
showScaleBar
public void showScaleBar(boolean selected) -
setCompositeMode
public void setCompositeMode(boolean selected) -
isCompositMode
public boolean isCompositMode() -
getDisplaySettingsObject
-
getChannels
-
getCanvasJPanel
Description copied from interface:ViewerInterfaceGet reference to the JPanel on which image drawing takes place- Specified by:
getCanvasJPanelin interfaceViewerInterface- Returns:
-
getAxisPosition
Description copied from interface:ViewerInterfaceGet the position that the scrollbar with the given label is currently at- Specified by:
getAxisPositionin interfaceViewerInterface- Returns:
-
getViewOffset
Description copied from interface:ViewerInterfaceget the offset of the top left displayed pixel to relative to top left of the full image (in full resolution coordinates)- Specified by:
getViewOffsetin interfaceViewerInterface- Returns:
-
getFullResSourceDataSize
Description copied from interface:ViewerInterfacePixel size of the region currently being displayed in full resolution pixels- Specified by:
getFullResSourceDataSizein interfaceViewerInterface- Returns:
-
setViewOffset
public void setViewOffset(double newX, double newY)Description copied from interface:ViewerInterfaceset the offset of the top left displayed pixel to relative to top left of the full image (in full resolution coordinates)- Specified by:
setViewOffsetin interfaceViewerInterface
-
getChannelName
-
showTimeLabel
public void showTimeLabel(boolean selected) -
showZPositionLabel
public void showZPositionLabel(boolean selected) -
getCurrentT
-
getCurrentZPosition
-
setCustomCanvasMouseListener
Description copied from interface:ViewerInterfaceAdd a custom object to respond to different types of mouse events on the canvas- Specified by:
setCustomCanvasMouseListenerin interfaceViewerInterface
-
getDisplayImageSize
Description copied from interface:ViewerInterfaceGet the size of the ge displayed on screen- Specified by:
getDisplayImageSizein interfaceViewerInterface- Returns:
-
setOverlayerPlugin
Description copied from interface:ViewerInterfaceSet a custom object to provide overlays- Specified by:
setOverlayerPluginin interfaceViewerInterface
-
addControlPanel
Description copied from interface:ViewerInterfaceAdd a custom JPanel containing controls to the JTabbedPane on the right side of the image- Specified by:
addControlPanelin interfaceViewerInterface
-
getChannelIndex
-
requestToClose
public void requestToClose()Called when window is x-ed out by user -
close
public void close()Description copied from interface:ViewerInterfaceForces the viewer to close, automatically aborting any acquisition in the process- Specified by:
closein interfaceViewerInterface
-
getSummaryMD
public mmcorej.org.json.JSONObject getSummaryMD()
-