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

Make dilate and erode accept floats #133

Open
ErichZimmer opened this issue Nov 13, 2022 · 5 comments
Open

Make dilate and erode accept floats #133

ErichZimmer opened this issue Nov 13, 2022 · 5 comments

Comments

@ErichZimmer
Copy link

Hi all,

I was using this library as a lightweight alternative to scipy, but I ran into a few inconveniences. I usually work with 2D images that are 32 bit floats and normalized to [0..1]. However, it seems some functions, notably erode and dilate, do not accept floating point arrays. Is there a particular reason to why erode and dilate only accepts integer data types? If so, it is no biggie as I can simply emulate floating point arithmetics with 32 bit integers.

Kind regards,
Erich

@luispedro
Copy link
Owner

I don't know if there is a particular reason, besides this originally being written to replicate other integer-only code that was much slower. Looking at the code, it may even just work well as is by removing the current limitations

@ErichZimmer
Copy link
Author

When getting accustomed to this library's code base, I ran into something interesting on line 117. To my assumption, this is the cause of unexpected results on the function erode. Is there a particular reason why erode_sub is written the way it is?

@luispedro
Copy link
Owner

The original reason was probably to make it behave like pymorph: at the time, pymorph did a lot of what I wanted, but was Python-only and 2D only, so a lot of mahotas was written to be a C++ version of that

@ErichZimmer
Copy link
Author

Should I implement dilate and erode functions that use a boolean footprint like what is implemented in SciPy? Currently, the phase separation algorithm I am implementing does not work with the current dilate and erode functions but works for SciPy and my own implementation.

@luispedro
Copy link
Owner

Yes, I'd be happy to review/help.

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