CHAPTER 5 - THE 'DISPLAY/MEASURE IMAGE' OPTION

5.1 INTRODUCTION

This option enables a film or image-plate image to be displayed with options for inputting or determining the image centre, calculating a background image and measuring spot positions.

Figure 5.1 Example of an Image Display (Lysozyme)

A predicted Laue pattern, based on the current parameters, may also be displayed superimposed on the image. The <Display/Measure Image> option is available from the processing menu and during parameter refinement as well as from the main menu.

When the option is selected, the following menu is displayed:

  <Measure Image>
  <Show Predicted Pattern>
  <X-distortion Image>
  <Y-distortion Image>
  <Re-display Normal Image>

<Return to Previous Menu>

The program first checks that at least one pack has has been defined; if it has not, a pop-up error notice will be displayed and the program will return to the previous menu when its 'continue' box has been selected (e.g. the main menu if the option was called from that menu). A film/plate centre for spot position determination is determined from the position of the fiducials or from the defined centre position. The image is read in at this stage if this has not already been done and the image is then displayed in an image view-object. The centre position is marked on the displayed image.

The options which may be selected from the menu are described in detail in the next sections.

List of sections:

Measure Image
Show Predicted Pattern
X-Distortion Image
Y-Distortion Image
Re-Display Normal Image
Spot Input Parameter Table

5.2 MEASURE IMAGE

5.2.1 Introduction

When this option is selected any spots currently in the input spots list are marked on the image display and another menu is displayed:

  <Cursor in Centre>
  <Find Conics Centre>
  <Gnomonic Centre>
  <Reset x_cen_f, y_cen_f>
  <Input Spot Positions>
  <Read Spots File>
  <Write Spots File>
  <Clear Spots List>
  <Get Background Image>

<Measurement Complete>

The first four options are concerned with the measurement of the centre position of the image, options five to eight with the measurement of spot positions and option nine with the calculation of a background image. When the required measurements have been performed, the user returns to the previous menu by selecting the <Measurement Complete> option. If the current film/plate is not the same as the last one measured then the spot positions list will start clear.

The measurement options are described in the following sections.

List of subsections in this section:

Cursor In Centre
Find Conics Centre
Gnomonic Centre
Reset x_cen_f, y_cen_f
Input Spot Positions
Read Spots File
Write Spots File
Clear Spots List
Get Background Image

5.2.2 Cursor In Centre

The symbol for the current spot measurements centre position is cleared from the display. The message 'Input Centre Position' is output to the active strip area of the image view-object and the user moves the cursor to the required centre position (on the main image or on the magnifying window) and clicks Button1 of the mouse to input that position. The new centre position is marked by a symbol on the display. A pop-up notice asks the user whether the x_cen_f and y_cen_f centre position parameters are to be updated and the x_c and y_c camera constants reset to zero. If the answer is yes then the parameter values will be changed for the current pack and plate and also, if appropriate, for other packs and plates (see Chapter 1 and Appendix 1 ). If the answer is no then the new centre centre position is only used for the measurement of spot positions; x_cen_f, y_cen_f, x_c and y_c may be updated at a later stage using the <Reset x_cen_f, y_cen_f> option if required.

5.2.3 Find Conics Centre

This option enables the determination of a Laue diffraction pattern centre from the intersection of three or more zone conics. At least five spot positions from each conic must be input by the user.

When the option is selected, all current symbols are cleared from the display. Spot input parameters are then set in parameter table 3 (section 5.7) .

The following menu is then displayed:

  <Calculate Conic>
  <Calculate Centre>
  <Redo Current Conic>

<Abort Centre Calculation>

The message 'Input Conic 1' is displayed in the image active strip area. Spot positions should then be input for the first conic (Error notices will be displayed if there are any problems encountered when trying to determine a spot position). When at least five spot positions have been input (move cursor to spot position (on the main image or on the magnifying window) and click Button1 of the mouse), the conic may be calculated by selecting the <Calculate Conic> menu option.The program will then fit a conic to the measured spots using a least squares procedure;if a singular matrix is found, an error message will be output; the user may then choose to input more spots for the current conic or to remove that conic. The process is then repeated for further conics. After at least three conics have been determined, the position of the centre of the Laue pattern may be calculated as the point of intersection of the conics by selecting the <Calculate Centre> option. The program uses the image mid point as an estimate of the centre and refines the position using the Powell minimisation routine from the Laue library. The determined centre position is output and the user is given the choice of accepting or not accepting the result.

