NB2121 Practical 5 Exercises
NB2121 Practical 5 Exercises
Practical 5: Quantification
Learning Goals
After this practical you should know by heart how to:
Measure the fraction of non-zero pixels in an image.
Read and use values from the Results window of ImageJ.
Write a macro that quantifies segmentation performance.
Plot and analyze the distribution of a measured feature.
Compute Gaussian smoothed image derivatives.
Incorporate a custom written function into a macro.
Write a macro that performs structure orientation analysis.
Perform colocalization analysis and interpret the results.
Question
Open Images / Quantification / Single Nucleus.tif. The image contains a single cell
nucleus that we would like to segment automatically as best as possible. Suppose we
have only three thresholding methods to choose from: 1) IsoData, 2) Percentile, and
3) Triangle (all three are available in the Threshold tool of ImageJ).
1
Write a macro that fully automatically computes the F-measure for a segmented
image using Images / Quantification / Single Nucleus Mask.tif as the reference
(the “true” segmentation). This reference was obtained by manually outlining the cell
nucleus and creating a mask image of it.
Run your macro for each of the three mentioned segmentation methods to get their
F-values. Which method is best? Explain why.
Answer
Now that you know how to write a macro that automatically computes the F-measure,
you should be able to do the same for the Jaccard and Dice similarity coefficients.
2
Cell Size Distribution Analysis
Once an image has been properly segmented into objects versus background, it is
possible to measure all kinds of object features. The ImageJ command Analyze >
Measure (together with Analyze > Set Measurements…) allows you to calculate
many features, as you have already seen in previous exercises.
The ImageJ command for making distributions of measured features is Analyze >
Distribution… It takes as input a specified column of the Results window (the
measurement results) to build a histogram of the values in that column.
Question
Open Images / Quantification / HeLa Cell Culture.tif. Write a macro that measures
the size (area) of every cell in the image automatically. Then make a histogram of the
size measurements. Which size (rounded to +/- 5 square microns) occurs most?
Answer
3
In today’s lecture we have learned that the orientation of an image structure can be
estimated by means of gradient tensor analysis. The formula is:
( )
1 2 Ix I y
θ= arctan 2 2
2 I x −I y
where I x and I y are the first-order derivatives of the image in, respectively, x and y .
The bar above a symbol means taking the local weighted average.
We are going to implement this analysis. To compute the image derivatives we will
use Gaussian derivate kernels. The Gaussian image derivatives (first-order) should
be computed at a relatively small spatial scale. We will use σ =1 (in pixels) for that
purpose. For local weighted averaging we can use Gaussian smoothing (which is
filtering with the zero-order Gaussian derivative). This must be done at a relatively
larger scale. We will use σ =5 pixels for that purpose.
All Gaussian filtering operations can be done using the command Plugins >
FeatureJ > FeatureJ Derivatives. For example, the numerator 2 I x I y (which is an
image) can be obtained by computing images I x and I y (first-order derivatives at σ =1
), multiplying these two images, smoothing the result (zero-order derivate at σ =5),
and finally multiplying that result with a factor 2. Similarly you can compute the
denominator (which is also an image) from the above equation.
Once you have the numerator image N ( x , y) and the denominator image D( x , y) you
can compute the final output as θ ( x , y )=¿ 0.5∗arctan (N (x , y )/ D( x , y )).
Question
Write a macro that fully automatically computes the image θ(x , y) of a given input
image I ( x , y ). Apply the macro to Images / Quantification / TEM Image 02.tif. What
is the orientation (angle, in degrees) of the structure in the middle of the image?
Answer
Colocalization Measurement
In biological experiments it often happens that you want to know to what extent two
(or more) different proteins are involved in the same process within a cell. As we
4
have learned in today’s lecture, one way to quantify this (with an accuracy limited to
the optical resolution) is to compute various colocalization measures.
Interesting questions to answer could be: To what extent do the bungarotoxin signals
from before and after permeabilization colocalize? Is the overlap the same for both
signals? And to what extent is there colocalization between the permeabilized
bungarotoxin and the tubulin inside the muscle?
5
The output of this command consists of three items:
1) A scatter plot showing the joint histogram of the two selected channels, with the
result of linear regression (a tilted line), and the automatically determined
thresholds for the two images (the vertical and horizontal lines).
The thresholds are determined by stepping down the regression line (from right to
left). Each point along the line defines a threshold for Channel 1 (the x coordinate
of the point) and a threshold for Channel 2 (the y coordinate of the point). Then
Pearson's correlation coefficient (PCC) is computed for all pixels for which either
image is below its threshold. As soon as PCC for these pixels drops below zero,
the search is stopped. These pixels can then be assumed to represent noise
(uncorrelated background) and can thus be ignored.
2) An image showing the colocalized pixels in white. These are the pixels
corresponding to the top-right quadrant of the joint histogram. That is, pixels for
which both images are above their respective thresholds.
3) A window called Results showing a table with the values of the various
colocalization measures. The table contains the following columns:
6
%Ch1 Int > thresh – % Sum colocalized intensities to sum Ch1 > threshold
%Ch2 Int > thresh – % Sum colocalized intensities to sum Ch2 > threshold
Question
Answer