google / neuroglancer

WebGL-based viewer for volumetric data
Apache License 2.0
1.07k stars 295 forks source link

Import annotation from csv feature, is it still available? #526

Closed mikejhuang closed 7 months ago

mikejhuang commented 8 months ago

This resource shows that once creating an annotation layer by ctrl+click new layer, there's a button to import or export annotations to csv. https://brainmaps.princeton.edu/2020/10/new-neuroglancer-feature-import-annotations-from-csv-files/ image

However, this does not show up in my present neuroglancer UI. image

What is the current method to import annotations from a csv if it's no longer available?

fcollman commented 8 months ago

This is related to a long ago fork of the seung-lab branch with mainline google. That documentation refers to the seung-lab branch. There is no GUI right now for upload/download of annotation layer annotations. You have to parse out the json in the state using the {} tool in the upper right. To create states there are some python tooling available via neuroglancer python, or pipelines build on top of it like nglui (https://pypi.org/project/nglui/).

Note annotation layers of most types can be dragged from seung-lab windows to mainline google, so a workaround is to use seung-lab branch (deployed at neuromancer-seung-import.appspot.com) and then create the annotation layer and then drag it over to a mainline neuroglancer window. Note there are more annotation features in seung-lab branch that aren't part of mainline so this only works with certain basic types of annotation features.

mikejhuang commented 8 months ago

Hmmm, given that the json is converted into a web URL, do you think there is a limit to the number of annotations before the URL becomes too long for the browser to handle? I'm working with MERSCOPE cell coordinates that number in the millions. I may need to find an alternative way to perform this annotation.

Edit: I suppose it's prudent to first give it a shot. Thanks for sharing that resource.

fcollman commented 7 months ago

Yes.. annotations in the json are only reasonable up to ~10K or so, and things begin breaking down in performance after that point.

Precomputed annotations can be written, I've been working on a PR #522 to make writing this format more accessible, you should give that branch a try in writing some MERSCOPE cell coordinates.

mikejhuang commented 7 months ago

I added 1000 annotations using the example "python/examples/write_annotations.py" from your PR #522 The spots tend to disappear. I might need to optimize the sharding parameters more. I tried a larger chunk size but it's made things worse.

https://github.com/google/neuroglancer/assets/10882060/373349c2-273d-4288-8104-fe604258fb8b

fcollman commented 7 months ago

try adjusting where you click in the spacing lines, this will modulate how many annotations will get loaded

image