next up previous contents index
Next:  Spatial Distortion Correction in Up: Calibration Sub-menu Previous: Notes on the Data

Subsections


Calibration Sub-Menu Commands


 ?

List of available commands in the calibration sub-menu together with brief description of their function. (See HELP.)

 CALCULATE DISTORTION FUNCTION

The complete interpolated distortion spline may be calculated for the whole of the ROI with this command, provided of course a distortion spline has been fitted, or input. The values of the distortion spline are output in the ``memory''. This may be useful to check that unwanted oscillations are not present in the fitted spline surface.

 DECAY CORRECTION

It has been noted by various investigators that the X-ray signal recorded on an imaging plate decays between the exposure and the read-out by a scanner [4,6,9,25,29,33]. This decay can both reduce the measured intensities, and more seriously lead to variable intensity response along the scanned plate. The magnitude of this effect can be 5 to 10 % for short exposures which are scanned soon after exposure, so has an appreciable effect on the integrated data statistics.

The decay of Fuji white and blue image plates has been accurately measured at the ESRF in a long series of calibration measurements by Olof Svensson. The measurements show the decay to be independent of the small temperature variations present in the ESRF Experimental Hall. (Note: The decay curve for the Kodak plates is different.) The decay curve measurements have been fitted by the least squares criterion to the following equation [9]:38


\begin{displaymath}
F_t = 0.13 e^{-t/180} + (1.0-0.13)e^{-t/6600}
\end{displaymath} (5)

$F_t$ is the fraction of the original recorded signal remaining after a time $t$ in seconds from the exposure.

The user has the option of using this equation with the decay constants specified, and using scan timing results measured for the Molecular Dynamics 400E scanner, or entering their own constants for the exponential decay and the scanner times.

The user is prompted for:

FULL USER CONTROL [NO]:

If the default of NO is entered FIT2D will prompt for the choice between 88 $\mu m$ and 176 $\mu m$ scan, as this affects the time of scanning:

176 MICRON SCAN ("NO" FOR 88 MICRON) [YES]:

Otherwise FIT2D outputs the basic equation used to approximate the decay and inputs user values for the decay time constants and the proportion of the ``fast'' and ``slow'' decay components:

The decay is approximated by the sum of two exponential decays. The
fraction is remaining signal t seconds after exposure I_t is defined by:
 
   I_t = P_fast * Exp(-t/T_fast)+ (1.0 - P_fast) * Exp(-t/T_slow)
 
where: P_fast is the proportion of the fast decay component
       T_fast is the time constant of the fast decay (in seconds)
       T_slow is the time constant of the slow decay (in seconds)
 
PROPORTION FAST DECAY (Range: 0.0 to 1.00000) [.13426]: 
TIME CONSTANT OF FAST DECAY (SECONDS)
 (Range: 0.0 to 1.000E+10) [179.411]: 
TIME CONSTANT OF SLOW DECAY (SECONDS)
 (Range: 0.0 to 1.000E+10) [6631.40]:

This is followed by an explanation of the times used to calculate the minimum and maximum decay times for each line, and the input of the scanner delay time from the user start (button press) to the start of the physical laser scan of the first line, the time to scan the image, and the number of lines scanned:

The program calculates for each line in the image the average decay that
has taken place from the longest time from first exposure to the scan,
to the shortest time from the end of the exposure to the scan. To know
this it needs to know how long was the exposure, the time between the
exposure and the user start of the scan (both these questions are asked
later), the time from the user start of the scan (click with with the
mouse, or similar) to the physical scan of the first line of the image,
and the time to scan each line of the image. The time to scan each line
is calculated from the total time of the physical scan divided by the
number of scanned lines.

START-UP TIME (SECONDS) (Range: 0.0 to 1000.00) [36.0000]: 
IMAGE SCAN TIME (SECONDS) (Range: 0.0 to 3600.00) [120.000]: 
NUMBER OF SCANNED LINES (Range: 1 to 50000) [1482]:

For both FULL CONTROL or not the user is prompted for the length of the exposure, and the time from the end of the exposure to the start of the scan (user button pressed). Both times are in seconds.

EXPOSURE LENGTH (SECONDS) (Range: 0.0 to 1.000E+10)
 [10.0000]: 
ELAPSE TIME (FROM END OF EXPOSURE TO SCAN, SECONDS)
 (Range: 0.0 to 1.000E+10) [60.0000]:

From this information the normalised integral of decay is calculated for each line of the scanned image (the difference within a scanned line is insignificant). From the decay values correction values relative to the first line of the ROI are calculated and applied to every pixel in the line.

At the end of the correction FIT2D will output the maximum correction factor which was applied to the last line to be scanned. This information may be useful in estimating the relative importance of the decay. e.g:

INFO: Maximum correction factor =   1.05994

The correction takes place in the current data, the old data values are replaced by the corrected values.

Note: If the oscillation method is used to collect crystallographic data, and if the total exposure times are long, then it is important to oscillate the crystals several times during each exposure. This is necessary since the correction assumes that all recorded X-rays have arrived uniformly with time 39.

 DESTROY GRID PEAKS

Sometimes false peaks may be found on the edge of the grid which can lead to problems in fitting a smooth interpolation function. To overcome this problem DESTROY GRID PEAKS allows the user to specific peak positions from the found grid and turn the peak to a missing peaks. Note: This operation is not reversible without re-commencing the FIND PEAKS operation.

 DISPLAY DISTORTION

