 1. Introduction
 2. Digital representation of an image and its Fourier transform
 3. Significance of the Fourier coefficients of an image
 4. Resolution
 5. Phase and modulus
 6. Shape and symmetry relations between direct and reciprocal space
 7. Signal on heavy noise
 8. Conclusions
 A1. (§3[link]. Significance of the Fourier coefficients of an image)
 A2. (§3.1[link]. Convolution)
 A3. (§3.2[link]. Patterson function)
 A4. (§4.1[link]. Resolution: aesthetic and quantitative point of view)
 A5. (§[link]5. Phase and modulus)
 A6. (§7[link]. Signal on heavy noise)
 References
 1. Introduction
 2. Digital representation of an image and its Fourier transform
 3. Significance of the Fourier coefficients of an image
 4. Resolution
 5. Phase and modulus
 6. Shape and symmetry relations between direct and reciprocal space
 7. Signal on heavy noise
 8. Conclusions
 A1. (§3[link]. Significance of the Fourier coefficients of an image)
 A2. (§3.1[link]. Convolution)
 A3. (§3.2[link]. Patterson function)
 A4. (§4.1[link]. Resolution: aesthetic and quantitative point of view)
 A5. (§[link]5. Phase and modulus)
 A6. (§7[link]. Signal on heavy noise)
 References