If, during the input of spot positions of a conic, the user wishes to clear the spot selection for that conic, the the <Redo Current Conic> option may be selected; the user may then repeat the input for the same or for an alternative conic.

When finding the conics centre, warning messages will be output if the current program limits, for the number of conics and spots per conic, are exceeded.

If the new centre position has been accepted then a pop-up notice asks the user whether the x_cen_f and y_cen_f centre position parameters are to be updated and the x_c and y_c camera constants reset to zero. If the answer is yes then the parameter values will be changed for the current pack and plate and also, if appropriate, for other packs and plates (see Chapter 1 and Appendix 1 ). If the answer is no then the new centre centre position is only used for the measurement of spot positions; x_cen_f, y_cen_f, x_c and y_c may be updated at a later stage using the <Reset x_cen_f, y_cen_f> option if required.

5.2.4 Gnomonic Centre

This option enables the determination of a Laue diffraction pattern centre by using the fact that, in gnomonic projection, the zone conics transform into straight lines. If an incorrect centre is used in the transformation, the lines become bent; thus by minimising the distance (in gnomonic projection) of a spot somewhere in the middle of the conic from the line joining two spots near two 'ends' of the conic a centre position can be refined. To get a good centre, several conics passing through the centre and surrounding the centre should be used. The program requires a minimum of three such conics to be defined. Three spots are selected for each conic; the first should be near the centre, the second about halfway round the conic and the third where the conic nears the centre again.

When the option is selected, all current symbols are cleared from the display. Spot input parameters are then set in parameter table 3 (section 5.7) . details).

The following menu is then displayed:

  <Redo Current Conic>
  <Calculate Centre>

<Abort Centre Calculation>

Messages in the image active strip area indicate which spot is to be input e.g. 'Input Conic 1 start spot', 'Input Conic 1 middle spot', 'Input Conic 1 end spot' etc. (Error notices will be displayed if there are any problems encountered when trying to determine a spot position). After the sets of three spots for at least three conics have been determined, the position of the centre of the Laue pattern may be calculated by selecting the <Calculate Centre> option. The program uses the image mid point as an estimate of the centre and refines the position using the Powell minimisation routine from the Laue library. The determined centre position is output and the user is given the choice of accepting or not accepting the result.

If, during the input of spot positions of a conic, the user wishes to clear the spot selection for that conic, the the <Redo Current Conic> option may be selected; the user may then repeat the input for the same or for an alternative conic.

When finding the gnomonic centre, warning messages will be output if the current program limit, for the number of conics, is exceeded.

If the new centre position has been accepted then a pop-up notice asks the user whether the x_cen_f and y_cen_f centre position parameters are to be updated and the x_c and y_c camera constants reset to zero. If the answer is yes then the parameter values will be changed for the current pack and plate and also, if appropriate, for other packs and plates (see Chapter 1 and Appendix 1 ). If the answer is no then the new centre centre position is only used for the measurement of spot positions; x_cen_f, y_cen_f, x_c and y_c may be updated at a later stage using the <Reset x_cen_f, y_cen_f> option if required.

5.2.5 Reset x_cen_f, y_cen_f

If this option is selected, then the currently displayed centre position for spot positions determination will be used to update the x_cen_f and y_cen_f parameters and will also set the x_c and y_c parameters to zero. The parameter values will be changed for the current pack and plate and also, if appropriate, for other packs and plates (see Chapter 1 and Appendix 1 ).

5.2.6 Input Spot Positions

Spot input parameters are set in parameter table 3 (section 5.7) .

The following menu is then displayed:

  <Add Spots>
  <Delete Spots>

<End Spots Input>

When the <Input Spot Positions> menu item is selected, the program is in 'Add Spots' mode and the message 'Input Spot Positions' is displayed in the active strip of the image view-object. Any spots currently in the spots list will be marked by red crosses on the image display. New spot positions are input by moving the cursor to the required spot position on the image display (on the main image or on the magnifying window) and clicking Button1 of the mouse. When a spot position is selected, it will be marked by a red cross on the display. A warning message will be output when the program's spot list is full. Error notices will be displayed if there are any problems encountered when trying to determine a spot position. To delete spots, select the <Delete Spots> menu item, move the cursor to the symbol of the spot to be deleted (again on the main image or on the magnifying window) and click Button1 of the mouse. (The selected spot nearest to the cursor will be deleted provided that the distance squared from the cursor to symbol on the main image display area does not exceed 18). To input further spot positions, select the <Add Spots> item from the menu.