After the FIND PEAKS command it is possible to display the measured X or Y-distortion as estimated over the 2-D grid of peaks. This command will display the distortion values as a 2-D image. False colour is used to show the values of the distortion. Each pixel is a peak of the grid. Missing peaks are displayed with a zero distortion value. (Strictly, the measured positions are not regularly spaced, but the deviation from ideal positions is hopefully not too great, so this display should give a reasonable idea of the distortion function over the detector surface.)

(If nothing appears to be displayed in the image it may be because Z-SCALE has been used to select a fixed intensity range for display. If this is the case, return to the main menu, set the z-scaling to automatic and return to the calibration sub-menu.)

 EXIT

To return to the main menu EXIT should be entered. As the calibration sub-menu uses extra dynamic memory to store peak positions and the spline coefficients, the user is given the choice of saving these values or recovering the memory, which means the values are lost. If you answer YES any spline correction coefficients are lost and need to be re-input or calculated.

 FAST CORRECTION

Corrects data in the current data ROI using a look-up table which must have been previously defined using LOOK-UP TABLE (SPATIAL DISTORTION) or input from a file using LOAD LOOK-UP TABLE.

This method is much faster than having to re-calculate geometrical areas for every data image, but the stored look-up table is very large so a large amount of computer RAM should be available on the system.

 FIND PEAKS

FIND PEAKS tries to measure the central position of peaks defined in a regular grid, as the result of a calibration measurement with a grid of known hole to hole distances. The entire ROI will be searched for peaks, so prior to FIND PEAKS the ROI should be set to the required region. Ideally, the ROI should just contain all peaks to be measured.

The search is started by the user defining three peaks graphically. A 200$\times$200 region of the ROI is displayed as an image and the user is invited to click on the centre of the starting peak, one peak horizontally from the starting peak, and one peak vertically from the starting peak40. The size of the displayed region may be changed by prior use of the SIZE (IMAGE DISPLAY) option (see Section 16.6.24), Page [*]). Clicking on the exact centre is not necessary, but the input coordinate needs to be close to the peak, or the peak searching can get lost.

After selecting an initial starting peak it is necessary to select the peak horizontally to the right of the starting peak, and then the peak vertically upwards from the starting peak41.

Two parameters are available to allow rejection of noise and spurious features:

MAXIMUM PEAK SEARCH DISTANCE and PEAK DETECTION RATIO.

MAXIMUM PEAK SEARCH DISTANCE sets the maximum distance in pixels from predicted position of a peak to a found ``peak'' position. Apart from the first three user input peaks, every peak has a predicted position based on the positions of previously found nearby peaks. The predicted position is used for the start of the peak search. If the peak search goes further than the SEARCH DISTANCE value from the initial position then the peak is deemed to be missing. This value may be reduced if the peak search is ``following'' spurious features, or may be increased if the distortion changes quickly relative to the grid peaks and genuine peaks are not being identified.

PEAK DETECTION RATIO: This parameter allows rejection of noise and spurious features which have been found within the search distance. This is the ratio of the cross-correlation value found for a new ``peak'' relative to that of the last accepted peak. (For genuine peaks the cross-correlation values are proportional to intensity.) If too low a value is set noise may be mistaken for peaks, whereas if too high a valid is set genuine peaks may be rejected.

PEAK STANDARD DEVIATION WIDTH: Initially, the peaks are assumed to be circularly symmetric 2-D Gaussians in profile. The user must enter the standard deviation size of the peaks in pixel units. (If this value is wrong, or the profile is not Gaussian, the centres should still be correct, so long as the actual profile is also symmetric, and the entered value is about right.) The FIT sub-menu may be used to fit 2-D Gaussians to the peaks prior to calibration (See Section 17, Page [*]).

NUMBER OF SUB-PIXELS: This sets the precision to which the peak centres should be determined; the number of sub-divisions into which each pixel should be divided when finding the best peak position. e.g. A value of 5 will mean that the centre of each peak will be determined to the best $\frac{1}{5}$ pixel bin in each of the X and Y-directions. The larger the value the longer the peak search will take, and the higher the accuracy provided the data statistics are good enough.

The program will now try to find all peaks in the ROI on the regular grid. First a ``cross'' of peaks is searched. Starting from the initial three peaks all peaks along the positive ``horizontal'' vector are found, followed by all peaks along the positive ``vertical'' vector, negative ``horizontal'' vector, and the negative ``vertical'' vector. This ``cross'' is used as starting points for the peak search in each of the four defined quadrants. As such it must not contain any missing peaks42. If the ``cross'' is found to contain missing peaks the peak search stops immediately. Usually an alternative starting position will overcome this problem, otherwise the ROI may need to be re-defined. If the central ``cross'' is found without missing peaks this sets the maximum size of the grid search. Each of the four quadrants is searched using starting estimated peak positions from the ``cross''. Missing peak positions may be encountered and the search will continue to look for subsequent peaks43. The peak search can take many minutes for large grids, so the program will periodically inform you on the progress.

When finished FIT2D outputs the number of peaks found and the size of the grid of peaks. Following the grid size is the number of holes in the whole grid as found. From this numbers the number of missing peaks can be calculated. (When the beam-stop covers some holes, or where the edge of the grid is not recorded owing to a circular detector, some missing peaks are normal.)

