 # How to create a Macro for a Laplacian of Gaussian filter

Hey guys, I would be very grateful for help to do with how to generate my own macro for a Laplacian of Gaussian filter based on the mathematical equation. Where would I begin?, let X= something and y=something. how would i do squareroot etc

Hello Fezzaaa -

You could do this using the ImageJ Macro (IJM) macro language.

My preference for things of mild-to-moderate complexity is to
write a jython (python) script. (ImageJ supports other scripting
languages, as well.) For more complicated tasks, I would
suggest writing a java plugin.

Here is some introductory information about jython scripting.

And here is documentation for ImageJ Macros.

To help you get started, here is a sample jython script that applies
the “sqrt” function to a test image on a pixel-by-pixel basis:

``````import math

from ij import IJ

imp = IJ.createImage ('32-bit ramp', '32-bit ramp', 256, 256, 1)   # test image
imp_sqrt = imp.duplicate()   # duplicate so we can see the difference
imp_sqrt.setTitle ('32-bit ramp -- sqrt')

ip = imp_sqrt.getProcessor()   # get imp_sqrt's FloatProcessor
for  x in range (imp_sqrt.getWidth()):
for  y in range (imp_sqrt.getHeight()):
ip.putPixelValue (x, y, math.sqrt (ip.getPixelValue (x, y)))   # apply sqrt

imp.show()
imp_sqrt.show()
``````

Thanks, mm

Maybe this is what you want:
https://imagej.nih.gov/ij/plugins/log-filter.html

The LoG3D filter plugin is scriptable: http://bigwww.epfl.ch/sage/soft/LoG3D/

``````run("LoG 3D", "sigmax=1 sigmay=1 sigmaz=13 displaykernel=0 volume=1");
``````
1 Like