Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video annotation: Extending the Point Tool #2099

Merged
merged 37 commits into from
May 5, 2021

Conversation

ErikOstlund
Copy link
Contributor

Package: lib-classifier
Project: Video Annotator
Project URL

Closes #2098

Changes:

The main chunk of this PR is to extend the following:

  • Point Marks model
  • PointTool Tools model
  • Point Component

to the following new files:

  • TemporalPoint Marks model
  • TemporalPoint Tools model
  • TemporalPoint Component

This was done by simulating inheritance by using type composition (reference).

The Point tool has the following properties:
PointTool

After extending the Points tool to TemporalTool, a time (t) property was added:
TemporalPointTool

When the TemporalPoint tool is used, the annotation will only display from the video timestamp it was created to the end of the video.

Misc clean-up was done including ESlint/Prettier fixes per Zooniverse Style Guide following: JavaScript Standard Style

Testing

In the front-end-monorepo folder, run yarn bootstrap to build the packages. Then cd packages/lib-classifier and run yarn dev.
Project URL: https://localhost:8080/?env=production&project=13789&workflow=16843

ErikOstlund and others added 17 commits March 31, 2021 20:32
per the Zooniverse style guide
From the SingleVideoViewerContainer to DrawingToolMarks so we can determine when to show an annotation.
Added a ’t’ property to the Point model to represent the timeStamp of a video.

# Conflicts:
#	packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/InteractionLayer/InteractionLayer.js
#	packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/SingleVideoViewer/SingleVideoViewerContainer.js
to easily reuse in other components.
And only show the annotation if current video timeStamp is greater or equal to the annotation timeStamp.
per the Zooniverse style guide
@ErikOstlund ErikOstlund added the enhancement New feature or request label Apr 12, 2021
@ErikOstlund ErikOstlund requested a review from a team April 12, 2021 22:32
ErikOstlund and others added 7 commits April 12, 2021 17:52
…o video-annotation-timestamp

# Conflicts:
#	packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/InteractionLayer/InteractionLayer.js
#	packages/lib-classifier/src/components/Classifier/components/SubjectViewer/components/InteractionLayer/components/DrawingToolMarks/DrawingToolMarks.js
#	packages/lib-classifier/src/plugins/drawingTools/components/Mark/Mark.js
#	packages/lib-classifier/src/plugins/drawingTools/models/marks/Mark/Mark.js
Copy link
Contributor

@goplayoutside3 goplayoutside3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added just two non-blocking comments, but looks great!

Comment on lines 60 to 64
TemporalPoint.propTypes = {
active: PropTypes.bool,
mark: PropTypes.object,
scale: PropTypes.number
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion to add the other prop onFinish to propTypes here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! But based on other comments and some refactoring, this file is being removed.

import PointTool from '../PointTool'
import { TemporalPoint } from '../../marks'

const TemporalPointTool = types
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably already have this planned, but a note to add a TemporalPointTool.spec test file 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have mentioned this in the PR - apologies. All unit tests will be in a future PR.

@github-actions github-actions bot added the approved This PR is approved for merging label Apr 22, 2021
@srallen
Copy link
Contributor

srallen commented Apr 23, 2021

@ErikOstlund we may need to give @CKrawczyk notice about this new drawing tool type for aggregation purposes. It'd be good to have a write up about the new tool types intended to be used with video, so perhaps a follow up ADR for this so it can be documented? Thanks!


const TemporalPointModel = types
.model('TemporalPointModel', {
t: types.optional(types.number, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer object properties and variable names to be spelled out, so it's absolutely clear as possible on intent. How about time here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time is good for this iteration. 👍

Though I suspect in the future this will evolve into startTime and endTime in a later enhancement. (Time ranges appears to be the direction the research project's requirements are going, IIRC?)

Copy link
Contributor

@srallen srallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question: The TemporalPoint component looks to be identical to the Point component. Is there a plan for TemporalPoint to diverge so that having a separate point component be necessary? Totally ok if this is setup for some future planned work. If it's not, perhaps the TemporalPoint model could return the existing Point mark component?

@ErikOstlund
Copy link
Contributor Author

Just a question: The TemporalPoint component looks to be identical to the Point component. Is there a plan for TemporalPoint to diverge so that having a separate point component be necessary? Totally ok if this is setup for some future planned work. If it's not, perhaps the TemporalPoint model could return the existing Point mark component?

@srallen, good catch! Initially, we weren't sure if the TemporalPoint component would need some extra buttons for 'displayTime' or 'hideTime'. This is still uncertain and can be added later if needed. For now, I refactored this based on your suggestion.

Copy link
Contributor

@srallen srallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -40,11 +40,12 @@ const icons = {
polygon: Polygon,
rectangle: Rectangle,
rotateRectangle: RotateRectangle,
temporalPoint: Point,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might consider a different icon, but something that can be followed up later.

@ErikOstlund ErikOstlund merged commit a04cd61 into master May 5, 2021
@ErikOstlund ErikOstlund deleted the video-annotation-timestamp branch May 5, 2021 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved This PR is approved for merging enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend the Point Annotation Tool
4 participants