REORDER - RE-ORDER IMAGE DATA ============================= INTRODUCTION The program REORDER is used to read a film or image-plate (i2) image which may have its data in any of the 8 possible orders and re-order it so that it has the standard order required by the Laue data processing software. Image plate (i2) data may also be byte swapped if required. Header information may be skipped if required. The program was written by J.W. Campbell, Daresbury Laboratory and has been upgraded (1993) by John Skinner, Brookhaven National Laboratory, to handle Fuji image plates. List of sections: Data Control Cards Input and Output Files Running the Program Notes Printer Output Error Messages Program Function References 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 re-ordered. Name of output file: The reply is the name of the output film or image-plate data file to contain the re-ordered data. No. of x rasters, no. of y rasters [nx ny]: The reply gives the numbers of x-rasters and y-rasters in the input file (x and y are in the standard film 'xf' and 'yf' coordinate frame). The default values are 2400, 2400 for film and 1200, 1200 for image-plate. Order of axes in input data file [+x+y]: The reply is a string indicating the order of the data in the input file. This indicates the slower moving axis in the file followed by the faster moving axes in terms of the directions of the film 'xf' and 'yf' coordinates. The order strings for the eight possible orders are: +xf +yf +xf -yf -xf +yf -xf -yf +yf +xf +yf -xf -yf +xf -yf -xf An additional item 's' in the string indicates that, for image-plate (i2) data, byte swapping of the data is to be carried out. The exact string may be input in a number of forms; the '+' signs need not be given, the letters 'f' need not be given, items need not be separated but may be separated by spaces or commas. Some valid examples are: xy -yx yxs -yf,xf,s xf -yf Byte swap data [n]: This question is only asked for image plate data and provided that byte swapping has not already been requested in reply to the previous question. The reply is either 'y' to byte swap or 'n' (the default) for no byte swapping. Number of header bytes to skip [0]: The reply is the number of bytes of header information to be skipped before reading the image data (if any). (Will be omitted for Fuji plate option -log -ip) 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 data reordered (and possibly byte swapped) as requested. RUNNING THE PROGRAM The program may be run via the command 'laue reorder' It may also be set up so that it can be run by just typing the program name 'reorder'. In this case the information required by the program may be input on the command line as follows: reorder [-film] [-ip] [-order string] [-rast xrasts yrasts] [-swab] [-noswab] [-head hbytes] [-log] [-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) -order string Indicates the order of the axes in the input file; see above for details; the string should be given without spaces. -rast xrasts yrasts The numbers of x and y rasters in the input file. -swab Swap bytes (for image-plate data). -noswab Do not swap bytes for image-plate data. -head hbytes Number of bytes of header information to be skipped. -log Logarithmic (Fuji plate data) (also give -ip) -echo Echo details of the translation 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: reorder -i -o yfxf -r 1200 1200 -s /scr1/pf1a.i2 /scr1/pf1a_trans.i2 NOTES For Fuji image plate data, the -log flag must be given. The program will attempt to read to read the header data from an information file extension .inf replaces given image file name which is assumed to have the extension .img. If the .inf file cannot be found then the following additional prompts will be o/p: pixel size?: sensitivity?: latitude?: 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 summary of the translation taking place. ERROR MESSAGES a) Memory allocation errors **Error** Unable to allocate memory to hold film image **Error** Unable to allocate temporary buffer **Error** Unable to allocate memory to hold image **Error** Unable to allocate temporary buffer b) Inconsistent command line arguments **Error** Cannot be both film and image plate **Error** Cannot be both film and image plate **Error** Cannot have swap bytes and noswap **Error** Cannot have swap bytes and noswap **Error** No string given after -o flag **Error** Invalid axis order string **Error** Cannot have swap bytes and noswap **Error** Option -r occurs more than once **Error** Two raster numbers must follow -r option **Error** Invalid number follows -r option **Error** Invalid number follows -r option **Error** More than two file names given c) File handling errors **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) Invalid replies to prompts **Error** Invalid file type **Error** Unable to open input file **Error** Invalid reply **Error** Invalid axis order string **Error** Byte swap requests not consistent PROGRAM FUNCTION The program REORDER is used to read a film or image-plate (i2) image which may have its data in any of the 8 possible orders and re-order it so that it has the standard order required by the Laue data processing software. Image plate (i2) data may also be byte swapped if required. The convention for defining the x and y axes are those of the film xf and yf axes defined for the oscillation film processing package MOSFLM. 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_out.i2 No. of x rasters, no. of y rasters [nx ny]: 1900 1900 Order of axes in input data file [+x+y]: yfxf Byte swap data [n]: y Translating image plate data with byte swapping Name of input file: /scr1/pf.i2 Name of output file: /scr1/pf_out.i2 No. x rasters = 1900, no. y rasters = 1900 Input axis order: +yf +xf *Reading file* *Writing file* *Translation successfully completed An example with command line arguments is given in a previous section.