seung-lab / cloud-volume

Read and write Neuroglancer datasets programmatically.
https://twitter.com/thundercloudvol
BSD 3-Clause "New" or "Revised" License
134 stars 47 forks source link

Uploading skeletons fails with neuroglancer main or spelunker branch but works with seung-lab/neuromancer #643

Open jboulanger91 opened 1 week ago

jboulanger91 commented 1 week ago

Hello,

I tried to upload skeletons to neuroglancer using the following function: vol.skeleton.upload_raw(777, skel.vertices, skel.edges) after creating a skeletons layer:

info_seg = CloudVolume.create_new_info(
    num_channels = 1, #this is critical 
    layer_type = 'segmentation', # 'image' or 'segmentation'
    data_type = 'uint32', # can pick any popular uint
    encoding = 'raw', # see: https://github.com/seung-lab/cloud-volume/wiki/Compression-Choices
    resolution = [ 8, 8, 30], # X,Y,Z values in nanometers
    skeletons = "skeletons",
    voxel_offset = [ 4096, 4096, 0 ], # values X,Y,Z values in voxels
    chunk_size = [ 64, 64, 64 ], # rechunk of image X,Y,Z in voxels
    volume_size = [ 40960-4096, 61440-4096, 4010], # X,Y,Z size in voxels
)

vol = CloudVolume('gs:///layers/skel_clem_test', info=info_seg)
vol.provenance.description = "test_upload_skel"
vol.provenance.owners = ['jbw@neuro.org'] # list of contact email addresses
vol.chunk_size
vol.commit_info() # generates gs://bucket/dataset/layer/info json file
vol.commit_provenance() # generates gs://bucket/dataset/layer/provenance json file
vol.skeleton.upload_raw(777, skel.vertices, skel.edges) 

Trying to load this layer into skelunker or the main neuroglancer branch results in an error 404. Unless I'm wrong somewhere, it would be nice to be able to make it work with the newer branches.

Thanks a lot, Jon

jboulanger91 commented 1 week ago

As a remark: uploding meshes works fine

william-silversmith commented 4 days ago

Hi! Sorry for taking so long to get back to you. The problem is that Neuroglancer is looking for a skeleton info file.

You can fix that by doing this:

vol.skeleton.meta.info["vertex_attributes"].pop()
vol.skeleton.meta.commit_info()

The pop command on the first line is to remove a uint8 attribute that neuroglancer can't handle currently.