Replies: 5 comments
-
Hi Achilles, What you are looking for is More concretely: navis.patch_cloudvolume()
cv = cloudvolume.CloudVolume("precomputed://xxx")
seg_ids = [1001, 1002, 1003] # Assuming these are the actual segment_id's in cloudvolume
skels = cv.skeleton.get_navis(seg_ids) # skels is a navis NeuronList with many skeletons
seg_id = 1004
skel = cv.skeleton.get_navis(seg_id) # skel is a navis NeuronList with a single TreeNeuron Let me know if you run into any issues. |
Beta Was this translation helpful? Give feedback.
-
PS: if you know the exact URL of the precomputed skeleton file(s), you can also use |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply, as per your suggestion, I wrote and tried to run the following code (from H01 dataset): import navis
import cloudvolume as cv
navis.patch_cloudvolume()
vol_seg = cv.CloudVolume("precomputed://gs://h01-release/data/20210601/c3", cache=True, use_https=True)
seg_ids = [635743109, 2120664699]
skels = vol_seg.skeleton.get_navis(seg_ids) Unfortunately there was an error,
I single-step debugged into the for k, v in res.items():
# res is a tuple of cv.Skeleton objects with no k value instead of a dictionary
# just like ([Skeleton(segid=635743109...), Skeleton(segid=2120664699...)
if isinstance(v, cv.Mesh):
n = core.MeshNeuron(v, id=k, units='nm')
neurons.append(n)
elif isinstance(v, cv.Skeleton).
swc_str = v.to_swc()
n = io.read_swc(swc_str)
n.id = k # n.id should be replaced by v.id here.
n.units = 'nm'
neurons.append(n) My cloudvolume and navis's version:
|
Beta Was this translation helpful? Give feedback.
-
I copied the above code for traversing res.item() into the main function at the very beginning with a slight modification and used vol_seg.skeleton.get(seg_ids) to read it instead of going through navis, which seems to give me a complete navis.NeuronList object at this point. I have a new question though, if I were to convert as follows, it also feels like it would take longer when there are a particularly large number of seg_ids. If I have run it once now, can I save the neuronList object below so that I can just read it directly when I want to use it next time. import navis
import cloudvolume as cv
navis.patch_cloudvolume()
vol_seg = cv.CloudVolume("precomputed://gs://h01-release/data/20210601/c3", cache=True, use_https=True)
seg_ids = [635743109, 2120664699]
skels = vol_seg.skeleton.get(seg_ids)
neurons = []
for skel in skels:
if isinstance(skel, cv.Skeleton):
swc_str = skel.to_swc()
n = io.read_swc(swc_str)
n.id = skel.id
n.units = 'nm'
neurons.append(n)
neuron_list = core.NeuronList(neurons) |
Beta Was this translation helpful? Give feedback.
-
Oh, that's strange. For me (on the same cloudvolume version) In any event: the issue should hopefully be fixed with cd4be35. Would you mind re-installing navis from Github and trying again? pip uninstall navis -y
pip3 install git+https://github.com/navis-org/navis@master |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm just learning to use navis. in general, I can get a skeleton or a list of skeletons object by using cloudvolume as shown below:
Suppose I want to use some api in navis now, such as
navis.downsample_neuron
, etc., is there any good way to implement the object conversion, to convert the Skeleton object obtained by cloudvolume directly to NeuronTree object supported by navis, one way I can think of is. Download each skeleton in skels and save it as a swc file. Then read it withnavis.read_swc
, however this doesn't seem to be very efficient when analyzing against Pb level dataBeta Was this translation helpful? Give feedback.
All reactions