It appears there are several scikit-image functions which have need of padding input. As far as I can see, these generally do so internally, with functions or routines that aren't exposed. From a quick search, the following functions in scikit-image all pad using their own internal methods: feature.match_template : mean value filter.lpi_filter : asymmetric zeros morphology.greyreconstruct : symmetric zeros or constant value morphology.watershed : pad child function for symmetric zeros transform.radon : symmetric zeros More broadly, there doesn't appear to be a publicly exposed API for padding NumPy image arrays in any packages I've come across. scipy.ndimage clearly has this functionality, via the common mode parameters, but it isn't exposed for general use. I've put some effort into making a pure Python 2d / 3d capable padding function for personal use, and most of the scipy.ndimage modes are available. Preliminary gist here wouldn't be hard to wrap into a PR (likely not optimal, but functional): https://gist.github.com/JDWarner/a26f77dae983fa1faba9 Would such functionality be desirable?
On 4/18/2013 5:41 PM, Josh Warner wrote:
It appears there are several scikit-image functions which have need of padding input. As far as I can see, these generally do so internally, with functions or routines that aren't exposed. From a quick search, the following functions in scikit-image all pad using their own internal methods:
|feature.match_template| : mean value |filter.lpi_filter| : asymmetric zeros |morphology.greyreconstruct| : symmetric zeros or constant value |morphology.watershed| : |pad| child function for symmetric zeros |transform.radon| : symmetric zeros
More broadly, there doesn't appear to be a publicly exposed API for padding NumPy image arrays in any packages I've come across. |scipy.ndimage| clearly has this functionality, via the common |mode| parameters, but it isn't exposed for general use.
I've put some effort into making a pure Python 2d / 3d capable padding function for personal use, and most of the |scipy.ndimage| modes are available. Preliminary gist here wouldn't be hard to wrap into a PR (likely not optimal, but functional): https://gist.github.com/JDWarner/a26f77dae983fa1faba9
Would such functionality be desirable?
Numpy has a pad function since version 1.7. <http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.pad.html> Christoph
Missed that in the notes, thanks for the notice. Looks like I need to update. If/when we consider moving to Numpy 1.7.x as a dependency instead of 1.6.x, I'll try to remember to bring this up again. On Thursday, April 18, 2013 7:52:06 PM UTC-5, Christoph Gohlke wrote:
On 4/18/2013 5:41 PM, Josh Warner wrote:
It appears there are several scikit-image functions which have need of padding input. As far as I can see, these generally do so internally, with functions or routines that aren't exposed. From a quick search, the following functions in scikit-image all pad using their own internal methods:
|feature.match_template| : mean value |filter.lpi_filter| : asymmetric zeros |morphology.greyreconstruct| : symmetric zeros or constant value |morphology.watershed| : |pad| child function for symmetric zeros |transform.radon| : symmetric zeros
More broadly, there doesn't appear to be a publicly exposed API for padding NumPy image arrays in any packages I've come across. |scipy.ndimage| clearly has this functionality, via the common |mode| parameters, but it isn't exposed for general use.
I've put some effort into making a pure Python 2d / 3d capable padding function for personal use, and most of the |scipy.ndimage| modes are available. Preliminary gist here wouldn't be hard to wrap into a PR (likely not optimal, but functional): https://gist.github.com/JDWarner/a26f77dae983fa1faba9
Would such functionality be desirable?
Numpy has a pad function since version 1.7. <http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.pad.html>
Christoph
participants (2)
-
Christoph Gohlke
-
Josh Warner