diff --git a/skimage/novice/_novice.py b/skimage/novice/_novice.py index 72f06855..2fc4b280 100644 --- a/skimage/novice/_novice.py +++ b/skimage/novice/_novice.py @@ -38,9 +38,6 @@ def _verify_picture_index(index): if isinstance(dim_slice, int): index[i] = dim_slice = slice(dim_slice, dim_slice + 1) - if dim_slice.step is not None and dim_slice.step != 1: - raise IndexError("Only a step size of 1 is supported") - return tuple(index) diff --git a/skimage/novice/tests/test_novice.py b/skimage/novice/tests/test_novice.py index 214492b4..80065e46 100644 --- a/skimage/novice/tests/test_novice.py +++ b/skimage/novice/tests/test_novice.py @@ -205,6 +205,14 @@ def test_negative_slice(): assert pic[0, -3:] == pic[0, n - 3:] +def test_getitem_with_step(): + h, w = 5, 5 + array = _array_2d_to_RGB(np.linspace(0, 255, h * w).reshape(h, w)) + pic = novice.Picture(array=array) + sliced_pic = pic[::2, ::2] + assert sliced_pic == novice.Picture(array=array[::2, ::2]) + + @raises(IndexError) def test_1d_getitem_raises(): pic = novice.Picture.from_size((1, 1)) @@ -229,12 +237,6 @@ def test_3d_setitem_raises(): pic[1, 2, 3] = 0 -@raises(IndexError) -def test_getitem_with_step_raises(): - pic = novice.Picture.from_size((3, 3)) - pic[::2, ::2] - - @raises(IndexError) def test_out_of_bounds_indexing(): pic = novice.open(SMALL_IMAGE_PATH)