When all the required spots have been input, select the <End Spots Input> menu item.

Note that the spots input list is cleared either when a new film/image-plate pack is input or when the film/plate number has been changed since the previous <Measure Image> menu item selection or when it is cleared explicitly (see below) .

5.2.7 Read Spots File

This option is used to read in spot positions from a file. If there are already spots in the current spots list then the user is given the choice of adding the spots from the read in file to those currently in the list or of overwriting the current spots. Again the user is given the choice of whether or not to use the measured centre from the file to replace the current spot positions centre; if not the current spot positions centre is used.

The user is then prompted for the spots file name as follows:

File name (default ext=.spots):

The user replies with the name of the required spot positions input file; if no file extension is given an extension of .spots is assumed. A blank reply will cancel the request. The program checks that the file exists and can be opened; if there is an error, an error message will be output and the prompt will be repeated.
The file will then be read; if it does not start with the keyword 'spots:' an error message will be output and the file name prompt will be repeated. The spot positions will then be read with any invalid records being flagged. A warning message will be output if the program's spot list becomes full. When the file has been read, the number of spots added to the spots list will be shown (and the number of input errors if there were any).

Symbols will be drawn on the film image for the centre position and for all the spots currently in the spots list.

5.2.8 Write Spots File

This option is used to write the current list of spot positions to a file. If there are no spots in the current spot positions list, an error notice will be displayed and the option abandoned. Otherwise the following prompt is output:
File name (default ext=.spots):

The user replies with the name of the required output spots file; if no file extension is given an extension of .spots will be added. A blank reply will cancel the request. The program checks that the file does not already exist and that it can be opened; if there is an error, an error message will be output window and the prompt will be repeated. If the file already exists, the user is given the option of overwriting the file or selecting an alternative file name.
The spots input centre position and the spot positions are then written to the requested file.

5.2.9 Clear Spots List

When this option is selected, the current spot positions list is cleared.

5.2.10 Get Background Image

This option is used to calculate a new background image for the current film/plate. When the option is selected the following menu is displayed:
  <2-D Search>
  <Radial X Strip>
  <Radial Y Strip>

<Return to Previous Menu>

