spd(1) SPatial Distortion Program


Synchrotron image corrections and azimuthal integration


SPD stands for SPatial Distortion. Written in C language, this command-line driven program deals with images coming from X-ray diffusion/diffraction experiments. It does subsequently:
 * intensity corrections (dark current, flat field correction, ...),
 * geometry corrections using spline files or a pair of distortion arrays,
 * azimuthal integration in 2D or 1D after masking defective pixels.  SPD was originally written by Jorg Klora for ESRF and was re-written by Peter Boesecke from ESRF/ID02. Maintenance and packaging of the program are provided by Rainer Wilcke and Jerome Kieffer from SciSoft at ESRF.


Usage: spd [--server] [--exit] parameter=option [filenames]

src_id=<source image shared memory id>

src_ext=<source image file extension> (default none)

cor_id=<shared memory id of corrected image>

cor_ext=<corrected image file extension> (default none)

type=<output data type> (default "FloatIEEE32")

dvo=<value> data value offset (default 0)

dark_id=<dark image shared memory id>

dark_file=<dark image file name>

dark_const=<value> subtract constant dark image value         default: no dark image subtraction done

dark_ext=<dark image file extension>         default none

do_dark=0|1 if 0, suppress dark image correction default 1

save_dark=0|1|2 save dark image memory to file
 0: never, 1: always, 2: only if new (default 2)

inp_const=<value> add input image constant (default 0.)

inp_exp=<value> apply exponent to input image (default 1.)

inp_factor=<value> multiply with input image factor (default 1.)

raw_cmpr="none"|"gzip"|"z" compression of raw & dark images (default none)

flood_id=<flood field image shared memory id> (or flat field)

flood_file=<flood field image file name> (default: no flood field used)

bckg_id=<scattering background image shared memory id>

bckg_file=<scattering background image file name> (default: no scattering background used)

bckg_const=<additive scattering constant> (default 0.)

bckg_fact=<constant scattering factor> (default 1.)

header_id=<shared memory id for data header> (default: not used)

pass=0|1 pass input file header to output (default 0)

header_min=<minimum header length for output file> (default 0)

header_ext=<extension for header output file> (default none)

distortion_file=<file> (default "spatial.dat")

xfile=<file> (x distortion read from edf file)

yfile=<file> (y distortion read from edf file)

xoutfile=<file> (x distortion saved to edf file)

youtfile=<file> (y distortion saved to edf file)

active_radius=<value> (values outside will not be corrected)

precen_1=xxx for pre-rotation center_1 (default calculated)

precen_2=xxx for pre-rotation center_2 (default calculated)

predis=xxx for pre-rotation distance (default calculated)

prerot_1=<angle (rad) for pre-rotation around axis 1> (default 0.)

prerot_2=<angle (rad) for pre-rotation around axis 2> (default 0.)

prerot_3=<angle (rad) for pre-rotation around axis 3> (default 0.)

psize_distort=0|1|2 take image params from distortion file 0: none, 1: pix, 2: pix, cen, dis, proj, rot (default 0)

cen_1=xxx if set, defines Center_1 header value

cen_2=xxx if set, defines Center_2 header value

i0=xxx if set, defines Intensity0 header value

i1=xxx if set, defines Intensity1 header value

off_1=xxx if set, defines Offset_1 header value

off_2=xxx if set, defines Offset_2 header value

pix_1=xxx if set, defines PSize_1 header value

pix_2=xxx if set, defines PSize_2 header value

bis_1=xxx if set, defines BSize_1 header value

bis_2=xxx if set, defines BSize_2 header value

dis=xxx if set, defines SampleDistance header value

ori=xxx if set, defines RasterOrientation header value

tit=xxx if set, defines Title header value

wvl=xxx if set, defines WaveLength header value

pro="Saxs"|"Waxs" projection type of image (default Saxs)

rot_1=<angle (rad) for detector rotation plane 1> (default 0.)

rot_2=<angle (rad) for detector rotation plane 2> (default 0.)

rot_3=<angle (rad) for detector rotation plane 3> (default 0.)

base_name=<name> (default "image")

outdir=<pathname> directory for output files (default: base_name)

verbose=-1|0|1|2 message printing level (low -> high, default 1)

version=0|1 print version string of the program if != 0

simul=0|1 (default 0)

do_distortion=0|1|2|3 distortion correction (default 1)         (0: none, 1: after dark, 2: after flat, 3: after norm)

flat_distortion=0|1 normalize to flat imgage (default 1)

do_prerotation=0|1|2 pre-rotation correction (default 1)         (0: none, 1: after, 2: without distortion correction)

norm_int=0|1 intensity normalization (default 0 = no)

norm_factor=<intensity normalization factor> (default 1.)

overflow=xxx (default 0 = not set)

dummy=<value> (default 0. = not set)

inp_min=<value> (default 0. = not set)

inp_max=<value> (default 0. = not set)

bin_1=<value> factor for x-binning (default 1 = no binning)

bin_2=<value> factor for y-binning (default 1 = no binning)

 azim_int=0|1 azimuthal regrouping (default 0 = no)

azim_pass=0|1 pass full header to azimuthal regrouping (def. 1 = yes)

azim_pro="Saxs"|"Waxs" project. type of azim. regrp. (default Saxs)

azim_id=<shared memory id of regrouped image> (default -1)

azim_ext=<file extension of regrouped image> (default none)

azim_r0=<value> minimum regrouping radius (default 0.)

azim_r_num=<value> radial output size (default 0)

azim_a0=<degrees> 1st regrouping start angle (default 0.)

azim_a1=<degrees> 2nd regrouping start angle (default: not used)

azim_da=<degrees> angular regrouping interval (default 1.)

azim_a_num=<value> angular output size (default 0)

ave_id=<shared memory id of averaged image> (default -1)

ave_ext=<file extension of averaged image> (default none)

ave_scf=<scale factor for "s" values> (default 1.)

mask_file=<azimuthal regrouping mask file name>
 (default: not used)

--server switch to server mode, i.e. wait for
 new command/image to process on stdin

--exit quit the program when we are on server mode.


Azimuthal integration can only be achieved if a wavelength is given, even if it is not needed for any calculation.

SPD was developed at ESRF and is tightly bound to Spec shared-memory arrays (http://www.certif.com) and EDF (ESRF Data Format) images, both in input and output.