Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swc export error #62

Open
zhihaozheng opened this issue Jun 1, 2020 · 5 comments
Open

swc export error #62

zhihaozheng opened this issue Jun 1, 2020 · 5 comments

Comments

@zhihaozheng
Copy link

segid = 720575940621647595
mm = trimesh_io.MeshMeta()
mesh = mm.mesh(filename = "{}.obj".format(segid))
sk=skeletonize.skeletonize_mesh(mesh, invalidation_d=12000)
sk.export_to_swc("{}.swc".format(segid))

.obj file is here

In [16]: sk.export_to_swc("{}.swc".format(segid))                                                                               
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-16-94e86f139667> in <module>
----> 1 sk.export_to_swc("{}.swc".format(segid))

~/scripts/git_clones/MeshParty/meshparty/skeleton.py in export_to_swc(self, filename, node_labels, radius, header, xyz_scaling)
    535 
    536         skeleton_io.export_to_swc(self, filename, node_labels=node_labels,
--> 537                                   radius=radius, header=header, xyz_scaling=xyz_scaling)
    538 
    539 

~/scripts/git_clones/MeshParty/meshparty/skeleton_io.py in export_to_swc(skel, filename, node_labels, radius, header, xyz_scaling)
    199         node_labels = np.full(len(skel.vertices), 3)
    200 
--> 201     swc_dat = _build_swc_array(skel, node_labels, radius, xyz_scaling)
    202 
    203     with open(filename, 'w') as f:

~/scripts/git_clones/MeshParty/meshparty/skeleton_io.py in _build_swc_array(skel, node_labels, radius, xyz_scaling)
    224                          xyz / xyz_scaling,
    225                          radius[:, np.newaxis] / xyz_scaling,
--> 226                          par_ids[:, np.newaxis]))
    227     return swc_dat
    228 

<__array_function__ internals> in hstack(*args, **kwargs)

~/anaconda3/envs/meshparty/lib/python3.7/site-packages/numpy/core/shape_base.py in hstack(tup)
    343         return _nx.concatenate(arrs, 0)
    344     else:
--> 345         return _nx.concatenate(arrs, 1)
    346 
    347 

<__array_function__ internals> in concatenate(*args, **kwargs)

ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 4313 and the array at index 1 has size 1538
@ceesem
Copy link
Collaborator

ceesem commented Jun 2, 2020

I don't get this with the most recent release version (1.9.0) of MeshParty, and am currently preparing an update with some significant changes to the underlying functions. What version is this from, and does the error still happen when you set collapse_soma=False in the skeletonize_mesh parameters?

@zhihaozheng
Copy link
Author

zhihaozheng commented Jun 2, 2020

I got this error with 1.9.0 (actually 1.9.1.dev2+ga8ad053), and still has it with collapse_soma=False.
Also got this runtime warning, not sure if it was related.

MeshParty/meshparty/skeletonize.py:383: RuntimeWarning: invalid value encountered in multiply
  target = np.nanargmax(root_ds*valid)

@ceesem
Copy link
Collaborator

ceesem commented Jun 2, 2020

What branch is that from? It's definitely not what you get from a pip install...

@ceesem
Copy link
Collaborator

ceesem commented Jun 2, 2020

Also, I doubt the runtime error matters, that should just result in an inf or a nan in an intermediate array during skeletonization.

@zhihaozheng
Copy link
Author

I tried different versions and got it working with 1.8.0. I didn't have a clue what was going on though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants