Comments (3)
Try this:
with viewer.txn() as s:
s.layers['my-layer-name'].segments = ['16429', '18022']
Edit: Oops, that's an example for the Python API. Now I notice that you mentioned JS in the title. Someone else will need to chime in.
from neuroglancer.
Your example code works for me, at least in my browser's developer tools console...
temp_state = viewer.state.toJSON();
temp_state['layers'][1]['segments'] = ['26650', '11022'];
viewer.state.restoreState(temp_state);
(It does return undefined
, but the viewer updates correctly.)
One thing to double-check: The index of the layer (e.g. temp_state['layers'][10]
should NOT match what you see in the UI, since obviously the JSON layers
list starts with item 0
, whereas the UI starts counting at 1
. Are you sure you're updating the correct layer? And be sure you're looking at the complete layer list (including "archived" layers, not just the ones shown at the top of the screen).
BTW, I notice that neuroglancer's own JSON editing UI also calls reset()
before applying the new state, though I don't know why that's necessary:
neuroglancer/src/neuroglancer/ui/state_editor.ts
Lines 95 to 101 in 5ccc518
from neuroglancer.
Ah! working! @stuarteberg - I had two state variables that were very close to the same name and was updating with the incorrect one. Was also thrown off by the undefined
response. interesting about the reset
.
This has to be the one of the most helpful, quickest replying community. Thanks much!
from neuroglancer.
Related Issues (20)
- How to use the segment_split_merge_tool
- Expose `bind_port` in python server arguments HOT 1
- Zstandard support? HOT 1
- Support for datasets in authenticated S3-compatible private buckets HOT 6
- N5 now supports Zstandard HOT 2
- "StarredSegments" object has no attribute "_visible" on release 2.37
- Consider using SolidJS HOT 1
- Use FinalizationRegistry to manage inter-worker object mappings without reference counting
- undock layer side panel HOT 1
- Set matrix transform for ImageLayer via Python HOT 2
- Hiding yellow border for images? HOT 3
- neuroglancer default framebuffer size artificially limits resolution HOT 7
- MAX_DRAW_BUFFERS limit error with shader in Safari
- Spatial dimensions, xy, is rendering in the 'zy' plane instead of the 'xy' plane when using the zarr format HOT 3
- Annotation coloring by random seed
- Loading of precomputed data stalls HOT 2
- Import annotation from csv feature, is it still available? HOT 5
- precomputed annotation format related ID lookup HOT 2
- WebXR support
- feature request: change default shader for multi-channel images
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neuroglancer.