class_docstr: Load and manage a collection of image files.
  
  Parameters
  ----------
  load_pattern : str or list of str
      Pattern string or list of strings to load. The filename path can be
      absolute or relative.
  conserve_memory : bool, optional
      If True, :class:`skimage.io.ImageCollection` does not keep more than one in
      memory at a specific time. Otherwise, images will be cached once they are loaded.
  
  Other parameters
  ----------------
  load_func : callable
      ``imread`` by default. See Notes below.
  **load_func_kwargs : dict
      Any other keyword arguments are passed to `load_func`.
  
  Attributes
  ----------
  files : list of str
      If a pattern string is given for `load_pattern`, this attribute
      stores the expanded file list. Otherwise, this is equal to
      `load_pattern`.
  
  Notes
  -----
  Note that files are always returned in alphanumerical order. Also note that slicing
  returns a new :class:`skimage.io.ImageCollection`, *not* a view into the data.
  
  ImageCollection image loading can be customized through
  `load_func`. For an ImageCollection ``ic``, ``ic[5]`` calls
  ``load_func(load_pattern[5])`` to load that image.
  
  For example, here is an ImageCollection that, for each video provided,
  loads every second frame::
  
    import imageio.v3 as iio3
    import itertools
  
    def vidread_step(f, step):
        vid = iio3.imiter(f)
        return list(itertools.islice(vid, None, None, step)
  
    video_file = 'no_time_for_that_tiny.gif'
    ic = ImageCollection(video_file, load_func=vidread_step, step=2)
  
    ic  # is an ImageCollection object of length 1 because 1 video is provided
  
    x = ic[0]
    x[5]  # the 10th frame of the first video
  
  Alternatively, if `load_func` is provided and `load_pattern` is a
  sequence, an :class:`skimage.io.ImageCollection` of corresponding length will
  be created, and the individual images will be loaded by calling `load_func` with the
  matching element of the `load_pattern` as its first argument. In this
  case, the elements of the sequence do not need to be names of existing
  files (or strings at all). For example, to create an :class:`skimage.io.ImageCollection`
  containing 500 images from a video::
  
    class FrameReader:
        def __init__ (self, f):
            self.f = f
        def __call__ (self, index):
            return iio3.imread(self.f, index=index)
  
    ic = ImageCollection(range(500), load_func=FrameReader('movie.mp4'))
  
    ic  # is an ImageCollection object of length 500
  
  Another use of `load_func` would be to convert all images to ``uint8``::
  
    def imread_convert(f):
        return imread(f).astype(np.uint8)
  
    ic = ImageCollection('/tmp/*.png', load_func=imread_convert)
  
  Examples
  --------
  >>> import imageio.v3 as iio3
  >>> import skimage.io as io
  
  # Where your images are located
  >>> data_dir = os.path.join(os.path.dirname(__file__), '../data')
  
  >>> coll = io.ImageCollection(data_dir + '/chess*.png')
  >>> len(coll)
  2
  >>> coll[0].shape
  (200, 200)
  
  >>> image_col = io.ImageCollection([f'{data_dir}/*.png', '{data_dir}/*.jpg'])
  
  >>> class MultiReader:
  ...     def __init__ (self, f):
  ...         self.f = f
  ...     def __call__ (self, index):
  ...         return iio3.imread(self.f, index=index)
  ...
  >>> filename = data_dir + '/no_time_for_that_tiny.gif'
  >>> ic = io.ImageCollection(range(24), load_func=MultiReader(filename))
  >>> len(image_col)
  23
  >>> isinstance(ic[0], np.ndarray)
  True
class_docstr_tok: ["Load","and","manage","a","collection","of","image","files",".","Parameters","--","--","--","--","--","load_pattern",":","str","or","list","of","str","Pattern","string","or","list","of","strings","to","load",".","The","filename","path","can","be","absolute","or","relative",".","conserve_memory",":","bool",",","optional","If","True",",",":","class",":","`","skimage.io.ImageCollection","`","does","not","keep","more","than","one","in","memory","at","a","specific","time",".","Otherwise",",","images","will","be","cached","once","they","are","loaded",".","Other","parameters","--","--","--","--","--","--","--","--","load_func",":","callable","``","imread","``","by","default",".","See","Notes","below",".","*","*","load_func_kwargs",":","dict","Any","other","keyword","arguments","are","passed","to","`","load_func","`",".","Attributes","--","--","--","--","--","files",":","list","of","str","If","a","pattern","string","is","given","for","`","load_pattern","`",",","this","attribute","stores","the","expanded","file","list",".","Otherwise",",","this","is","equal","to","`","load_pattern","`",".","Notes","--","--","-","Note","that","files","are","always","returned","in","alphanumerical","order",".","Also","note","that","slicing","returns","a","new",":","class",":","`","skimage.io.ImageCollection","`",",","*","not","*","a","view","into","the","data",".","ImageCollection","image","loading","can","be","customized","through","`","load_func","`",".","For","an","ImageCollection","``","ic","``",",","``","ic","[","5","]","``","calls","``","load_func","(","load_pattern","[","5","]",")","``","to","load","that","image",".","For","example",",","here","is","an","ImageCollection","that",",","for","each","video","provided",",","loads","every","second","frame",":",":","import","imageio.v3","as","iio3","import","itertools","def","vidread_step","(","f",",","step",")",":","vid","=","iio3.imiter","(","f",")","return","list","(","itertools.islice","(","vid",",","None",",","None",",","step",")","video_file","=","'no_time_for_that_tiny.gif'","ic","=","ImageCollection","(","video_file",",","load_func=vidread_step",",","step=2",")","ic","#","is","an","ImageCollection","object","of","length","1","because","1","video","is","provided","x","=","ic","[","0","]","x","[","5","]","#","the","10th","frame","of","the","first","video","Alternatively",",","if","`","load_func","`","is","provided","and","`","load_pattern","`","is","a","sequence",",","an",":","class",":","`","skimage.io.ImageCollection","`","of","corresponding","length","will","be","created",",","and","the","individual","images","will","be","loaded","by","calling","`","load_func","`","with","the","matching","element","of","the","`","load_pattern","`","as","its","first","argument",".","In","this","case",",","the","elements","of","the","sequence","do","not","need","to","be","names","of","existing","files","(","or","strings","at","all",")",".","For","example",",","to","create","an",":","class",":","`","skimage.io.ImageCollection","`","containing","500","images","from","a","video",":",":","class","FrameReader",":","def","__init__","(","self",",","f",")",":","self.f","=","f","def","__call__","(","self",",","index",")",":","return","iio3.imread","(","self.f",",","index=index",")","ic","=","ImageCollection","(","range","(","500",")",",","load_func=FrameReader","(","'movie.mp4","'",")",")","ic","#","is","an","ImageCollection","object","of","length","500","Another","use","of","`","load_func","`","would","be","to","convert","all","images","to","``","uint8","``",":",":","def","imread_convert","(","f",")",":","return","imread","(","f",")",".astype","(","np.uint8",")","ic","=","ImageCollection","(","'\/tmp\/","*",".png","'",",","load_func=imread_convert",")","Examples","--","--","--","--",">",">",">","import","imageio.v3","as","iio3",">",">",">","import","skimage.io","as","io","#","Where","your","images","are","located",">",">",">","data_dir","=","os.path.join","(","os.path.dirname","(","__file__",")",",","'","..","\/data","'",")",">",">",">","coll","=","io.ImageCollection","(","data_dir","+","'\/chess","*",".png","'",")",">",">",">","len","(","coll",")","2",">",">",">","coll","[","0","]",".shape","(","200",",","200",")",">",">",">","image_col","=","io.ImageCollection","(","[","f","'","{","data_dir","}","\/","*",".png","'",",","'","{","data_dir","}","\/","*",".jpg","'","]",")",">",">",">","class","MultiReader",":","...","def","__init__","(","self",",","f",")",":","...","self.f","=","f","...","def","__call__","(","self",",","index",")",":","...","return","iio3.imread","(","self.f",",","index=index",")","...",">",">",">","filename","=","data_dir","+","'\/no_time_for_that_tiny.gif'",">",">",">","ic","=","io.ImageCollection","(","range","(","24",")",",","load_func=MultiReader","(","filename",")",")",">",">",">","len","(","image_col",")","23",">",">",">","isinstance","(","ic","[","0","]",",","np.ndarray",")","True"]
docstr: Iterate over the images.
docstr_tok: ["Iterate","over","the","images","."]
code: def __iter__(self):
      """Iterate over the images."""
      for i in range(len(self)):
          yield self[i]
  
imports: import os
  from glob import glob
  import re
  from collections.abc import Sequence
  from copy import copy
  import numpy
  from PIL import Image
  from tifffile import TiffFile
label_desc: Use image node_id 7 for calling the ImageCollection obj's underlying member method code with example usage: obj.__iter__() without return types