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

skeleton border region issu #438

Open
DerThorsten opened this issue Sep 12, 2018 · 2 comments
Open

skeleton border region issu #438

DerThorsten opened this issue Sep 12, 2018 · 2 comments

Comments

@DerThorsten
Copy link
Contributor

DerThorsten commented Sep 12, 2018

Hi Ullrich ,

When using the skeletonizeImage I noticed that regions at the border have a strange behavior.
In fact, when I zero-pad the labels passed to skeletonizeImage and un-pad after that, I get different results compared to the unpadded version:

Image:
vbug

Connected Comp:
figure_1

Without Any Padding :
figure_1-1

With Padding:
figure_1-2

Here is the code

import vigra
import numpy

img = vigra.impex.readImage('vbug.png')[...,0]
img = 255 - img
img = img.astype('uint32')

cc = vigra.analysis.labelImageWithBackground(img)
vigra.imshow(cc)


skeleton = vigra.filters.skeletonizeImage(cc) != 0
skeleton = vigra.taggedView(skeleton, "xy")
vigra.imshow(skeleton)

padded_cc = numpy.pad(cc, 1, mode='constant')
skeleton = vigra.filters.skeletonizeImage(padded_cc) != 0
skeleton = skeleton[1:-1,1:-1]
skeleton = vigra.taggedView(skeleton, "xy")
vigra.imshow(skeleton)

Greetings Thorsten

@ukoethe
Copy link
Owner

ukoethe commented Sep 13, 2018

This is expected because the underlying distance transform only considers distances to pixels inside the image domain. Looking at your results, the padding solution might be more desirable.

Besides this, two observations are strange: (1) Without apparent reason, regions behave quite differently in terms of skeleton side arms. (2) In the unpadded result, the skeleton of the upper left region is disconnected -- this shouldn't happen. It would be interesting to compare with results from flipped/rotated versions of the input. Theoretically, the skeleton should be equivariant (modulo tie breaking).

@DerThorsten
Copy link
Contributor Author

(1) I totaly agree, all brush strokes have been made with same brush size. I was also suprised to see these results.

Flipping does not seem to change the result at all

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