0% found this document useful (0 votes)
42 views7 pages

NB2121 Practical 5 Exercises

This document provides instructions for a practical exercise on quantifying and analyzing biomedical images. It discusses how to assess segmentation performance using measures like the F-measure. It also describes how to analyze features like cell size distributions and structure orientation. The document provides questions and hints for writing macros to automatically perform these quantitative image analysis tasks.

Uploaded by

Rushan Tan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views7 pages

NB2121 Practical 5 Exercises

This document provides instructions for a practical exercise on quantifying and analyzing biomedical images. It discusses how to assess segmentation performance using measures like the F-measure. It also describes how to analyze features like cell size distributions and structure orientation. The document provides questions and hints for writing macros to automatically perform these quantitative image analysis tasks.

Uploaded by

Rushan Tan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

NB2121: Image Analysis

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.

Segmentation Performance Analysis


Before we can do any quantitative analysis of objects within an image, we first need
to segment these objects. In the previous lesson we have learned about various
image segmentation methods. A popular approach is intensity thresholding. But there
are even many different automatic thresholding methods.

In practice, if we have to analyze hundreds or even thousands of images, we first


need to find out which segmentation method works best for the type of images made
in the experiment. This can be done by taking several representative images from the
experiment and computing the performance of the different segmentation methods
for these images. As a reference we can use a manual segmentation.

In today’s lecture we have discussed quantitative measures to assess segmentation


performance. An often used measure is the F-measure.

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.

Remarks and hints:


 See the handouts of today’s lecture for the definition of the F-measure. Given a
segmented image and the reference image, figure out how to obtain an image
showing the true-positive pixels, and similar for the false-positive pixels and the
false-negative pixels, using the Image Calculator.
 There is an option in the Set Measurements window to measure the fraction of
non-zero pixels in an image. Find out which option that is (click the Help button in
the window to go to the online description of all options) and use it.
 To get a value from the Results window (showing the measurement results) you
can use the macro function getResult("Column", row). See the ImageJ Macro
Guide (or the online description) for more details.

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.

It is often interesting to look at the distribution of a certain feature. For example, an


image may contain many cells with slightly different sizes, and you may want to know
which cell size occurs most often. This can be done by making a histogram of the
feature of interest (in this case the cell size) and then looking for the mode of that
histogram (the bin with the highest value).

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?

Remarks and hints:


 Notice that this image is calibrated. That means the pixels have a specified size,
in this case in microns, and measurements are done in microns, not in pixels. You
can check the calibration using Image > Properties…
 Use the methods you have learned in previous practicals (thresholding, binary
watershed segmentation, and particle analysis) to make a good segmentation,
leaving out segmentation noise and cells at the image boundary.
 In the Distribution window, use the right parameter settings to reach the required
precision (+/- 5 means a bin size of 10 square microns).

Answer

Structure Orientation Analysis

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?

Hint: There is no simple ImageJ command to perform the arctan operation. So we


have written a macro function for you that does this. Download the macro Arctan
Function.ijm from Brightspace and copy the function into your own code.

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.

As an example, open Images / Quantification / Motor Neuron Muscle.tif. The


image contains three channels containing the following information:
 Ch1 (Green) shows the level of bungarotoxin before permeabilization.
 Ch2 (Red) shows the level of bungarotoxin after permeabilization.
 Ch3 (Green) shows the level of tubulin inside the muscle.
Bungarotoxin is a stain for acetylcholine receptors.

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?

We have discussed several colocalization measures in today’s lecture. The ImageJ


command that computes all of them (and more) is Analyze > Colocalization >
Colocalization Threshold. The command requires separate images (you cannot
select the channels of an image stack) so you first need to split the color channels of
the image. For this exercise you should use the same options as shown below and
specify only Channel 1 and Channel 2.

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:

Images – Names of the two images


Mask – Whether a ROI was used (and, if so, from which channel)
ZeroZero – Whether zero-zero pixels are used in the threshold calculation
Rtotal – PCC for all non-zero-zero pixels (ignoring thresholds)
m – Slope of the regression line (Ch2=m*Ch1 + b)
b – Intercept of the regression line
Ch1 thresh – Automatically found threshold for Channel 1
Ch2 thresh – Automatically found threshold for Channel 2
Rcoloc – PCC for pixels where both channels are above their thresholds
R<threshold – PCC for pixels where either channel is below its threshold
M1 – Mander's first coefficient for all pixels above zero
M2 – Mander's second coefficient for all pixels above zero
tM1 – Mander's first coefficient for all pixels above the threshold
tM2 – Mander's second coefficient for all pixels above the threshold
Ncoloc – Number of colocalized pixels
%Volume – % Colocalized pixels to all pixels.
%Ch1 Vol – % Colocalized pixels to all pixels in Channel 1 > threshold
%Ch2 Vol – % Colocalized pixels to all pixels in Channel 2 > threshold
%Ch1 Int – % Sum colocalized intensities to total sum in Channel 1
%Ch2 Int – % Sum colocalized intensities to total sum in Channel 2

6
%Ch1 Int > thresh – % Sum colocalized intensities to sum Ch1 > threshold
%Ch2 Int > thresh – % Sum colocalized intensities to sum Ch2 > threshold

Question

Run the Colocalization Threshold command on image Motor Neuron Muscle.tif


and answer the following three questions:
1) Do the bungarotoxin signals from before and after permeabilization colocalize?
2) Is the amount of colocalization the same for both signals (one w.r.t. the other)?
3) Does the permeabilized bungarotoxin colocalize with the tubulin?

Answer

You might also like