{"id":444,"date":"2012-06-19T15:40:48","date_gmt":"2012-06-19T19:40:48","guid":{"rendered":"http:\/\/blogs.vassar.edu\/diffractionsymmetries\/?page_id=444"},"modified":"2012-07-11T10:01:32","modified_gmt":"2012-07-11T14:01:32","slug":"mathematica","status":"publish","type":"page","link":"https:\/\/pages.vassar.edu\/diffractionsymmetries\/discoveries\/diffraction-patterns\/mathematica\/","title":{"rendered":"Mathematica."},"content":{"rendered":"<p>What is <em>Mathematica<\/em>?<\/p>\n<p><em>Mathematica<\/em> 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 <em>C. elegans.\u00a0<\/em><\/p>\n<p>Why <em>Mathematica<\/em>?<\/p>\n<p><em>Mathematica<\/em> 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\u00a0functionality for many technical areas. Numerical and\u00a0Symbolic computation are usually separate however mathematica\u00a0seamlessly 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.<\/p>\n<p>Using <em>Mathematica<\/em><\/p>\n<p>Before one can begin to process any data using mathematica, one has to \u00a0be familiar with the system. After a few tutorials, and trails runs one should know the basic procedures.<\/p>\n<p>In order to produce our diffraction images using mathematica, one must write a code specifically geared to his or her specifications. \u00a0Here is a simple image of a <em>C. elegan.<\/em> Lets go through each command and break down what&#8217;s exactly happening.<\/p>\n<p>&nbsp;<\/p>\n<p>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 <em>C. elegan<\/em> image, and start capturing pictures. This image was taken with a compound microscope.\u00a0The first step in this process is to import the image from a storage file and insert into mathematica.<\/p>\n<p>1.) when processing an image, we must set a constant and have it equal something. In our case, we use the word &#8220;Worm&#8221; and set it equal to the picture of a <em>C.elegan<\/em> in a circular shape.<\/p>\n<p>Worm = \u00a0<a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/Fig-5-Worm-Simulation-2012.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-447\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/Fig-5-Worm-Simulation-2012.jpg\" alt=\"\" width=\"141\" height=\"102\" \/><\/a>\u00a0;<\/p>\n<p>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\u00a0sets pixels with value\u00a0t\u00a0to. 51\u00a0and all other pixels to 0<\/p>\n<p>Threshld = FindThreshold[Worm]<\/p>\n<div>\n<p>BWorm = Binarize[Worm, .51]<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/Fig-5-outline-1-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-448\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/Fig-5-outline-1-.jpg\" alt=\"\" width=\"141\" height=\"102\" \/><\/a><\/p>\n<p>3.) \u00a0\u00a0Next using EdgeDetect, is a hysteresis thresholding with global threshold.Imagesize gives a resized version of\u00a0image\u00a0that has the specified maximum width and height.\u00a0next we set &#8220;h&#8221; equal ImageData which gives the array of pixel values in\u00a0image. fourier\u00a0finds the discrete Fourier transform of a list of complex numbers. With the setting \u00a0fourier pararmeters, -&gt;{0,-2}, the discrete transform is then computed by fourier which is\u00a0<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/reference.wolfram.com\/mathematica\/ref\/Files\/Fourier.en\/5.gif\" alt=\"\" width=\"182\" height=\"27\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>BWorm = EdgeDetect[<a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/Fig-5-small-worm.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-449\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/Fig-5-small-worm.jpg\" alt=\"\" width=\"51\" height=\"37\" \/><\/a>, 7,0.03]<\/p>\n<p>h = ImageData[BWorm];<br \/>\nfa = Fourier[h, FourierParameters -&gt; {0, -2}];<br \/>\ny = Image[Log[1 + (Abs[fa])^2]\/0.5]; f4 = ImageResize[ImageCrop[y, 100], 500]<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/fig-5-skinny-outline-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-450\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/fig-5-skinny-outline-.jpg\" alt=\"\" width=\"141\" height=\"102\" \/><\/a><\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/Fig-5-diffraction-image-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-451\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/Fig-5-diffraction-image-.jpg\" alt=\"\" width=\"144\" height=\"72\" srcset=\"https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/Fig-5-diffraction-image-.jpg 500w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/Fig-5-diffraction-image--300x150.jpg 300w\" sizes=\"auto, (max-width: 144px) 100vw, 144px\" \/><\/a><\/p>\n<p>4.) The next set are examples of various <em>C.elegans<\/em>. Theses examples use the same basic approach but minor changes are present fine tune the outcome.<\/p>\n<p>BWorm = Binarize[Worm];<br \/>\nh = ImageData[BWorm];<br \/>\nfa = Fourier[h, FourierParameters -&gt; {0, -2}]; tt = Image[Abs[fa]];<br \/>\nfa2 = fa^2; y = Image[Log[1 + Abs[fa2]]\/0.5]; f3 = ImageCrop[y, 100]; f4 = ImageResize[f3,500]<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/binary-worm-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-457\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/binary-worm-1.jpg\" alt=\"\" width=\"180\" height=\"131\" srcset=\"https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/binary-worm-1.jpg 500w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/binary-worm-1-300x219.jpg 300w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/binary-worm-1-410x300.jpg 410w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><\/p>\n<p>Worm =<a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/green-binary-worm.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-458\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/green-binary-worm.jpg\" alt=\"\" width=\"51\" height=\"37\" \/><\/a>;<\/p>\n<p>Threshld = FindThreshold[Worm]<br \/>\nBWorm = Binarize[Worm, .51]<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-of-green-worm-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-459\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-of-green-worm-.jpg\" alt=\"\" width=\"141\" height=\"102\" \/><\/a><\/p>\n<p>Worm =[<a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/green-binary-worm.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/green-binary-worm.jpg\" alt=\"\" width=\"51\" height=\"37\" \/><\/a>,7,0.03]<\/p>\n<div>\n<p>h = ImageData[BWorm];<br \/>\nfa = Fourier[h, FourierParameters -&gt; {0, -2}];<br \/>\ny = Image[Log[1 + (Abs[fa])^2]\/0.5]; f4 = ImageResize[ImageCrop[y, 100], 500]<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/ouline-of-worm-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-460\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/ouline-of-worm-.jpg\" alt=\"\" width=\"141\" height=\"102\" \/><\/a><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-pic-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-461\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-pic-.jpg\" alt=\"\" width=\"144\" height=\"104\" srcset=\"https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-pic-.jpg 500w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-pic--300x216.jpg 300w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-pic--416x300.jpg 416w\" sizes=\"auto, (max-width: 144px) 100vw, 144px\" \/><\/a><\/p>\n<p>BWorm = EdgeDetect[<a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/horn-image-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-462\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/horn-image-.jpg\" alt=\"\" width=\"97\" height=\"49\" \/><\/a>,7,03]<\/p>\n<p>h = ImageData[BWorm];<br \/>\nfa = Fourier[h, FourierParameters -&gt; {0, -2}];<br \/>\ny = Image[Log[1 + (Abs[fa])^2]\/0.4]; f4 = ImageResize[ImageCrop[y, 100], 500]<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/outline-of-worm-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-463\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/outline-of-worm-.jpg\" alt=\"\" width=\"161\" height=\"81\" \/><\/a><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-horn-qorm-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-464\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-horn-qorm-.jpg\" alt=\"\" width=\"173\" height=\"86\" srcset=\"https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-horn-qorm-.jpg 500w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-horn-qorm--300x150.jpg 300w\" sizes=\"auto, (max-width: 173px) 100vw, 173px\" \/><\/a><\/p>\n<p>BWorm = EdgeDetect[<a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/horn-image-.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/horn-image-.jpg\" alt=\"\" width=\"97\" height=\"49\" \/><\/a>,6.0,0.035]<\/p>\n<p>h = ImageData[BWorm];<br \/>\nfa = Fourier[h, FourierParameters -&gt; {0, -2}];<br \/>\ny = Image[Log[1 + (Abs[fa])^2]\/0.4]; f4 = ImageResize[ImageCrop[y, 100], 500]<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/outline-of-horn-worm-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-466\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/outline-of-horn-worm-1.jpg\" alt=\"\" width=\"131\" height=\"68\" \/><\/a><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-wormdd.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-467\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-wormdd.jpg\" alt=\"\" width=\"130\" height=\"68\" srcset=\"https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-wormdd.jpg 500w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-wormdd-300x156.jpg 300w\" sizes=\"auto, (max-width: 130px) 100vw, 130px\" \/><\/a><\/p>\n<p>BWorm = EdgeDetect[<a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/circle-worm-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-468\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/circle-worm-.jpg\" alt=\"\" width=\"55\" height=\"44\" srcset=\"https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/circle-worm-.jpg 153w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/circle-worm--150x121.jpg 150w\" sizes=\"auto, (max-width: 55px) 100vw, 55px\" \/><\/a>, 6.0, 0.035]<\/p>\n<p>h = ImageData[BWorm];<\/p>\n<p>fa = Fourier[h, FourierParameters -&gt; {0, -2}];<\/p>\n<p>y = Image[Log[1 + (Abs[fa])^2]\/0.35]; f4 = ImageResize[ImageCrop[y, 100], 500]<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/outlinwdiff-of-circle-worm-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-469\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/outlinwdiff-of-circle-worm-.jpg\" alt=\"\" width=\"153\" height=\"121\" \/><\/a><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-circle-worm-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-470\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-circle-worm-.jpg\" alt=\"\" width=\"158\" height=\"125\" srcset=\"https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-circle-worm-.jpg 500w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-circle-worm--300x237.jpg 300w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/diff-image-of-circle-worm--379x300.jpg 379w\" sizes=\"auto, (max-width: 158px) 100vw, 158px\" \/><\/a><\/p>\n<p>BWorm = EdgeDetect [<a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/hook-worm-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-471\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/hook-worm-.jpg\" alt=\"\" width=\"91\" height=\"58\" \/><\/a>, 6.0, 0.035]<\/p>\n<p>h = ImageData[BWorm];<br \/>\nfa = Fourier[h, FourierParameters -&gt; {0, -2}];<br \/>\ny = Image[Log[1 + (Abs[fa])^2]\/0.35]; f4 = ImageResize[ImageCrop[y, 100], 500]<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/hook-worm-outline-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-472\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/hook-worm-outline-.jpg\" alt=\"\" width=\"152\" height=\"97\" \/><\/a><a href=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/dif-of-hook-worm-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-474\" src=\"http:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/dif-of-hook-worm-.jpg\" alt=\"\" width=\"162\" height=\"102\" srcset=\"https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/dif-of-hook-worm-.jpg 500w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/dif-of-hook-worm--300x189.jpg 300w, https:\/\/pages.vassar.edu\/diffractionsymmetries\/files\/2012\/06\/dif-of-hook-worm--476x300.jpg 476w\" sizes=\"auto, (max-width: 162px) 100vw, 162px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/pages.vassar.edu\/diffractionsymmetries\/discoveries\/diffraction-patterns\/mathematica\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2480,"featured_media":0,"parent":146,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-444","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/pages.vassar.edu\/diffractionsymmetries\/wp-json\/wp\/v2\/pages\/444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pages.vassar.edu\/diffractionsymmetries\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/pages.vassar.edu\/diffractionsymmetries\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/pages.vassar.edu\/diffractionsymmetries\/wp-json\/wp\/v2\/users\/2480"}],"replies":[{"embeddable":true,"href":"https:\/\/pages.vassar.edu\/diffractionsymmetries\/wp-json\/wp\/v2\/comments?post=444"}],"version-history":[{"count":21,"href":"https:\/\/pages.vassar.edu\/diffractionsymmetries\/wp-json\/wp\/v2\/pages\/444\/revisions"}],"predecessor-version":[{"id":456,"href":"https:\/\/pages.vassar.edu\/diffractionsymmetries\/wp-json\/wp\/v2\/pages\/444\/revisions\/456"}],"up":[{"embeddable":true,"href":"https:\/\/pages.vassar.edu\/diffractionsymmetries\/wp-json\/wp\/v2\/pages\/146"}],"wp:attachment":[{"href":"https:\/\/pages.vassar.edu\/diffractionsymmetries\/wp-json\/wp\/v2\/media?parent=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}