GRID SPACING (CENTRE TO CENTRE IN microns): In order to calculate the distortion from ideal positions the program needs to know the distance between grid holes (this is the centre to centre distance). The input spacing is in microns. (If this distance is wrong the distortion shape will still be correctly calculated, but the deduced average pixel sizes will be wrong.)

The option to correct peak positions for the effect of off-axis mask vignetting is now given:

CORRECT OFF-AXIS MASK VIGNETTING [YES]:

Mask vignetting is the shadowing caused by the finite thickness of the calibration mask. (This option was introduced in V7.12.) For off-axis hole positions the X-ray illumination is non-orthogonal to the mask (the mask is assumed to be orthogonal to the direct X-ray beam). Thus the finite thickness of the mask leads to a shadowing of the hole, and the effective centre of the grid peak will move outwards slightly. This option allows this effect to be estimated and the peak positions corrected.

If this option is chosen the user will be prompted for the necessary experiment geometrical information:

MASK THICKNESS (microns) (Range: 1.00000 to 1.000E+05)
 [200.000]:
SAMPLE TO DETECTOR DISTANCE (MILLIMETRES)
 (Range: .10000 to 1.000E+05) [140.000]:
INFO: The beam centre does not need to be specified accurately. An
      approximate centre is appropriate.
X-PIXEL COORDINATE OF BEAM CENTRE [512.500]:
Y-PIXEL COORDINATE OF BEAM CENTRE [512.500]:

Note: An approximate beam centre is quite good enough for this correction. The correction should normally be a small effect, and is only worthwhile at short sample to mask distances (< 150mm) or with unusually thick masks. Near the centre there will be almost no effect.

Based on the measured peak centres and the input grid spacing, the program calculates average pixel sizes based on the average distance between the furthest peaks on the rows and columns, and based on the RMS pixel sizes found from adjacent peaks. As the grid may not be perfectly aligned to the detector raster, an average rotation is also calculated.

IDEAL X PIXEL SIZE (MICRONS): / IDEAL Y PIXEL SIZE (MICRONS):
The user is prompted for values for the ideal raster pixel sizes (in microns). These values will be used to calculate the ``distortion'' values and eventually will be the pixel sizes for spatially corrected images. The RMS X and Y-sizes are given as default values. Depending on the flexibility of subsequent processing software it may be necessary to set square pixels. By default the pixel sizes will in general be non-square.

GRID ROTATION ANGLE (DEGREES): This is the angle of rotation of the grid ``horizontal'' relative to the detector raster. This avoids grid mask mis-alignment being counted as distortion. By default the average value of mask rotation based on the ends of the columns and rows of peaks is given. For Molecular Dynamics scanner data the value based only on the columns may be better, as the scanner is continual moving in the Y-direction as the X-direction is being scanned.

X-NUMBER OF IDEAL HOLE: / Y-NUMBER OF IDEAL HOLE: Defines zero distortion reference position. By default the centre of the grid, but the defined grid position must not be a missing peak44.

These values are used to define initial values for the spatial distortion at each peak position. (The distortion is defined as the ideal position minus the measured position.) (The distortion values can be changed using the RE-CALCULATE DISTORTION command.)

It is strongly recommended to use the DISPLAY DISTORTION command to verify that the peak searching has produced reasonable results prior to further processing.

Here is an example of the program dialogue:

Calibration sub-menu: ENTER COMMAND [FIND PEAKS]: 
MAXIMUM PEAK SEARCH DISTANCE (PIXELS) (Range: 1 to 100) [3]:4
PEAK DETECTION RATIO (Range: 0.0 to .99000) [.10000]:.2
PEAK STANDARD DEVIATION WIDTH (Range: 0.0 to 1.000E+05)
 [1.30000]:2.63
NUMBER OF SUB-PIXELS (Range: 1 to 100) [9]:3
INFO: Starting peaks found O.K.
INFO: Starting peak is at position    474.83334   453.16669
INFO: Next first grid axis peak is at position    508.50000   453.50000
INFO: Next second grid axis peak is at position    475.50000   487.16669
PROGRESS REPORT FREQUENCY (PEAKS) (Range: 1 to 100000) [400]:100
 
INFO: Starting peak search, this takes some time for big grids
INFO: Found    100  peaks
INFO: Found    200  peaks
INFO: Found    300  peaks
INFO: Found    400  peaks
INFO: Found    500  peaks
INFO: Found    600  peaks
INFO: Number of peaks found =    682
INFO: Number of grid peaks (X/Y) =     28    27 (     756)
INFO: Time taken =    14.     seconds
GRID SPACING (CENTRE TO CENTRE IN microns)
 (Range: 1.00000 to 1.000E+06) [2000.00]:5000
INFO: Average pixel size in X-direction =     131.0585 +-   2.5767 microns
INFO: Average pixel size in Y-direction =     130.6994 +-   3.4362 microns
INFO: Overall average pixel size =     130.8787 +-     3.0057 microns
INFO: RMS pixel size in X-direction =     128.3574
INFO: RMS pixel size in Y-direction =     128.3764
INFO: Average rotation based on rows =     -.324837 +-    .4656 degrees
INFO: Average rotation based on columns =     -.841206 +-    .6721 degrees
INFO: Average rotation (both rows and columns) =
INFO:     -.583021 +-      .6277 degrees
IDEAL X-PIXEL SIZE (MICRONS) (Range: 1.000E-04 to 1.000E+06)
 [128.357]: 
