From e531e57124a71739f834c23ea930cfb40cb823d3 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 25 Mar 2015 22:22:06 -0500 Subject: [PATCH] Only index tif and gif files in collection --- skimage/io/collection.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/skimage/io/collection.py b/skimage/io/collection.py index aab7cb86..cdcb31d6 100644 --- a/skimage/io/collection.py +++ b/skimage/io/collection.py @@ -201,7 +201,7 @@ class ImageCollection(object): if fname.lower().endswith(('.tiff', '.tif')): img = TiffFile(fname) index += [(fname, i) for i in range(len(img.pages))] - else: + elif fname.lower().endswith('gif'): im = Image.open(fname) try: # this will raise an IOError if the file is not readable @@ -221,6 +221,8 @@ class ImageCollection(object): i += 1 if hasattr(im, 'fp') and im.fp: im.fp.close() + else: + index += (fname, 0) self._frame_index = index return len(index)