Repository: scikit-image/scikit-image

Issue:
Deprecate edge cases in peak_local_max
## Description

While investigating for #3990, I found that `peak_local_max` manages two edge cases that can be deprecated:

- `min_distance=0` and `footprint=None`
- `footprint.size=1`

in this cases `peak_local_max` is equivalent to applying a threshold. I think that these settings must be forbidden.

## Version information

```python
3.7.5 (default, Oct 25 2019, 15:51:11) 
[GCC 7.3.0]
Linux-4.4.0-179-generic-x86_64-with-debian-stretch-sid
scikit-image version: 0.18.dev0
numpy version: 1.18.4

```



Discussion:

Resolving patch:
diff --git a/skimage/feature/peak.py b/skimage/feature/peak.py
--- a/skimage/feature/peak.py
+++ b/skimage/feature/peak.py
@@ -1,3 +1,4 @@
+from warnings import warn
 import numpy as np
 import scipy.ndimage as ndi
 from .. import measure
@@ -172,6 +173,18 @@ def peak_local_max(image, min_distance=1, threshold_abs=None,
 
     threshold_abs = threshold_abs if threshold_abs is not None else image.min()
 
+    if min_distance < 1:
+        warn("When min_distance < 1, peak_local_max acts as finding "
+             "image > max(threshold_abs, threshold_rel).",
+             RuntimeWarning, stacklevel=2)
+
+    if footprint is not None:
+        footprint = np.asarray(footprint)
+        if footprint.size == 1:
+            warn("When footprint.size < 2, peak_local_max acts as finding "
+                 "image > max(threshold_abs, threshold_rel).",
+                 RuntimeWarning, stacklevel=2)
+
     if isinstance(exclude_border, bool):
         exclude_border = (min_distance if exclude_border else 0,) * image.ndim
     elif isinstance(exclude_border, int):


Test patch:
diff --git a/skimage/feature/tests/test_peak.py b/skimage/feature/tests/test_peak.py
--- a/skimage/feature/tests/test_peak.py
+++ b/skimage/feature/tests/test_peak.py
@@ -357,14 +357,16 @@ def test_disk(self):
         '''
         image = np.random.uniform(size=(10, 20))
         footprint = np.array([[1]])
-        with expected_warnings(["indices argument is deprecated"]):
+        with expected_warnings(["indices argument is deprecated",
+                                "When footprint.size < 2"]):
             result = peak.peak_local_max(image, labels=np.ones((10, 20)),
                                          footprint=footprint,
                                          min_distance=1, threshold_rel=0,
                                          threshold_abs=-1, indices=False,
                                          exclude_border=False)
         assert np.all(result)
-        with expected_warnings(["indices argument is deprecated"]):
+        with expected_warnings(["indices argument is deprecated",
+                                "When footprint.size < 2"]):
             result = peak.peak_local_max(image, footprint=footprint,
                                          threshold_abs=-1,
                                          indices=False,
@@ -411,7 +413,9 @@ def test_threshold_rel_default(self):
         assert_equal(peak.peak_local_max(image), [[2, 2]])
 
         image[2, 2] = 0
-        assert len(peak.peak_local_max(image, min_distance=0)) == image.size - 1
+        with expected_warnings(["When min_distance < 1"]):
+            assert len(peak.peak_local_max(image,
+                                           min_distance=0)) == image.size - 1
 
 
 @pytest.mark.parametrize(