IDEAL Y-PIXEL SIZE (MICRONS) (Range: 1.000E-04 to 1.000E+06)
 [128.376]: 
GRID ROTATION ANGLE (DEGREES)
 (Range: -360.0000000 to 360.0000000) [-.583021399]: 
X-NUMBER OF IDEAL HOLE (Range: 1 to 28) [14]: 
Y-NUMBER OF IDEAL HOLE (Range: 1 to 27) [14]:


 FIT GRID PEAKS

Once peak positions have been found and values of the spatial distortions in the X and Y directions have been calculated, the distortion may be fitted by an interpolating function which will allow the value of spatial distortion to be estimated throughout the ROI region. At present two 2-D bi-cubic spline functions are fitted to the measured distortions. The spline functions are defined on an irregular grid of knot points. It should be noted that whilst the holes are defined in a regular grid, their measured positions will no longer be on a grid. (By defining the interpolating function on a grid it will be much more efficient to correct data.)

FIT ACCURACY: The user is prompted for the accuracy with which the spline functions should fit the measured positions. This is the required RMS discrepancy between the measured positions and the value of the interpolating spline. This would ideally be equal to the RMS error in peak positions. Typically a starting value of 0.1 pixels is useful. (If the value is too small the spline will fit the noise.)

The routine will find the minimum number of spline knots necessary to achieve the required fit, i.e. the larger the value of the FIT ACCURACY, the smoother the function. The number of knot points used to produce the spline is output. It is recommended to keep this number to a maximum of about half the number of grid peaks in each direction. By keeping the number of knot points relatively low the function is kept smooth, and more importantly is better constrained by the data. (If the number of knot points is equal to the number of data points the cubic functions may well oscillate wildly in-between the measured positions.)45


 FLAT-FIELD CORRECTION

(Note: You should subtract off any dark current, or other non-signal related background prior to this operation. Spatial distortion correction may also be needed prior to this operation, since a flat uniform pixel size image is assumed.)

Ideally an isotropic source would be used to produce a ``flat-field'' image which could then be used to correct any non-uniformity in detector response simply by dividing by a normalised version. In practice such isotropic sources are unavailable [9,32,35]. At present this option corrects an input ``flood-field'' image to a ``flat-field'' by inputing a 1-D scan of the source profile from a scintillation counter on a two theta arm or similar experimental set-up [9].

First the user must have an appropriate ASCII file containing the 2$\theta$ scan information. The file is read-in in a free format, so the data can be in any vertical column. The scan may have been obtained using the spec ascan, dscan, or other methods at other facilities. Prior to input the scan it may need to be edited to remove undesirable data points. As the data points are to be fitted by a polynomial it is important to remove ``erroneous'' data points such as those from behind any beam-stop46.

The program prompts for the file name:

Enter name of file containing 1-D 2-theta scan of source
FILE NAME [fe_2.scan]:

A sample of the start of the file is output to help the user chose the correct columns for input of the angular and intensity data:

Sample of start of the input file:
 -30.0000    39689        0          0
 -28.0000    40200        0          0
 -26.0000    40682        0          0
 -24.0000    40892        0          0
 -22.0000    40914        0          0
 -20.0000    40569        0          0

A variety of questions allow the user to specify the starting line, and character position for the data, and which columns of data to use for X-coordinates (angle) and the Y-coordinates (intensity). By entering 0 for the number of coordinates to be input the program automatically inputs as many coordinates as possible. Alternatively the number of coordinates to input may be specified.

TYPE OF DATA FORMAT [VERTICAL COLUMNS]: 
NUMBER OF LINES TO IGNORE (Range: 0 to 1000) [0]: 
NUMBER OF CHARACTERS TO IGNORE (Range: 0 to 255) [0]: 
NUMBER OF COORDINATES (Range: 0 to 300) [0]: 
Columns of numbers for data-set  1
COLUMN NUMBER FOR X-COORDINATES (Range: 0 to 80) [1]: 
COLUMN NUMBER FOR Y-COORDINATES (Range: 1 to 80) [2]: 
INFO:   31 X/Y coordinates per data-set have been found

The intensity values may be corrected for detector dead-time assuming the dead-time is non-paralysable i.e. an event arriving during a dead-time period does not increase the length of the dead-time period [18]. To correct for dead-time the user must enter the count time (integration time) per data value in the 2$\theta$ scan. (This is used to calculate the count rate per second from the values input in the scan file, which should be raw total counts.) The user must also enter the detector dead time for a single event. Note: Some ``intelligent'' detectors may already take account of dead-time; if this is the case the dead-time correction should be ``turned-off'' by entering a value of 0.0 seconds.

For details on methods on calibrating the detector dead-time see [18].

COUNT TIME PER DATA POINT (SECONDS)
 (Range: 0.0 to 1.000E+06) [10.0000]:
EVENT DEAD TIME (SECONDS) (Range: 0.0 to .10000) [1.000E-06]:1e-5

The original data values are corrected for the dead-time, and will be replaced by higher values (unless 0.0 dead-time was entered).

Note: The input dead-time, and the input count time per data point places a maximum limit on the possible counts in a data point. If a value in the scan exceeds this value, an error message will be output and that value will not be corrected. However, this almost certainly means that all the other values are incorrect. Presumably, either the estimate of the dead-time is incorrect, or the counting time has been entered incorrectly.

