The Multifile input method

The multifile input method allows multiple monochrome files of "standard" types like PNG and BMP to be imported as multispectral images. It can also read raw binary files.

Each file is flattened to greyscale in the process (if it is RGB) by finding the mean of the three channels for each pixel.

Camera data files

In order to analyse the images, PCOT needs to be able to find out which filter was used for each image and get information about it. It also needs access to calibration information, for example flat and dark field images, and reflectance data.

This data is stored in PARC files - PCOT archives - and is generated by the pcot gencam command. If you want to know to make them yourself, read this documentation.

However, PCOT already comes with some camera files. These can be found in the cameras directory inside the PCOT directory. They do not have flat/dark fields because that data is very large, but hopefully you will not need them - that stage of processing will take place upstream in the ROC. Other camera data files can be downloaded from the PCOT Cookbook.

Setting a camera

Once you know what camera was used, and you have installed a data file for that camera, you can set it in the multifile input using the Camera widget.

Which image is which filter? Setting a file pattern

The multifile input method lets you specify a camera, but PCOT still needs to be able to work out which filter was used to capture each band in the image. This is done by extracting the filter name or position from the filename using a regular expression (or regex). If you have some experience with regular expressions (or access to someone with this experience), it will help immensely.

Regular expressions describe patterns which texts might match. For example, the regex c[a-z]t will match any three-letter string starting with c and ending with t: it's c, followed by any character between a and z, followed by t.

The default pattern looks something like this:

.*[LR]WAC(?P<pos>[0-9][0-9]).*

This means:

  • .* matches any number of any character, so there could be anything at the start of the filename.
  • [LR] means "either L or R".
  • WAC means we must then have the sequence of letters WAC
  • (?P<pos>[0-9][0-9]) means we must now match two digits ([0-9]). We've put them in brackets and preceded them with ?P<pos> which means we should store the result under the name pos.
  • The final .* means that there can now be any number of any character again - so there could be anything at the end of the filename.

The idea is that a filename like /home/jim/files/DogBiscuitLWAC02Fish.jpg will be matched, and will result in 02 being stored as pos, which will then be used to look up the filter.

You can set the default pattern from the command line with

    pcot setconfig Default.multifile_pattern "your pattern here"

Named matches and how they are used

Only one of the following should be true (e.g. you can't use name and n together):

  • lens and n: if these are found, they are joined together to form a filter position which is looked up in the filter set (by the position column). The idea is that lens indicates either the left or right camera and n identifies a filter. They're separate because many early files used names like LWAC02 or LWideAngle02, in which the two elements were separate.
  • pos: if this is found, it us used to match a filter position using the pos column - as such, it's a simpler version of the lens/n combination
  • name: if this is found, it is used to match a filter using the name column
  • cwl: if this is found, it is used to match a filter using the cwl (wavelength) column

If you need assistance, or this isn't flexible enough, contact us - or maybe use the assignfilters node.

An alternative: assignfilters

You can assign filters in a camera to bands in an image manually using the assignfilters node (in the "utility" group). This is fairly self-explanatory: feed in an image, select a camera, and assign the bands using the move up and down buttons.

Reading raw binary files

Data is often provided "as is" from the camera, in a raw binary format. Reading these files requires a little more information in advance:

  • What the numeric format of the data is (e.g. 16-bit unsigned integer)
  • How big the image is in pixels
  • Whether there is a header at the start which should be skipped and how big it is (the "offset")
  • Whether the image needs to be rotated and/or flipped
  • Whether the data is "big-endian" or "little-endian."

These can be set by clicking the "raw loader settings" dialog.

Presets

You can save and load these values - and most other settings for multifile input, such as the pattern and filter - using the "Presets" button. Presets are currently stored in your home user directory in a file called MFPresets.json. Users can easily copy this file from other users.