Title: ECSE6963, BMED 6961 Cell
1ECSE-6963, BMED 6961Cell Tissue Image Analysis
- Lecture 13 Blob Segmentation Basics (Contd)
- Badri Roysam
- Rensselaer Polytechnic Institute, Troy, New York
12180.
2Recap Labeling Connected Components
Adaptive Smoothing Thresholding
Connected Components Labeling
Binary image
Regions labeled
image
Image
Connected Components Labeling
Binary Segmentation
3CC labeling A Versatile Tool
- MATLAB Function
- L,num bwlabel(BW,n) for 2-D images only
- BW binarized image
- n 4 or 8 (default) connectivity
- L label array, same size as BW
- num number of connected components
- L,NUM bwlabeln(BW,CONN) for n-dimensional
images - CONN 6/18/26 connectivity in 3-D space
- RGB label2rgb(L,map,zerocolor) for displaying
the CC labels - Can use CC labeling in diverse ways limited only
by our imagination - Find the background
- Count components
- Measure size (area, volume, radius), extent
(feret box, diameter), location, shape
(convexity, circularity), and orientation (min.
enclosing rectangle) features - Filter components by size shape
- Find and fill holes
- Cleanup results of edge detection
4Recap Features of Connected Components
- Area
- Feret box, and minimum enclosing rectangle
- Diameter
- Centroid
- Convexity
- Radius Circularity
5Radius Circularity
- The circularity, C, is defined as the variance of
the distances around the radius
Circularity of a circular object is zero, and for
non-circular objects, it is greater than 0
6Example Compactness
Compact
Invariant to linear image transformations,
but Watch for scale-dependent error in perimeter
estimate
Not so compact
7Perimeter
- Simplest Definition Count the number of boundary
pixels - Boundaries often associated with membranes
- Extremely important sites of biochemical activity
- CC pixels with at least one 4-connected
background neighbor are boundary pixels - In MATLAB, BW2 bwperim(BW1,CONN) identifies
perimeter pixels - Two types of boundary pixels
- Type I only one 4-connected background neighbor
- Type II Two 4-connected background neighbors
- For a more accurate estimation, necessary to
perform contour following - Freemans algorithm
- Weight for Type I pixels 1
- Weight for Type II pixels ??2
2
2
1
8Accurate Estimation of Perimeter
- Kulpas Algorithm
- Start with 8-connected contour
- Scale Freemans estimate by 0.948
- Many other formulas discussed in the literature
- 3-D case is analogous
- Surface area of a connected component
Correction factor for closed surfaces
9Contours External Internal
- Usually, external contours are better behaved
- Form closed curves when object contains no holes
- Even if parts of object are just 1 pixel wide
Practical notes 1. Internal contour would work
better if we had a single-pixel-wide tunnel 2.
Often convenient to either erode or widen
single-pixel-wide structures to 2 pixels
10Contour Following
Starting Point
- Need a way to represent a contour
- Need algorithms to
- Find a starting point
- Find the next point on contour
- Recognize when contour following is complete
11Neighbor Labeling
- A contour can be written as a series of 3-bit
numbers - Chain code directions
- Invented by Herb Freeman in the 60s
- An RPI professor
12Finding the Starting Point
- Just scan from upper left to bottom right
- The first background pixel that has a foreground
neighbor to the right is our starting point for
contour following - Pixel (2, 6) in this example
13Finding the Second Point
- Search the neighbors that have not been tested
before (from 4 to 7) - Look for first transition from background to
foreground - Pick the background pixel as the next point on
the external contour - Will always yield counter-clockwise contour
14Subsequent Points
- We need a way to keep track of whats already
been traced and whats not - P Previous pixel
- C Current pixel
- N Next pixel
Directions
15The invert() function
Directions
16Finding Subsequent Points
- Starting from , search the neighborhood
counter clockwise for contour candidates,
including the previous point - Allows algorithm to enter and leave a tunnel
- Pick the last candidate as the next direction
Directions
17Finding Subsequent Points
- Note that the previous pixel is also a candidate
in the search - Need that to handle single-pixel wide entrances
- Taken only when there are no other candidates to
avoid getting stuck
18End Point
- Stop when you encounter the start point while
finding the subsequent points - Works when you dont have holes
19Doing this in MATLAB
(x, y) sequences, one for each object
Label Matrix
No. of objects
Boundary Array
Adjacency matrix
- B,L,N,A bwboundaries (BW, CONN, options)
Binarized image
How holes should be treated holes or noholes
Type of Connectivity (4 or 8)
20Freemans Perimeter Estimate - Revisited
Directions
Number of odd direction codes in contour
Number of even direction codes in contour
21Perimeter Comments
- Perimeters, surface areas, and curve lengths are
notoriously susceptible to estimation errors - Small segmentation errors can cause big changes
- The fractal nature of object perimeters
- Often more meaningful to define these
measurements at a specific scale - We would like to smooth the contour and then
measure
22Perimeter Based Features
23Curvature
- Basic Concept
- Curvature is the rate of change of the slope of a
curve - Positive curvature means convex, and vice versa
- Using curvature, we can locate special points of
interest
24Curvature Estimation
- The derivatives can be approximated by differences
25Practical Method
m is a scale parameter Notwithstanding m, we
still need to smooth the boundary
26Shape Complexity Feature
- Find the nearest distance of each pixel to the
boundary - Efficient algorithms, known as Distance
Transforms are available to do this (shortly) - Find the average ? of the above distances
Suppose the two shapes had the same area, which
one will have more complexity?
27Using CC labels as cookie cutters
- Keep in mind that the original image data is
available, and spatially aligned with
segmentation labels - CC labels can help define regions of interest in
the image - Make spatially selective measurements over the
original image - Fluorescence intensity measurements
- Optical density measurements
28Example Absorption features
Feret Box
- Important for transmitted-light images
- Total Optical Density
- Measure background within a local neighborhood,
usually a slightly expanded Feret box, or a
rounder approximation - Mean Optical Density
- Variance of optical density
- A texture measure
29Reference
- Shape analysis Classification Theory and
Practice by Luciano da Fontura Costa - Available on-line through the RPI library catalog
- Chapter 5.2 describes the contour following
algorithm
30Summary
- Connected components labeling is a versatile tool
- Applications only limited by our imagination
- We looked at more features of regions
- We looked at shape features of regions
- Term Projects
- Need more time? Need to meet/talk?
- Next Class
- Invariance of Features
- More object features
- Distance transforms separation of connected
components
31Instructor 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 Ying Chen (cheny9_at_rpi.edu, Office JEC
6308, 518-276-8207)
Center for Sub-Surface Imaging Sensing