Title: ECSE6963, BMED 6961 Cell
1ECSE-6963, BMED 6961Cell Tissue Image Analysis
- Lecture 9 Fundamentals of Image Analysis - III
- Badri Roysam
- Rensselaer Polytechnic Institute, Troy, New York
12180.
2Recap
- Thresholding a technique to extract the
foreground - Image intensity based thresholding
- Thresholding is a form of hypothesis testing with
two hypotheses - The optimal value of the threshold ultimately
comes from the probabilistic models, and the
prior probabilities - Automatic Thresholding
- Threshold chosen automatically based on image
characteristics - We looked at one pixel at a time thresholding
- With thresholding, we are making an independent
decision at each pixel. - This is obviously naïve we know that adjacent
pixels are not independent - Today
- Adaptive thresholding methods
- More on blob segmentation methods
3Recall The Intensity Histogram
- h(i) pixels with intensity i.
Normalized Histogram
N bits means K 2N
Can be interpreted as a probability
Cumulative normalized histogram
Monotonic non-decreasing
4Recall Gaussian Mixture Model
- Observation
- The intensity data can be thought of as a mixture
of three types of pixels - Really dark background
- Background
- Foreground
- Suggests the use of mixture distributions as a
way to model pixel intensities - The Gaussian is commonly used for the component
distributions - Provides an intuitive basis for estimating
thresholds
Gaussian
weights
5The Otsu Algorithm
- If t is chosen as a threshold, and p(i) is the
normalized histogram
0
K-1
N bits means K 2N
6The Otsu Algorithm
- Means and variance for each class
means
variances
7The Otsu Algorithm
- Statistical discrimination measure based on
variance between classes
- Run through all possible values of t, and pick
the one that maximizes the discrimination measure
Chosen Threshold
8Thresholding after Local Processing
I(x,y)
General idea Design a function f() whose inputs
can be pixel values from an entire neighborhood
around (x,y) The output of f() is a number that
can be thresholded to yield a segmentation!
9Example Local Contrast
I(x,y)
Local contrast belongs to a class of operators
known as top hat filters
Outer neighborhood
Inner neighborhood
10Cervical Smear Example
Local Contrast
Thresholding Local Contrast has better chance of
detecting nuclei!!
11Unscheduled DNA Synthesis Example
Original Image
Local Contrast
Result of thresholding LC
12More General Pixel Intensity Models
Neighborhood of pixel (x,y)
- Model the probability of an observed pixel
intensity in a channel based on - Its intensity
- Intensities of neighbors
- Any other available information
13How to build these models?
- Two basic approaches
- Supervised Methods
- Useful when we want to process a batch of similar
images - Manually segment some sample images
- From manually segmented labels, estimate model
- Unsupervised Methods
- Why bother?
- Potential to achieve more automation
- Algorithms based on unsupervised methods have the
potential to be more adaptive - Immediate question
- How does it relate to labeling problems?
- How do we do it?
14Starting Idea
Tile
- Tile the image into small blocks
- Choose the size so that each box is as
homogeneous as possible - We could also slide a window across the image
- Compute one or more features over each block
plot them - Look for groups of boxes with similar features
- Need to learn a bit of cluster analysis to get by!
slide
15Cluster Analysis
Roughness
Unlabeled points
Brightness
- We start with a scatter plot of features
- Standard plotting function in Excel
- Two questions to answer
- How many significant groups are in the data?
- What are the boundaries separating them, i.e.,
the decision regions?
16Example
8x8 boxes
17Example
Pyramidal Cells
Glial Cells
Background
Visual Assessment of the Scatter Plot
18Processing Blocks in MATLAB
- B blkproc(Image,m n,function)
You can specify any function that accepts an m by
n block of pixels, and produces a number. You
can also specify padding to make the blocks
overlap (see the manual page)
19Cluster Analysis
Pyramidal Cells
Glial Cells
Background
- Two questions to answer
- How many significant groups/clusters are in the
data? - What are the decision regions?
20Clusters
- A cluster is a set of points on the scatter plot
that are, in some defined sense, similar among
themselves - Points belonging to different clusters are
- maximally different from each other, i.e., as
heterogeneous as possible - Points within clusters are
- Maximally similar to each other, i.e., as
homogeneous as possible
21Distance Measures
- A chosen distance metric defines the sense, and
the extent to which points are considered either
similar or different - Simplest measure
- Euclidean distance
- Invariant to rigid translation and rotation of
feature space
Manhattan taxicab approximation
22Approaches to Cluster Analysis
- Two Basic Approaches
- Partitional Clustering
- Break up the data set into partitions
- Agglomerative Clustering
- A bottom-up process
- Start with pairs of data points, and group them
- Build higher-level groups progressively until all
data points are included
23k-means Clustering Algorithm
- desired clusters k
- data points N
- Step 0 Initialize means of all clusters
- Step 1 Label each data point by the nearest
- Step 2 Based on step 1, recalculate
- Step 3 If stop changing, stop. Else go
back to Step 1
24The MATLAB kmeans function
Cluster indices
Cluster centroids
Part of the Statistics Toolbox available in
RPIs MATLAB license Additional inputs and
outputs are possible if you need them For
example, you can choose a distance measure
25k-means Result
Using a package known as StatBoxPro
(www.grimmersoft.com)
26Practical Issues
- Choice of a similarity measure again crucial
- No universal measure
- Craft or choose one that is meaningful to the
data of interest - Important conceptual issue
- We need to measure distances between clusters,
i.e., sets. - In the k-means, we approximate the centroid of
each cluster as a representative for the that
cluster of points, and measured distance to it
Example
27Agglomerative Cluster Analysis
- desired clusters c
- data points N
- Initialize each point to a cluster, i.e., N
clusters - Step 1 Set c ? c 1
- Step 2 Find and merge the nearest clusters
- Step 3 if c c, stop. Else go back to Step 1.
We can make specific choices at each step. For
example, many ways to compute distances between
points and clusters.
28Hierarchical Agglomerative Clustering
- Basic idea
- The overall data is broken into two groups
- Each group is broken into subgroups
- We continue this process until either
- Each point is a group unto itself, or
- A desired number of groups has been achieved
- Two basic strategies
- Bottom-up
- Top down
Lengths indicate similarity
Dendrogram
29Hierarchical Clustering in MATLAB
- Proceeds in 3 steps
- Compute distances between every pair of data
points using function y pdist(X,metric) - Build the full hierarchical tree using the
function Z linkage(y,method) - Prune the tree to compute a chosen number of
clusters using the function - T cluster(Z,'cutoff',c,'depth',d)
Alternately, use the single combined function
clusterdata that does all 3 steps using mostly
default settings
30Agglomerative Cluster Analysis
16x16 blocks
Dendrogram
The data has 3 clearly defined clusters
31Adaptive Thresholding
- Basic Idea
- Allow the threshold to adapt (be adjusted) to
each pixel location
image
window
- Adaptive methods are always based on local
information (e.g., local window histograms) - By tiling the image or otherwise, define a N?M
pixel window around each pixel - Compute a threshold based on that local keyhole
view of the image using any method you know
(x,y)
32Practical Programming Issue
- As you slide the window, keep in mind that only a
small number of pixels change - In writing your program, try to reuse any
calculations that were made for the previous
window - The border blocks need appropriate padding
- MATLAB has sliding block processing functions
- Not very fast, but convenient
image
n
m
(x1,y)
B nlfilter(I, m n, function)
Your function
Image
33Summary
- The Otsu Algorithm for thresholding
- Pre-processing prior to thresholding
- Local contrast
- Cluster Analysis for threshold selection
- Automatic and locally-adaptive thresholding
- Next Class
- Well continue our study of blob segmentation
methods - Adaptive thresholding methods
34Homework Addendum
- 1. Download the image cell_image.TIF from the
course website - Write a program that automatically extracts the
foreground in this image using any two
non-adaptive methods discussed in class today - Submit a description of your algorithm, a
printout of your code, and the results - Extra Credit
- Write a program that adaptively extracts the
foreground in this image using any combination of
methods discussed in class today
35Instructor Contact Information
- Badri Roysam
- Professor of Electrical, Computer, Systems
Engineering - Office JEC 7010
- Rensselaer Polytechnic Institute
- 110, 8th Street, Troy, New York 12180
- Phone (518) 276-8067
- Fax (518) 276-8715
- Email roysam_at_ecse.rpi.edu
- Website http//www.ecse.rpi.edu/roysam
- Course website http//www.ecse.rpi.edu/roysam/CT
IA - Secretary Laraine Michaelides, JEC 7012, (518)
276 8525, michal_at_.rpi.edu - Grader Piyushee Jha (jhap_at_rpi.edu)
Center for Sub-Surface Imaging Sensing