epicat

concatenate Advanced NMR echo-planar image files

usage: epicat source_path [...] dest_path

epicat concatenates separate Advanced NMR echo-planar studies into a single study. This can be useful in cases in which a single operation -- such as DART motion correction -- is to be applied to a series of studies as a unit. Inputs consist of binary image data (.img files) and ASCII parameter (.irp) files. The command-line parameters are pathname prefixes; parameter files are identified by appending a .irp extension to each of these prefixes, and image files are identified by finding the lexicographically least .img filename that begins with the given prefix. (This complexity in the naming scheme for image files allows names that include a trailing digit string -- for example, the source path specification epi will match the parameter file epi.irp and the image file epi_001.img.) Output files are named by appending .irp and .img extensions to the destination pathname specified in the rightmost argument on the command line; any existing files with these names are overwritten.

Since images are stored in slice-major, time-minor order, input files are read one slice at a time in order to multiplex all their images into a single output file. Within an image file, each image is followed by a sixteen-byte header. This header is copied intact except for the third and fourth bytes, which represent the image number within the current slice. These bytes are modified appropriately.

Images whose dimensions or numbers of slices differ from those of the first image file are excluded, as are those whose file sizes do not match the dimensions specified in their parameter files. Unlike the image dimensions and number of slices, the number of images per slice may vary across input files.

Author: Matthew Belmonte