A Brief Introduction to Using ImageJ

advertisement
Image Analysis
Claudia Neuhauser
March 12, 2011
A Brief Introduction to Using ImageJ
ImageJ is a NIH resource for processing and analyzing images. The software can be downloaded from the
ImageJ web site: http://rsbweb.nih.gov/ij/
The documentation can be found at http://rsbweb.nih.gov/ij/docs/index.html
Preparation for Instructor
Whether you use images from the web or create your own images, the TIFF format works best for
ImageJ since it the least degradable format when an image is repeatedly used for analysis. It is therefore
recommended to save any image first as TIFF.
If saving the image in TIFF format is not possible when downloading an image from the web, copy the
image into a PowerPoint slide, and save the image in the TIFF format by first right-clicking on the image
and then selecting “Save as Picture.” Choose “TIFF Tag Image File Format” in the “Save as type” pulldown menu in the window that popped up.
Example
Download an image of blood vessels from the following website:
http://nanocluster.mit.edu/research.php
Click on 2.4 Multifunctional Microspheres and click on Figure 2, which is an image of the blood vessel in
the brain of a mouse. The image appears enlarged in a new window. If you saved the image directly, it
would be saved as a JPEG file. Instead copy the image using “Copy image,” open PowerPoint, and save
the image on a new slide. Follow the instructions above to obtain the image in TIFF format. Save the
image on your desktop as “Microvessel.”
Citation: Neuhauser, C. A Brief Introduction to Using ImageJ.
Created: May 19, 2009 Revisions: March 12, 2011
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 1
Image Analysis
Claudia Neuhauser
March 12, 2011
Learning Objectives
The student will be able to



load images into ImageJ
prepare images for image analysis
perform simple image analysis (measuring and counting)
Knowledge and Skills


using imaging software for image analysis
concepts: circularity
Prerequisites


