Repository: scikit-image/scikit-image

Issue:
Store pivchallenge data on gitlab
## Description

I'm seeing a fair number of failed builds due to pivchallenge.org rejecting http requests. I think it is not designed to get hammered by CI builds! 😂 We should contact the authors (this is on my to-do, haven't gotten around to it yet) to ask whether we could host that image ourselves.

example build:

https://travis-ci.org/github/scikit-image/scikit-image/jobs/735724132

```pytb
/home/travis/build/scikit-image/scikit-image/doc/examples/registration/plot_opticalflow.py failed to execute correctly: Traceback (most recent call last):
  File "/home/travis/build/scikit-image/scikit-image/doc/examples/registration/plot_opticalflow.py", line 92, in <module>
    image0 = imageio.imread("http://www.pivchallenge.org/pub/B/B001_1.tif")
  File "/home/travis/venv/lib/python3.6/site-packages/imageio/core/functions.py", line 265, in imread
    reader = read(uri, format, "i", **kwargs)
  File "/home/travis/venv/lib/python3.6/site-packages/imageio/core/functions.py", line 186, in get_reader
    return format.get_reader(request)
  File "/home/travis/venv/lib/python3.6/site-packages/imageio/core/format.py", line 170, in get_reader
    return self.Reader(self, request)
  File "/home/travis/venv/lib/python3.6/site-packages/imageio/core/format.py", line 221, in __init__
    self._open(**self.request.kwargs.copy())
  File "/home/travis/venv/lib/python3.6/site-packages/imageio/plugins/tifffile.py", line 222, in _open
    self._f = f = open(self.request.get_local_filename(), "rb")
  File "/home/travis/venv/lib/python3.6/site-packages/imageio/core/request.py", line 377, in get_local_filename
    shutil.copyfileobj(self.get_file(), file)
  File "/home/travis/venv/lib/python3.6/site-packages/imageio/core/request.py", line 353, in get_file
    self._file = urlopen(self.filename, timeout=float(timeout))
  File "/home/travis/venv/lib/python3.6/site-packages/imageio/core/util.py", line 34, in urlopen
    return urlopen(*args, **kwargs)
  File "/opt/python/3.6.3/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/opt/python/3.6.3/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/opt/python/3.6.3/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/opt/python/3.6.3/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/opt/python/3.6.3/lib/python3.6/urllib/request.py", line 1346, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/opt/python/3.6.3/lib/python3.6/urllib/request.py", line 1321, in do_open
    r = h.getresponse()
  File "/opt/python/3.6.3/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/opt/python/3.6.3/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/opt/python/3.6.3/lib/python3.6/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
```


Discussion:
First step of the challenge, get the image :) 

Resolving patch:
diff --git a/doc/examples/registration/plot_opticalflow.py b/doc/examples/registration/plot_opticalflow.py
--- a/doc/examples/registration/plot_opticalflow.py
+++ b/doc/examples/registration/plot_opticalflow.py
@@ -17,10 +17,9 @@
 
 """
 import numpy as np
-import imageio
 from matplotlib import pyplot as plt
 from skimage.color import rgb2gray
-from skimage.data import stereo_motorcycle
+from skimage.data import stereo_motorcycle, vortex
 from skimage.transform import warp
 from skimage.registration import optical_flow_tvl1, optical_flow_ilk
 
@@ -89,8 +88,7 @@
 # velocimetry (PIV). The sequence is the Case B from the
 # `PIV challenge 2001 <http://www.pivchallenge.org/>`_
 
-image0 = imageio.imread("http://www.pivchallenge.org/pub/B/B001_1.tif")
-image1 = imageio.imread("http://www.pivchallenge.org/pub/B/B001_2.tif")
+image0, image1 = vortex()
 
 # --- Compute the optical flow
 v, u = optical_flow_ilk(image0, image1, radius=15)
diff --git a/skimage/data/__init__.py b/skimage/data/__init__.py
--- a/skimage/data/__init__.py
+++ b/skimage/data/__init__.py
@@ -1173,3 +1173,26 @@ def brain():
 
     """
     return _load("data/brain.tiff")
+
+
+def vortex():
+    """Case B1 image pair from the first PIV challenge.
+
+    Returns
+    -------
+    image0, image1 : (512, 512) grayscale images
+        A pair of images featuring synthetic moving particles.
+
+    Notes
+    -----
+    This image was licensed as CC0 by its author, Prof. Koji Okamoto, with
+    thanks to Prof. Jun Sakakibara, who maintains the PIV Challenge site.
+
+    References
+    ----------
+    .. [1] Particle Image Velocimetry (PIV) Challenge site
+           http://pivchallenge.org
+    .. [2] 1st PIV challenge Case B: http://pivchallenge.org/pub/index.html#b
+    """
+    return (_load('data/pivchallenge-B-B001_1.tif'),
+            _load('data/pivchallenge-B-B001_2.tif'))
diff --git a/skimage/data/_registry.py b/skimage/data/_registry.py
--- a/skimage/data/_registry.py
+++ b/skimage/data/_registry.py
@@ -136,6 +136,8 @@
     "data/lily.tif": "395c2f0194c25b9824a8cd79266920362a0816bc9e906dd392adce2d8309af03",
     "data/mitosis.tif": "2751ba667c4067c5d30817cff004aa06f6f6287f1cdbb5b8c9c6a500308cb456",
     "data/skin.jpg": "8759fe080509712163453f4b17106582b8513e73b0788d80160abf840e272075",
+    "data/pivchallenge-B-B001_1.tif": "e95e09abbcecba723df283ac7d361766328abd943701a2ec2f345d4a2014da2a",
+    "data/pivchallenge-B-B001_2.tif": "4ceb5407e4e333476a0f264c14b7a3f6c0e753fcdc99ee1c4b8196e5f823805e",
 }
 
 registry_urls = {
@@ -147,6 +149,8 @@
     "data/mitosis.tif": "https://gitlab.com/scikit-image/data/-/raw/master/AS_09125_050116030001_D03f00d0.tif",
     "data/rank_filters_tests_3d.npz": "https://gitlab.com/scikit-image/data/-/raw/master/Tests_besides_Equalize_Otsu/add18_entropy/rank_filters_tests_3d.npz",
     "data/skin.jpg": "https://gitlab.com/scikit-image/data/-/raw/master/Normal_Epidermis_and_Dermis_with_Intradermal_Nevus_10x.JPG",
+    "data/pivchallenge-B-B001_1.tif": "https://gitlab.com/scikit-image/data/-/raw/master/pivchallenge/B/B001_1.tif",
+    "data/pivchallenge-B-B001_2.tif": "https://gitlab.com/scikit-image/data/-/raw/master/pivchallenge/B/B001_2.tif",
     "restoration/tests/astronaut_rl.npy": "https://gitlab.com/scikit-image/data/-/raw/master/astronaut_rl.npy",
 }
 


Test patch:
diff --git a/skimage/data/tests/test_data.py b/skimage/data/tests/test_data.py
--- a/skimage/data/tests/test_data.py
+++ b/skimage/data/tests/test_data.py
@@ -190,3 +190,11 @@ def test_lily_multichannel():
     fetch('data/lily.tif')
     lily = data.lily()
     assert lily.shape == (922, 922, 4)
+
+
+def test_vortex():
+    fetch('data/pivchallenge-B-B001_1.tif')
+    fetch('data/pivchallenge-B-B001_2.tif')
+    image0, image1 = data.vortex()
+    for image in [image0, image1]:
+        assert image.shape == (512, 512)