# Mathematica.

What is Mathematica?

Mathematica is powerful computational software in which scientist, engineers, and mathematicians use to compute all sorts of technical problems. At Vassar Applied Optics Center we have formulated a mathematica code that maximizes our result when conducting Fourier transforms on C. elegans.

Why Mathematica?

Mathematica incorporates an intelligent automation into every aspect of their design. This translates to a reliable high quality system. With specialized software, and various build in features this allows for functionality for many technical areas. Numerical and Symbolic computation are usually separate however mathematica seamlessly integrates both entities for many problems while ensuring consistent results whenever quantities of any precision are combined. This allows for many programming paradigms. When processing problems, one has to pay close attention to segmentation. There are various ways to approaches each problem. Mathematica presents algorithms that are finely tuned to specific tasks. Combine with unparalleled advantages; Mathematica presents the user with endless tools to accomplish any task.

Using Mathematica

Before one can begin to process any data using mathematica, one has to  be familiar with the system. After a few tutorials, and trails runs one should know the basic procedures.

In order to produce our diffraction images using mathematica, one must write a code specifically geared to his or her specifications.  Here is a simple image of a C. elegan. Lets go through each command and break down what’s exactly happening.

The first step is to pick the worms from a cuvette, and place them on a microscope slide. Once on a slide, place the slide on the microscope translation stage. Next select an objective that will optimize the C. elegan image, and start capturing pictures. This image was taken with a compound microscope. The first step in this process is to import the image from a storage file and insert into mathematica.

1.) when processing an image, we must set a constant and have it equal something. In our case, we use the word “Worm” and set it equal to the picture of a C.elegan in a circular shape.

2.) The next step is to set find the threshold of the worm. This command converts multichannel and colors into grayscale images and then finds a global threshold. Next Binarize produces an image in which sets pixels with value t to. 51 and all other pixels to 0

Threshld = FindThreshold[Worm]

BWorm = Binarize[Worm, .51] 3.)   Next using EdgeDetect, is a hysteresis thresholding with global threshold.Imagesize gives a resized version of image that has the specified maximum width and height. next we set “h” equal ImageData which gives the array of pixel values in image. fourier finds the discrete Fourier transform of a list of complex numbers. With the setting  fourier pararmeters, ->{0,-2}, the discrete transform is then computed by fourier which is h = ImageData[BWorm];
fa = Fourier[h, FourierParameters -> {0, -2}];
y = Image[Log[1 + (Abs[fa])^2]/0.5]; f4 = ImageResize[ImageCrop[y, 100], 500]  4.) The next set are examples of various C.elegans. Theses examples use the same basic approach but minor changes are present fine tune the outcome.

BWorm = Binarize[Worm];
h = ImageData[BWorm];
fa = Fourier[h, FourierParameters -> {0, -2}]; tt = Image[Abs[fa]];
fa2 = fa^2; y = Image[Log[1 + Abs[fa2]]/0.5]; f3 = ImageCrop[y, 100]; f4 = ImageResize[f3,500] Threshld = FindThreshold[Worm]
BWorm = Binarize[Worm, .51] h = ImageData[BWorm];
fa = Fourier[h, FourierParameters -> {0, -2}];
y = Image[Log[1 + (Abs[fa])^2]/0.5]; f4 = ImageResize[ImageCrop[y, 100], 500]

h = ImageData[BWorm];
fa = Fourier[h, FourierParameters -> {0, -2}];
y = Image[Log[1 + (Abs[fa])^2]/0.4]; f4 = ImageResize[ImageCrop[y, 100], 500]

BWorm = EdgeDetect[ ,6.0,0.035]

h = ImageData[BWorm];
fa = Fourier[h, FourierParameters -> {0, -2}];
y = Image[Log[1 + (Abs[fa])^2]/0.4]; f4 = ImageResize[ImageCrop[y, 100], 500]

BWorm = EdgeDetect[ , 6.0, 0.035]

h = ImageData[BWorm];

fa = Fourier[h, FourierParameters -> {0, -2}];

y = Image[Log[1 + (Abs[fa])^2]/0.35]; f4 = ImageResize[ImageCrop[y, 100], 500]

BWorm = EdgeDetect [ , 6.0, 0.035]

h = ImageData[BWorm];
fa = Fourier[h, FourierParameters -> {0, -2}];
y = Image[Log[1 + (Abs[fa])^2]/0.35]; f4 = ImageResize[ImageCrop[y, 100], 500]