Authors: Julien Cauchie, Valérie Fiolet, Didier Villers (didier_dot_villers_AT_umons_dot_ac_dot_be)
Université de Mons, Belgium.
History: 2004/11/15 : First version
Sources: Contained in Hough_Center_Sources.zip , which can be opened using a ZIP utility Installation: Download and expand the Hough_Center.zip archive in the plugins folder, or subfolder, restart ImageJ, and there will be a new Plugins/Hough_Center/Hough command. Documentation: Download the Hough_Center_Javadoc.zip archive which contains the documentation in HTML format generated by the javadoc tool. Description: This adaptive Hough transform has been developped to automatically find the center of a diffraction pattern. The basic idea is to calculate the intensity gradients for the pixels and then use the fact that the gradients are directed to the center. The intersection between the gradients should lie in the center of the diffraction pattern. As this supposition is obvious for isotropic samples (i.e. rotation symmetric patterns), it still works for oriented samples. The plugin must be applied on 8 bits grey images. Although it was designed for X-ray diffraction analysis, it could also be used for similar purposes on any grey level images.
The transformation needs parameters :
- Accumulator dimension
- Background color
- Filter dimension
- Percentage of pixels
We allow the user to modify the percentage of the points used for the transformation. Normally only points being part of the diffraction maxima should be taken into consideration as they produce the highest gradients. If the image contains much noise with high diffraction intensities, e.g. an isotropic sample containing a lot of small monocrystals, the percentage of the points should be increased. For standard diffraction patterns of good quality we experienced good results using only one percent of the points in the image. Overall computation time depends on the percentage of points used.
For the points with the highest intensities we calculate the gradient (absolute value and direction) of the point. The calculation of the gradients is done using the Canny operator. It's width can be chosen by the user (filter dimension). Larger widths lead to a better precision in the computation of the gradient. Computation time of the gradients is proportional to the square of the width. We obtained good results using a Canny filter width of 9 pixels.
Due to noise in the gradients (which can be due to numerical precision as well as noise in the diffraction pattern) we should calculate the center of gravity of the intersections between the gradients. As it is fastidious and long to directly calculate the intersections between all gradients, we use a different approach. In order to determine the point of highest density of the gradients we subdivide the image in cells we will call accumulator. Initially the so formed matrix is initialized to zero. In a next step we calculate for each pair of point and gradient if the line passes through a cell of the accumulator. If this is the case we add the absolute value of the gradient to the respective accumulator cell. Having done this for all gradients and all the accumulator cells we first apply a threshold to the accumulator and then calculate the center of gravity of the accumulator. Applying the threshold means eliminating all the cells smaller than the accumulator thresholding ratio, a user-defined parameter. We experienced good results with a ratio of 85%. It is useful to apply a threshold to eliminate contributions of bad gradients (e.g. as produced by beam-stop, nonradial gradients in anisotropic patterns etc.). Applying the threshold allows us to keep the same algorithm for diffraction patterns of isotropic samples as well as diffraction patterns of oriented samples.
Once found the center of gravity in the accumulator we construct a new accumulator. The new accumulator has usually the size of one cell of the old accumulator and is centered on the previously calculated center of gravity. The size (number) of the accumulator cells can be changed. Smaller accumulator cells (larger number) normally allow faster iteration but needs more memory for calculation. We experienced good results using accumulators with 5 divisions in each direction (accumulator dimensions).
As long as the cell size of the accumulator is larger than the desired accuracy of the center, we continue iterating. The default accuracy we use is 0.5 pixel.
Usually, the grey scale is choosen in order that background is white and signal is black. This could be changed using the background color choice.
An example image file is available.
References:"Use of the Hough transform to determine the center of digitized X-ray diffraction patterns". C. Dammer, P. Leleux, D. Villers, M. Dosière, Nucl. Instr. and Meth. B, 1997, 132, 214-220.
"Optimisation et intégration d'un algorithme de transformée de Hough circulaire". J. Cauchie (2004), master thesis in computer science, Université de Mons-Hainaut, Belgium.
Optimization of an Hough transform algorithm for the search of a center. Julien Cauchie, Valérie Fiolet, Didier Villers, Pattern Recognition 41 (2008) 567 – 574. DOI : http://dx.doi.org/10.1016/j.patcog.2007.07.001
See Also: Radial Profile Plot plugin
|Plugins at NIH | Home of ImageJ at NIH | Homepage |