# Batch mode

#### 2018-11-11

First of all, please read the vignette on working with single images at https://rorynolan.github.io/nandb/articles/single-images.html to see how N&B calculations work on an individual image basis and to understand the nature and importance of thresholding and detrending. It’s not necessary to understand every line, but it provides important context.

## Batch processing

Batch processing applies the same routine to all of the images in a directory. If you have a directory with some images on which you want to perform N&B calculations and some that you don’t, put the ones you want to calculate on in their own directory and act on that directory. Then put the resulting images wherever you like.

First decide whether or not your images need to be thresholded or not. Again, if some need to be thresholded and some don’t, put these in separate directories and process them separately. Always remember to check that the thresholding worked satisfactorily when it has been employed.

To calculate brightness on a directory `path/to/some/dir` with e.g. Huang thresholding and detrending, run

    brightness_folder("path/to/some/dir", def = "e", thresh = "Huang", detrend = TRUE)

This will make a new directory called `brightness` within `path/to/some/dir` which will contain the processed TIFF images. They will be named in such a way as to make clear how they were processed (with which thresholding and detrending parameters).

`brightness_timeseries()` also has its equivalent batch mode `brightness_timeseries_folder()`, so all bases are covered.