Giter Site home page Giter Site logo

Comments (5)

liuyx599 avatar liuyx599 commented on July 17, 2024

I now know that it seems to be possible to get the corresponding skeleton and convert it to swc by cloudvolume, but I seem to have some bugs

vol = cloudvolume.CloudVolume(
    'precomputed:xxxx/seg',  # neuroglancer layer
    use_https=True,  #
    mip=2
)

segment_id = 45
skel = vol.skeleton.get(45)
skel.viewer()

with open('segment_45.swc', 'w') as f:
    f.write(skel.to_swc())

then there is bug

Traceback (most recent call last):
  File "C:\Users\Administrator\miniconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3398, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-125-874f70be3ddb>", line 1, in <cell line: 1>
    skel0.to_swc()
  File "C:\Users\Administrator\miniconda3\lib\site-packages\cloudvolume\skeleton.py", line 1049, in to_swc
    swc += generate_swc(skel, offset) + "\n"
  File "C:\Users\Administrator\miniconda3\lib\site-packages\cloudvolume\skeleton.py", line 1028, in generate_swc
    T=skel.vertex_types[node],
IndexError: index 0 is out of bounds for axis 0 with size 0

but the skeleton is not empty

Skeleton(segid=45, vertices=(shape=226, float32), edges=(shape=225, uint32), radius=(226, float32), vertex_types=(0, uint8), space='physical' transform=[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0]])

Ok, when I wrote this issue I seem to have solved the bug, I need to manually set the type of these nodes

segment_id = 45
skel = vol.skeleton.get(45)
skel.vertex_types = np.zeros(shape=skel.vertices.shape[0], dtype=np.uint8)   # manually setting
skel.viewer()

with open('segment_45.swc', 'w') as f:
    f.write(skel.to_swc())

By the way, can't Igneous discern the node type of the skeleton using kimimaro's skeletonization method? For example, endpoint, soma, etc.? If I want to determine that a node is an endpoint, do you have a better suggestion?

from igneous.

william-silversmith avatar william-silversmith commented on July 17, 2024

Hi liuyx599,

Thank you for persisting and figuring out the issue! You make a good point, it should be possible to annotate at least some of the points using radius and structural information. This is something we could add. Endpoints in particular are very easy.

However, one reason we strip the vertex_types when making neuroglancer compatible skeletons is (afaik) neuroglancer doesn't support integer vertex attributes. Once that is fixed, we can stop stripping them.

from igneous.

liuyx599 avatar liuyx599 commented on July 17, 2024

Thanks for your reply! So kimimaro, like teaser, does not generate node type information during the skeletonization process? I now have a simple idea to speak about nodes of degree 1 (leaf nodes) and root nodes as endpoints of the skeleton, which can be achieved with the help of navis as follows:

skel = navis.read_swc(".\segment_45.swc")
skel.leafs
Out[8]: 
     node_id label       x       y       z      radius  parent_id type
99       104     0  2328.0  2088.0  2970.0  107.331261        103  end
221      226     0  5256.0  3192.0  2970.0   24.000000        225  end
225       79     0  1824.0  1968.0  2970.0   53.665630         78  end

If kimimaro can't automatically determine the type of these nodes, I can't think of a better way to determine the endpoints

from igneous.

william-silversmith avatar william-silversmith commented on July 17, 2024

Hi! Navis is definitely more sophisticated, but the Skeleton class used in Igneous, CloudVolume, and Kimimaro does have the capability to compute terminal and branch nodes. We could augment the SWC generator with this information.

https://github.com/seung-lab/cloud-volume/blob/master/cloudvolume/skeleton.py#L308-L322

skel.terminals()
skel.branches()

from igneous.

liuyx599 avatar liuyx599 commented on July 17, 2024

This is very cool, and it seems to be consistent with navis' results, where cloud-volume's terminals are equivalent to navis' leafs plus root

from igneous.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.