May 23, 2024

Public workspaceGraphing area from an image series using ImageJ: a simple method

Graphing area from an image series using ImageJ: a simple method
  • 1University of Alberta
Open access
Protocol CitationVanessa R Ho, Sally P Leys 2024. Graphing area from an image series using ImageJ: a simple method. protocols.io https://dx.doi.org/10.17504/protocols.io.n2bvj326blk5/v1
License: This is an open access protocol distributed under the terms of the Creative Commons Attribution License,  which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited
Protocol status: Working
We use this protocol and it's working
Created: October 04, 2023
Last Modified: May 23, 2024
Protocol Integer ID: 88815
Keywords: image analysis, area measurement, behaviour analysis
Funders Acknowledgement:
NSERC Discovery Grant
Grant ID: Leys 2022-03414
Abstract
This protocol provides a quick way to quantify change in area of an object in a large series of images, by pixel contrast. It's equivalent to rootpainter, except much simpler, but it does rely on good contrast of light and dark in the region you wish to measure.
Others have used ImageJ for this too, but the method and workflow we provide has been tested successfully by many students and therefore offers a more consistent, standardized process.
Image Attribution
Vanessa Ho
Before start
Make sure you have ImageJ downloaded, available here: https://imagej.net/software/fiji/
Create a workflow (macro) in ImageJ with the following steps: This will be run on all your images.
  1. Open ImageJ
  2. Opening an image,
  3. Selecting Plugin>Macro>Record, which opens up a ‘recorder’ window.
Note
Once you have the recorder window open it will automatically record your actions from this point onward
Recording the macro for image processing:
  1. Set image type to 8-bit grayscale
  2. Select the rectangular selection tool and draw a rectangle over the image to create a ROI,
  3. Crop the image to that region >Image>Crop,
  4. Threshold the image >Image>Adjust>Threshold>Auto>Set>OK,
  5. Measure the area fraction, >Analyze>Set Measurements>, check the Area Fraction box (no other measure is needed), >Analyze>Measure. This action sends the measurement to a results window.
  6. Save the results to a folder by choosing >File>Save as>[choose your folder and type the file name].
  7. Stop the macro recording in the ‘recorder’ window by clicking >Create.

A Macro.ijm window opens with the macro, click >File>Save as>[choose a folder and file name for the macro].
Close the image and result window now.
Note
The default is to measure the dark areas of the image (coloured in red by ImageJ). To measure the light areas instead check the "dark background" box on the threshold window.


Example of ImageJ thresholding based on pixel brightness/contrast on a selected cropped region
Example of ImageJ thresholding based on pixel brightness/contrast on a selected cropped region

Run the macro on a set of images:
  1. In the main ImageJ toolbar choose >Process>Batch>Macro, to open the batch process window.
  2. Select the folder which contains the image set to be analysed, and the folder where the data and the processed images will be placed.
  3. Copy and paste the macro.ijm file from above into the window, and click >Process.
The image set will be analysed and the area fraction for each image will be calculated and placed in a .csv file, which can be opened for graphing or further analysis in Excel or other programs

Summarized workflow analyzing a selected area of the excurrent canal system in Ephydatia muelleri.
Summarized workflow analyzing a selected area of the excurrent canal system in Ephydatia muelleri.