The scan data is fitted with a number of different polynomials of different orders, and displays the order and residual value for each polynomial fit order.

Order =   0 residual =  6.82410E+02
Order =   1 residual =  6.94029E+02

$\dots$

Order =  28 residual =  1.51192E+02
Order =  29 residual =  8.70165E+01

The user must choose the order required. The order with the lowest residual (adjusted for number of parameters) is given as a default. However, this is often too high a value. To help decide the fit or the chosen order is displayed graphically each time a different order is entered (e.g. Figure 44, Page [*]).

ORDER OF POLYNOMIAL (Range: 0 to 29) [30]:10
ACCEPT FIT ("NO" TO TRY ANOTHER ORDER) [NO]: 
ORDER OF POLYNOMIAL (Range: 0 to 29) [10]:3
ACCEPT FIT ("NO" TO TRY ANOTHER ORDER) [NO]: 
ORDER OF POLYNOMIAL (Range: 0 to 29) [3]:2
ACCEPT FIT ("NO" TO TRY ANOTHER ORDER) [NO]:yes

Figure 44: FLAT-FIELD CORRECTION Graphics Output
\includegraphics[height=120mm]{fit2d_scan.ps}

The user should try to find a good fit to the data, but without unwanted oscillations, and be careful not to fit to the noise. When satisfied enter YES to the ACCEPT FIT prompt.

The centre of the ``flat-field'' image is specified together with the sample to detector distance and the pixel sizes in the X and the Y-directions47. The corresponding angle to the sample position to be calculated for each pixel in the image. If the ``flood-field'' image has been corrected for spatial distortion the pixel sizes are the corrected pixel sizes.

FLAT-FIELD CENTRE X-COORDINATE [621.500]:553
FLAT-FIELD CENTRE Y-COORDINATE [576.500]:567
SAMPLE: DETECTOR DISTANCE (METRES)
 (Range: 1.000E-04 to 1.000E+05) [.25000]:.21
PIXEL X-SIZE (MICRONS) (Range: 1.000E-03 to 10000.0)
 [0.0]:131.2
PIXEL Y-SIZE (MICRONS) (Range: 1.000E-03 to 10000.0)
 [0.0]:131.4

If significant on-axis absorption occurs there will be an addition correction necessary to account for the increased path length for off-axis positions. Thus, the user is prompted for the on-axis absorption fraction.

ON-AXIS ABSORPTION (FOR OFF-AXIS CORRECTION)
 (Range: 0.0 to 1.00000) [0.0]:?
Enter fractional absorption; to be used to calculate off-axis absorption
correction. If no off-axis correction is required enter 0.0. If
off-axis correction is required enter the on-axis axis absorption as a
fraction e.g. If the transmission is 80% enter 0.2 for the absorption.
ON-AXIS ABSORPTION (FOR OFF-AXIS CORRECTION)
 (Range: 0.0 to 1.00000) [0.0]:

The input ``flood-field'' data is corrected pixel by pixel for the source profile as a function of angle, $\frac{1}{r^2}$ intensity drop-off, and increased absorption as a function of increased path length with angle. The $\frac{1}{r^2}$ intensity drop-off correction needs to be applied because the 2$\theta$ scan is at a constant distance from the source, but the detector is (assumed to be) flat.

The output over-writes the original image.

It may be normalised (CDIVIDE) usually with a low value, thresholded (THRESHOLD), and perhaps smoothed (BLUR) prior to being used for flat-field correction.

As initially produced the resulting ``flat-field'' correction image should be used for pixel by pixel division (DIVIDE) to correct input data48. However, it may be preferred to store the reciprocal of the ``flat-field'' image using the RAISE TO A POWER command with -1 as the power, and to use pixel by pixel multiplication (MULTIPLE).

The following is an example of the use of the FLAT-FIELD CORRECTION command:

Calibration sub-menu: ENTER COMMAND [FIND PEAKS]:flat
Enter name of file containing 1-D 2-theta scan of source
FILE NAME [fe_2.scan]:Fe_2.scan
Sample of start of the input file:
 -30.0000    39689        0          0
 -28.0000    40200        0          0
 -26.0000    40682        0          0
 -24.0000    40892        0          0
 -22.0000    40914        0          0
 -20.0000    40569        0          0
TYPE OF DATA FORMAT [VERTICAL COLUMNS]: 
NUMBER OF LINES TO IGNORE (Range: 0 to 1000) [0]: 
NUMBER OF CHARACTERS TO IGNORE (Range: 0 to 255) [0]: 
NUMBER OF COORDINATES (Range: 0 to 300) [0]: 
Columns of numbers for data-set  1
COLUMN NUMBER FOR X-COORDINATES (Range: 0 to 80) [1]: 
COLUMN NUMBER FOR Y-COORDINATES (Range: 1 to 80) [2]: 
INFO:   31 X/Y coordinates per data-set have been found
COUNT TIME PER DATA POINT (SECONDS)
 (Range: 0.0 to 1.000E+06) [10.0000]: 5
EVENT DEAD TIME (SECONDS) (Range: 0.0 to .10000) [1.000E-06]:5.0e-5
Order =   0 residual =  6.82410E+02
Order =   1 residual =  6.94029E+02
Order =   2 residual =  1.99863E+02
Order =   3 residual =  2.03530E+02
Order =   4 residual =  2.05713E+02

