Class ViewTracker

java.lang.Object
qupath.lib.gui.viewer.recording.ViewTracker
All Implemented Interfaces:
EventListener, QuPathViewerListener

public class ViewTracker extends Object implements QuPathViewerListener
Default ViewTracker implementation.

This tracks only viewer location and cursor position (no eye tracking... because it can't see you). It does not handle viewer rotations.

Author:
Pete Bankhead, Melvin Gelbard
  • Property Details

  • Field Details

  • Method Details

    • nFrames

      public int nFrames()
      Return the number of recorded frames.
      Returns:
      number of recorded frames
    • getFrame

      public qupath.lib.gui.viewer.recording.ViewRecordingFrame getFrame(int index)
      Return the frame at the specified index.

      N.B. The index is not equivalent to the frame's timestamp.

      Parameters:
      index -
      Returns:
      See Also:
    • setRecording

      public void setRecording(boolean recording)
      Set the recording property of this ViewTracker.
      Parameters:
      recording -
    • isRecording

      public boolean isRecording()
      Return whether this is currently recording.
      Returns:
      whether it is currently recording
    • isEmpty

      public boolean isEmpty()
      Return whether the collection of recorded frames is empty.
      Returns:
      whether the collection is empty
    • appendFrame

      public void appendFrame(qupath.lib.gui.viewer.recording.ViewRecordingFrame frame)
      Append frame to the collection of frames.
      Parameters:
      frame -
    • getFrames

      protected List<qupath.lib.gui.viewer.recording.ViewRecordingFrame> getFrames()
      Return an unmodifiable list of all the frames stored by this view tracker.
      Returns:
    • isLastFrame

      public boolean isLastFrame(qupath.lib.gui.viewer.recording.ViewRecordingFrame frame)
      Return whether the specified frame is the last one recorded.
      Parameters:
      frame -
      Returns:
      whether it is the last frame
    • getFrameIndexForTime

      public int getFrameIndexForTime(long timestamp)
      Return the index of the frame visible at the specified timestamp (in ms). If the timestamp is lower than the first recorded frame, 0 will be returned.
      Parameters:
      timestamp -
      Returns:
      index of frame
    • getFrameForTime

      public qupath.lib.gui.viewer.recording.ViewRecordingFrame getFrameForTime(long timestamp)
      Return the frame visible at the specified timestamp (in ms).
      Parameters:
      timestamp -
      Returns:
      the corresponding frame
    • visibleRegionChanged

      public void visibleRegionChanged(QuPathViewer viewer, Shape shape)
      Description copied from interface: QuPathViewerListener
      Called when the visible region has changed in a viewer.
      Specified by:
      visibleRegionChanged in interface QuPathViewerListener
      Parameters:
      viewer - the viewer whose visible region has changed.
      shape - shape representing the new visible region (in image pixel coordinates). This is rectangular, but may also be rotated.
    • getMousePointIfRequired

      protected Point2D getMousePointIfRequired()
    • getActiveToolIfRequired

      protected PathTool getActiveToolIfRequired()
    • getEyePointIfRequired

      protected Point2D getEyePointIfRequired()
    • getEyeFixatedIfRequired

      protected Boolean getEyeFixatedIfRequired()
    • selectedObjectChanged

      public void selectedObjectChanged(QuPathViewer viewer, PathObject pathObjectSelected)
      Description copied from interface: QuPathViewerListener
      Called when the primary selected object has changed in a viewer.
      Specified by:
      selectedObjectChanged in interface QuPathViewerListener
      Parameters:
      viewer - the viewer
      pathObjectSelected -
    • viewerClosed

      public void viewerClosed(QuPathViewer viewer)
      Description copied from interface: QuPathViewerListener
      Called when a viewer is closed.
      Specified by:
      viewerClosed in interface QuPathViewerListener
      Parameters:
      viewer - the viewer that has been closed.
    • recordingProperty

      public BooleanProperty recordingProperty()
      Return the recording property of this ViewTracker.
      Returns:
      recording property
      See Also:
    • imageDataChanged

      public void imageDataChanged(QuPathViewer viewer, ImageData<BufferedImage> imageDataOld, ImageData<BufferedImage> imageDataNew)
      Description copied from interface: QuPathViewerListener
      Called with the image data within a viewer has changed.
      Specified by:
      imageDataChanged in interface QuPathViewerListener
      Parameters:
      viewer - the viewer whose image has changed
      imageDataOld - the image previously open in the viewer
      imageDataNew - the image now open in the viewer
    • getFile

      public File getFile()
      Return the file associated with this ViewTracker. This can return null if it is not local or if the recording cannot be saved.
      Returns:
      file
    • setFile

      public void setFile(File file)
      Set the file for this ViewTracker.
      Parameters:
      file -
    • getName

      public String getName()
      Return the name of this ViewTracker.
      Returns:
      name
    • setName

      public void setName(String name)
      Set the name of this ViewTracker.
      Parameters:
      name -
    • nameProperty

      public StringProperty nameProperty()
      Return the String property of this ViewTracker.
      Returns:
      nameProperty
      See Also:
    • getStartTime

      public long getStartTime()
      Return the time associated with the first recorded frame.
      Returns:
      start time
    • getLastTime

      public long getLastTime()
      Return the time associated with the last recorded frame.
      Returns:
      last time
    • hasZAndT

      public boolean hasZAndT()
      Return whether this ViewTracker has Z and T information.
      Returns:
      whether it has Z and T
    • hasCursorTrackingData

      public boolean hasCursorTrackingData()
      Return whether this ViewTracker tracks the cursor.
      Returns:
      whether the cursor is tracked
    • hasActiveToolTrackingData

      public boolean hasActiveToolTrackingData()
      Return whether this ViewTracker tracks the active tool.
      Returns:
      whether active tool is tracked
    • hasEyeTrackingData

      public boolean hasEyeTrackingData()
      Return whether this ViewTracker tracks the eye.
      Returns:
      whether the eye is tracked
    • cursorTrackingProperty

      public BooleanProperty cursorTrackingProperty()
      Return the cursorTracking property of this tracker.
      Returns:
      doCursorTracking
    • activeToolProperty

      public BooleanProperty activeToolProperty()
      Return the activeTool property of this tracker.
      Returns:
      doActiveToolTracking
    • eyeTrackingProperty

      public BooleanProperty eyeTrackingProperty()
      Return the eyeTracking property of this tracker.
      Returns:
      doEyeTracking
    • getAllFrames

      public List<qupath.lib.gui.viewer.recording.ViewRecordingFrame> getAllFrames()
      Return the collection of recorded frames.
      Returns:
      collection of all frames
    • setOptionalParameters

      public void setOptionalParameters(boolean ZandT, boolean cursorTracking, boolean activeToolTracking, boolean eyeTracking)
      Set optional parameters for this ViewTracker.
      Parameters:
      ZandT -
      cursorTracking -
      activeToolTracking -
      eyeTracking -