Repository: scikit-image/scikit-image

Issue:
Bug (regression???) in imread_collection
It looks like `imread_collection` on master is only reading in the first image. (!)

``` python
In [1]: from skimage import io

In [2]: ic = io.imread_col
io.imread_collection          io.imread_collection_wrapper

In [2]: ic = io.imread_collection('MYO
MYORES-p1-j01-110210_02490700_3d91229a-8d26-4a97-a7ae-743a66d8fd4f_H05_w1_stitched.chs.tif
MYORES-p1-j01-110210_02490700_3d91229a-8d26-4a97-a7ae-743a66d8fd4f_L13_w1_stitched.chs.tif
MYORES-p1-j01-110210_02490701_9ace4eb8-9d26-4173-bea3-23c6166121f9_G03_w1_stitched.chs.tif
MYORES-p1-j01-110210_02490701_9ace4eb8-9d26-4173-bea3-23c6166121f9_L04_w1_stitched.chs.tif
MYORES-p1-j01-110210_02490702_575ab627-a7fb-4651-a404-acaddb6e1a08_G03_w1_stitched.chs.tif
MYORES-p1-j01-110210_02490702_575ab627-a7fb-4651-a404-acaddb6e1a08_H05_w1_stitched.chs.tif
MYORES-p1-j01-110210_02490702_575ab627-a7fb-4651-a404-acaddb6e1a08_L04_w1_stitched.chs.tif
MYORES-p1-j01-110210_02490702_575ab627-a7fb-4651-a404-acaddb6e1a08_L13_w1_stitched.chs.tif

In [2]: ic = io.imread_collection('MYORES-p1-j01-110210_0249070*')

In [3]: len(ic)
Out[3]: 8

In [4]: (ic[0] == ic[1]).all()
Out[4]: True

In [5]: im0 = io.imread('MYORES-p1-j01-110210_02490700_3d91229a-8d26-4a97-a7ae-743a66d8fd4f_H05_w1_stitched.chs.tif')

In [6]: im1 = io.imread('MYORES-p1-j01-110210_02490700_3d91229a-8d26-4a97-a7ae-743a66d8fd4f_L13_w1_stitched.chs.tif')

In [7]: (im0 == im1).all()
Out[7]: False

In [8]: (im0 == ic[0]).all()
Out[8]: True
```



Discussion:
(This was not a problem on 0.10. We only found out when I told my intern @sahas111 to download skimage master cos it's so much better! LOL)


Resolving patch:
diff --git a/skimage/io/collection.py b/skimage/io/collection.py
--- a/skimage/io/collection.py
+++ b/skimage/io/collection.py
@@ -254,7 +254,7 @@ def __getitem__(self, n):
             if ((self.conserve_memory and n != self._cached) or
                     (self.data[idx] is None)):
                 if self._frame_index:
-                    fname, img_num = self._frame_index[idx]
+                    fname, img_num = self._frame_index[n]
                     self.data[idx] = self.load_func(fname, img_num=img_num,
                                                     **self.load_func_kwargs)
                 else:


Test patch:
diff --git a/skimage/io/tests/test_multi_image.py b/skimage/io/tests/test_multi_image.py
--- a/skimage/io/tests/test_multi_image.py
+++ b/skimage/io/tests/test_multi_image.py
@@ -50,6 +50,10 @@ def test_getitem(self):
                 assert type(img[i]) is np.ndarray
             assert_allclose(img[0], img[-num])
 
+            assert_raises(AssertionError,
+                          assert_allclose,
+                          img[0], img[1])
+
             # assert_raises expects a callable, hence this thin wrapper function.
             def return_img(n):
                 return img[n]
@@ -77,6 +81,9 @@ def set_mem(val):
 
     def test_concatenate(self):
         for img in self.imgs:
+            if img[0].shape != img[-1].shape:
+                assert_raises(ValueError, img.concatenate)
+                continue
             array = img.concatenate()
             assert_equal(array.shape, (len(img),) + img[0].shape)