Table of Contents


marreference- Subtracts a reference image from a mar image


marreference [ -h (--help) ] [ -a (--auto) ] [ -f (--force) ] [ -l (--list) ] [ --rec(ursive) ] [ -v (--verbose) ] [ +a (--add) OFFSET ] [ -d (--directory) DIR ] [ -n (--name) NAME ] [ -r (--reference) FILE ] [ -o FILE ] [ -raw ] file1 file2 ...


marreference subtracts a reference image from a diffraction image. Typical usage is to correct for special diffraction effects. The reference image should typically taken with the same experimental conditions (exposure time, beam intensity) as normal images, but without diffracting samples. After subtraction, the net difference of the diffracting material will remain in the resulting image. When subtracting the reference image from the diffraction image, at least some pixel values may become negative. The program will truncate all negative values to 0. In order to ensure that all pixel values are positive an arbitrary OFFSET value may added to all pixels after subtraction. With option -a (--auto) the OFFSET value is adjusted automatically by determining the largest negative difference and adding this to all pixels. Since every image of a series of images may then receive a different OFFSET value, the automatic procedure may not be desirable to use but rather an arbitrary but fixed value that leaves all pixels > 0, e.g. a value of 100. The used offset values will be written into the mar345 image header of the resulting image and can be found in parameters ADD_A and ADD_B on keyword ADC. Note, that this information is lost when choosing RAW as image output format.

The program can apply a given reference file to images of the same pixelsize but a smaller scan radius. E.g. a reference file taken from the entire plate (345 mm diameter) and pixelsize 0.15 mm in scanmode 2300 can be applied to all other scanmodes of pixelsize 0.15 mm, i.e. scanmodes 2000, 1600 and 1200, but not to images collected with a pixelsize of 0.10 mm (scanmodes 3450, 3000, 2400, 1800). Likewise, it is not possible to apply a reference image collected in mode 1200 to mode 2300! Also, when processing a series of images using wildcards, the program will adapt the size of the reference image to the size of the input images in memory. Once the size is reduced, the program will not be able to automatically augment the memory size. To process those images, the program will have to be restarted.

The program accepts wildcards for input images.


-h, --help
Provides a summary of the options.
-a, --auto
Automatically determines the largest negative difference in the resulting image and add this value to all pixels, so all pixels become > 0.
+a, --add OFFSET
After subtraction, add OFFSET to all pixel values in order to avoid too many truncated negative values.
-d DIR
Place output images in directory DIR. Default is: same directory as input images.
-f, --force
Forces image output, even if a file with the same name already exists. The default is to skip output.
-l, --list
Lists the selected files (directories) only, no output.
-n, --name NAME
Root name of output images. Default is: keep existing root name.
Specify name of single output file. Careful when converting multiple images: they will all have the same name!
-r, --ref FILE
Specify name of reference file. This image will be used for subtraction of all given input images.
Instead of producing a mar345 image output file, a raw 16-bit array of data is written out without header. This is for compatibility with other data processing programs.
If the file argument (see below) is a directory, all images in this directory and its subdirectories will be converted. This is a very fast way of converting large numbers of images scattered in many directories.
-v, --verbose
Writes more information to stdout.
file1 file2 ...
Image files to convert. Wildcards allowed.


marreference +a 100 -r ref_001.mar2300 -n out in_???.mar2300
Subtracts contents of ref_001.mar2300 from all files in_???.mar2300 and produces output files named out_???.mar2300, where ??? is any 3-digit number. After subtraction, 100 is added to all pixel values.

See Also



Claudio Klein, marXperts GmbH, Norderstedt, Germany


© Copyright 2016 marXperts GmbH, Norderstedt, Germany


marXperts GmbHPhone: +49 - (40) - 529 884-0
Werkstr. 3 FAX: +49 - (40) - 529 884-20
D-22844 Norderstedt -

Table of Contents