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

Extend JS API with some functionality for managing segments #7694

Merged
merged 3 commits into from
Mar 18, 2024

Conversation

philippotto
Copy link
Member

@philippotto philippotto commented Mar 15, 2024

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • execute the following in the console:
window.webknossos.apiReady(3).then(api => {
   const layerName = api.data.getSegmentationLayerNames()[0];
   api.tracing.registerSegment(1, [10, 10, 10], undefined, layerName);
   const groupId = api.tracing.createSegmentGroup("New group")

   api.tracing.updateSegment(1, {name: "myName", groupId}, layerName);
   const segment = api.tracing.getSegment(1, layerName);
   console.log(segment);
})

Issues:

  • users reported missing some functionality

(Please delete unneeded items, merge only when none are left open)

@philippotto philippotto self-assigned this Mar 15, 2024
* console.log(segment.groupId)
*/
getSegment(segmentId: number, layerName: string): Segment {
const segment = getSegmentsForLayer(Store.getState(), layerName).get(segmentId);
Copy link
Member

Choose a reason for hiding this comment

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

What happens if the layer name does not exist?

Copy link
Member Author

Choose a reason for hiding this comment

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

an error will be thrown which I find acceptable.

@philippotto philippotto merged commit a49bcb8 into master Mar 18, 2024
2 checks passed
@philippotto philippotto deleted the extend-segment-api branch March 18, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants