sridharjagannathan / pyroglancer Goto Github PK
View Code? Open in Web Editor NEWPythonic interface to neuroglancer for displaying neuron data
License: BSD 3-Clause "New" or "Revised" License
Pythonic interface to neuroglancer for displaying neuron data
License: BSD 3-Clause "New" or "Revised" License
Sometimes, the image segmentation layer needs authentication for e.g:
dvid://https://emdata5-private.janelia.org/blabla/segmentation
without authentication this leads to an error like:
Traceback (most recent call last):
File "/Users/sri/Documents/Python/neuroglancer/python/neuroglancer/sockjs_handler.py", line 52, in _on_changed
provider = self.credentials_manager.get(parsed_key['key'], parsed_key.get('parameters'))
File "/Users/sri/Documents/Python/neuroglancer/python/neuroglancer/credentials_provider.py", line 31, in get
return self._providers[key](parameters)
KeyError: 'DVID'
I tried to remove the dependencies that it hangs on, but it's hopeless effort as it keeps reoccurring in others.
resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking
Using cached pyOpenSSL-16.0.0-py2.py3-none-any.whl (45 kB)
Using cached pyOpenSSL-0.15.1-py2.py3-none-any.whl (102 kB)
Using cached pyOpenSSL-0.15-py2.py3-none-any.whl (102 kB)
Using cached pyOpenSSL-0.14.tar.gz (128 kB)
This code looks very useful, and I was wondering how the multires meshes are created. Here it shows that a mesh's vertices and faces are passed to decompose_meshes
, where they are scaled, sliced and quantized for each respective scale. But this doesn't change the resolution (number of faces/vertices) of the mesh, correct? Or am I missing something.
I plot ALad1 (VFB_00020032 ) first in one flywire link,
ALl1 (VFB_00020008 ) in another flywire link.
Then If I move the LM layer from one flywire link to another through clicking the 3 vertical dots on the top right of Flywire -> edit JSON state -> expanding 'layers', and copy and paste the volumes layer from one to the other, such that the latter flywire link has 2 layers of LM data of different lineages, these 2 layers actually give the same LM data of the same lineage (I think the one originally in the link). Please note layer 4 and 5 are both volumes in the screenshot below. The first is the original ALad1, and the second ALl1 that I pasted from another flywire link.
Here I've used the gal4line2flyiwre example for both. Here's a flywire link containing the brain mesh that you could use for shorturl
. Please let me know if you'd like all the code I used pasted here.
Function for adding body IDs to display while creating a FlyWire URL.
Similar to fafbseg function flywire.encode_url, example:
url = fafbseg.flywire.encode_url(segments=720575940642841623)
The meshes plotted by gal4line2flywire script sometimes have shifts anteriorly.
All the code comes from the gal4line2flywire example, except: ALad1 (VFB_00020032) may be a good example as you can see that some of the plotted mesh is outside the brain mesh. Here's a flywire link with the brain mesh. You could use this as the shorturl.
However this shift doesn't always happen, and I'm not sure what triggers it. Please let me know if you'd like me to paste all the code I ran here.
Hey @SridharJagannathan ,
I generated single resolution meshes similarly to the way we did it together before..
This time rather than using neuroglancer, I wanted to display them in flywire. There's one minor problem though, that in flywire interface I don't see labels, just IDs.
What I want to have is ideally something similar to this:
Do you know how to fix it, or some workaround?
BTW In folder segment_properties/info
there are correct labels that I want to display:
{"@type": "neuroglancer_segment_properties", "inline": {"ids": ["100", "101", "102"], "properties": [{"id": "label", "type": "label", "values": ["AAA", "BBB", "CCC"]}]}}
Currently adding a volume layer is named "volume" rather than the specified name
Recent version of cloudvolume doesn't work with pyroglancer.
Error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-12-63b0b2ba0a2e> in <module>
----> 1 tmpviewer = add_flywirelayer(flywireurl2dict(shorturl), layer_kws = {'type': 'volumes','name': 'vfb_' + vfbmeshes_dict[first_mesh].name,
2 'source': vfb2flywiremeshes[first_mesh],'color': 'magenta'})
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyroglancer/flywire.py in flywireurl2dict(flywireurl)
56 if 'json_url' in querystring:
57 # Get the layers from the json file as query
---> 58 token = cloudvolume.secrets.chunkedgraph_credentials['token']
59 response = requests.get(querystring['json_url'][0], headers={'Authorization': f"Bearer {token}"})
60 response.raise_for_status()
AttributeError: module 'cloudvolume.secrets' has no attribute 'chunkedgraph_credentials'
see here: seung-lab/cloud-volume@b27efae#diff-ec178a16c0f1feda0f5b888d04fa181c97d33af8d8514baa6019920b176f7f64
hey @SridharJagannathan, I was wondering what is expected input to uploadskeletons
function. I have a bunch of skeletons in swc format, that I read to navis:
swcs = navis.read_swc('data/')
But then:
uploadskeletons(swcs, skel_ids, skel_names, hostdirectory, 'longest_neurites')
Gives the following error:
AttributeError Traceback (most recent call last)
Input In [31], in <module>
----> 1 uploadskeletons(swcs, skel_ids, skel_names, hostdirectory, 'longest_neurites')
File ~/miniforge3/envs/newpyg2/lib/python3.9/site-packages/pyroglancer/skeletons.py:143, in uploadskeletons(skelsource, skelseglist, skelnamelist, path, layer_name)
121 def uploadskeletons(skelsource, skelseglist, skelnamelist, path, layer_name):
122 """Upload skeleton (of cloudvolume class) to a local server.
123
124 Parameters
(...)
140 object of cloudvolume class
141 """
142 info = {"@type": "neuroglancer_skeletons",
--> 143 "transform": skelsource[0].transform.flatten(),
144 "vertex_attributes": [{"id": "radius", "data_type": "float32", "num_components": 1}],
145 "scales": "um"}
146 path = 'file://' + path + '/precomputed/' + layer_name
147 cv = CloudVolume(path, info=info)
File ~/miniforge3/envs/newpyg2/lib/python3.9/site-packages/navis/core/skeleton.py:199, in TreeNeuron.__getattr__(self, key)
193 """We will use this magic method to calculate some attributes on-demand."""
194 # Note that we're mixing @property and __getattr__ which causes problems:
195 # if a @property raises an Exception, Python falls back to __getattr__
196 # and traceback is lost!
197
198 # Last ditch effort - maybe the base class knows the key?
--> 199 return super().__getattr__(key)
File ~/miniforge3/envs/newpyg2/lib/python3.9/site-packages/navis/core/base.py:156, in BaseNeuron.__getattr__(self, key)
153 return 'NA'
154 return None
--> 156 raise AttributeError(f'Attribute "{key}" not found')
AttributeError: Attribute "transform" not found
I tried to convert it to a regular list of TreeNeurons:
skel_list = [swcs[i] for i in range(len(swcs))]
But the error is the same. Any step that I'm missing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.