public class NDViewer extends Object implements NDViewerAPI
| Modifier and Type | Field and Description |
|---|---|
protected NDViewerDataSource |
dataSource_ |
protected DataViewCoords |
viewCoords_ |
| Constructor and Description |
|---|
NDViewer(NDViewerDataSource cache,
NDViewerAcqInterface acq,
mmcorej.org.json.JSONObject summaryMD,
double pixelSize,
boolean rgb) |
NDViewer(NDViewerDataSource cache,
NDViewerAcqInterface acq,
mmcorej.org.json.JSONObject summaryMD,
double pixelSize,
boolean rgb,
String preferencesKey) |
| Modifier and Type | Method and Description |
|---|---|
void |
abortAcquisition() |
void |
addControlPanel(ControlsPanelInterface panel)
Add a custom JPanel containing controls to the JTabbedPane on the right
side of the image.
|
void |
addSetImageHook(Consumer<HashMap<String,Object>> hook)
Add a hook function that runs whenever setImage gets called,
either programatically or by someone moving the scrollbars
|
void |
channelSetActive(String channelName,
boolean selected) |
void |
close()
Forces the viewer to close, automatically aborting any acquisition in the
process.
|
Object |
getAxisPosition(String axis)
Get the position that the scrollbar with the given label is currently at.
|
ViewerCanvas |
getCanvas() |
JPanel |
getCanvasJPanel()
Get reference to the JPanel on which image drawing takes place.
|
List<String> |
getChannels() |
String |
getCurrentT() |
String |
getCurrentZPosition() |
Point2D.Double |
getDisplayImageSize()
Get the size of the ge displayed on screen.
|
mmcorej.org.json.JSONObject |
getDisplaySettingsJSON()
Get the JSON represenation of the internal data structure use for saving
display and contrast settings.
|
DisplaySettings |
getDisplaySettingsObject() |
Point2D.Double |
getFullResSourceDataSize()
Pixel size of the region currently being displayed in full resolution
pixels.
|
int |
getIntegerPositionFromStringPosition(String axisName,
String axisPosition)
Convert the position of a string axis to an integer position
|
double |
getMagnification()
Return ratio between size of pixels on screen and size of full resolution
pixels in the imamge.
|
double |
getPixelSize() |
Preferences |
getPreferences() |
String |
getStringPositionFromIntegerPosition(String axisName,
int axisPosition) |
mmcorej.org.json.JSONObject |
getSummaryMD() |
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).
|
void |
initializeViewerToLoaded(List<String> channelNames,
mmcorej.org.json.JSONObject dispSettings,
HashMap<String,Object> axisMins,
HashMap<String,Object> axisMaxs)
Initialize all controls needed for a dataset loaded from disk
where you're not calling newImageArrived each time.
|
boolean |
isAcquisitionPaused() |
boolean |
isCompositMode() |
boolean |
isImageXYBounded() |
boolean |
isIntegerAxis(String axis) |
void |
newImageArrived(HashMap<String,Object> axesPositions)
Signal to viewer that a new image is available.
|
void |
onAnimationToggle(AxisScroller scoller,
boolean animate) |
void |
onCanvasResize(int w,
int h) |
void |
onContrastUpdated() |
void |
onScollersAdded() |
void |
onScollPositionChanged(AxisScroller scroller,
int value) |
void |
pan(int dx,
int dy)
Change the view offset by the specified amount.
|
void |
redrawOverlay()
trigger redraw of the image overlay.
|
void |
requestToClose()
Called when window is x-ed out by user.
|
void |
setAnimateFPS(double doubleValue) |
void |
setAxisPosition(String axis,
int position)
Set the scrollbar with a given axis label to a position.
|
void |
setChannelColor(String channel,
Color c)
Set display settings for channel with the given name.
|
void |
setCompositeMode(boolean selected) |
void |
setCustomCanvasMouseListener(CanvasMouseListenerInterface m)
Add a custom object to respond to different types of mouse events on the
canvas.
|
void |
setImageEvent(HashMap<String,Object> axes,
boolean fromHuman)
Called when scrollbars move
|
void |
setOverlay(Overlay overlay)
Set a custom overlay object to be displayed on top of the image.
|
void |
setOverlayerPlugin(OverlayerPlugin overlayer)
Set a custom object to provide overlays.
|
void |
setPausedAction(boolean paused) |
void |
setReadTimeMetadataFunction(Function<mmcorej.org.json.JSONObject,Long> fn)
Optional: Pass in a function that tells how to extract elapsed ms from
image metadata, for display purposes.
|
void |
setReadZMetadataFunction(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 purposes.
|
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).
|
void |
setWindowTitle(String s)
Set the text in the windows frame.
|
void |
showFolder() |
void |
showScaleBar(boolean selected) |
void |
showTimeLabel(boolean selected) |
void |
showZPositionLabel(boolean selected) |
void |
superlockAllScrollers() |
void |
unlockAllScroller() |
void |
update()
Redraw current image and any overlay
|
void |
zoom(double factor,
Point mouseLocation)
multiply zoom by given factor, centered at location.
|
protected volatile NDViewerDataSource dataSource_
protected DataViewCoords viewCoords_
public NDViewer(NDViewerDataSource cache, NDViewerAcqInterface acq, mmcorej.org.json.JSONObject summaryMD, double pixelSize, boolean rgb)
public NDViewer(NDViewerDataSource cache, NDViewerAcqInterface acq, mmcorej.org.json.JSONObject summaryMD, double pixelSize, boolean rgb, String preferencesKey)
public int getIntegerPositionFromStringPosition(String axisName, String axisPosition)
axisPosition - public String getStringPositionFromIntegerPosition(String axisName, int axisPosition)
public void setReadTimeMetadataFunction(Function<mmcorej.org.json.JSONObject,Long> fn)
NDViewerAPIsetReadTimeMetadataFunction in interface NDViewerAPIpublic void setReadZMetadataFunction(Function<mmcorej.org.json.JSONObject,Double> fn)
NDViewerAPIsetReadZMetadataFunction in interface NDViewerAPIpublic void setChannelColor(String channel, Color c)
NDViewerAPIsetChannelColor in interface NDViewerAPIpublic boolean isImageXYBounded()
public mmcorej.org.json.JSONObject getDisplaySettingsJSON()
NDViewerAPIgetDisplaySettingsJSON in interface NDViewerAPIpublic Preferences getPreferences()
public void pan(int dx,
int dy)
NDViewerAPIpan in interface NDViewerAPIpublic void onScollersAdded()
public void onScollPositionChanged(AxisScroller scroller, int value)
public void zoom(double factor,
Point mouseLocation)
NDViewerAPIzoom in interface NDViewerAPImouseLocation - location in display pixel coordinates, or null to zoom in
on centerpublic void onCanvasResize(int w,
int h)
public void initializeViewerToLoaded(List<String> channelNames, mmcorej.org.json.JSONObject dispSettings, HashMap<String,Object> axisMins, HashMap<String,Object> axisMaxs)
NDViewerAPIinitializeViewerToLoaded in interface NDViewerAPIchannelNames - names of all channelsaxisMins - map of axis names to miniumum extents (can be negative)axisMaxs - map of axis names to maximum extentspublic void channelSetActive(String channelName, boolean selected)
public void setWindowTitle(String s)
NDViewerAPIsetWindowTitle in interface NDViewerAPIpublic void newImageArrived(HashMap<String,Object> axesPositions)
newImageArrived in interface NDViewerAPIaxesPositions - Hashmap of axis labels to positionspublic void addSetImageHook(Consumer<HashMap<String,Object>> hook)
NDViewerAPIaddSetImageHook in interface NDViewerAPIpublic void setAxisPosition(String axis, int position)
NDViewerAPIsetAxisPosition in interface NDViewerAPIpublic void setImageEvent(HashMap<String,Object> axes, boolean fromHuman)
public void onContrastUpdated()
public void onAnimationToggle(AxisScroller scoller, boolean animate)
public void update()
NDViewerAPIupdate in interface NDViewerAPIpublic ViewerCanvas getCanvas()
public void superlockAllScrollers()
public void unlockAllScroller()
public void showFolder()
public void setAnimateFPS(double doubleValue)
public void abortAcquisition()
public void setPausedAction(boolean paused)
public boolean isAcquisitionPaused()
public void setOverlay(Overlay overlay)
NDViewerAPIOverlayerPluginsetOverlay in interface NDViewerAPIpublic void redrawOverlay()
NDViewerAPIredrawOverlay in interface NDViewerAPIpublic double getMagnification()
NDViewerAPIgetMagnification in interface NDViewerAPIpublic double getPixelSize()
public void showScaleBar(boolean selected)
public void setCompositeMode(boolean selected)
public boolean isCompositMode()
public DisplaySettings getDisplaySettingsObject()
public JPanel getCanvasJPanel()
NDViewerAPIgetCanvasJPanel in interface NDViewerAPIpublic Object getAxisPosition(String axis)
NDViewerAPIgetAxisPosition in interface NDViewerAPIpublic Point2D.Double getViewOffset()
NDViewerAPIgetViewOffset in interface NDViewerAPIpublic Point2D.Double getFullResSourceDataSize()
NDViewerAPIgetFullResSourceDataSize in interface NDViewerAPIpublic void setViewOffset(double newX,
double newY)
NDViewerAPIsetViewOffset in interface NDViewerAPIpublic void showTimeLabel(boolean selected)
public void showZPositionLabel(boolean selected)
public String getCurrentT()
public String getCurrentZPosition()
public void setCustomCanvasMouseListener(CanvasMouseListenerInterface m)
NDViewerAPIsetCustomCanvasMouseListener in interface NDViewerAPIpublic Point2D.Double getDisplayImageSize()
NDViewerAPIgetDisplayImageSize in interface NDViewerAPIpublic void setOverlayerPlugin(OverlayerPlugin overlayer)
NDViewerAPIsetOverlayerPlugin in interface NDViewerAPIpublic void addControlPanel(ControlsPanelInterface panel)
NDViewerAPIaddControlPanel in interface NDViewerAPIpublic boolean isIntegerAxis(String axis)
public void requestToClose()
public void close()
NDViewerAPIclose in interface NDViewerAPIpublic mmcorej.org.json.JSONObject getSummaryMD()
Copyright © 2023. All rights reserved.