$\dots$

Order =  26 residual =  1.38680E+02
Order =  27 residual =  1.31981E+02
Order =  28 residual =  1.51192E+02
Order =  29 residual =  8.70165E+01
ORDER OF POLYNOMIAL (Range: 0 to 29) [29]:10
ACCEPT FIT ("NO" TO TRY ANOTHER ORDER) [NO]: 
ORDER OF POLYNOMIAL (Range: 0 to 29) [10]:3
ACCEPT FIT ("NO" TO TRY ANOTHER ORDER) [NO]: 
ORDER OF POLYNOMIAL (Range: 0 to 29) [3]:2
ACCEPT FIT ("NO" TO TRY ANOTHER ORDER) [NO]:yes
FLAT-FIELD CENTRE X-COORDINATE [621.500]:553
FLAT-FIELD CENTRE Y-COORDINATE [576.500]:567
SAMPLE: DETECTOR DISTANCE (METRES)
 (Range: 1.000E-04 to 1.000E+05) [.25000]:.21
RAW PIXEL X-SIZE (MICRONS) (Range: 1.000E-03 to 10000.0)
 [0.0]:131.2
RAW PIXEL Y-SIZE (MICRONS) (Range: 1.000E-03 to 10000.0)
 [0.0]:131.4
ON-AXIS ABSORPTION (FOR OFF-AXIS CORRECTION)
 (Range: 0.0 to 1.00000) [0.0]:?
Enter fractional absorption; to be used to calculate off-axis absorption
correction. If no off-axis correction is required enter 0.0. If
off-axis correction is required enter the on-axis axis absorption as a
fraction e.g. If the transmission is 80% enter 0.2 for the absorption.
ON-AXIS ABSORPTION (FOR OFF-AXIS CORRECTION)
 (Range: 0.0 to 1.00000) [0.0]:


 HELP

On-line paged help text on available CALIBRATION sub-menu commands controlled by the ``pager'' (see Section 14.4, Page [*]).

 INPUT SPATIAL FUNCTION

Input previously stored fitted spatial distortion function. A fitted spatial distortion function may be recovered for correction of data.

 INVERSE DISTORTED/IDEAL

INVERSE DISTORTED/IDEAL command inverses the definition of the spatial distortion function. By default the spatial distortion is defined from the distorted grid to an ideal grid, with position referring to the distorted grid position. This command toggles the definition, so that after one command the definition is from an ideal grid to a distorted grid, with position referring to ideal grid position. Using the command twice (or any even number of times) returns to the default definition of the distortion function. When a fitted spline is output an extra line is output for splines which are defined from an ideal grid.

This option is necessary to be able to define a distortion mapping for a program such as MADNES 49 which predicts positions on an ideal grid and then apply a distortion value to give the corresponding position on the distorted grid (see Section 16.7, Page [*]).

 LEARN HOLE PROFILE

After FIND PEAKS has been used to find the centres of grid peaks LEARN HOLE PROFILE may be used to calculate an average hole profile from the found peaks at sub-pixel resolution. The user prompts for the level of the sub-pixel resolution required. The output is in the memory.

 LINEARISE INTENSITIES

LINEARISE INTENSITIES allows the ROI intensities to be corrected for intensity non-linearity, provided that an ASCII file is available which contains measurements of raw intensities together with the estimated true linear intensities. (It is beyond the scope of this manual to describe the problems and pitfalls of trying to obtain adequate intensity linearity calibration measurements [9])50. At present the data is read-in using a ``free format'' routine which allows different columns to be selected for the raw and the linearised intensities. Thus the data must be in a column format, but the order or number of columns is not important.

The intensity information is converted to a Log(10) raw intensity scale, and the ratio between the linearised intensity and the raw intensity is calculated. This modified data is fitted by a variety of orders of Chebyshev polynomials. The residual fit statistic for each order is output, and the user is invited to choose a polynomial fit order. The modified data points are displayed together with the fitted polynomial. The user can choose to accept the polynomial order and correct the data, or try a different order of polynomial. Thus, an order which adequately fits the data, but does not exhibit unwanted oscillations between data points can be selected.

The selected polynomial is used to interpolate between the measured data points when correcting the data. All data values within the range of the defined polynomial (between the minimum and maximum raw intensities in the raw/linearised intensity file) are replaced by the interpolated linearised values. Values outside the range are treated as if the non-linearity function continues outside the range, but is then linear, but offset from the end points. Raw image intensities are replaced in-place by the linearised intensities.

As an example of a non-linearity correction, Figure 45 (Page [*]) shows a polynomial fit to data which was produced from a series of linearity calibration tests on an image plate scanner. The program dialogue which produced this graphic and the correction follows:

Figure 45: LINEARISE INTENSITIES Graphics Output

\includegraphics[height=120mm]{fit2d_linearity.ps}

Main menu: ENTER COMMAND [INPUT DATA]:calibration
Calibration sub-menu: enter command [FIND PEAKS]:linearise
INFO: To linearise the data it is necessary to give the name of a file
      which contains values of the raw intensity values together with
      corresponding values on the required (linearised) scale. The raw
      intensity values correspond the X-coordinates and the corresponding
      linearised intensities the Y-coordinates.
