ImageFolder.group

ImageFolder.group(key)

Sort Files into a series of objectFolders according to the value of the key.

Parameters

key (string or callable or list) – Either a simple string or callable function or a list. If a string then it is interpreted as an item of metadata in each file. If a callable function then takes a single argument x which should be an instance of a metadataObject and returns some vale. If key is a list then the grouping is done recursely for each element in key.

Returns

A copy of the current objectFolder object in which the groups attribute is a dictionary of objectFolder objects with sub lists of files

Notes

If ne of the grouping metadata keys does not exist in one file then no exception is raised - rather the fiiles will be returned into the grou with key None. Metadata keys that are generated from the filename are supported.