Counting paramecia in Fiji/ImageJ with pieces of macros

ImageJ Macors

ImageJ Macro writing takes some time. When the number of the files to be processed is not extremely large, doing it manually can be quicker than writing a macro that works on any recorded files. Yet, it is torturous to move around the mouse and clicking it so many times. I’m afraid that it may cause  tendonitis. In such a case, running peices of macro commands one by one, while manually working on critical steps may help.

First of all, get Fiji/ImageJ if you don’t have it yet.

Use Macro recording to generate macro while you do what you want to do in the macro.  To run Macro recording, Go to Plugin > Macros > Record…

Here is an example of what I have done recently.

Firs, make macro windows by going to Plugins > New > Macro.

 

Here is a macro that can be used for the sample movie, to reproduce the following procedure by yourself. Copy and paste each block into each tab of the Macro window.

To obtain multiple tabs, in the Macro window, go to File > New, then go to Language > IJ1 Macro.

Here I have dozens of short movies (~ 1 sec) for which I want to count the number of paramecia. 

Before going through the following steps, prepare the Macros by copy and paste.

Open a movie by drag and drop into Fiji.

Click “Run”

run(“Z Project…”, “projection=Median”);
selectImage(1)
image1=getTitle()
selectImage(2)
image2=getTitle()
imageCalculator(“Divide create 32-bit stack”, image1,image2);
run(“Enhance Contrast”, “saturated=0.35”);
run(“16-bit”);
run(“Threshold…”);

Adjust threshold min and max and “Apply”, and click “OK”.

Click “Run”

run(“Invert”, “stack”);

CLick “Run”

makeOval(30, 10, 982, 979);

Adjust the location of the ROI by hand.

Click “Run”

Note: Later I noticed that circularity=0.30-1.00 may work beter.

run(“Analyze Particles…”, “size=15-90 circularity=0.50-1.00 show=Masks display clear summarize stack”);

Save the Summary.

Close the test windows. Say “No”.

Click “Run” to close all the image windows.

close();close();close();close();

Open the Summary in Excel

Calculate the average in Excel.

Be aware of the errors in this method of counting paramecia. Averaging a longer movie gives a better result. Carefully optimize the ragne of areas and circularity so that paramecia can be detected.

It looks like I should have set the circularity=0.3-1.00 insetad of 0.5-10.00. Some paramecia were lost in the shown analysis.

 

Notes

  1. A zebrafish larva in a movie does not affect the paramecium count much. Some miscounts from larval pigments may be negligible if the conditions were careflly chosen (enough number of paramecia, thresholding values, circularity and the range of the areas).
  2. For the ease of paramecium count by image processing, I usually use larger sized paramecia in the culture. To do this, put paramecium solution through a mesh (recover paramecia left on a 40 micron mesh, for example) to discard small-sized paramecia.
  3. I prefer to use a short movie (and average over frames) than a still image to count the paramecium for the better result.
  4. The size of the circular ROI should have been the exact size of the recording chamber for a better result.
  5. For a better result, thresholding value may be the one that gives almost no single pixel noies in the background inside the chamber.

 

タイトルとURLをコピーしました