-
Notifications
You must be signed in to change notification settings - Fork 295
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
text labels for segmentation layer #199
Comments
Yes, via a segment property map defined using the precomputed format: See example here: Note: The segmentation data itself does not need to be in the neuroglancer precomputed format, you can just add the segment property map as an additional data source. |
Note: Ignore the "indexed" property type, that isn't implemented yet. |
Depending on your use case, it might also make sense to define a new segment property map data source type, e.g. a DVID-backed one. |
Thanks for the information, I'm not sure I grok it all yet. For context, my datasets are n5 arrays stored on s3. I will have between 0 and 60 text labels to map to the same number of integer values in the segmented volume. Are you saying that I would need to define a segment property map as a datasource backed by a new JSON file that contains the mapping between uint64 values in one of my segmented volumes? (I know the FlyEM team, so I can ask them about this if you think they can demonstrate this to me) |
Yes, create a JSON file like: Then make sure it can be retrieved via a URL like: (the filename must be then add as a data source: precomputed://https://whatever If there is some convention for defining such maps as additional attributes within the n5 attributes.json file, then it would be easy enough to add support to Neuroglancer for that as well (then the map could be used automatically when you add the n5 data source). |
@jbms what is your suggested method for hosting the segment properties JSON file? I only know about hosting precomputed datasets with cloudvolume, but since this info file is not of the right format for cloudvolume, then that is not an option. |
You will have to write your own code to generate it, but that should be easy since the format is pretty simple. If you are using Google Cloud Storage, you can upload it using gsutil or with one the Python libraries (e.g. boto or https://cloud.google.com/storage/docs/reference/libraries). |
My solution needs to be local - in my project we are hosting our data locally rather than in the cloud. I wrote my own code to host the info file locally using flask, but Neuroglancer gives me a CORS error: |
Using a local web server is fine, but you will need to set it up to send back the appropriate CORS headers. I'm not sure specifically how to set that up with flask (though I did find this https://flask-cors.readthedocs.io/en/latest/). As an example, you can use cors_webserver.py in the neuroglancer repository, or the node http-server package with the --cors option. |
OK that worked in the sense that I no longer get a CORS error and can load in localhost:5000 as a layer with no errors. However, I don't see any segment property information showing up in my segmentation layer under the "Seg." tab. I have tried the example info file you referenced above and another one, but still no luck. I figured the problem with the example info file was that there was no "string" type property, so I added one in my example but that did not help. Is there an extra step required that I am missing? Here is the example info file I have tried in addition to the one referenced above: |
@d-v-b did you end up getting this working with a separate info JSON file defining the segment properties? |
Is there a template or an accessible example of |
The base.json file is accessible, but it is just a Neuroglancer state: Add a segment_properties member to the the The value is the name of the sub-directory. Then create the info file in the sub-directory specified by the segment_property key: http://storage.googleapis.com/neuroglancer-janelia-flyem-hemibrain/v1.0/rois/segment_properties/info |
@austinhoag I missed your comment earlier, but the additional step required for the segment properties to show up in the data source list is to reference it from your top-level info file via a "segment_properties" member. See example in prior message. You can also directly add the segment_properties as an additional data source to the layer, using the "+" button at the button of the Sources tab. |
@jbms I can't seem to load up "segment_properties" even after I created the sub-directory and info file. And I have doubts where I'm placing the "segment_name_map": "names", "segment_property": "segment_properties" since they disappear after I apply the change to json on Neuroglancer. (When I load this sub directory as a main source, I do see segmentation ids in the tab without the actual data.) Would you be able to point out what I'm doing wrong here? Thanks, -m
|
segment_name_map is a remnant for an earlier version of the support in Neuroglancer. Don't use that, just use "segment_properties". segment_properties is not a property to be specified in the Neuroglancer JSON state (what you've posted above). It is a property to set in the http://localhost:8888/precomputed/test_data/segment_properties/info Then if you don't want to add the segment_properties property to your precomputed://http://localhost:8888/precomputed/test_data/segment_properties as an additional data source to the same layer in the Neuroglancer JSON state: ...
"layers": [
{
"type": "segmentation",
"source": [
"precomputed://http://localhost:8888/precomputed/test_data",
"precomputed://http://localhost:8888/precomputed/test_data/segment_properties",
],
"tab": "segments",
"name": "segmented mesh",
}
],
... |
That works great! Thanks @jbms Could I also ask how to open and use the bottom "select" UI? I suppose it is to select coordinates in the viewer and pin to the dashboard? I have not figured out the "Annotations" tab yet so I suppose it might be used for just picking a point versus cropping a volume in "Annotations" tab? Thank you always for your help @jbms |
Control right-click opens that panel. |
Agh, I see. I had to use a mouse instead of the track pad. My track pad on mac keeps getting the following warning and I wasn't sure how to activate this. Could I activate annotation tool without mouse? But mouse right click seem to pop up the gui ok. Thank you @jbms |
Thanks for pointing out the issue with using control+rightclick on macOS. I think the issue is that macOS converts rightclick to control+click and vice versa in some cases, because historically Apple shipped machines with just a single button mouse. It appears that control+rightclick is getting translated to just control+leftclick, which is the annotate action. I will have to look into an alternative binding that works on macOS. Or perhaps you can check if there is already a way to trigger control+rightclick from the touchpad? |
I figured "control + two fingers" on the trackpad and that seem to pop up the GUI so I suppose that could work? |
Sorry, I had to ask this @jbms Does segment_properties support Thanks, -m |
To be clear, control + two finger click already works on your trackpad? If I get around to writing documentation, I'll include that. Currently setting colors via precomputed segment_properties is not supported, but that would certainly make sense as a feature if you were interested in implementing it. At the moment you can only assign colors using the |
yes, I've given a try and control + two finger click does work on my trackpad. |
Is it possible to construct a segmentation layer with a mapping that assigns a name to each unique value in the underlying data?
The text was updated successfully, but these errors were encountered: