jni / skan

Python module to analyse skeleton (thin object) images

Home Page:https://skeleton-analysis.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Skeleton.path_label_image requires keep_images=True

jarodhanko-crafco opened this issue · comments

The method path_label_image requires setting keep_images=True on the Skeleton constructor. However, it simply looks at the shape of the skeleton. If the skeleton shape is saved in the constructor, then this wouldn't be necesssary.

I propose either saving the skeleton shape, or updating the doc comment to note it requires keep_images=True

You're right, we only use the shape. So, we could save the shape independently and use that. That seems preferable to requiring keep_images=True. Would you be able to open a pull request to make this change? It would be most welcome! 😊

@jni I can create a new issue for this if you want, but I noticed that prune_paths could potentially use the saved shape as well, although I don't use that method. If I understand what it is doing, rather than pruning paths after copying the original skeleton_image, it could simply create a new image and add all the paths to a new image that should not be pruned. Maybe this would be slower, and should have different logic based on if the skeleton_image exists.

Regardless, the prune_paths method requires skeleton_image but returns a Skeleton where keep_images=False, so it isn't possible to prune twice sequentially.

So it should probably either:

  1. Add keep_images=True
  2. Allow passing a skeleton into the function
  3. Implement a way to generate the pruned skeleton without the original (assuming my note above is valid)

@jarodhanko-crafco Yes, it's probably ideal to open a new issue! I think you are absolutely right that we don't need to keep the image around.

Ultimately, it would be good to do all the pruning in graph space and not need an image at all. I think before MST junctions (#135), the current image-based pruning was necessary, but after MST it doesn't make sense anymore.