morphology.is_local_maximum --> feature.peak_local_max

Hey! I noticed that there is no 2D array support anymore in the 0.8 release. Neither in morphology.is_local_max() nor in the feature.peak_local_max() Is this on purpose? If yes, a meaningful error massage would be cool. Thanks Siggi

Hi, I cannot confirm this behavior. Can you paste a code snippet to reproduce the error? Am 05.09.2013 um 15:30 schrieb Sigmund <siggin@gmail.com>:
Hey!
I noticed that there is no 2D array support anymore in the 0.8 release. Neither in morphology.is_local_max() nor in the feature.peak_local_max() Is this on purpose? If yes, a meaningful error massage would be cool.
Thanks
Siggi
-- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.

I think the API changed a little bit, I stumble on this a few weeks ago... You mean 2D support for the output don't you? peak_local_max default is to pass the indices, when is_local_maximum was giving a bool area So if you pass `indices=False` to peak_local_max it gives you the 2D output... I'm not sure this was your pb though... G. Le 05/09/2013 15:37, Johannes Schönberger a écrit :
Hi,
I cannot confirm this behavior. Can you paste a code snippet to reproduce the error?
Am 05.09.2013 um 15:30 schrieb Sigmund <siggin@gmail.com>:
Hey!
I noticed that there is no 2D array support anymore in the 0.8 release. Neither in morphology.is_local_max() nor in the feature.peak_local_max() Is this on purpose? If yes, a meaningful error massage would be cool.
Thanks
Siggi
-- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.

I'm using the Enthough Canopy 2.7.3 distribution.
import skimage skimage.version.version '0.8.2'
import numpy as np from skimage.morphology import is_local_maximum a = np.zeros(5) a[2] = 2 is_local_maximum(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\_shared\utils.py",
*the is_local_maximum function* line 41, in wrapped return func(*args, **kwargs) File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\morphology\watershed.py", line 297, in is_local_maximum indices=False, exclude_border=False) File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\feature\peak.py", line 153, in peak_local_max out[coordinates[:, 0], coordinates[:, 1]] = True IndexError: index 1 is out of bounds for axis 1 with size 1
import numpy as np from skimage.feature import peak_local_max a = np.zeros(5) a[2]= 2
a array([ 0., 0., 2., 0., 0.]) peak_local_max(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\feature\peak.py",
*the peak_local_max function* line 136, in peak_local_max image[:, :min_distance] = 0 IndexError: too many indices
Thank you for your help!

Ok so **1D** is not supported... I guess if you just do: a = np.atleast_2D(a) before calling is_local_maximum it will be correct... Cheers Guillaume On 06/09/2013 10:39, Sigmund wrote:
I'm using the Enthough Canopy 2.7.3 distribution.
import skimage skimage.version.version '0.8.2'
import numpy as np from skimage.morphology import is_local_maximum a = np.zeros(5) a[2] = 2 is_local_maximum(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\_shared\utils.py",
*the is_local_maximum function* line 41, in wrapped return func(*args, **kwargs) File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\morphology\watershed.py", line 297, in is_local_maximum indices=False, exclude_border=False) File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\feature\peak.py", line 153, in peak_local_max out[coordinates[:, 0], coordinates[:, 1]] = True IndexError: index 1 is out of bounds for axis 1 with size 1
*the peak_local_max function*
import numpy as np from skimage.feature import peak_local_max a = np.zeros(5) a[2]= 2
a array([ 0., 0., 2., 0., 0.]) peak_local_max(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\feature\peak.py", line 136, in peak_local_max image[:, :min_distance] = 0 IndexError: too many indices
Thank you for your help! -- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.

Could you file a bug report on github? Am 06.09.2013 um 11:13 schrieb Guillaume Gay <guillaume@mitotic-machine.org>:
Ok so **1D** is not supported...
I guess if you just do:
a = np.atleast_2D(a) before calling is_local_maximum it will be correct...
Cheers
Guillaume On 06/09/2013 10:39, Sigmund wrote:
I'm using the Enthough Canopy 2.7.3 distribution.
import skimage skimage.version.version '0.8.2'
the is_local_maximum function
import numpy as np from skimage.morphology import is_local_maximum a = np.zeros(5) a[2] = 2 is_local_maximum(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\_shared\utils.py", line 41, in wrapped return func(*args, **kwargs) File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\morphology\watershed.py", line 297, in is_local_maximum indices=False, exclude_border=False) File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\feature\peak.py", line 153, in peak_local_max out[coordinates[:, 0], coordinates[:, 1]] = True IndexError: index 1 is out of bounds for axis 1 with size 1
the peak_local_max function
import numpy as np from skimage.feature import peak_local_max a = np.zeros(5) a[2]= 2
a array([ 0., 0., 2., 0., 0.]) peak_local_max(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\feature\peak.py", line 136, in peak_local_max image[:, :min_distance] = 0 IndexError: too many indices
Thank you for your help! -- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
-- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.

I authored the changes. Prior to 0.8 there were two entirely separate peak-finding algorithms, and we decided to pick the better performing one and merge them into a single backend with backwards-compatible front ends. I believe one is deprecated and could now be removed pre-0.9. At the time the goal was to match the old API exactly. It appears there isn't an input check for rank-2+ arrays, but in a general sense we might want to consider generalizing it to n-dimensional support. It uses scipy.ndimage.maximum_filter under the hood, so I think our wrapper is the limiting factor. On Friday, September 6, 2013 5:34:57 AM UTC-5, Johannes Schönberger wrote: Could you file a bug report on github?
Am 06.09.2013 um 11:13 schrieb Guillaume Gay <guil...@mitotic-machine.org<javascript:>>:
Ok so **1D** is not supported...
I guess if you just do:
a = np.atleast_2D(a) before calling is_local_maximum it will be correct...
Cheers
I'm using the Enthough Canopy 2.7.3 distribution.
import skimage skimage.version.version '0.8.2'
the is_local_maximum function
import numpy as np from skimage.morphology import is_local_maximum a = np.zeros(5) a[2] = 2 is_local_maximum(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\_shared\utils.py",
Guillaume On 06/09/2013 10:39, Sigmund wrote: line 41, in wrapped
return func(*args, **kwargs) File
"c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\morphology\watershed.py", line 297, in is_local_maximum
indices=False, exclude_border=False) File
"c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\feature\peak.py", line 153, in peak_local_max
out[coordinates[:, 0], coordinates[:, 1]] = True IndexError: index 1 is out of bounds for axis 1 with size 1
the peak_local_max function
import numpy as np from skimage.feature import peak_local_max a = np.zeros(5) a[2]= 2
a array([ 0., 0., 2., 0., 0.]) peak_local_max(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> File
"c:\users\neher\appdata\local\enthought\canopy\user\lib\site-packages\skimage\feature\peak.py", line 136, in peak_local_max
image[:, :min_distance] = 0 IndexError: too many indices
Thank you for your help! -- You received this message because you are subscribed to the Google
Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com <javascript:>. For more options, visit https://groups.google.com/groups/opt_out.
-- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com <javascript:>. For more options, visit https://groups.google.com/groups/opt_out.
participants (4)
-
Guillaume Gay
-
Johannes Schönberger
-
Josh Warner
-
Sigmund