insect-scanner macro for ImageJ

  • strict warning: Declaration of views_handler_field_user_name::init() should be compatible with views_handler_field_user::init(&$view, $data) in /home/aubreymoore/ on line 61.
  • strict warning: Declaration of views_handler_argument_many_to_one::init() should be compatible with views_handler_argument::init(&$view, $options) in /home/aubreymoore/ on line 169.

The insect_scanner macro extracts images of organisms from scans of sticky traps, pan trap samples, Berlese funnel samples, etc.  using ImageJ's particle analysis tools. Morphometric and color features for each particle (organism) are stored in an SQLite database for further analysis.


  1. Download and install Fiji.  (Fiji is just Imagej)
  2. Update ImageJ and Fiji from the Fiji "Help" menu. This step is important.
  3. Download and install SQLite.  (On my Windows XP and Windows 7 machines, installation was simply a matter of putting SQLite3.exe in the C:\WINDOWS\system32 directory.)
  4. Download insect_scanner and clustering.R from the attachment list below and put these in a folder where you can find them.
  5. Download R and add the R bin directory to your PATH. R is used to analyse and display feature data extracted by insect_scanner.
  6. [Optional] Download and install SQLiteSpy. This utility will enable you to explore databases created by insect_scanner.

Using insect_scanner

  1. Scan images of your samples and place them in a folder. I suggest saving scans as *.tif files. Alternatively, you can download test scans from http:\\\ Beware that this is a very large file, about 161 MB.
  2. Create a comma-separated values file in the same directory as your scans and name it "metadata.csv". The first row contains field names and the first field must be "scan_image". Names and contents of other columns are up to you. You may want to enter GPS locations, start and stop times for the sample period, habitat notes, etc. Here's an example "metadata.csv":
    scan_image, description
    scan0001TA.tif, Termites in tunnel on trunk of Serianthes.
    scan0002TA.tif, Termites in carton at base of Serianthes.
  3. Start Fiji and run the insect_scanner macro (Plugins | Macros | Run). A dialog will ask for the location of the folder containing your scans and metadata file.
  4. If all goes well, insect_scanner will create a new folder named "insects" which will contain an image of each organism in the scan and a database containing two tables: "metadata" and "features".


  1. insect_scanner was inspired by ZooImage which was developed for digital image analysis of plankton.
  2. Storing your scans in file paths containing space characters may pose a problem for the current version of insect_scanner.
  3. Speed test: insect_scanner_20120412.ijm took 73 seconds to process two 77 megapixel images on a Windows 7 64-bit machine; 2.6 GHz; 8 GB RAM. Greater than 2 GB of RAM were used. 
  4. The SQLite database facilitates efficient data analysis. For example the following SQL command generates a table containing the number of organisms and mean body length for each scan.
SELECT scan_image, count(insect_image), avg(Major)
FROM features 
GROUP BY scan_image;

insect_scanner_20120412.ijm14.14 KB
clustering.R807 bytes