Amorphous
DigitalMicrograph Script
Make an image resembling a TEM image of an amorphous specimen.
Preview
/////////////////////////////////////////////////////////////////////
// (c) Gatan Inc.
/////////////////////////////////////////////////////////////////////
// This script creates an image resembling a TEM image of an amorphous specimen
// by filtering a random image with a band pass filter.
//////////////////////////////////////////////////////////////////////
// last modified 08-July-2014 BS (comments only)
// Set the height and width of the destinantion image
number width = 512, height = 512
// Create an image of the same size and fill with random signal
image randomImage := RealImage("image", 4, width, height)
randomImage = Random()
// Create another image of the same size to contain the square of the Fourier frequency
image freqSquared := RealImage("Frequency Squared", 4, width, height)
// Set the values of the image to the square of the distance from the image centre (in pixels)
// i.e. the Fourier frequency
freqSquared = (icol-(width/2))*(icol-(width/2)) + (irow-(height/2))*(irow-(height/2))
// Create a complex image of the same size to be a filter
complexImage filter := ComplexImage("Filter", 8, width, height)
// This conditional argument sets the real part of all pixels in the filter image to unity
// iff the value of the corresponding pixel in the frequency squared image falls within
// the specified values. Else the pixel is set to zero.
filter = (freqSquared > 100 && freqSquared < 1000) ? complex(1, 0) : complex(0, 0)
// FFT the randomimage, filter using the filter image, and take the inverse
//transform to yield an 'amorphous' image
image filteredImage := RealIFFT( RealFFT( randomImage ) * filter )
// Finally, set the image name... and display it.
FilteredImage.Setname("Simulated Amorphous Image")
ShowImage( filteredImage )