This enables one of three background image calculation methods to be invoked. When a background image has been calculated, it will remain in use until another plate is selected.
  1. 2-D Search

    This background image calculation is for single crystal X-ray diffraction images (i.e. one with spots over a fairly slowly changing background. The method calculates the background at a pixel by taking the average of the lowest pixel values in a box surrounding the pixel such that the number of such values is a requested percentage of the total number of pixels in the box. To optimise the calculation, the box is 'walked' through the image moving a pixel at a time starting at the top left. It then repeats the process of moving from to bottom, then one pixel to the right, then from bottom to top, and then one pixel to the right until the film image has been covered. The calculation is done on the compressed image as displayed in the image view-object.

    When the option is selected the following prompt/reply sequence is entered:

    Box size (compressed pixels - odd) [11]:

    The reply is the required size of the square box to be used in calculating the background value at each pixel position. The size is in pixels for the compressed image. The

    Percentage of background pixels [50]:

    The reply is the percentage of the pixels within the box which are to be used in calculating the background value for the current pixel.

    Messages will be output when the background calculation is started and when it is completed. An error message will be output if the selected box size is too large for the displayed image and the calculation will be abandoned.

    An example of such a background image (for a Proflavin film) is shown in the figure at the end of Appendix 8 .

  2. Radial X Strip

    This background image calculation is for single crystal X-ray diffraction images (i.e. one with spots over a fairly slowly changing background. The method calculates the background at a pixel by taking the average of the lowest pixel values in a box surrounding the pixel such that the number of such values is a requested percentage of the total number of pixels in the box. The background values are found for a horizontal (along 'xd') strip of pixels running through the centre of the image and the values from the two halves of the strip are averaged to give a radially averaged background function from which a background image is calculated. The calculation is done on the compressed image as displayed in the image view-object.

    When the option is selected the following prompt/reply sequence is entered:

    Strip width (compressed pixels - odd) [21]:

    The reply is the required width ('yd' direction) of the strip (and box size) to be used in calculating the radial background function. The size is in pixels for the compressed image.

    Percentage of background pixels [50]:

    The reply is the percentage of the pixels within the box which are to be used in calculating a background value.

    Messages will be output when the background calculation is started and when it is completed. An error message will be output if the selected box size is too large for the displayed image or if the program is unable to allocate some extra temporary memory that it requires and the calculation will be abandoned.

  3. Radial Y Strip This is analogous to the 'Radial X Strip' option except that the strip taken is in the vertical direction (along 'yd') instead of the horizontal direction.

5.3 SHOW PREDICTED PATTERN

5.3.1 Introduction

This option enables a predicted Laue pattern based on the current parameters in parameter tables 1 and 2 to be overlaid on the displayed image. The program first generates the predicted pattern (if this has not already been done for the current parameter values) and determines the film/plate centre position. Normally all predicted reflections will be displayed by default; however there is a program limit on the number of predicted reflections which may be displayed on an image and if this is exceeded selected nodals will be displayed instead; in this latter case a prompt will request the user input of a nodal selection index (see description of the <Display Nodals Only> option).

When a pattern is displayed, all current corrections, such as centre offsets and distortion parameters, will be applied to the get the predicted spot positions.

The following menu will then be displayed allowing the user to change the selection of predicted reflections to be displayed:

  <Display All Predicted>
  <Display Nodals Only>

<Return to Previous Menu>

The options are described in the following sections.

List of subsections in this section:

Display All Predicted
Display Nodals Only

5.3.2 Display All Predicted

When this option is selected all predicted reflections will be displayed provided that the number does not exceed the program maximum for the number of predicted reflections which may be displayed on an image. If this number is exceeded an error notice will be displayed and the option will be abandoned.

Nodal spots will be shown as blue crosses and non-nodal spots as green crosses. (See also Appendix 9 )

5.3.3 Display Nodals Only

The program will calculate the nodal reflections (up to a program maximum nodal index - see Appendix 9 ) and output a histogram showing the number of nodal reflections as a function of nodal index. The following prompt is then output:
Nodal spot selection index [4]:

The reply is the required index for the selection of the nodal spots to be displayed. An error message will be output and the prompt repeated if the given value is outside the allowed range. If the number of spots is greater than the program limit for the number of possible spots to be used in a refinement, then the selected spots list will be truncated and a warning notice displayed.
The selected nodal reflection positions will be overlaid on the displayed image as blue crosses.

5.4 X-DISTORTION IMAGE

If this option is requested, an image is created showing the x-distortion at each point of the image calculated using the current values of the distortion parameters. The image is compressed as for the normal image display in the main image display area. The pixel values represent the distortion in units of 1/100 rasters e.g. 500 is equivalent to 5 rasters. The user defined colour map is set so that there is a range of colours blue ... green ... yellow ... orange ... red going from low to high. Points outside the valid range for correction are shown with a pixel value of zero.

5.5 Y-DISTORTION IMAGE

This is the same as the previous option except that the y-distortion at each point of the image is shown.

5.6 RE-DISPLAY NORMAL IMAGE

After displaying a distortion image, selecting this option enables the normal image display to be shown again.

5.7 SPOT INPUT PARAMETER TABLE

When input spot positions are to be measured, the following parameters are output to parameter table 3:

  Spot method:
  Spot box (mm):
  Spot threshold:

The spot may be either 'c_of_g' to measure the spot centre of gravity within the specified spot measurement box (see also Appendix 10 ) or 'input' to use the cursored input position directly. The spot box size in mm defines the size of a box centred at the input cursor position and used when finding the spot centre of gravity position; when finding such a position only pixels whose intensities exceed the background value at the box centre position by the requested spot threshold value are considered. The spot box size retains its current value unless
  1. it is modified via this parameter table in one of the 'Display/measure image' options or in the 'Refine orientation' option 'match spots and refine' where it is called the 'match box' (see Chapter 9) .

    or

  2. when a new LDM parameter file is read; in this latter case the value is set to 1.0 mm which is also the program's initial value.

    or

  3. when the program parameter defaults are reset.
The spot threshold value is the same parameter as that given as the LDM parameter 'spot thresh' in parameter table 1 and the value in that parameter table will be updated if it is changed via parameter table 3 which provides the only means of update at this stage of the processing.



John W. Campbell
CCLRC Daresbury Laboratory
Last update 16 Jan 1998