measurement of distance in different units
measurement of area and perimeter of geometric objects, including circle, rectangle, and ellipse
Introduction
ImageJ is a public domain software that can be downloaded on a variety of platforms, including
Windows and Mac. The software can convert many image formats including GIF, JPEG, and TIFF to to 8bit, 16-bit, or 32-bit images, which can then be analyzed by ImageJ.
We will use ImageJ to measure distances and areas, and count objects. Since TIFF is the least degradable
format when an image is repeatedly used for analysis, it is recommended to save any image first as TIFF
before conversion to 8-bit, 16-bit, or 32-bit.
Measuring Distances
The image Microvessel.tif is an image of a blood vessel in the brain of a mouse
(http://nanocluster.mit.edu/wiki/images/0/07/Microsphere_fig2.jpg).
Citation: Neuhauser, C. A Brief Introduction to Using ImageJ.
Created: May 19, 2009 Revisions: March 12, 2011
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 2
Image Analysis
Claudia Neuhauser
March 12, 2011
Start ImageJ and load the image Microvessel.tif into ImageJ: click on the File menu and choose the
submenu Open. A file manager opens. Locate the folder where the image is saved and open the folder.
Click on the image and click on Open to load it into ImageJ.
The image is already in TIFF format. We need to change it to a bit format before we can use any of the
tools within ImageJ: Image > Type > 8-bit
We start with the image on the left side: We will determine how many pixels correspond to 50 μm. Note
that the x- and y-coordinates of a point are in units of inches. Move the cursor to the beginning of the
scale bar that corresponds to 50 μm. Record the x-value. Move the cursor to the end of the line segment
that corresponds to 50 μm. Record the x-value again. The difference in the x-values tells you how many
inches correspond to 50 μm. ImageJ has a tool that does the calculation for the user: Click on Analyze >
Set Scale. A dialog box pops up. The dialog box tells you how many pixels correspond to 1 inch on the
image.
We can use the Straight Line Selection tool to determine how many pixels correspond to 50 μm and
then set the scale using the Set Scale tool. Click on the Straight Line Selection tool and draw a straight
line from one end of the scale bar to the other. Click Ctrl-M. A Result box pops up that displays the
length in the final column. Click on Analyze > Set Scale. A dialog box pops up. Enter “50” (without the
quotation marks” in the “Known Distance” field and enter “um” (which stands for μm) in the “Unit of
Citation: Neuhauser, C. A Brief Introduction to Using ImageJ.
Created: May 19, 2009 Revisions: March 12, 2011
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 3
Image Analysis
Claudia Neuhauser
March 12, 2011
Length” field. Click “OK.” If you repeat your measurement with the Straight Line Selection tool and you
click Ctrl-M, the Results box should now display a Length of 50 and the units are μm.
We can now measure the diameter of the large vessel that goes from top to bottom of the picture using
the Straight Line Selection tool. Draw a straight line across the vessel, and record the distance of the
line segment by clicking Ctrl-M. A window will pop up with the record of your measurement. Repeat
your measurements ten times and take the average. You can either use a calculator to calculate the
average, or copy the results of your measurements into a spreadsheet and then use the AVERAGE
function to calculate the average.
To measure the length of the vessel, you can use the Freehand Line tool. You can choose the tool by
right-clicking on the Straight Line Selection tool and selecting the Freehand Line Selection tool.
Repeat your measurements of the diameter of the vessels using the two images on the right, which are
enlargements of two parts of the image on the left. Note that the scale bar is 20 μm in the images on the
right. Explore how the finer scale increases accuracy of your diameter measurements.
Counting Objects
To learn how to count objects, we will count the number of sheep in an aerial photo. Load the image
sheep1.tif.
Citation: Neuhauser, C. A Brief Introduction to Using ImageJ.
Created: May 19, 2009 Revisions: March 12, 2011
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 4
Image Analysis
Claudia Neuhauser
March 12, 2011
The image is already in TIFF format. We need to change it to a bit format before we can use any of the
tools within ImageJ: Image > Type > 8-bit
To segment the image into the objects of interest and the background, we use thresholding
Image > Adjust > Threshold
A dialog box pops up where we can adjust the threshold so that only the pixels of the objects of interest
appear red. Choose Black & White (B&W) in the drop down menu within the dialog box. The image will
change into a black and white picture. Adjust the thresholds so that the pixels of the objects of interest
are black and all other pixels are white. Click Apply. Close the dialog box.
To count the objects, we use the Analyze menu
Analyze > Analyze Particles
A dialog box pops up where we need to enter the size and circularity of the objects, and what we want
to show. In order to count only particles above a certain number of pixels, enter a single value into the
Size field. Particles smaller than that value will be ignored. The circularity is a measure of how close the
shape of the object is to that of a circle. The circularity of a circle is 1. The more oblong is the object, the
smaller is the circularity. Here is how circularity is calculated. First note that the area of a disk and the
circumference of a circle are calculated as
Area of disk of radius r   r 2 and Perimeter of circle of radius r  2 r
If we take the ratio of the area and the square of the perimeter, we find
Area
 r2
1


2
2 2
4
Perimeter
4 r
This motivates the following definition of Circularity so that if the object is circular, the value of the
quantity Circularity is equal to 1:
Circularity  4
Area
Perimeter2
Citation: Neuhauser, C. A Brief Introduction to Using ImageJ.
Created: May 19, 2009 Revisions: March 12, 2011
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 5
Image Analysis
Claudia Neuhauser
March 12, 2011
To understand the concept of circularity, we calculate this
quantity for ellipses with different values of the major
radius a and minor radius b. The area of an ellipse is equal
to A   ab . There is no simple formula for the perimeter
of an ellipse. An approximation is given by


1 2 2
a  b . This implies that the circularity is
2
P  2
approximately
C
2ab
a  b2
2
The following table provides values for circularity for different ellipses:
a
b
1
2
3
4
5
6
C
1
1
1
1
1
1
1.00
0.80
0.60
0.47
0.38
0.32
Back to counting sheep: Enter Size and Circularity into the dialog box, and check Display, Clear,
Summarize, and Include Holes. Experiment with different values for Size and Circularity to get a sense
for how these parameters influence the total count.
Citation: Neuhauser, C. A Brief Introduction to Using ImageJ.
Created: May 19, 2009 Revisions: March 12, 2011
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 6
Image Analysis
Claudia Neuhauser
March 12, 2011
How many sheep? Partitioning the image and counting by hand reveals 95 sheep.
Further Explorations
1. Download an image from the web and apply what you learned after formulating a question that can
be answered using ImageJ.

https://d-e-science11.wikispaces.com/file/view/petri_dish.jpg/34493029/petri_dish.jpg

http://www.uphs.upenn.edu/news/news_photos/photos/DR5%20Gene%20Silencing.gif
2. Consult the instruction manual to find another feature you wish to learn about and apply the feature.
Citation: Neuhauser, C. A Brief Introduction to Using ImageJ.
Created: May 19, 2009 Revisions: March 12, 2011
Copyright: © 2009 Neuhauser. This is an open-access article distributed under the terms of the Creative Commons Attribution
Non-Commercial Share Alike License, which permits unrestricted use, distribution, and reproduction in any medium, and allows
others to translate, make remixes, and produce new stories based on this work, provided the original author and source are
credited and the new work will carry the same license.
Funding: This work was partially supported by a HHMI Professors grant from the Howard Hughes Medical Institute.
Page 7
Download