cloud-volume: Skeleton.from_swc breaks with KeyError parent value 0
Hi,
I’ve recently updated CloudVolume (8.18.1) and realized a couple of things broke while converting to precomputed format.
- Skeleton.from_swc() throws KeyError in this line for swc files containing a parent_id value 0
Changed this line to avoid the the error.
if parent_id > 0:
if vid < parent_id:
edge = [vid, parent_id]
else:
edge = [parent_id, vid]
Sample data:
# id type x y z radius parent
1 1 10662.0 1035.0 4095.0 11.0 0
2 3 10650.999 1040.0 4098.258 5.0 1
3 3 10649.728 1042.636 4100.0 4.0 2
4 3 10648.539 1041.539 4102.154 3.0 3
5 3 10646.334 1041.0 4103.333 1.0 4
6 3 10645.667 1042.333 4105.445 3.0 5
In other cases, parent value takes -1 and they convert ok. Would it be possible to allow 0 parent value in swc files?
- scales value in info file
Has the “scales” definition changed lately? It seems I need to change the value in an array of dict type now. Do you have an latest example of the placeholder I can use for skeleton?
# info = {"@type": "neuroglancer_skeletons", "vertex_attributes": [{"id": "radius", "data_type": "float32","num_components": 1}], "scales":"um"}
info = {"@type": "neuroglancer_skeletons", "vertex_attributes": [{"id": "radius", "data_type": "float32","num_components": 1}], "scales":[{'key':'um','resolution':[1000,1000,1000]}]}
Thank you, -m
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 19 (10 by maintainers)
Hi m,
Unfortunately, not at this time. We’ll need to fix Neuroglancer. You can make two copies of the data to preserve the attribute and also make it Neuroglancer viewable.
I did do some experiments with Neuroglancer a while back but didn’t test them. You can try this old branch: https://github.com/william-silversmith/neuroglancer/tree/wms_int_skel
Will
On Mon, Apr 24, 2023 at 6:02 PM manoaman @.***> wrote:
yes
On Wed, Apr 19, 2023, 3:13 PM manoaman @.***> wrote:
Hi m,
At a glance, the problem seems to be that vertex_types is not included in the vertex_attributes list.
Oh yea, the entire system is designed around the images. You need to have a valid image info in the directory above the skeletons. We can maybe change that, but for now you just need to make a fake info.
Interesting. It looks like the 0 corresponds to the eswc format, but now to swc. The SWC format is defined in this paper: https://www.sciencedirect.com/science/article/pii/S0165027098000910
It looks like eswc is used in this field. If there’s more demand for its support, I’ll consider it, but I’d like to keep things to a tighter scope if possible.
As for the example above, I’m surprised that you need to add and delete the scales attribute. The simple assignment operator for the info shouldn’t be triggering any additional behavior.
Hi m!
Thank you! I think if you can adjust the conversion script that would be best, but then again, I’ve never heard of
eswcbefore. Can you link me to some documentation?I’m not totally sure, but I think that error means you have the
infofile in the main directory. The skeleton info file should be in the skeletons directory. A normal image describing info file should be in the top level directory.Will
Hi m! Sorry, I was on vacation for a few weeks. I’ll take a look into this soon.