Type “environment variables” in the system search bar.
Modify the environment variables, this will redirect you to the system properties panel.
Click on “Environment variables”.
In the window that opens, modify the Path variable. Select Path, then click on “Edit”. Next, click on “New”, then “Browse”, and search for the R folder (e.g. C:\Program Files\R\R-4.4.2). Select the bin folder and click “OK”.
Step 3: Install the codicount.jar plugin
Download the latest version of codicount.jar
Copy it to the plugins folder inside the Fiji or ImageJ folder.
Restart Fiji or ImageJ. CODICOUNT should now appear in the “Plugins” menu.
Tutorial
Here is a step-by-step description of how to count egg images in ImageJ / FIJI.
1-Identification of the area-to-be-counted (image preparation)
We must begin by identifying the portion that we want to count in the images, excluding any polluting elements (tube edges, pieces of cotton, labels with the sample number, finger stains ...). For this the easiest way is to open the images and crop them ( "Crop"). If the area has a square or rectangular shape, select the area with the Selection Tool "Rectangular". Once the area is correctly defined, use the command "Image, Crop." We can then save the cropped image.
Another approach is to tell the plugin to ignre certain image portions. This is especially useful when the area to count as a more complex shape (disk, oval...). The way to proceed is to paint all the areas to be ignored with the exact color (r, g, b): (255, 0, 182). One can for example use the "Paintbrush tool" brush. Any pixel having this rgb value will be completely ignored when counting; then it is unnecessary to crop the image. You must first specify the color, which is achieved via the menu "Image> Color> Color Picker ...". Double click in the square on the bottom left of the window Color Picker. A new window "Foreground Color" appears where you can set the values (r, g, b).
Obviously, the simplest procedure is still to frame only the area to count when shooting, to have images directly used for counting.
2-Plugin calibration (training phase)
This step will train the plugin on type of images that will have to deal with, allowing it to determine the best way to proceed for counting. After this step, the plugin will generate an ImageJ macro that can be used to count such images. One macro should be created per image type (background color, lighting, exposure, and host species, age of eggs ...) to ensure maximum performance.
We need to select representative samples of pixels from three areas: background (colored), healthy (unparasitized) eggs and parasitized eggs, to be called Background, Healthy and Parasitized, respectively.
To do this, the best method is to select the "Oval" tool with the right mouse button to access the selection tool "Selection Brush tool." A double left click on the button allows to adjust the size of the selection area, which should be neither too small nor too large compared to the size of eggs, thus facilitating selection.
With this tool, first we'll select image portions belonging to the background (thus having no egg). Try to get a sample of pixels that is as representative as possible of the background color. You can select several disjoint zones, obviously, holding down the "Shift" key while selecting. Once all the desired pixels have been selected, we will store the selection in the ROI Manager, using "Edit> Selection> Add to Manager" from the menu, or by using the keyboard shortcut "Ctrl + T". A window titled "ROI Manager" will open, and the selection appears with an arbitrary name defined by ImageJ. We just have to rename this ROI "Background", using the button "Rename". Note that only the first letter of the name ("B") is required, the rest is optional.
We then repeat the operation for healthy eggs (ROI to be renamed "Healthy") and parasitized eggs (ROI to be renamed "Parasitized"). Each time we first deselect all the pixels corresponding to the previous ROI, by simultaneously pressing the keys "Ctrl + Shift + A", or by the menu "Edit, Selection, Select None".
There is no need here to try to select precisely the contour of eggs. It is important however when the selections to ensure take points representing all areas of the picture (guideline: about forty points for the background, healthy eggs and black eggs, uniformly distributed over the entire image). It is also important to select all types of pixels that are found in each area. For example, if eggs cast shadows on the background, these must also be included in the selection "Background", so the plugin knows well that the shadows belong to the background, and optimizes the discrimination accordingly.
Typically, when a large number of images of the same type are to be counted with the same macro, the ideal is to calibrate the plugin from several images, to obtain appropriate settings for all the images and not overly specific to one of the images.
To do this, simply make a montage of several images. Just open several images, for example using the menu "File> Import> Image Sequence".
Once all the images are open, we can create a montage via the "Image> Stacks> Make Montage" menu (set the scale factor to 1). You can calibrate the plugin on this image.
3-Egg size calibration (optional)
On the same image, it is also possible to calibrate egg size. This requires selecting the tool "Freechand selections", and to surround groups of one or more eggs (if possible isoalted on the background). These areas are to be added individually to the ROI Manager ( "Ctrl + T" as previously) and renamed according to the number of eggs they contain (1,2,3, ...). For example: if one surrounds a single egg, the ROI is to be called "1" in the ROI Manager, if 7 eggs are in it, renames it "7", etc...
There is no need to count all of the image, but the ideal is once again to have several areas representative of the distribution of egg size.
4-Macro generation
Once all areas are stored in the ROI Manager, you can call the plugin "CODICOUNT" available in the dropdown menu "Plugins". It may be useful to save the selected areas in the ROI Manager on disk, using "More> Save". This allows to keep track of the calibration phase, to be able to repeat the procedure later.
Following the execution of the plugin (a few seconds), a window opens named "Log" in which the code of the macro is written. This code can be used to count the different images. The macro contains different informations (including the date of creation and the name of the image that was used for calibration). The text of the macro begins with // and ends with CODICOUNT // End of macro.
It is useful to save the macro in order to use it later, and to keep track of analyzes. The contents of the macro can be copied and pasted from the Log window. Just create a new macro window via "Plugins> New> Macro", and paste to it the text of the macro. At the end of this operation, we can save the macro ( "File> Save As ...").
5-Image counting
You will now be able to perform automatic counting of your pictures, by running the macro generated by the plugin ( "Macro> Run" in the window of the macro or keyboard shortcut "Ctrl + R"). To run a macro that was previously saved to disk, simply use the "Plugins> Macros> Run ...".
After running the macro, two things happen.
First, a new image appears, corresponding to the image such that the program has seen it: the healthy eggs are shown in orange, parasitized eggs in black
Second, the results window appears on the screen, with the following columns:
Picture: the name of the image
Total area: total number of pixels (excluding color pixels (255, 0, 182)) - Column B: "Background", the number of background pixels
Column H: "Healthy" number of pixels of healthy eggs
Column P "Parasitized" number of pixels of parasitized eggs
Column #H (if the size of the eggs was calibrated): number of healthy eggs
Column # P(if the size of the eggs was calibrated): number of parasitized eggs
Column %P: percentage of parasitized eggs (parasitism rate).
Typically, we have many pictures to count. The macro can of course be applied to each image individually, but the most effective method is to apply it on an entire folder of images. To do this you must click on "Process> Batch> Macro". A batch process window opens, in which you must select the "Imput" folder where the images are located. Then select the target folder "output" in which will be stored the analyzed images. After you click on "Open", to select the file containing the macro. At the end of this procedure, you click "Process" to start the counting operation. The results will be presented as a table (one line per frame counted). It can be saved in Excel format for subsequent statistical analysis.
By browsing our site you accept the installation and use cookies on your computer.
Know more
About cookies
What is a "cookie"?
A "cookie" is a piece of information, usually small and identified by a name, which may be sent to your browser by a website you are visiting. Your web browser will store it for a period of time, and send it back to the web server each time you log on again.
Different types of cookies are placed on the sites:
Cookies strictly necessary for the proper functioning of the site
Cookies deposited by third party sites to improve the interactivity of the site, to collect statistics
Cookies strictly necessary for the site to function
These cookies allow the main services of the site to function optimally. You can technically block them using your browser settings but your experience on the site may be degraded.
Furthermore, you have the possibility of opposing the use of audience measurement tracers strictly necessary for the functioning and current administration of the website in the cookie management window accessible via the link located in the footer of the site.
Technical cookies
Name of the cookie
Purpose
Shelf life
CAS and PHP session cookies
Login credentials, session security
Session
Tarteaucitron
Saving your cookie consent choices
12 months
Audience measurement cookies (AT Internet)
Name of the cookie
Purpose
Shelf life
atid
Trace the visitor's route in order to establish visit statistics.
13 months
atuserid
Store the anonymous ID of the visitor who starts the first time he visits the site
13 months
atidvisitor
Identify the numbers (unique identifiers of a site) seen by the visitor and store the visitor's identifiers.
13 months
About the AT Internet audience measurement tool :
AT Internet's audience measurement tool Analytics is deployed on this site in order to obtain information on visitors' navigation and to improve its use.
The French data protection authority (CNIL) has granted an exemption to AT Internet's Web Analytics cookie. This tool is thus exempt from the collection of the Internet user's consent with regard to the deposit of analytics cookies. However, you can refuse the deposit of these cookies via the cookie management panel.
Good to know:
The data collected are not cross-checked with other processing operations
The deposited cookie is only used to produce anonymous statistics
The cookie does not allow the user's navigation on other sites to be tracked.
Third party cookies to improve the interactivity of the site
This site relies on certain services provided by third parties which allow :
to offer interactive content;
improve usability and facilitate the sharing of content on social networks;
view videos and animated presentations directly on our website;
protect form entries from robots;
monitor the performance of the site.
These third parties will collect and use your browsing data for their own purposes.
How to accept or reject cookies
When you start browsing an eZpublish site, the appearance of the "cookies" banner allows you to accept or refuse all the cookies we use. This banner will be displayed as long as you have not made a choice, even if you are browsing on another page of the site.
You can change your choices at any time by clicking on the "Cookie Management" link.