public class NDViewer extends Object implements NDViewerAPI
| Modifier and Type | Field and Description |
|---|---|
static String |
CHANNEL_AXIS |
static String |
NO_CHANNEL |
| Constructor and Description |
|---|
NDViewer(NDViewerDataSource cache,
NDViewerAcqInterface acq,
mmcorej.org.json.JSONObject summaryMD,
double pixelSize,
boolean rgb) |
NDViewer(NDViewerDataSource dataSource,
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 |
channelSetActiveByCheckbox(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.
|
String |
getCurrentT() |
String |
getCurrentZPosition() |
NDViewerDataSource |
getDataSource() |
Point2D.Double |
getDisplayImageSize()
Get the size of the ge displayed on screen.
|
DisplayModel |
getDisplayModel() |
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.
|
GuiManager |
getGUIManager() |
double |
getMagnification()
Return ratio between size of pixels on screen and size of full resolution
pixels in the imamge.
|
double |
getPixelSize() |
Preferences |
getPreferences() |
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(mmcorej.org.json.JSONObject dispSettings) |
void |
initializeViewerToLoaded(List<String> channelNames,
mmcorej.org.json.JSONObject displaySettings,
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() |
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 |
pan(int dx,
int dy)
Change the view offset by the specified amount.
|
void |
readHistogramControlsStateFromGUI() |
void |
redrawOverlay()
trigger redraw of the image overlay.
|
void |
requestToClose()
Called when window is x-ed out by user.
|
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 |
setHistogramSettings(boolean autostretch,
boolean ignoreOutliers,
boolean syncChannels,
boolean logHist,
boolean composite,
double percentToIgnore) |
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 |
updateActiveChannelCheckboxes() |
void |
zoom(double factor,
Point mouseLocation)
multiply zoom by given factor, centered at location.
|
public static String NO_CHANNEL
public static String CHANNEL_AXIS
public NDViewer(NDViewerDataSource cache, NDViewerAcqInterface acq, mmcorej.org.json.JSONObject summaryMD, double pixelSize, boolean rgb)
public NDViewer(NDViewerDataSource dataSource, NDViewerAcqInterface acq, mmcorej.org.json.JSONObject summaryMD, double pixelSize, boolean rgb, String preferencesKey)
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 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 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 displaySettings, 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 initializeViewerToLoaded(mmcorej.org.json.JSONObject dispSettings)
public void channelSetActiveByCheckbox(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 updateActiveChannelCheckboxes()
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 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 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 GuiManager getGUIManager()
public void setHistogramSettings(boolean autostretch,
boolean ignoreOutliers,
boolean syncChannels,
boolean logHist,
boolean composite,
double percentToIgnore)
public DisplayModel getDisplayModel()
public NDViewerDataSource getDataSource()
public void readHistogramControlsStateFromGUI()
public void requestToClose()
public void close()
NDViewerAPIclose in interface NDViewerAPIpublic mmcorej.org.json.JSONObject getSummaryMD()
Copyright © 2023. All rights reserved.