*You can find more details on the method described below in the article
"Building shape and texture models of diatoms for analysis and synthesis
of drawings and identification" by Y.A.Hicks, A.D.Marshall, R.R.Martin, P.L.Rosin,
S.J.M.Droop and D.G.Mann. To be punblished in the IMVIP2004 proceedings.*

C code for diatom contour extraction can be downloaded *here *

Matlab code for diatom texture analysis and drawing synthesis can be downloaded *here *

We analyse the internal diatom silica shell patterns and represent them in a way suitable for synthesis. The variety of patterns occurring in diatoms is very great. A complete system would need to perform a series of tests to detect the type of pattern and then choose a suitable set of analytical tools to measure the values of appropriate pattern parameters. In the initial system reported here we restricted our approach to analysis of pennate diatom species with striae patterns on their shells, a common class of diatoms. The striae are the silica ribs coming out from the diatom's long axis (raphe). The patterns formed by the striae are characterised by frequency and orientation. For simplicity, we model striae as straight, which is a good approximation in the majority of cases considered.

In ADIAC, Gabor wavelets were used to detect the frequency and orientation of the striae and to segment the internal pattern. However, unless the pattern orientations and frequencies are known beforehand, or of a very limited range, a large bank of filters needs to be applied. In ADIAC, 28 filters were used, covering a range of 4 different orientations and 7 different frequencies.

Fourier analysis provides a more general approach to detecting the frequency and orientation of the striae patterns, and is more suitable for the purpose given the range of possible frequencies and orientations, thus it is our chosen analysis tool. We perform an FFT within a sliding window of size 48x48 at each pixel inside the diatom contour, from which we find the striae orientation and frequency corresponding to each pixel.

We find the central area containing no striae using an FFT within a sliding window of size 2x48 and approximate its borders with cubic splines.

To obtain parameter values characterising the texture, we split the inside of the diatom contour into a number of parts. In our experiments we used 6 areas above the raphe and the same number below the raphe. The borders of the parts are determined by splitting the curves approximating the top and the bottom borders of the central diatom area into equal lengths. We find the average orientation and frequency inside each of these parts as the average of all orientation and frequency values weighted by the corresponding energy values.

The internal pattern of each diatom is described using a 100 element vector, where 76 elements are the coordinates of the 38 control points and the other 24 values are orientation and frequency values (assuming the whole diatom is split into 12 parts).

To draw the internal structure of the diatom, we draw lines representing the striae between the external contour and the edge of the raphe. This is done using the average orientation and frequency values in several areas inside the diatom contour.

In our synthesis algorithm we attempt to follow the way it is believed a diatom shell is formed naturally. The striae are formed gradually: the ones near the centre of the diatom start growing first and may be partially completed by the time the striae further away from the centre start forming. We attempt to model this process in our iterative synthesis algorithm outlined below.

- Starting at the centre of the top raphe border, going out towards the right end of the diatom add one more pixel to the length of all existing striae, keeping all striae of orientations appropriate to the areas of the diatom they are located in, checking that they have not reached the diatom contour yet and that they are not too close (less than half of the striae spacing appropriate to the corresponding area of diatom) or too far (more than twice the striae spacing appropriate to the corresponding area of diatom) from the nearest stria on the left. The threshold values for the striae spacing were derived experimentally to imitate the underlying natural processes.
- If the stria on the left is too close to the current stria, or the current stria has reached the external contour, then the current stria becomes ``completed'', and in that case no more pixels are added to it in the future.
- If the stria on the left is too far away, then another stria is inserted between the two that have diverged too far.
- After we have considered all existing striae on the right from the centre, and if we have not reached the contour of the diatom, we add one more stria to the right of the rightmost stria.
- Repeat all the above steps until all the striae are ``completed''.
- Repeat all the above steps for the other three quarters of the diatom starting at the centre and going out towards the ends of the diatom along the top or bottom raphe.