Enter name of file containing non-linear and linear intensities values
FILE NAME [source.scan]:linear.dat
Sample of start of the input file:
      56595.5      52929.5
      100770.      105859.
      56674.8      52929.5
      27886.5      26464.8
      56482.0      52929.5
      81965.5      79394.3
TYPE OF DATA FORMAT [VERTICAL COLUMNS]: 
NUMBER OF LINES TO IGNORE (Range: 0 to 1000) [0]: 
NUMBER OF CHARACTERS TO IGNORE (Range: 0 to 255) [0]: 
NUMBER OF COORDINATES (Range: 0 to 500) [0]: 
Columns of numbers for data-set  1
COLUMN NUMBER FOR X-COORDINATES (Range: 0 to 80) [1]: 
COLUMN NUMBER FOR Y-COORDINATES (Range: 1 to 80) [2]: 
INFO:   96 X/Y coordinates per data-set have been found
Order =   0 residual =  4.15320E-02
Order =   1 residual =  2.45350E-02
Order =   2 residual =  2.25695E-02
Order =   3 residual =  2.12051E-02

(Here some program output has been omitted.)

Order =  28 residual =  3.45833E-03
Order =  29 residual =  3.43466E-03
Order =  30 residual =  3.43787E-03
ORDER OF POLYNOMIAL (Range: 0 to 30) [31]:7
ACCEPT FIT ("NO" TO TRY ANOTHER ORDER) [NO]: 
ORDER OF POLYNOMIAL (Range: 0 to 30) [10]:11
ACCEPT FIT ("NO" TO TRY ANOTHER ORDER) [NO]:y
Calibration sub-menu: ENTER COMMAND [EXIT]:

 LOAD LOOK-UP TABLE

Input a distortion correction look-up table from a disk file. The file must previously have been created using the STORE LOOK-UP TABLE command.

 LOOK-UP TABLE (SPATIAL DISTORTION)

Create a distortion correction look-up table internally from an interpolated spline. Once created this is a much faster way of correcting for spatial distortion, but the internal look-up table is very large so a large amount of computer RAM must be available to FIT2D.

 OUTPUT SPATIAL FUNCTION

Output fitted spatial distortion function to an ASCII file. A fitted spatial distortion function may be input later for correction of data.

 PLATYPUS CORRECTION FILE

This option allows a calibration file to be created in the correct format for the program PLATYPUS [27]51. PLATYPUS needs a 2-D grid of true positions in millimetres corresponding to regularly spaced pixel positions from a Molecular Dynamics imaging plate scan. The calibration file corresponds to a full A3 image plate even if only an A4 scan was performed.

Because FIT2D works with the data looking from the opposite side of the detector (from the sample) as does PLATYPUS, and because FIT2D works with the data going from bottom to top which is the opposite way round to PLATYPUS52, it is necessary to FLIP the full data in both directions prior to the FIND PEAKS, FIT GRID PEAKS, and PLATYPUS CORRECTION FILE commands.

Having fitted a calibration grid image to define the spatial distortion, or after using INPUT SPATIAL FUNCTION to recover a previously calculated spatial distortion function, you may use the PLATYPUS CORRECTION FILE command to produce a calibration file. You will be prompted with a warning explaining the present need to have reversed the image using the FLIP command twice. You must reply ``YES'', that you understand the requirements to continue producing the file.

FIT2D needs to know where the scan was started using the Molecular Dynamics coordinate system. This system which is used on the controlling PC starts at A1 and each letter or number increment represents 2cm squares. The letters refer to the laser scanning direction and the numbers to the mechanical scan direction. e.g. At the ESRF presently an A4 scan starts at coordinate E5. This may not be the same for other scanners. e.g. The High Pressure group at Daresbury uses A4 plates in a different orientation.

The next input is the name if the output file for the calibration correction.

Below is an example of a log showing the creation of a file called calib.pos for an ESRF A4 image plate scan.

Calibration sub-menu: ENTER COMMAND [SPATIAL CORRECTION]:platy
 
IMPORTANT NOTE: The image MUST have been flipped in both
		directions using the "FLIP" command.
 
LIMITATIONS O.K. [NO]:y
MD STARTING COORDINATE [E5]:E5
PLATYPUS CALIBRATION FILE NAME [calib.pos]: 
Calibration sub-menu: ENTER COMMAND [EXIT]:

 QUIT

Same as EXIT

 RE-CALCULATE DISTORTION

FIND PEAKS calculates initial values of the distortion. The distortion values may be re-calculated using RE-CALCULATE DISTORTION without needing to perform the peak search again. (See FIND PEAKS for explanation of user prompts.)


 RESIDUALS OF FIT

Calculates in the ``memory'' the residuals between the fitted spline function and the measured peak positions for each peak position, for either the X or the Y-distortion values. Missing peaks are given a zero residual.

 SAVE PEAKS

The user may save the measured peak positions and calculated distortion values to an ASCII file. This can then be used for display by graph plotting programs e.g. CHIPLOT, or as entry to a spread-sheet program for further calculation of average pixel sizes, grid rotation, etc.

 SIZE (IMAGE DISPLAY)

By default the FIND PEAKS option displays a 200$\times$200 central region of pixels, for the user to select peaks for the start of the peak search. (This number is compromise between having sufficient detail to be able easily to click on the peaks, and having enough peaks displayed.) If owing to a large beam-stop or another reason the default is not suitable it may be changed with the SIZE (IMAGE DISPLAY) command.

