Add segment IDs by their text labels programmatically? (with neuroglancer_segment_properties)
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 389
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
Hey @jbms — I read through the docs and some comments in #199 and I don't think there's an easy way to do this currently:
If I have a `segmentation` channel with IDs `[1, 2, 3, 4]` and a `neuroglancer_segment_properties` `info` that looks like this:
```json
{
"inline": {
"ids": ["1", "2", "3", "4"],
"properties": [{
"type": "label",
"id": "label",
"values": ["John", "Paul", "George", "Ringo"]
}]
}
}
```
**Is there an easy way to add `Ringo` to the `segments` array of my ngl state object at pageload, if I don't know what ID that corresponds to?**
Right now, I need to know that `Ringo` corresponds to segment `"4"` so that I can populate state like this:
```js
... // in `layers[]`
{
"type": "segmentation",
"source": [
"precomputed://.../segmentation",
"precomputed://.../properties"
],
"tab": "source",
"segments": [
"4", // Works
"Ringo" // Doesn't Work
],
"name": "segmentation"
},
...
```
Is there a way for me to specify the `label` instead of the segment ID, and let neuroglancer run the lookup at load time?
Contributor guide
Assessment
This issue has not been assessed yet.