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

consider using iso lines for raster to vector #301

Open
JeroenVerstraelen opened this issue Jun 4, 2024 · 1 comment
Open

consider using iso lines for raster to vector #301

JeroenVerstraelen opened this issue Jun 4, 2024 · 1 comment

Comments

@JeroenVerstraelen
Copy link
Contributor

Screenshot from 2024-06-04 16-24-16

The current implementation of raster_to_vector can cause quite a few problems in the output polygons that make them unusable for further processing. This is known problem that is usually solved by using iso lines.

cc @EmileSonneveld

@EmileSonneveld
Copy link
Contributor

Perfectly parallel lines and polygons that touch perfectly aligned can cause some issues like considering polygons inside out, or unable to calculate overlaps.
When taking iso-lines (or marching squares) tent to have less of those issues. Also they weight less.

I would propose a threshold argument:
raster_cube.raster_to_vector(threshold=800)

For binary images, it would allow us to do:
gaussian_blur(raster_cube, range=0.2).raster_to_vector(threshold=0.5) (A method used by ITK-Snap)

Downsides for doing this on binary images are that it would be less precise and that some might say that it is not true to the original data. But the differences are mostly on sub-pixel proportions.

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