The user is prompted for the number of pixels (maximum) in each dimension to be displayed graphically for entry of the initial grid peaks.

 SPATIAL CORRECTION

Once a spatial distortion interpolation function has been calculated, or a previously calculated function has been input, data may be corrected for spatial distortion. The correction is applied throughout the ROI, so REGION or IMAGE should be used to select the required ROI prior to entering the calibration sub-menu.

The user is prompted for an OVER-LOADED PIXEL VALUE. This value allows over-loaded pixels intensity not to be distributed below the overload value. Any pixel intensities above the input limit will be added to all the over-lapped output pixels, rather than the intensity being distributed proportional amongst the covered pixels. This means that the output pixels will have at least the overload value so may be easily found and ignored in later processing. A very large value may be entered to turn-off this facility.

OVER-LOADED PIXEL VALUE (Range: 0.0 to 1.700E+38) [16382.5]:

Next the user must enter the number of rows of the distortion function which will be calculated in a block. The value will not affect the results, but too large a value will require a lot of memory, which may cause problems. To small a number will cause the correction to take longer. The default value should be about right, but every different machine will have a different optimum value depending on the usage and availability of memory.

NUMBER OF ROWS OF DISTORTION FUNCTIONS TO CALCULATED IN A BLOCK
 (Range: 2 to 501) [25]:

The input pixels are re-binned to output pixels in the memory data image, taking into account the spatial distortion as defined from the interpolating function at the edges of each pixel. The spatially corrected input pixels are assumed to be rectangular on the output grid. The intensity in each input pixel is distributed between one or more output pixels in proportion to the covered area [30].

Owing to the spatial distortion, in general, the size of each input pixel is different. Thus, a uniform input image will not be uniform on output. (By recording the fraction of input pixels added to each output pixel, this non-uniformity could be corrected in the software, but this is not presently the case. It is felt that it is better to correct spatially a flat-field image and use the spatially corrected flat-field image to correct for non-uniformity.)

The corrected image is in the memory at the end of the operation.

Users are kindly asked to cite A P Hammersley, S O Svensson, and A Thompson, ``Calibration and correction of spatial distortions in 2D detector systems'', Nucl. Instr. Meth., A346, 312-321, 1994 and generally to acknowledge the use of FIT2D for data corrected by this method.

Here is an example of the program output produced by the SPATIAL CORRECTION command:

Calibration sub-menu: ENTER COMMAND [SPATIAL CORRECTION]: 
INFO: The corrected pixel dimension in X is     128.4577 microns
INFO: The corrected pixel dimension in Y is     128.4577 microns
 
OVER-LOADED PIXEL VALUE (Range: 0.0 to 1.700E+38) [16382.5]:?
In order to avoid over-loaded pixels being re-binned and their intensity
spread out to an undetermined value, you can enter a "over-loaded" pixel
value. All input pixels which have this value or more, will cause one or 
more output pixels to be incremented by the value regardless of the normal
proportional are re-binning algorithm. Thus over-loaded pixels in the
output image can be easily identified and ignored.
(This can be turned-off by entering a very large value.)
OVER-LOADED PIXEL VALUE (Range: 0.0 to 1.700E+38) [16382.5]: 
NUMBER OF ROWS OF DISTORTION FUNCTIONS TO CALCULATED IN A BLOCK
 (Range: 2 to 501) [25]: 
INFO: Starting to correct data for spatial distortion
WARNING: One input pixel is trying to be binned into more than three
	 output pixels in the X-direction (Pixel    1,    1)
INFO: Number of rows re-binned =    300 ( 60%)
INFO: Time for re-binning =         4.42 seconds
WARNING:          1 input pixels have been ignored, because they require
	 re-binning into more than three output pixels (X-direction).

 STORE LOOK-UP TABLE

Save a distortion correction look-up table in a named disk file. The internal look-up table must previously have been created using the LOOK-UP TABLE (SPATIAL DISTORTION) command.

The LOAD LOOK-UP TABLE command can be used to recover a previously stored look-up table.

 TRANSFER DISTORTION

The distortion values for either the X or Y-directions may be transferred to the memory through the TRANSFER DISTORTION command. The user is prompted for X-DISTORTION. Enter ``YES'' to save the X-distortion values in the memory or ``NO'' in order to save the Y-distortion values. (Missing peaks are given a zero value for distortion.) By exiting the CALIBRATION sub-menu and using the EXCHANGE command, the distortion values may be processed (e.g. STATISTICS), stored in an output file, etc.

 VIEW PEAKS

This command allows the measured positions and calculated distortion values of individual peaks, and rows and columns of peaks, to be output to the screen.

(Hint: Use the OPEN LOG command in the main menu to save all screen text to an ASCII output file. The output values from rows and columns of peaks may subsequently be displayed using CHIPLOT or a spread-sheet program.)

 XRII FLAT-FIELD

WARNING: This option is under development and should be presently assumed not to work. The aim is calculate the theoretical flat-field response of the ESRF X-ray Image Intensifier for an arbitrary source position according to a simple model. This model will only be an approximation for the true detector so the theoretical correction will only ever be approximately correct.


next up previous contents index
Next:  Spatial Distortion Correction in Up: Calibration Sub-menu Previous: Notes on the Data
Andrew Hammersley
2004-01-09