JITAX - Some experimental/example source code for the processing of Bruker SMART CCD Frames (and any other type of CCD Data you define in the code). by Scott A. Belmonte (s.a.belmonte@dl.ac.uk). Other application code: mask.c - Masking nasty parts of frames to help with indexing and integration. subtract.c - Background subtraction (powder rings and other nasties) jitax.c - Background subtraction with running average options for the standard frame. (command line options allow the output of PNG files) Released under the GPL licence. This code has been tested and run on a Dec Alpha workstation running Digital UNIX. However, users may have to do their own modifications to get it to work on other platforms(?) Documentation typed in by Lachlan M. D. Cranswick (CCP14) (E-mail: l.m.d.cranswick@dl.ac.uk - WWW: http://www.ccp14.ac.uk/people/lachlan/ ) ****************************************************************************** * * Copyright (C) 1999 - 2000 Scott Belmonte * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * ***********************************************************************/ Frame Reading/Writing Code: frames.c - source code frames.h - public header file framesP.h - private header file Subroutines: read_frame (reads frames from disk) write_frame (writes frames to disk) free_frame (frees up all the memory allocated by read_frame) get_base36_extension (routine to convert frame number above 1000 into Bruker base_36 numbering system) ======================================== ======================================== MODIFICATIONS users may like to do to the following code: Check whether converted data gives better integrations (this has primarily been used for clearer indentification of peaks for indexing) Algorithms for dynamically setting the running average for generating the "average" frame for "jitax" background subtraction code. A nice GUI with graphics to graphically compare the results Add more CCD formats. Build a complete CCD control and data integration system around this code. ======================================== ======================================== mask.c - Used as an example of using the JITAX code - [MASKING Source Code] Compile using: cc -o mask mask.c frames.c -lm ( -lm links with the maths library) With no command line options: Takes a range of Bruker SMART frames and averages them into a single frame then writes it out as a Bruker Frame and a PGM file. And automatically applies the average pixel value in the averaged frame to all the "RAW" frames as a "mask". Where all the pixel values above the average pixel value are set to zero. All the pixel values below the average are kept. This does not kill your reflections unless they are present in nearly "ALL" the frames. (Starting frames are not over-written. Corrected frames are output with the filename of filename of corr.* for corrected frames) This can be useful for ellimating out nasty background problems that are affecting all the frames and causing false peaks. USAGE: When prompted, enter base name (Job/Experiment name), then when prompted, enter the start and end frame numbers (enter these values in standard base 10 integer - not base_36). ------------------- ------------------- ------------------- subtract.c - Used as an example of using the JITAX code - [Background Subtraction Source Code from CCD Frames] Compile using: cc -o subtract subtract.c frames.c -lm ( -lm links with the maths library) With no command line options: Takes a range of Bruker SMART frames and averages them into a single frame then writes it out as a Bruker Frame and a PGM file. And automatically subtracts the average pixel value in the averaged frame to all the "RAW" frames as a "mask". If a pixel value is less than zero, the pixel value is set to zero. This does not kill your reflections unless they are present in nearly "ALL" the frames. (Starting frames are not over-written. Corrected frames are output with the filename of filename of corr.* for corrected frames) This can be useful for getting rid of "powder diffraction rings" and other nasties affecting identification and and indexing of peaks. USAGE: When prompted, enter base name (Job/Experiment name), then when prompted, enter the start and end frame numbers (enter these values in standard base 10 integer - not base_36). ------------------- ------------------- ------------------- jitax.c - Used as an example of using the JITAX code - [Background Subtraction Source Code from CCD Frames] Compile using: cc -o jitax jitax.c frames.c -lm ( -lm links with the maths library) With no command line options: Same as subtract.c - but uses a moving average window as the "average" frame for subtraction. This can be useful when the background is slowly changing and you wish to get rid of "powder diffraction rings" and other slowly changing nasties affecting identification and and indexing of peaks. User is prompted for: base name enter the start and end frame numbers frame window i.e., (when prompted) cime 300 1200 50 values of 5 to 200 can be a good for trying as a moving average but you may have to play with this. ========================== ========================= Command line options: mask -pgm min max subtract -pgm min max jitax -pgm min max Output PGM files as well as Bruker Frames (as filename of corr.* for corrected frames) (min and max is used to adjust the contrast on the PGM file) PGM file has 256 grey scales - default could cause problems if you have a really large peak that forces the other into the background noise. Running the programs "mask" and "subtract" without command line options displays the min and max values of the averaged frame at the end of a "default" run. This can then be used to decide what min and max values to use with the "-pgm" option. ========================== =========================