Package qupath.lib.gui.viewer.recording
Class ViewTracker
java.lang.Object
qupath.lib.gui.viewer.recording.ViewTracker
- All Implemented Interfaces:
EventListener,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 Summary
PropertiesTypePropertyDescriptionReturn the activeTool property of this tracker.Return the cursorTracking property of this tracker.Return the eyeTracking property of this tracker.Return the String property of thisViewTracker.Return the recording property of thisViewTracker. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final DecimalFormatprotected static final String -
Method Summary
Modifier and TypeMethodDescriptionReturn the activeTool property of this tracker.voidappendFrame(qupath.lib.gui.viewer.recording.ViewRecordingFrame frame) Append frame to the collection of frames.Return the cursorTracking property of this tracker.Return the eyeTracking property of this tracker.protected PathToolList<qupath.lib.gui.viewer.recording.ViewRecordingFrame>Return the collection of recorded frames.protected Booleanprotected Point2DgetFile()Return the file associated with thisViewTracker.qupath.lib.gui.viewer.recording.ViewRecordingFramegetFrame(int index) Return the frame at the specifiedindex.qupath.lib.gui.viewer.recording.ViewRecordingFramegetFrameForTime(long timestamp) Return the frame visible at the specifiedtimestamp(in ms).intgetFrameIndexForTime(long timestamp) Return the index of the frame visible at the specifiedtimestamp(in ms).protected List<qupath.lib.gui.viewer.recording.ViewRecordingFrame>Return an unmodifiable list of all the frames stored by this view tracker.longReturn the time associated with the last recorded frame.protected Point2DgetName()Return the name of thisViewTracker.longReturn the time associated with the first recorded frame.booleanReturn whether thisViewTrackertracks the active tool.booleanReturn whether thisViewTrackertracks the cursor.booleanReturn whether thisViewTrackertracks the eye.booleanhasZAndT()Return whether thisViewTrackerhas Z and T information.voidimageDataChanged(QuPathViewer viewer, ImageData<BufferedImage> imageDataOld, ImageData<BufferedImage> imageDataNew) Called with the image data within a viewer has changed.booleanisEmpty()Return whether the collection of recorded frames is empty.booleanisLastFrame(qupath.lib.gui.viewer.recording.ViewRecordingFrame frame) Return whether the specifiedframeis the last one recorded.booleanReturn whether thisis currently recording.Return the String property of thisViewTracker.intnFrames()Return the number of recorded frames.Return the recording property of thisViewTracker.voidselectedObjectChanged(QuPathViewer viewer, PathObject pathObjectSelected) Called when the primary selected object has changed in a viewer.voidSet the file for thisViewTracker.voidSet the name of thisViewTracker.voidsetOptionalParameters(boolean ZandT, boolean cursorTracking, boolean activeToolTracking, boolean eyeTracking) Set optional parameters for thisViewTracker.voidsetRecording(boolean recording) Set the recording property of thisViewTracker.voidviewerClosed(QuPathViewer viewer) Called when a viewer is closed.voidvisibleRegionChanged(QuPathViewer viewer, Shape shape) Called when the visible region has changed in a viewer.
-
Property Details
-
recording
Return the recording property of thisViewTracker.- See Also:
-
name
Return the String property of thisViewTracker.- See Also:
-
cursorTracking
Return the cursorTracking property of this tracker. -
activeTool
Return the activeTool property of this tracker. -
eyeTracking
Return the eyeTracking property of this tracker.
-
-
Field Details
-
df
-
LOG_DELIMITER
- See Also:
-
-
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 specifiedindex.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 thisViewTracker.- Parameters:
recording-
-
isRecording
public boolean isRecording()Return whether thisis 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
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 specifiedframeis 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 specifiedtimestamp(in ms). If thetimestampis 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 specifiedtimestamp(in ms).- Parameters:
timestamp-- Returns:
- the corresponding frame
-
visibleRegionChanged
Description copied from interface:QuPathViewerListenerCalled when the visible region has changed in a viewer.- Specified by:
visibleRegionChangedin interfaceQuPathViewerListener- 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
-
getActiveToolIfRequired
-
getEyePointIfRequired
-
getEyeFixatedIfRequired
-
selectedObjectChanged
Description copied from interface:QuPathViewerListenerCalled when the primary selected object has changed in a viewer.- Specified by:
selectedObjectChangedin interfaceQuPathViewerListener- Parameters:
viewer- the viewer
-
viewerClosed
Description copied from interface:QuPathViewerListenerCalled when a viewer is closed.- Specified by:
viewerClosedin interfaceQuPathViewerListener- Parameters:
viewer- the viewer that has been closed.
-
recordingProperty
Return the recording property of thisViewTracker.- See Also:
-
imageDataChanged
public void imageDataChanged(QuPathViewer viewer, ImageData<BufferedImage> imageDataOld, ImageData<BufferedImage> imageDataNew) Description copied from interface:QuPathViewerListenerCalled with the image data within a viewer has changed.- Specified by:
imageDataChangedin interfaceQuPathViewerListener- Parameters:
viewer- the viewer whose image has changedimageDataOld- the image previously open in the viewerimageDataNew- the image now open in the viewer
-
getFile
Return the file associated with thisViewTracker. This can returnnullif it is not local or if the recording cannot be saved.- Returns:
- file
-
setFile
Set the file for thisViewTracker.- Parameters:
file-
-
getName
Return the name of thisViewTracker.- Returns:
- name
-
setName
Set the name of thisViewTracker.- Parameters:
name-
-
nameProperty
Return the String property of thisViewTracker.- 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 thisViewTrackerhas Z and T information.- Returns:
- whether it has Z and T
-
hasCursorTrackingData
public boolean hasCursorTrackingData()Return whether thisViewTrackertracks the cursor.- Returns:
- whether the cursor is tracked
-
hasActiveToolTrackingData
public boolean hasActiveToolTrackingData()Return whether thisViewTrackertracks the active tool.- Returns:
- whether active tool is tracked
-
hasEyeTrackingData
public boolean hasEyeTrackingData()Return whether thisViewTrackertracks the eye.- Returns:
- whether the eye is tracked
-
cursorTrackingProperty
Return the cursorTracking property of this tracker. -
activeToolProperty
Return the activeTool property of this tracker. -
eyeTrackingProperty
Return the eyeTracking property of this tracker. -
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 thisViewTracker.- Parameters:
ZandT-cursorTracking-activeToolTracking-eyeTracking-
-