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

Obtain the centerlines from 3D binary mask #12

Open
qiang-zhang-neu opened this issue Dec 20, 2019 · 1 comment
Open

Obtain the centerlines from 3D binary mask #12

qiang-zhang-neu opened this issue Dec 20, 2019 · 1 comment
Assignees
Labels

Comments

@qiang-zhang-neu
Copy link

This label_centerlines is realy a very good project. However, I wonder whether it can provide the center lines from a 3D binary mask?

In addition, currently, I use the skimage.measure.skeleton to obtain the skeletion, but the skeletion is really not smooth and there are some wrong branches. Thus, could you please explain how to exclude the wrong branch and smooth the center line?

Thank you very much!

@ungarj
Copy link
Owner

ungarj commented Dec 26, 2019

Hi @qiang-zhang-neu,

I'm not sure what you mean by "3D binary mask". I guess a 2D binary mask in this context is a raster dataset, so in order to use it with this tool you can try to vectorize the raster into a feature and then apply the centerlines algorithm. I don't think this would work for a 3D dataset though.

You use the skeleton as an alternative to the Voronoi approach here? We use the networkx package to build a temporary network graph and then calculate the longest path of all possible paths on that graph. (see https://github.com/ungarj/label_centerlines/blob/master/label_centerlines/_src.py#L66)

Then the tool smoothes the linestring by using NumPy and a Gaussian filter on the xy coordinates: https://github.com/ungarj/label_centerlines/blob/master/label_centerlines/_src.py#L146

I guess this approach will work with a skimage skeleton as well as long as you manage to convert the skeleton into a networkx graph.

@ungarj ungarj self-assigned this Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants