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

adds button for duplicating annotations #6386

Merged
merged 4 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Added an "extrude segment" feature which is similar to the old "copy from previous slice" feature. The segment interpolation and the new segment extrusion feature are both available via the toolbar (see the dropdown icon which was added to the old interpolation button). [#6370](https://github.com/scalableminds/webknossos/pull/6370)
- Added support for ad-hoc meshing for volume annotation layers with fallback segmentations. [#6369](https://github.com/scalableminds/webknossos/pull/6369)
- Added new backend API route for requesting all publications. Those publications can now have also attached annotations. [#6315](https://github.com/scalableminds/webknossos/pull/6315)
- Added a "duplicate" button for annotations. [#6386](https://github.com/scalableminds/webknossos/pull/6386)


### Changed
Expand Down
1 change: 1 addition & 0 deletions docs/tracing_ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The most common buttons are:
- `Archive`: Closes the annotation and archives it, removing it from a user's dashboard. Archived annotations can be found on a user's dashboard under "Annotations" and by clicking on "Show Archived Annotations". Use this to declutter your dashboard. (Not available for tasks)
- `Download`: Starts a download of the current annotation including any skeleton and volume data. Skeleton annotations are downloaded as [NML](./data_formats.md#nml) files. Volume annotation downloads contain the raw segmentation data as [WKW](./data_formats.md#wkw) files.
- `Share`: Create a shareable link to your dataset containing the current position, rotation, zoom level etc. Use this to collaboratively work with colleagues. Read more about this feature in the [Sharing guide](./sharing.md).
- `Duplicate`: Create a duplicate of this annotation. The duplicate will be created in your account, even if the original annotation belongs to somebody else.
- `Add Script`: Using the [webKnossos frontend API](https://webknossos.org/assets/docs/frontend-api/index.html) users can script and automate webKnossos interactions. Enter and execute your user scripts (Javascript) from here. Admins can curate a collection of frequently used scripts for your organization and make them available for quick selection to all users.
- `Restore Older Version`: Opens a window that shows all previous versions of an annotation. webKnossos keeps a complete version history of all your changes to an annotation (separate for skeleton/volume). From this window, any older version can be selected, previewed, and restored.

Expand Down
2 changes: 1 addition & 1 deletion frontend/javascripts/admin/admin_rest_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ export function finishAllAnnotations(selectedAnnotationIds: Array<string>): Prom
);
}

export function copyAnnotationToUserAccount(
export function duplicateAnnotation(
annotationId: string,
annotationType: APIAnnotationType,
): Promise<APIAnnotation> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
CheckCircleOutlined,
CheckOutlined,
CodeSandboxOutlined,
CopyOutlined,
DeleteOutlined,
DisconnectOutlined,
DownloadOutlined,
Expand All @@ -30,7 +31,7 @@ import { AsyncButton, AsyncButtonProps } from "components/async_clickables";
import type { LayoutKeys } from "oxalis/view/layouting/default_layout_configs";
import { mapLayoutKeysToLanguage } from "oxalis/view/layouting/default_layout_configs";
import {
copyAnnotationToUserAccount,
duplicateAnnotation,
finishAnnotation,
reOpenAnnotation,
createExplorational,
Expand Down Expand Up @@ -302,11 +303,21 @@ class TracingActionsView extends React.PureComponent<Props, State> {
};

handleCopyToAccount = async () => {
const newAnnotation = await copyAnnotationToUserAccount(
// duplicates the annotation in the current user account
const newAnnotation = await duplicateAnnotation(
this.props.annotationId,
this.props.annotationType,
);
location.href = `/annotations/Explorational/${newAnnotation.id}`;
location.href = `/annotations/${newAnnotation.id}`;
};

handleDuplicate = async () => {
await Model.ensureSavedState();
const newAnnotation = await duplicateAnnotation(
this.props.annotationId,
this.props.annotationType,
);
location.href = `/annotations/${newAnnotation.id}`;
};

handleCopySandboxToAccount = async () => {
Expand Down Expand Up @@ -583,6 +594,14 @@ class TracingActionsView extends React.PureComponent<Props, State> {
annotationId={annotationId}
/>,
);
if (activeUser != null) {
elements.push(
<Menu.Item key="duplicate-button" onClick={this.handleDuplicate}>
<CopyOutlined />
Duplicate
</Menu.Item>,
);
}
elements.push(screenshotMenuItem);
elements.push(
<Menu.Item key="user-scripts-button" onClick={this.handleUserScriptsOpen}>
Expand Down