spd(1)
β¨ NAME β¨
spd β the SPatial Distortion Program, aka your new bestie for X-ray image glow-ups π
πΈ SYNOPSIS πΈ
Synchrotron image corrections and azimuthal integration. That's it, that's the vibe. β¨
π¦ DESCRIPTION π¦
okay so. SPD stands for SPatial Distortion. No cap. It's written in C, it's command-line driven, and it deals with images coming from X-ray diffusion/diffraction experiments. She's a real one.
Here's the pipeline, in order, and yes she does all of it:
- 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. Shoutout to the devs, absolute icons. π
π OPTIONS π
Usage, copy it exactly bestie:
spd [--server] [--exit] parameter=option [filenames]
Every single one of these, in order, no skipping, we are thorough in this house:
src_id=<source image shared memory id>β the shared memory id where your source image lives.src_ext=<source image file extension>β file extension for the source image (default none).cor_id=<shared memory id of corrected image>β shared memory id of the corrected image.cor_ext=<corrected image file extension>β file extension for the corrected image (default none).type=<output data type>β the output data type (default"FloatIEEE32").dvo=<value>β data value offset (default0).dark_id=<dark image shared memory id>β shared memory id of the dark image.dark_file=<dark image file name>β file name of the dark image.dark_const=<value>β subtract a constant dark image value. Default: no dark image subtraction done.dark_ext=<dark image file extension>β file extension for the dark image. Default none.do_dark=0|1β if0, suppress dark image correction. Default1.save_dark=0|1|2β save dark image memory to file.0: never,1: always,2: only if new (default2).inp_const=<value>β add input image constant (default0.).inp_exp=<value>β apply exponent to input image (default1.).inp_factor=<value>β multiply with input image factor (default1.).raw_cmpr="none"|"gzip"|"z"β compression of raw & dark images (default none).flood_id=<flood field image shared memory id>β shared memory id of the flood field image (or flat field).flood_file=<flood field image file name>β file name of the flood field image (default: no flood field used).bckg_id=<scattering background image shared memory id>β shared memory id of the scattering background image.bckg_file=<scattering background image file name>β file name of the scattering background image (default: no scattering background used).bckg_const=<additive scattering constant>β additive scattering constant (default0.).bckg_fact=<constant scattering factor>β constant scattering factor (default1.).header_id=<shared memory id for data header>β shared memory id for the data header (default: not used).pass=0|1β pass input file header to output (default0).header_min=<minimum header length for output file>β minimum header length for the output file (default0).header_ext=<extension for header output file>β extension for the header output file (default none).distortion_file=<file>β the distortion file (default"spatial.dat").xfile=<file>β x distortion read from an edf file.yfile=<file>β y distortion read from an edf file.xoutfile=<file>β x distortion saved to an edf file.youtfile=<file>β y distortion saved to an 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>β pre-rotation angle around axis 1 (default0.).prerot_2=<angle (rad) for pre-rotation around axis 2>β pre-rotation angle around axis 2 (default0.).prerot_3=<angle (rad) for pre-rotation around axis 3>β pre-rotation angle around axis 3 (default0.).psize_distort=0|1|2β take image params from distortion file.0: none,1: pix,2: pix, cen, dis, proj, rot (default0).cen_1=xxxβ if set, defines theCenter_1header value.cen_2=xxxβ if set, defines theCenter_2header value.i0=xxxβ if set, defines theIntensity0header value.i1=xxxβ if set, defines theIntensity1header value.off_1=xxxβ if set, defines theOffset_1header value.off_2=xxxβ if set, defines theOffset_2header value.pix_1=xxxβ if set, defines thePSize_1header value.pix_2=xxxβ if set, defines thePSize_2header value.bis_1=xxxβ if set, defines theBSize_1header value.bis_2=xxxβ if set, defines theBSize_2header value.dis=xxxβ if set, defines theSampleDistanceheader value.ori=xxxβ if set, defines theRasterOrientationheader value.tit=xxxβ if set, defines theTitleheader value.wvl=xxxβ if set, defines theWaveLengthheader value.pro="Saxs"|"Waxs"β projection type of image (defaultSaxs).rot_1=<angle (rad) for detector rotation plane 1>β detector rotation plane 1 angle (default0.).rot_2=<angle (rad) for detector rotation plane 2>β detector rotation plane 2 angle (default0.).rot_3=<angle (rad) for detector rotation plane 3>β detector rotation plane 3 angle (default0.).base_name=<name>β the base name (default"image").outdir=<pathname>β directory for output files (default:base_name).verbose=-1|0|1|2β message printing level (low -> high, default1).version=0|1β print version string of the program if!= 0.simul=0|1β (default0).do_distortion=0|1|2|3β distortion correction (default1). (0: none,1: after dark,2: after flat,3: after norm).flat_distortion=0|1β normalize to flat imgage (default1). and yes the manpage really does say "imgage", we stan a legend π«Άdo_prerotation=0|1|2β pre-rotation correction (default1). (0: none,1: after,2: without distortion correction).norm_int=0|1β intensity normalization (default0= no).norm_factor=<intensity normalization factor>β intensity normalization factor (default1.).overflow=xxxβ (default0= not set).dummy=<value>β (default0.= not set).inp_min=<value>β (default0.= not set).inp_max=<value>β (default0.= not set).bin_1=<value>β factor for x-binning (default1= no binning).bin_2=<value>β factor for y-binning (default1= no binning).azim_int=0|1β azimuthal regrouping (default0= no).azim_pass=0|1β pass full header to azimuthal regrouping (def.1= yes).azim_pro="Saxs"|"Waxs"β project. type of azim. regrp. (defaultSaxs).azim_id=<shared memory id of regrouped image>β shared memory id of the regrouped image (default-1).azim_ext=<file extension of regrouped image>β file extension of the regrouped image (default none).azim_r0=<value>β minimum regrouping radius (default0.).azim_r_num=<value>β radial output size (default0).azim_a0=<degrees>β 1st regrouping start angle (default0.).azim_a1=<degrees>β 2nd regrouping start angle (default: not used).azim_da=<degrees>β angular regrouping interval (default1.).azim_a_num=<value>β angular output size (default0).ave_id=<shared memory id of averaged image>β shared memory id of the averaged image (default-1).ave_ext=<file extension of averaged image>β file extension of the averaged image (default none).ave_scf=<scale factor for "s" values>β scale factor for"s"values (default1.).mask_file=<azimuthal regrouping mask file name>β the mask file for azimuthal regrouping (default: not used).--serverβ switch to server mode, i.e. wait for new command/image to process on stdin. she's just gonna sit there and listen, patient queen π--exitβ quit the program when we are on server mode.
π BUGS π
okay so there are two things you NEED to know, and I'm saying them with my whole chest:
Azimuthal integration can only be achieved if a wavelength is given, even if it is not needed for any calculation. Like, even if the math doesn't care, the program does. Give her the wavelength. Periodt.
- 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.
and that's the whole page bestie, you ate that π this was spd(1) from the General Commands Manual, built as SPD=1.3 SAXS=2.445 EDF=2.188, dated Oct 5 2011 β a classic, an icon, no notes. mwah ππ¦β¨
π¦ where this page comes from
- debian trixie: spd 1.3.0-2 Β· LGPL-3.0-or-later
- ubuntu jammy: spd 1.3.0-1ubuntu3 Β· LGPL-3.0-or-later
- ubuntu noble: spd 1.3.0-1.1 Β· LGPL-3.0-or-later
- ubuntu resolute: spd 1.3.0-2 Β· LGPL-3.0-or-later
- ubuntu stonking: spd 1.3.0-2 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms