Skip to content

Commit

Permalink
Create Volumetric Task (#7227)
Browse files Browse the repository at this point in the history
* Create Volumetric Task
* Clean up based on PR feedback
  • Loading branch information
kieftrav authored Dec 16, 2024
1 parent a854eb3 commit 9d723fb
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/classifier/tasks/generic-editor.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = createReactClass
when 'slider' then ['instruction']
when 'highlighter' then ['instruction', 'highlighterLabels']
when 'dataVisAnnotation' then ['instruction', 'tools']
when 'volumetric' then ['instruction']

isAQuestion = @props.task.type in ['single', 'multiple']
canBeRequired = @props.task.type in ['single', 'multiple', 'text']
Expand Down
4 changes: 3 additions & 1 deletion app/classifier/tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Highlighter from './highlighter';
import TranscriptionTask from './transcription';
import SubjectGroupComparisonTask from './subjectGroupComparison';
import DataVisAnnotationTask from './dataVisAnnotation'
import VolumetricTask from './volumetric';

const tasks = {
combo: ComboTask,
Expand All @@ -29,7 +30,8 @@ const tasks = {
highlighter: Highlighter,
transcription: TranscriptionTask,
subjectGroupComparison: SubjectGroupComparisonTask,
dataVisAnnotation: DataVisAnnotationTask
dataVisAnnotation: DataVisAnnotationTask,
volumetric: VolumetricTask
};

export default tasks;
44 changes: 44 additions & 0 deletions app/classifier/tasks/volumetric/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import PropTypes from "prop-types";
import React from "react";
import GenericTaskEditor from "../generic-editor";

export default class VolumetricTask extends React.Component {
render() {
return <div>This is a placeholder for the Volumetric Task, which is only visible in the FEM Classifier</div>;
}
}

VolumetricTask.Editor = GenericTaskEditor;

VolumetricTask.getDefaultTask = () => ({
help: "",
instruction: "Describe how to use this tool",
type: "volumetric",
});

VolumetricTask.getTaskText = (task) => task.instruction;

VolumetricTask.getDefaultAnnotation = () => ({ value: [] });

VolumetricTask.defaultProps = {
showRequiredNotice: false,
task: {
help: "",
required: false,
type: "volumetric",
instruction: "Describe how to use this tool",
},
workflow: {
tasks: [],
},
};

VolumetricTask.propTypes = {
showRequiredNotice: PropTypes.bool,
task: PropTypes.shape({
help: PropTypes.string,
instruction: PropTypes.string,
required: PropTypes.bool,
type: PropTypes.string,
})
};
2 changes: 1 addition & 1 deletion app/pages/admin/project-status/experimental-features.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const experimentalFeatures = [
'textFromSubject', // textFromSubject task only works in FEM!
'transcription-task',
'translator-role',
'volumetricViewer',
'volumetricProject', // Turns a project into a Volumetric-enabled Project
'wildcam classroom', // Indicates a Project is linked to a "WildCam Lab"-type Zooniverse Classroom. Allows the classifier to select a workflow (i.e. "classroom assignment") directly via ID.
'workflow assignment',
'worldwide telescope'
Expand Down
10 changes: 9 additions & 1 deletion app/pages/lab-fem/workflow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class EditWorkflowPage extends Component {
} = this.props.workflow.configuration;
if (hide_classification_summaries === undefined) { hide_classification_summaries = true; }

const isCaesarDataFetchingEnabled = this.props.workflow?.configuration?.enable_caesar_data_fetching ?? false;
const isCaesarDataFetchingEnabled = this.props.workflow?.configuration?.enable_caesar_data_fetching ?? false;

return (
<div className="edit-workflow-page">
Expand Down Expand Up @@ -301,6 +301,14 @@ class EditWorkflowPage extends Component {
<small><strong>Data annotation</strong></small>
</button>
</AutoSave> : undefined}{' '}
{this.canUseTask(this.props.project, "volumetricProject") ?
<AutoSave resource={this.props.workflow}>
<button type="button" className="minor-button" onClick={this.addNewTask.bind(this, 'volumetric')} title="Volumetric Task: the volunteer looks at a volumetric viewer, and selects the point of the volume to be annotated.">
<i className="fa fa-th fa-2x"></i>
<br />
<small><strong>Volumetric Task</strong></small>
</button>
</AutoSave> : undefined}{' '}
</div> : undefined}
</div>

Expand Down

0 comments on commit 9d723fb

Please sign in to comment.