teaching and education
Illustrated Fourier transforms for crystallography
^{a}Laboratoire de Cristallographie et Modélisation des Matériaux Minéraux et Biologiques, UMR UHP–CNRS 7036, Faculté des Sciences et Techniques, NancyUniversité, Boulevard des Aiguillettes, BP 239, 54506 VandoeuvrelèsNancy, France
^{*}Correspondence email: emmanuel.aubert@lcm3b.uhpnancy.fr
Concepts such as Fourier transformation, convolution and resolution that are required to understand crystallography are illustrated through visual examples. These concepts can be explained pedagogically in a very direct way using the DigitalMicrograph software from Gatan Inc. (https://www.gatan.com/imaging/downloads.php ), originally intended for data collection and analysis, and practical exercises developed around this tool can be used in teaching crystallography.
Keywords: teaching tools; DigitalMicrograph software; Fourier transform.
1. Introduction
Teaching crystallography implies the development of concepts such as Fourier transformation, convolution, resolution etc. that are not necessarily obvious for beginners. In order to help students new to this field, some interactive web sites have been created (e.g. Schoeni & Chapuis, 2006) and practical exercises using the Mathematica software were recently developed by Dumas et al. (2006). Practicals were also developed in Nancy University for the `Signal Processing' lectures intended for secondyear university students (Licence Science de la Vie L2) and for the National CNRS Thematic School `Structural Analysis by Xray Diffraction, Crystallography under Perturbation', held in Nancy in September 2006 (https://www.lcm3b.uhpnancy.fr/nancy2006/ ).
In singlecrystal Xray diffraction and under kinematic conditions, the amplitude of the Xray beam diffracted by a crystal of electron density is given by
where E_{e} is the amplitude scattered by one electron, is the interference function giving rise to the sharp Bragg diffraction peaks, and
is the
associated with the reciprocallattice vector . Since it is the Fourier transform of the thermally smeared electron density, the contains information about the unitcell content (the motif composition). The diffracted intensities for a crystal composed of a large number of unit cells are then determined byThe structure factors are the Fourier coefficients of the electron density of the motif inside the
Structure factors are generally complex quantities and can be represented in polar form:
with the modulus and the phase .
However, according to (3), the diffraction process leads to the determination of only the moduli , the information about the phase being lost. Specialized experimental techniques such as multibeam Xray diffraction or convergentbeam electron diffraction offer possibilities to measure relative phases between some structure factors (see for example Spence & Zuo, 1992).
Moreover, it is not possible to measure all Fourier coefficients of the electron density, firstly because of spatial limitations around the diffractometer (the diffraction angle has maximum practical value 2θ_{max} < 180°, depending on the experimental setup), and secondly because one uses nonzero wavelength λ (from the Bragg law the reciprocal resolution is , and since λ is finite the resolution cannot be infinite).
This paper aims to present examples that can be used to illustrate graphically Fourier transform properties in crystallography courses, introducing notions such as resolution, convolution and signaltonoise ratio using the free (timelimited licence) demo version of a very simple but nevertheless powerful software (DigitalMicrograph from Gatan; https://www.gatan.com/imaging/downloads.php ), originally intended for data collection and analysis.
We draw an analogy between a singlecrystal Xray experiment and manipulation of digital images, as shown in Fig. 1.
The crystal is replaced by a twodimensional digital image that consists of pixels having integer values. It is thus possible to calculate the Fourier transform (FT) of that twodimensional image, modifying it with userfriendly tools (e.g. removing Fourier coefficients far from the origin) and calculating to which object it corresponds in direct space.
In the following we will first describe how digital images are coded and introduce Fourier transformations, and then we will use the analogy with Xray diffraction to address some points about resolution, the
in crystallography, and the relation between direct and Finally, an example showing the important effect of multiple measurements on signaltonoise ratio will be presented.Another possible approach is to use Abbe's theory of image formation with a rather simple optical bench, and various examples have been given by e.g. Hecht (2002), Harburn et al. (1975) and Lipson et al. (1995).
2. Digital representation of an image and its Fourier transform
The reference image (Fig. 2) is a digital photograph composed of 256 × 256 pixels coded in 8 bit greyscale [i.e. pixels have integer values from 0 (black) to 255 (white)]. All images used in this practical are in 8 bit greyscale TIFF format and are opened with the pulldown menu option File > Open, or are directly downloaded using the browser. As shown in Fig. 2, the mouse pointer is on an almost dark (value = 2) pixel of coordinates (x, y) = (211, 78).
The Fourier transform of an I(n, m) image is defined as
(with N = 256 in our example), which is similar to the definition of the from the electron density [equation (2)]. The inverse Fourier transform is
In the following we will limit ourselves to real I(n, m) signals [in our analogy the electron density is a real quantity], which implies that F^{*} (h,k) = F(  h,  k). Moreover, in order to use the fast Fourier transform algorithm implemented in DigitalMicrograph, these images must have square N × N pixel sizes with N a power of two.
Fourier transform calculations can be illustrated on a smaller image (Fig. 3a), composed of only 4 × 4 pixels. Table 1 displays the integer values of each of the 16 pixels, and Table 2 (visualized in Fig. 4) displays the values of the corresponding Fourier coefficients [note the origin definition (h = 0, k = 0)].


As can be seen from Table 2 and generalizing to an N × N pixel image, the centre of the Fourier transform (h, k) = (0, 0) is placed at the (N/2 + 1)th row and column. This implies, as the original image and its Fourier transform are N × N, that all Fourier coefficients are related by a complex conjugate relationship centrosymmetric about (0, 0), except those in the first row (k = −2) and column (h = −2).
3. Significance of the Fourier coefficients of an image
In order to illustrate the significance of the Fourier coefficients of an image, it is possible to look at which image corresponds to a limited number of Fourier coefficients. As a first example we start from an allzero 16 × 16 complex image and then set F(−1, 0) = 1 − i, F(1, 0) = 1 + i and calculate its inverse Fourier transform (see Appendix A, §A1 for the procedure in DigitalMicrograph). This leads to the horizontal sine wave of lowest frequency displayed in Fig. 5(a). Then, using F(−h, 0)/F(h, 0) couples, further and further from (0, 0) (Figs. 5b and 5c), one sees that these conditions correspond to sine waves of increasing frequencies. The highest frequency is a special case (Fig. 5c), coded only in one Fourier coefficient, i.e. F(−8, 0); this special treatment for the highestfrequency coefficients simply allows the use of arrays of identical sizes (N × N) for the images and their Fourier transforms. Starting from equation (7) and setting , one finds the same results, the recomposed image being
The complicated image represented in Fig. 2 can thus be seen as resulting from the interference (sum of amplitudes taking into account the relative phases) of the different sine waves generated from each F(h, k)/F(−h, −k) pair. This example also illustrates that Fourier coefficients close to the origin (0, 0) bear information on largescale intensity variations across the image, whereas the F(h, k) far from the origin encode precise details of the image (this point will be further developed in §4).
3.1. Dirac delta function and convolution
The twodimensional Dirac delta function (defined in real space) is nonzero only at position ; one of its properties is to select the value at of a given function :
If the Dirac function is centred on the origin [], the Fourier representation of digital images given in §2 [] gives the Fourier transform as simply
Thus the Dirac delta function [δ(0, 0) = 1] is the inverse Fourier transform of the constant 1:
The convolution between two twodimensional functions and is defined by
and the convolution theorem relates the Fourier transform of the convolution product to the product of the Fourier transforms of the original functions:
As an example, Fig. 6 displays the convolution between a twodimensional Gaussian function centred at position (x, y) = (200, 200) on a 1024 × 1024 pixel grid, and an image made of four Dirac peaks located at (100, 300), (400, 200), (300, 300) and (450, 450) pixels coordinates (see §A2). The final image is calculated in this example using the convolution theorem, but the result can be seen as being obtained by `applying' the Gaussian function to the four Dirac peaks, taking into account that the Gaussian function is shifted from the origin.
From a mathematical point of view, this corresponds to [with one Gaussian centred at and one Dirac peak centred at ]
i.e. a Gaussian centred at .
3.2. Patterson function
In crystallography, the
, used to solve structures containing heavy atoms, is defined as the autocorrelation function of , or in other words as the convolution of with :One important property of is that its Fourier transform is simply
that is to say that unlike electron density , this function can be directly computed from experimental data by inverse Fourier transformation.
Starting from the previous image (Fig. 6) composed of the four Gaussian functions that can be seen as analogous to a fouratom structure, the can be calculated in different ways, given in §A3. The resulting is shown in Fig. 7; it displays 12 peaks around the origin (image centre) corresponding to the N^{2} − N = 12 interatomic vectors for the N = 4 `atoms'.
4. Resolution
4.1. Resolution: aesthetic and quantitative point of view
Starting from the original image (Fig. 2), one wonders how it will be modified if one keeps only a selected part of its Fourier transform. In order to perform such modifications, we use masking tools such as those indicated in Fig. 2 (§A4).
The results using a circular masking tool, displayed in Fig. 8, illustrate that the Fourier coefficients far from the origin (centre of the FT) encode details of the image such as the leafs behind the statue, whereas the Fourier coefficients close to the origin encode largescale intensity variation (e.g. the statue is white on dark background forest).
For a more quantitative approach we consider Fig. 9(a) (256 × 256 pixels), composed of two black disks (15 pixels in diameter) separated by 40 pixels, and ask what is the minimal number of Fourier coefficients that is required for the two disks to be visually separable?
One can consider that the lowest frequency necessary to distinguish the two disks corresponds to a sine wave having a periodicity equal to the separation between the disks. From the first part we know that the first Fourier coefficient close to the origin corresponds to a sine wave of one period on the image, i.e. 256 pixels. Thus the sine wave with a period of 40 pixels corresponds to the sixth or seventh Fourier coefficient starting from the origin (256/40 = 6.4). Indeed, as displayed in Fig. 10(a), the image reconstructed using only a central area of the first five Fourier coefficients in radius does not permit one to distinguish the two disks, whereas the image calculated with eight Fourier coefficient radii clearly allows one to conclude the presence of two objects on the original image.
In our analogy these disks can be seen as two atoms; the shortest interatomic distance that one can expect in a compound is, for example, a C—H bond (∼1 Å). Using the Bragg law and with d = 1 Å, one deduces that the Xray diffraction experiment has to collect diffracted beams up to diffraction angle [corresponding to 2θ ≃ 41° for Mo Kα radiation (λ = 0.711 Å)] in order to distinguish H atoms from their neighbours.
4.2. Interpretation of the aesthetic effect of resolution using the convolution theorem
The blurred appearance of the lowresolution image in Fig. 8(b) can be explained using the convolution theorem. This image is the inverse FT of the FT of the original image (Fig. 8a), of which we only kept a circular central area. This modified FT can be considered to be the simple product in of the FT of the original image and a circular mask displayed in Fig. 11(b). In the fuzzy image in Fig. 11(f) is thus the convolution of the original image and the inverse FT of the circular mask (more examples of FTs of simple objects are given in §6).
Indeed, the inverse FT of the circular mask (Fig. 11e) is characterized by four peaks surrounded by oscillations that rapidly decrease in magnitude. It should be noted that the most important contribution to the final image (Fig. 11f) arises from the topleft peak corresponding to the coordinate origin (the three other peaks at the corners create duplicate images outside the boundary of the display but may lead to some artefact close to the edges of the image). The convoluted final image (Fig. 11f) can thus be seen as the sum of copies of the original image shifted and weighted according to the shape of Fig. 11(e). In the limiting case of an infinite mask (thus no masking), the inverse FT of the mask is simply a Dirac peak centred on the topleft corner, and the resulting image is then identical to the original one (convolution of the original image with a Dirac peak placed at the origin). If the mask narrows in its inverse FT widens in (see §6), with increasing contributions far from the topleft corner, and blurring is more and more pronounced in the final image. In the other limiting case the mask is reduced to a single Dirac peak of height 1, of which the inverse FT is a constant image (1/N^{2}). In that case the original image is `totally' blurred, leading to an image having a constant value (which is the average value of the original image).
4.3. Resolution in analysis
Assuming that an Xray diffraction experiment allows the determination of all structure factors in moduli and phases up to 1 Å^{−1}, then, according to the Bragg law, the smallest observable detail without using a model for the structure is 0.5 Å. However, in structure reports, typical estimated standard deviations in C—C bond lengths, for example, are of the order of 0.002 Å, which is far below the diffraction limit. This `extra resolution' is induced by the model inserted to fit the observations (and solve the phase problem); the crystal is composed of atoms of known (usually spherical) shapes. This extra resolution may be misleading because it is strongly linked to the model, and this is not unique; usually one uses spherical atoms (independent atom model, IAM) to model Xray diffraction data, but atoms are not spherical because of chemical bonds with their neighbours. This asphericity of the valence electron density may be taken into account in more sophisticated atomic models [e.g. multipolar models (Stewart, 1976; Hansen & Coppens, 1978)] and offers precise characterization of interatomic and intermolecular interactions (Lecomte et al., 2005). Bond distances may be significantly different between the IAM and multipolar models. Dahaoui (2007) and Espinosa et al. (1997) performed charge density studies of complexes of tetracyanoquinodimethane (TCNQ) with different molecules [benzidine: BDTCNQ; pterphenyl: PTPTCNQ; bis(thiodimethylene)tetrathiafulvalene: BTDMTTFTCNQ; see Appendix B]. Using exactly the same data for IAM and multipolar models on these compounds, the cyano bond distances in TCNQ were 1.1604 (7), 1.1602 (7) and 1.1615 (9) Å for mutlipolar models of BD, PTP and BTDMTTFTCNQ, respectively, but `only' 1.1539 (9), 1.1532 (7) and 1.1551 (10) Å for the corresponding IAM models. These bond lengths differ between the two atomic models by as much as Δ/σ = 7.2, 10 and 6.4 for BD, PTP and BTDMTTFTCNQ, respectively, σ being the larger bond length standard deviation from the two models. The reason for these significant discrepancies between IAM and multipolar models is illustrated in Fig. 12, where the static deformation density through the TCNQ molecular plane is plotted. This density is defined as the difference between the electron density derived from the multipolar model and the electron density of the corresponding IAM model, and thus it shows the redistribution of valence electron density due to chemical bonding. As can be seen from this figure, the valence density in C≡N bonds is strongly shared between the two atoms, leading to a substantial displacement of the electronic centroids of both the C and the N atoms and therefore to a biased bond length if an IAM model is used.
Consistent with that finding but in a different way, Seiler et al. (1984) showed that, for a given model, structural parameters depend on the data set extension used to refine these parameters. Their compound (tetrafluoroterephthalonitrile) also possesses a C≡N bond whose length converged from an IAM to 1.1489 (8) Å using all of the structurefactor data set (sinθ/λ < 1.15 Å^{−1}); however, this distance increased to 1.1538 (4) Å if only highorder data were used (0.85 Å^{−1} < sinθ/λ < 1.15 Å^{−1}). This underestimation of bond lengths when using an IAM model is explained by the fact that valence electrons (responsible for biased interatomic distances) contribute mainly to loworder reflections (see §6 for an explanation of valence/core contributions to diffraction).
This biasing of bond distances is mainly encountered in strongly polar interactions, where the electron density is shared between atoms. An even more obvious example is X—H bonds (X = C, N, O), in which the distance can be underestimated by as much as 0.1 Å when using an IAM model. Because H atoms have their electronic clouds strongly deformed in such bonds, one must use neutron nuclear diffraction (where neutrons interact with nuclei, not with electrons) to perform a precise or charge density modelling.
5. Phase and modulus
In this section we consider the relative importance of the modulus and phase of the Fourier coefficients. Starting from two images (Figs. 13a and 13b), one can extract the moduli and phases of their respective Fourier transforms and recombine them (modulus of FT of image a with phase of FT of image b and reciprocally; see §A5.1). As shown in Fig. 14, the images obtained are closer to the image from which we took the phase than that one from which we extracted the modulus.
It is also possible to use random moduli (Fig. 15a) or random phases (Fig. 15b): one has to note, however, that in order to obtain real images the relation around (h, k) = (0, 0) must be imposed on these random values and this could be achieved using more complex scripts (§A5.2).
Each pixel of an image built from a Fourier transform (i.e. using an inverse Fourier transform operation) is the result of the interference (addition in the complex plane) of the contributions of each Fourier coefficient (Fig. 16). If phases are strongly modified, the resulting amplitude will be strongly affected. Comparing Fig. 14(a) (created with moduli of Fig. 13b) and Fig. 15(a) (created with random moduli), one can easily see that the former is closer to the original image (Fig. 13a); this is explained by noting that the moduli of Fig. 13(b) `resemble' more closely the moduli of the original image Fig. 13(a) (with a central strong peak and decreasing Fourier coefficients away from the centre), whereas the random moduli used here are uniform in reciprocal space.
The importance of the phases relative to the moduli is also evidenced by repeating these examples with different sets of random phases or moduli. Whereas the images (not shown here) composed with random moduli are aesthetically very similar (one can recognize the edges of the statue), the images obtained with random phases are clearly different from one another and do not resemble the original object.
6. Shape and symmetry relations between direct and reciprocal space
6.1. Fourier transformation of individual objects
In order to explain, for example, the `shape' of the Fourier transform of a crystal or the contributions of core and valence electron densities to diffraction, one must illustrate the relations between direct and reciprocal space.
Fig. 17 underlines the well known Fourier transform property that a shaperestricted object (direct space) corresponds to an extended Fourier transform and vice versa (Figs. 17a–17d). Also evident is the symmetry relationship between the two spaces: a cylindrical object (Fig. 17a) will have a cylindrical FT (Fig. 17b); a rectangular object (Fig. 17e) will have an FT (Fig. 17f) that is an assembly of rectangles but with their smallest extension in the same direction as the greatest dimension of the object. The polygon displayed in Fig. 17(g) has then an FT characterized by tails perpendicular to its edges, since this object has restricted extension along these directions [the five edges of the polygon give rise in the FT (Fig. 17h) to five tails crossing at the origin]. Remembering images of the sun recorded in movies (often observed as a disk surrounded by six tails), one recalls that usually hexagonal diaphragms are used in front of the camera.
Starting from Fig. 17(e) one can see that the FT of an infinite vertical slit is obtained from Fig. 17(f) where the horizontal oscillations are kept (they are linked to the slit width) but the vertical ones are condensed in the horizontal direction. Adding a second vertical slit leads to interference (Young's twoslit experiment), where the spacing between the minima is linked to the slit separation (Fig. 18d). If more and more equidistant slits are inserted, secondary maxima of decreasing height are created between the principal maxima, which sharpen, and in the limiting case of an infinite number of slits giving rise to a lattice, the Fourier transform becomes a Dirac row (Fig. 19).
A twodimensional lattice can then be constructed by crossing vertical and horizontal onedimensional lattices, as displayed in Fig. 20(a). This lattice being infinite, its Fourier transform is then also a lattice [in Fig. 20(b) the Dirac peaks are artificially enlarged for clarity]. The (Fig. 20a) can be seen as the convolution of a Dirac peaks lattice and the motif composing the `unit cell' (Fig. 20d): indeed, its Fourier transform is the simple product between the (FT of the direct lattice) and the FT (Fig. 20e) of the motif (Fig. 20d). The two black horizontal lines In Fig. 20(b) arise from the fact that a node of the FT (Fig. 20e) falls on the same position as a row of the that samples this function.
Returning to crystallography, the crystal is the convolution of a threedimensional in the case of a large number of unit cells], with the FT of the motif, which is the which leads to intensity variations from spot to spot and to (nonlattice) systematic extinctions.
with a motif that describes or `decorates' the its Fourier transform (related to the diffraction pattern) is then the simple product of the giving rise to sharp diffraction spots [it is the interference function of equation (1)The structure factors are the sum of the contributions of the N_{at} different atoms composing the
where is the j and is the Fourier transform of its electron density. Electrons of nonH atoms may be defined as core and valence electrons and have distinct contributions in because of their different locations in real space. As shown in Fig. 21 the iron core electrons tightly bound to the nuclei contribute in the whole diffraction angle range, whereas valence electrons spread in have noticeable contributions only for small diffraction angles, i.e. close to the origin of the owing to the FT properties. This implies that in charge density (in which one wants to observe and model the distribution of valence electrons) or accurate thermal motion studies one has to collect accurately low and highdiffractionangle reflections in order to distinguish valence effects from thermal displacements (static or dynamic) since the FT of the structure factors is the thermally smeared electron density (Coppens, 1997) [see Aubert et al. (2003, 2004) for an example of charge density and electrostatic potential studies].
of atom6.2. Effect of the crystal shape
In singlecrystal Xray diffraction a typical size of the specimen is about 100 µm in length in each direction, the optimal size being a compromise between the diffracting power proportional to the crystal volume and the absorption phenomenon. Crystal size has a less important effect with the Xray technique than it has in electron diffraction, where the crystal must be very thin to be transparent to the electron beam (Williams & Carter, 1996).
Given the infinite perfect crystal displayed in Fig. 22(a), one wonders how its diffraction pattern will be modified if its shape is changed. Because the crystal is infinite, its Fourier transform is a regular array of Dirac peaks of varying heights across the image.
According to what was seen in the preceding section, if one restricts the object shape in one direction its Fourier transform will expand in that direction. Examples of different crystal shapes are given in Fig. 23, together with their Fourier transforms. These latter can be explained using the convolution theorem: in the finite size crystal can be seen as the simple product of the infinite crystal with a mask giving the crystal shape; in the Fourier transform of the finite crystal is then the convolution of the Fourier transform of the infinite crystal (array of Dirac peaks) by the Fourier transform of the mask.
6.3. Playing: bird in cage…
As a recreation, one can play with the well known example of the captive bird shown in Fig. 24(a), the aim being to release the flying animal. As displayed in Fig. 24(b) one can recognize the respective contributions of the bird (complex intensity variation with a global decreasing from the origin) and of the cage (which is a simple vertical onedimensional lattice) giving rise to sharp spots in the equatorial line. The bars of the cage will then disappear if one masks their contributions in the as in Fig. 24(c). The final image still displays traces of the bars because the cage contribution spreads beyond the section that was hidden. In the original image is the simple product of the bird and of the cage; thus in it corresponds to the convolution of the FT of the bird on the Dirac peaks of the FT of the cage.
7. Signal on heavy noise
As a final application, we present an example related to (a) are displayed 20 objects that are assumed to be identical and related by translation only (i.e. no rotation). As can be seen, the high noise level allows the identification of these objects on the image but precludes the observation of the possible details inside them. Because the noise is assumed to be random across the image, one can thus average the 20 objects in order to increase their signal to noise ratio (§A6).
in Fig. 25The first step is to find the precise position of each object on the image; one extracts one of the objects (Fig. 26a) and computes the cross correlation between this extracted object and the full image. The result, shown in Fig. 26(b), displays sharp peaks corresponding to the repetitive positions of the extracted object on the original image (these peaks give the coordinates in the image frame of the topleft corner of the square selection that have to be used to extract and average the 20 objects). The average image (Fig. 27 after adequate rotation) is then obtained by summing the objects extracted from the original image using the coordinates derived from the cross correlation; it reveals the weak signal hidden by the high level noise.
This example of utilization of correlation also illustrates the importance of multiple measurements of structure factors in singlecrystal Xray diffraction in order to increase their signaltonoise ratio. This is of the utmost importance, for instance, in charge density modelling, where the effect to be observed (i.e. electron density reorganization owing to chemical bonding) is weak.
8. Conclusions
This paper illustrates the Fourier transformation and its properties used in crystallography with emphases on Xray diffraction. Obviously, the demonstrations are not restricted to crystallographic applications but are relevant to all domains where Fourier transformation, convolution, correlation, resolution etc. are important. The example of Xray imaging that uses synchrotron and the promising sources is particularly relevant. Figs. 17(b) and 17(f) of the present paper correspond to Figs. 7 and 8 of the Livet lead article on diffraction with an Xray coherent beam (Livet, 2007).
Some other examples of image manipulations are given at https://www.lcm3b.uhpnancy.fr/lcm3b/Pages_Perso/Aubert/sommaire.html . These illustrations show, for example, how to use Fourier transform for zooming on an image or to insert a digital signature into a photograph.
The free demonstration version of DigitalMicrograph software is available from Gatan (https://www.gatan.com/imaging/downloads.php ).
APPENDIX A
Procedures and scripts used for the examples developed in the text
A1. (§3. Significance of the Fourier coefficients of an image)
File > New > Width 16 Height 16 Complex 8 Bytes Constant (0)
Object > Display Type > Spreadsheet
Modify F(h, k) by double click on it
Object > Display Type > Raster
Process > Inverse FFT
Object > Display > Complex Display Real Part
A2. (§3.1. Convolution)
File > New > 1024 1024 Real 4 Ramp X → Image A
File > New > 1024 1024 Real 4 Ramp Y → Image B
File > New > 1024 1024 Real 4 Constant 0 → Image C
File > New > 1024 1024 Real 4 Constant 0 → Image D
In one script:
c = exp(1e3*((a200)**2+(b200)**2))
d = 0
d[100,300] = 1
d[400,200] = 1
d[300,300] = 1
d[450,450] = 1
Process > FFT on images C and D (results in E and F)
Process > Simple Math > E*F (results in G)
Process > Inverve FFT on G (results in H)
Edit > Change Data Type > Real > Real Component
A3. (§3.2. Patterson function)
Directly using the implemented function:
Process > Auto correlation (results in I)
Using the convolution theorem:
Process > Rotate 180° (results in J from H)
iFFT on the product of FFT of H and FFT of J
Using the relation : calculate from H:
Process > FFT (result in J)
Edit > Change Data Type > Real > Modulus
Process > Simple Math > a**b with b = 2 (results in K)
Edit > Change Data Type > Complex
Process > Inverse FFT
A4. (§4.1. Resolution: aesthetic and quantitative point of view)
Open image
Process > Fourier Transform
Apply the masking tool to that FT
Process > Apply Mask
Process > Inverse FFT
A5. (§5. Phase and modulus)
A5.1. Open the two images (results in A and B)
Process > Fourier Transform on these two images (results in A, B → C, D)
mp = complex(modulus(c)*cos(phase(d)), modulus(c)*sin(phase(d)))
pm = complex(modulus(d)*cos(phase(c)), modulus(d)*sin(phase(c)))
A5.2. With random moduli and phases of the Chinese Musician:
File > New > 256 256 Real 4 Random (image A)
In a script: (image C)
b = a[1,1,256,256]
FlipHorizontal(b)
FlipVertical(b)
c = a
c[129,1,256,256] = b[128,0,255,255]
deleteimage(b)
d = c[128,1,129,256]
FlipHorizontal(d)
c[128,1,129,128] = d[0,0,1,127]
deleteimage(d)
d = c[0,1,1,256]
FlipHorizontal(d)
c[0,1,1,128] = d[0,0,1,127]
deleteimage(d)
d = c[1,0,256,1]
FlipVertical(d)
c[1,0,128,1] = d[0,0,127,1]
deleteimage(d)
Open image of the Chinese Musician (image B)
Process > FFT (image D)
z = complex(c*cos(phase(d)),c*sin(phase(d))) (image Z)
Process > Inverse FFT (Z → E)
Edit > Change Data Type > Real > Real Component (on E)
With random phases and moduli of the Chinese Musician:
File > New > 256 256 Real 4 Random (image A)
In a script: (image D)
b = (a0.5)*2*pi()
c = b[1,1,256,256]
FlipHorizontal(c)
FlipVertical(c)
d = b
d[129,1,256,256] = c[128,0,255,255]
e = d[128,1,129,256]
FlipHorizontal(e)
d[128,1,129,128] = e[0,0,1,127]
deleteimage(e)
e = d[0,1,1,256]
FlipHorizontal(e)
d[0,1,1,128] = e[0,0,1,127]
deleteimage(e)
e = d[1,0,256,1]
FlipVertical(e)
d[1,0,128,1] = e[0,0,127,1]
deleteimage(e)
deleteimage(b)
deleteimage(c)
d[0,0] = 0
d[128,128] = 0
d[0,128] = pi()
d[128,0] = pi()
Open image of the Chinese Musician (image B)
Process > FFT (image C)
z = complex(modulus(c)*cos(d),modulus(c) *sin(d)) (image Z)
Process > Inverse FFT (Z → E)
Edit > Change Data Type > Real > Real Component (on E)
A6. (§7. Signal on heavy noise)
Open the 20 object image (image A)
Draw a square 256 × 256 pixel selection around a given object
File > New > 2048 2048 Real 4 Constant (a) (image B)
In a script: b[0,0,256,256] = a[]
Now we have to compute the cross correlation between A and B:
which can be seen as the convolution of with .
Process > Rotate (180°) (image B → image C)
Process > FFT (A → D)
Process > FFT (C → E)
Process > Simple Math (D × E → F)
Process > Inverse FFT (F → G)
APPENDIX B
Diffraction data
BDTCNQ: C2/m; temperature: 100 K; sinθ/λ_{max} = 1 Å^{−1}; multipolar model: R = 0.023, R_{w} = 0.024; g.o.f. = 0.605; IAM: R = 0.038, R_{w} = 0.049, g.o.f. = 1.208. PTPTCNQ: ; temperature: 120 K; sinθ/λ_{max} = 1.09 Å^{−1}; multipolar model: R = 0.031, R_{w} = 0.032, g.o.f. = 1.476; IAM: R = 0.045, R_{w} = 0.048, g.o.f. = 2.122. BTDMTTFTCNQ: C2/m; temperature: 15 K; sinθ/λ_{max} = 1.14 Å^{−1}; multipolar model: R = 0.027, R_{w} = 0.025, g.o.f. = 0.957; IAM: R = 0.035, R_{w} = 0.037, g.o.f. = 1.397.
Acknowledgements
The authors thank Dr Eric Chabrière for fruitful discussions, and Professor Enrique Espinosa and Angélique Lagoutte for their help during the practical training session at the CNRS thematic school `Structural Analysis by Xray Diffraction, Crystallography under perturbation' held in Nancy in September 2006. EA thanks Dr S. Pillet for the invitation to this CNRS school. We are grateful to Dr Slimane Dahaoui for providing accurate bond lengths and charge density results on TCNQ complexes, before publication, and to the referees for constructive comments and corrections of the manuscript.
References
Aubert, E., Porcher, F., Souhassou, M. & Lecomte, C. (2003). Acta Cryst. B59, 687–700. Web of Science CrossRef CAS IUCr Journals Google Scholar
Aubert, E., Porcher, F., Souhassou, M. & Lecomte, C. (2004). J. Phys. Chem. Solids, 65, 1943–1949. Web of Science CrossRef CAS Google Scholar
Coppens, P. (1997). Xray Charge Densities and Chemical Bonding, IUCr Texts on Crystallography. Oxford University Press. Google Scholar
Dahaoui, S. (2007). Personal Communication. Google Scholar
Dumas, P., Vanwinsberghe, J. & Cura, V. (2006). Crystallographic Teaching Commission of the IUCr Newsletter, No. 1, pp. 4–10. Google Scholar
Espinosa, E., Molins, E. & Lecomte, C. (1997). Phys. Rev. B, 56, 1820–1832. CrossRef CAS Web of Science Google Scholar
Hansen, N. K. & Coppens, P. (1978). Acta Cryst. A34, 909–921. CrossRef CAS IUCr Journals Web of Science Google Scholar
Harburn, G., Taylor, C. A. & Welberry, T. R. (1975). Atlas of Optical Transforms. London: G. Bell. Google Scholar
Hecht, E. (2002). Optical Physics, 4th ed. San Francisco: Addison Wesley. Google Scholar
Lecomte, C., Aubert, E., Legrand, V., Porcher, F., Pillet, S., Guillot, B. & Jelsch, C. (2005). Z. Kristallogr. 220, 373–384. Web of Science CrossRef CAS Google Scholar
Lipson, S. G., Lipson, H. & Tannhauser, D. S. (1995). Optical Physics, 3rd ed. Cambridge University Press. Google Scholar
Livet, F. (2007). Acta Cryst. A63, 87–107. Web of Science CrossRef CAS IUCr Journals Google Scholar
Schoeni, N. & Chapuis, G. (2006). https://lcr.epfl.ch/page37304.html Google Scholar
Seiler, P., Schweizer, W. B. & Dunitz, J. D. (1984). Acta Cryst. B40, 319–327. CSD CrossRef CAS Web of Science IUCr Journals Google Scholar
Spence, J. C. H. & Zuo, J. M. (1992). Electron Microdiffraction. New York: Plenum. Google Scholar
Stewart, R. F. (1976). Acta Cryst. A32, 565–574. CrossRef CAS IUCr Journals Web of Science Google Scholar
Williams, D. B. & Carter, C. B. (1996). Transmission Electron Microscopy. New York: Plenum Press. Google Scholar
© International Union of Crystallography. Prior permission is not required to reproduce short quotations, tables and figures from this article, provided the original authors and source are cited. For more information, click here.