skimage 0.17.2

AttributesNotesOther ParametersParametersBackRef

Attributes

files : list of str

If a pattern string is given for :None:None:`load_pattern`, this attribute stores the expanded file list. Otherwise, this is equal to :None:None:`load_pattern`.

Notes

Note that files are always returned in alphanumerical order. Also note that slicing returns a new ImageCollection, not a view into the data.

ImageCollection can be modified to load images from an arbitrary source by specifying a combination of :None:None:`load_pattern` and :None:None:`load_func`. For an ImageCollection ic , ic[5] uses load_func(file_pattern[5]) to load the image.

Imagine, for example, an ImageCollection that loads every tenth frame from a video file:

class AVILoader:
    video_file = 'myvideo.avi'

    def __call__(self, frame):
        return video_read(self.video_file, frame)

avi_load = AVILoader()

frames = range(0, 1000, 10) # 0, 10, 20, ...
ic = ImageCollection(frames, load_func=avi_load)

x = ic[5] # calls avi_load(frames[5]) or equivalently avi_load(50)

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)

For files with multiple images, the images will be flattened into a list and added to the list of available images. In this case, load_func should accept the keyword argument img_num .

Other Parameters

load_func : callable

imread by default. See notes below.

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, ImageCollection does not keep more than one in memory at a specific time. Otherwise, images will be cached once they are loaded.

Load and manage a collection of image files.

Examples

This example is valid syntax, but we were not able to check execution
>>> import skimage.io as io
... from skimage import data_dir
This example is valid syntax, but we were not able to check execution
>>> coll = io.ImageCollection(data_dir + '/chess*.png')
... len(coll) 2
This example is valid syntax, but we were not able to check execution
>>> coll[0].shape
(200, 200)
This example is valid syntax, but we were not able to check execution
>>> ic = io.ImageCollection(['/tmp/work/*.png', '/tmp/other/*.jpg'])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.io.collection.imread_collection_wrapper.<locals>.imread_collection skimage.io.collection.ImageCollection skimage.io.collection.ImageCollection.concatenate

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /skimage/io/collection.py#98
type: <class 'type'>
Commit: