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
TypePropertyDescriptionReturn 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
Modifier and TypeFieldDescriptionprotected static final DecimalFormat
protected static final String
-
Method Summary
Modifier and TypeMethodDescriptionReturn the activeTool property of this tracker.void
appendFrame
(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 PathTool
List
<qupath.lib.gui.viewer.recording.ViewRecordingFrame> Return the collection of recorded frames.protected Boolean
protected Point2D
getFile()
Return the file associated with thisViewTracker
.qupath.lib.gui.viewer.recording.ViewRecordingFrame
getFrame
(int index) Return the frame at the specifiedindex
.qupath.lib.gui.viewer.recording.ViewRecordingFrame
getFrameForTime
(long timestamp) Return the frame visible at the specifiedtimestamp
(in ms).int
getFrameIndexForTime
(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.long
Return the time associated with the last recorded frame.protected Point2D
getName()
Return the name of thisViewTracker
.long
Return the time associated with the first recorded frame.boolean
Return whether thisViewTracker
tracks the active tool.boolean
Return whether thisViewTracker
tracks the cursor.boolean
Return whether thisViewTracker
tracks the eye.boolean
hasZAndT()
Return whether thisViewTracker
has Z and T information.void
imageDataChanged
(QuPathViewer viewer, ImageData<BufferedImage> imageDataOld, ImageData<BufferedImage> imageDataNew) Called with the image data within a viewer has changed.boolean
isEmpty()
Return whether the collection of recorded frames is empty.boolean
isLastFrame
(qupath.lib.gui.viewer.recording.ViewRecordingFrame frame) Return whether the specifiedframe
is the last one recorded.boolean
Return whether thisis currently recording
.Return the String property of thisViewTracker
.int
nFrames()
Return the number of recorded frames.Return the recording property of thisViewTracker
.void
selectedObjectChanged
(QuPathViewer viewer, PathObject pathObjectSelected) Called when the primary selected object has changed in a viewer.void
Set the file for thisViewTracker
.void
Set the name of thisViewTracker
.void
setOptionalParameters
(boolean ZandT, boolean cursorTracking, boolean activeToolTracking, boolean eyeTracking) Set optional parameters for thisViewTracker
.void
setRecording
(boolean recording) Set the recording property of thisViewTracker
.void
viewerClosed
(QuPathViewer viewer) Called when a viewer is closed.void
visibleRegionChanged
(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.- See Also:
-
activeTool
Return the activeTool property of this tracker.- See Also:
-
eyeTracking
Return the eyeTracking property of this tracker.- See Also:
-
-
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 specifiedframe
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 specifiedtimestamp
(in ms). If thetimestamp
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 specifiedtimestamp
(in ms).- Parameters:
timestamp
-- Returns:
- the corresponding frame
-
visibleRegionChanged
Description copied from interface:QuPathViewerListener
Called when the visible region has changed in a viewer.- Specified by:
visibleRegionChanged
in 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:QuPathViewerListener
Called when the primary selected object has changed in a viewer.- Specified by:
selectedObjectChanged
in interfaceQuPathViewerListener
- Parameters:
viewer
- the viewerpathObjectSelected
-
-
viewerClosed
Description copied from interface:QuPathViewerListener
Called when a viewer is closed.- Specified by:
viewerClosed
in interfaceQuPathViewerListener
- Parameters:
viewer
- the viewer that has been closed.
-
recordingProperty
Return the recording property of thisViewTracker
.- 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 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 returnnull
if 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
.- 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 thisViewTracker
has Z and T information.- Returns:
- whether it has Z and T
-
hasCursorTrackingData
public boolean hasCursorTrackingData()Return whether thisViewTracker
tracks the cursor.- Returns:
- whether the cursor is tracked
-
hasActiveToolTrackingData
public boolean hasActiveToolTrackingData()Return whether thisViewTracker
tracks the active tool.- Returns:
- whether active tool is tracked
-
hasEyeTrackingData
public boolean hasEyeTrackingData()Return whether thisViewTracker
tracks the eye.- Returns:
- whether the eye is tracked
-
cursorTrackingProperty
Return the cursorTracking property of this tracker.- Returns:
- doCursorTracking
-
activeToolProperty
Return the activeTool property of this tracker.- Returns:
- doActiveToolTracking
-
eyeTrackingProperty
Return the eyeTracking property of this tracker.- Returns:
- doEyeTracking
-
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
-
-