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 Details

    • newImageArrived

      void newImageArrived​(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 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 inferred
      channelName - Name of the channel of the image
    • setChannelDisplaySettings

      void setChannelDisplaySettings​(String chName, Color c, int bitDepth)
      Set display settings for channel with the given name.
      Parameters:
      chName -
      c -
      bitDepth -
    • setAxisPosition

      void setAxisPosition​(String axis, int pos)
      Set the scrollbar with a given axis label to a position
      Parameters:
      axis -
      pos -
    • getAxisPosition

      int getAxisPosition​(String axis)
      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 channels
      axisMins - map of axis names to miniumum extents (can be negative)
      axisMaxs - map of axis names to maximum extents
    • setWindowTitle

      void setWindowTitle​(String string)
      Set the text in the windows frame
      Parameters:
      string -
    • setReadTimeMetadataFunction

      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
      Parameters:
      fn -
    • setReadZMetadataFunction

      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
      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

      void zoom​(double factor, Point location)
      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

      void setCustomCanvasMouseListener​(CanvasMouseListenerInterface m)
      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

      void setOverlay​(Overlay overlay)
      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 custom OverlayerPlugin
      Parameters:
      overlay -
    • setOverlayerPlugin

      void setOverlayerPlugin​(OverlayerPlugin overlayer)
      Set a custom object to provide overlays
      Parameters:
      overlayer -
    • redrawOverlay

      void redrawOverlay()
      trigger redraw of the image overlay
    • addControlPanel

      void addControlPanel​(ControlsPanelInterface panel)
      Add a custom JPanel containing controls to the JTabbedPane on the right side of the image
      Parameters:
      panel -