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

Does medial axis skeletonization work for 3D input arrays ? #5468

Closed
nicobousquet opened this issue Jul 9, 2021 · 4 comments
Closed

Does medial axis skeletonization work for 3D input arrays ? #5468

nicobousquet opened this issue Jul 9, 2021 · 4 comments
Labels
🫂 Support User help and QA

Comments

@nicobousquet
Copy link

nicobousquet commented Jul 9, 2021

Description

Hi, I'm just trying to run the medial axis method in order to skeletonize a 3d object (stl file). But I have this error:
image

Here is the stl file used in the code:
Turtle_Tree.zip

Way to reproduce

import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage as ndi
from skimage.morphology import skeletonize, medial_axis
import trimesh
from trimesh.voxel import creation
from mpl_toolkits.mplot3d import Axes3D #don't delete this line

mesh = trimesh.load_mesh('objets 3d/Turtle_Tree.stl')
volume = trimesh.voxel.creation.voxelize(mesh=mesh, pitch=mesh.extents.max() / 128)
array = volume.matrix


filled = ndi.binary_fill_holes(array)
skeleton, distance = medial_axis(filled, return_distance=True)

However, skeletonize_3d works for this input 3d array. So does medial axis work for 3d arrays too or it only does for 2d arrays ?

Thanks in advance.

@nicobousquet nicobousquet changed the title Does medial axis skeletonization work for 3D input arrays Does medial axis skeletonization work for 3D input arrays ? Jul 9, 2021
@jni
Copy link
Member

jni commented Jul 16, 2021

As indicated by the error message, medial axis does not work for 3D images currently.

I don't know much about the medial axis algorithm, but based on my reading of the wikipedia page, the medial axis in a 3D object is in general not a skeleton but a surface. So, although we could (and probably should) update medial axis to work for 3D images, it will not return a skeleton.

@grlee77 grlee77 added the 🫂 Support User help and QA label Aug 25, 2021
@grlee77
Copy link
Contributor

grlee77 commented Aug 25, 2021

I will go ahead close this as not a bug, but feel free to open a new issue as a feature request for 3D support in skimage.morphology.medial_axis

@grlee77 grlee77 closed this as completed Aug 25, 2021
@DWesl
Copy link

DWesl commented Sep 10, 2021

feel free to open a new issue as a feature request for 3D support in skimage.morphology.medial_axis

Would #4105 be that feature request?

@nicobousquet
Copy link
Author

Personally, I worked on 3D arrays so I would say yes but the other algorithm works pretty well too. I just wanted to compare both methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🫂 Support User help and QA
Projects
None yet
Development

No branches or pull requests

4 participants