Grouping files using a pattern file
Individual files can be grouped together into a single fileset using a pattern file. This works for any single-file format that Bio-Formats supports, as long as all files are in the same format. It is most useful for sets of TIFF, JPEG, PNG, etc. files that do not have any associated metadata.
All files to be grouped together should be in the same folder. The pattern
file should be in the same folder as the other files; it can have any name,
but must have the
.pattern extension. The pattern file is what must be
opened or imported, so it may be helpful to give it a descriptive or
The pattern file contains a single line of text that is specially formatted to describe how the files should be grouped. The file can be created in any text editor.
The text in the pattern file can take one of several forms. To illustrate, consider a folder with the following file names:
A pattern file that groups
in that order would look like:
A pattern that groups
<> notation in general can accept a single literal value, a
comma-separated list of literal values, a range of integer values, or a range
of integer values with a step value greater than 1 (the range and step are
:). Note that inverting the values in a range (e.g.
<2-0>) is not
supported and will cause an exception to be thrown.
The characters immediately preceding the
< can affect
which dimension is assigned to the specified values. The values will be
Z sections, if
Note that the listed dimension specifier characters are case insensitive. A separator character (underscore or space) must precede the dimension specifier if it is not at the beginning of the filename. In the above example, 2 Z sections and 2 out of 3 channels would be detected according to the dimension specifiers.
Leading zeros in the integer values must be specified. To group
Note that this pattern would not group the files correctly:
A pattern file that groups all PNG files beginning with
test_ would look like:
This and most other Java-style regular expressions can be used in place of the
<> notation above. See the java.util.regex.Pattern Javadoc
for more information on constructing regular expressions.