The first line is commented out (everything on a line “//” in ImageJ code is ignored, known as a comment), since that line would show the Threshold dialog box, and we want to set the threshold automatically, not show the dialog box for user input. Also notice that there are 2 lines which show the run(“Analyze Particles…”) command. The first line where this appears is not necessary, since that line will show the dialog box for the Analyze Particles window, so you can delete that line, since for automating the analysis of a whole plate, we don’t want to show the Analyze Particles dialog for every image. The second line actually calls the Analyze Particles command and gives it the parameters needed to execute the function, this is the line we need.
Step 3. Create the Macro
Now we are ready to get to the coding. To create a new macro, on the ImageJ menu, click Plugins > New > Macro. The Macro code box will pop up.
First, we will create a function to execute the steps we just recorded. We will call the function “processImage” and it will contain the lines that were recorded using the macro recorder.