GNOMCONV - CONVERT IMAGE TO GNOMONIC ==================================== INTRODUCTION The program GNOMCONV is used to read a film or image-plate (i2) image and convert it to its gnomonic projection image using the maximum pixel method outlined in section 9 below. The program was written by J.W. Campbell, Daresbury Laboratory. List of sections: Data Control Cards Input and Output Files Running the Program Notes Printer Output Error Messages Program Function References Examples DATA CONTROL CARDS The program may be run interactively and will use the following question and answer sequence. As an alternative, some or all the options may be specified via command line arguments and any information required and not given will be requested (see section 5. for details). Film (f) or image-plate (i) file [f]: The reply indicates the type of data file being accessed. This is either 'f' to indicate film or 'i' to indicate image-plate (i2) data. The default is film data. Name of input file: The reply is the name of the input film or image-plate data file to be converted. Name of output file: The reply is the name of the output film or image-plate data file to contain the gnomonic projection image. No. of x (slow) rasters, no. of y (fast) rasters [nx ny]: The reply gives the numbers of x-rasters and y-rasters in the input file. 'x' refers to the slower moving axis in the image file and 'y' refers to the faster moving axis. The default values are 2400, 2400 for film and 1200, 1200 for image-plate. Centre x, y in raster units [xcen ycen]: The reply is the position of the centre of the Laue pattern in the image in raster units. This must be accurate if a good gnomonic projection is to be obtained; the default mid point will, in general, not be sufficiently accurate. Crystal to film distance in raster units [ctof]: The reply is the crystal to film distance in raster units. Again, this must be accurate if a valid gnomonic projection is to be obtained. The default is set as a guide only to half the number of x-rasters in the image. Rmin value in raster units [rm]: The reply is the minimum radius, in raster units, to be used in calculating the projection. The default is set at the number of x-rasters in the image divided by 20. It corresponds basically to the distance from the centre of the Laue pattern to the closest in spots which are to be included in the gnomonic projection; these will appear at the outside of the converted image. The gnomonic projection is rescaled so that the resulting image is the same size as the input image. INPUT AND OUTPUT FILES The input file is one of the following: a) A film image file; this is assumed to have unsigned byte data and no header information. b) An image-plate (i2) data file; this is assumed to have unsigned two byte integer data and to have no header information. The output file is: a) The same format as the input file with the image converted to its gnomonic projection. RUNNING THE PROGRAM The program may be run via the command 'laue gnomconv' It may also be set up so that it can be run by just typing the program name 'gnomconv'. In this case the information required by the program may be input on the command line as follows: gnomconv [-film] [-ip] [-size xrasts yrasts] [-cent xcen ycen] [-dist ctof] [-rmin rmin] [-echo] [file_in] [file_out] The keywords may be shortened to a single letter; [] indicates optional items. The items are as follows: -film Indicates film data -ip Indicates image-plate (i2) data (-film and -ip are mutually exclusive) -size xrasts yrasts The numbers of x (slow) and y (fast) rasters in the input file. -cent xcen ycen The centre position of the Laue pattern in raster units. -dist ctof The crystal to film distance in raster units. -rmin rmin The minimum radius in raster units to be used in calculating the gnomonic projection. -echo Echo details of the conversion even if all items are input via the command line. file_in Name of the input image data file file_out Name of the output image data file If not all the required information is supplied, then the user will be prompted for the missing items. Example: (\ indicates continuation of line) gnomconv -i -s 1200 1200 -c 595 601 -d 762 -r 60 \ /scr1/pf.i2 /scr1/pf_gnom.i2 NOTES None. PRINTER OUTPUT There is no printer output as such but the program, if run via the question and answer sequence (or if -echo is specified), will output a brief summary of the conversion taking place. See section 10 for an example. ERROR MESSAGES a) Command line argument errors **Error** Cannot be both film and image plate** **Error** Option -s occurs more than once **Error** Two raster numbers must follow -s option **Error** Invalid number follows -s option **Error** Option -c occurs more than once **Error** Two raster values must follow -c option **Error** Invalid number follows -c option **Error** Option -d occurs more than once **Error** Distance value must follow -d option **Error** Invalid number follows -d option **Error** Option -r occurs more than once **Error** Radius value must follow -r option **Error** Invalid number follows -r option **Error** More than two file names given b) Invalid replies to questions **Error** Invalid file type **Error** Invalid reply c) File handling errors **Error** Unable to open input file **Error** Unable to open output file **Error** Unable to open input file 'file-name' **Error** Unable to open output file 'file_name' **Error** Error reading record 'n' **Error** Error writing file d) Memory allocation errors **Error** Unable to allocate memory to hold film image **Error** Unable to allocate temporary buffer PROGRAM FUNCTION The program GNOMCONV is used to read a Laue film or image-plate (i2) image and convert it to an image which is a gnomonic projection of the original image (see section 11 for a reference on gnomonic projections). The user needs to supply the position of the centre of the Laue pattern, the crystal to film distance and a minimum radius value. The program calculates the crystal to film distance for the gnomonic projection so that the transformed image is the same size as the original image. Some approximations are made so that an effective image may be produced; the necessity for these arise for the following two reasons: 1) There is no direct pixel to pixel mapping between the two images; for example a pixel close to the centre is transformed into a far larger area at the outside and a pixel at the outside maps on to a fraction of a pixel near the centre. 2) Because of problem (1), the densities of spots get very much reduced towards the outside and get very much enhanced towards the centre giving an image with a very different density distribution from the original image. The program treats these problems by going through the pixels of the output image one at a time and for each pixel the following is done: a) Find the area in the input image from which the data in the current pixel should be generated. b) Find within this area of the input image, the maximum pixel value present. c) Set the output pixel value to this 'maximum pixel value'. This treatment gives and image which has a density distribution which is very similar to that of the original image. The spots should be in the correct position and have approximately the correct size. Thus the image would be suitable for calculating spot positions with some indication of the likely errors in their measurement. The treatment also gives a quicker calculation than would otherwise be the case. The program may be run interactively via a question and answer sequence or by giving a series of command line arguments; in this latter form it would be suitable for inclusion in a script (command) file. REFERENCES Example of a question and answer sequence: Film (f) or image-plate (i) file [f]: i Name of input file: /scr1/pf.i2 Name of output file: /scr1/pf_gnom.i2 No. of x (slow) rasters, no. of y (fast) rasters [1200 1200]: Centre x, y in raster units [600.0 600.0]: 595 598 Crystal to film distance in raster units [600.0]: 625.4 Rmin value in raster units [60.0]: 50.0 Transforming image plate data Name of input file: /data1/jwc/lys.od Name of output file: /scr1/xxx.i2 No. x rasters = 1200, no. y rasters = 1200 *Reading file* *Gnomonic transformation* *Writing file* *Transformation successfully completed An example with command line arguments is given in section 5. EXAMPLES 1) Amoros J.L., Buerger M.J. and Amoros M.C. (1975) "The Laue Method", New York: Academic Press