Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale...

49
Image Processing and Shape Tutorial For Malignant Tumor Classification Part I Fred Park UC Irvine iCAMP Summer Program July 3 rd 2012

Transcript of Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale...

Page 1: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Image Processing and Shape Tutorial

For Malignant Tumor Classification

Part I

Fred Park UC Irvine

iCAMP Summer Program

July 3rd 2012

Page 2: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Problem Intro !  Choose Optimal Shape Descriptors that correlate

highly to Tumors that are malignant with high concentrations of HGF.

!  Train on 2/3 of data.

!  Based on shape descriptors, classify remaining 1/3 of data. " classify Tumors with high concentrations of HGF based purely on descriptor info.

Page 3: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.
Page 4: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.
Page 5: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.
Page 6: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

!  Binary Image

!  1 bit per sampled pixel. Takes only values 0 or 1.

!  0 = black, 1 = white

Image Representation

y

x

(x,y): pixel location

f(x,y) = 0 or 1

(x,y) ! f(x,y) 2 {0,1}

Page 7: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Image Representation: Grayscale !  Grayscale Digital Image

!  8 bits per sampled pixel = 256 different intensities from 0 to 255. i.e. 256 shades of gray

!  Value 255 = white, 0 = black. Anything else is a shade of gray

255

0

Decreasing resolution (dpi)

Page 8: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

A Digital Image and Graph of the Function that Represents It

Digital Image Graph of f(x)

Page 9: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Image Representation: Color

R: red G: green B: blue

Channels:

•  Red Dress: high intensity in R channel •  Green Grass: high intensity in G channel

[R, G, B]

•  Pixel " [R, G, B] vector

•  8 bits per channel •  24 bit color image

Page 10: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Some Examples of Image Processing

Denoising

Deblurring

Page 11: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Some Examples of Image Processing Cont’d

Super-resolution (AKA Zooming)

Zoom in by Factor of 4

Page 12: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Inpainting

Segmentation

Some Examples of Image Processing Cont’d

Page 13: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Image Processing: Motivation Recall the Los Angeles Riots of 1992

Page 14: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

High Point of Riots: Reginald Denny Beaten Mercilessly on Nat’l. TV

Image Processing: Some Motivation

Public Outrage!

Perpetrators at large!

Page 15: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Calculus Based Image Processing Used to Enhance Footage Cognitech and UCLA Image Processing Group Help LAPD

Page 16: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

It started out as just a speck on a photograph of a man who threw a brick at truck driver Reginald Denny at Florence and Normandie avenues in the opening hours of the 1992 Los Angeles riots. But when Leonid Rudin subjected it to a complicated computer algorithm and a slew of complex mathematical equations, that speck--originally less than 1/6,000th the size of the total photograph--was revealed to be a rose-shaped tattoo on the arm of the man, later identified in court as Damian Monroe Williams.

Page 17: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

NAWCWPNS TP 8348

either identify those workstation bottlenecks that can be improved, automated, or augmented by the ACI algorithms, or to introduce new exploitation aids tailored to digital libraries.

Reginald Denny Beating Investigation

Perpetrator's tatoo superresolution

Comparison with the suspect's real tatoo

Cognitech, Inc.

FIGURE 2. Investigative Image Processing.

Outcome: All 3 Criminals Convicted!

à Original Crime Scene Video

à Tattoo Superresolution

à Comparison w/ Real Tatoo

Image Processing Crime Footage

Page 18: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Example: License Plate Recogition in Low Light

Page 19: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Example: Elevator Video Enhancement

degraded reconstructed

Page 20: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

���The Image Restoration Problem

A given Observed image f

Related to True Image u

Through Blur K

And Noise ´

�Blur+Noise Initial ����Blur

Inverse Problem: restore u, given K, and statistics for ´.

Keeping edges sharp and in the correct location is a key problem!

See Matlab functions: conv2 and filter2

Page 21: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Total Variation Regularization

!  Measures “variation” of u w/o penalizing discontinuities

!  1D: If u is monotonic on [a,b], then TV(u) = |u(b)-u(a)|, regardless of whether u is discontinuous or not

!  Coarea Formula:

!  Thus TV controls both size of jumps and geometry of boundaries

!  TV norm can be thought of as ‘Jump x Perimeter’ of a feature

!  Extends to vector valued images. e.g. Color

!  For Binary Images, TV reduces to Perimeter

Page 22: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

TV Norm vs H1 Norm

Tends to Penalize High Gradients More than the TV Norm

Preserves Edges doesn’t penalize gradients too heavily

TV norm: Sharper edges H1: More smoothed edges

Zooming Example

Page 23: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Calculus of Variations

Functional: Function of functions

•  How does one minimize a functional? Depends on functional •  Special case: convex function •  Take derivative and set equal to zero like in calculus •  Derivative wrt to a functional is called ‘variation’

First variation:

When differentiate g(u) and set = 0 you obtain:

Which can be solved by time marching:

Page 24: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Diffusion of heat source in all directions Anisotropic Diffusion: When gradient big = smaller diffusion

Observed noisy image Heat Flow TV Flow

Min TV equiv to solving: Min H1 equiv to solving Heat Equation:

Page 25: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

0=∂∂nu

Gradient Flow: ut = −g(u) = λ∇⋅ ∇u

|∇u |$

%&

'

()− (K ∗Ku−K * f )

�anisotropic diffusion �data fidelity

!  First proposed by Rudin-Osher-Fatemi ‘92.

! Allows for edge capturing (discontinuities along curves).

!  TVD schemes popular for shock capturing.

Regularization:

Variational Model:

Total Variation Restoration

Page 26: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Variational Image Processing Examples of Restoration: TV Denoising

Page 27: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Image Inpainting (Masnou-Morel; Sapiro et al ‘99)

��Disocclusion

��Graffiti Removal

Page 28: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

� � � � � ��

Unified TV Restoration & Inpainting model

∫∫ −+∇=∪ EDE

dxdyuudxdyuuJ ,||2

||][ 20λ

,0)(||

0 =−+""#

$%%&

'

∇•∇− uu

uu

.0; ,,DzEze ∈∈=λλ

(Chan and Shen ‘00) Main Idea: #  Fit only where have data #  Regularize everywhere

Fit only in E Regularize in E[D

Page 29: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

TV Inpainting: disocclusion

Page 30: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Examples of TV Inpaintings

Where is the Inpainting Region?

Page 31: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

�TV Zoom-in

Inpaint Region: high-res points that are not low-res pts

Page 32: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Image Segmentation !  Problem: Detect Salient regions & their boundaries in a given image

!  Often: P.W. Smooth (or cartoonish) regions & sharp boundaries

!  Useful for object location and recognition, medical imaging (tumor detection etc.), face recognition, tracking, … and more

Original images Our Results Brightness only [13] Normalized cuts [9]

Figure 1. Experimental results

Proceedings of the Ninth IEEE International Conference on Computer Vision (ICCV 2003) 2-Volume Set

0-7695-1950-4/03 $17.00 © 2003 IEEE

Original images Our Results Brightness only [13] Normalized cuts [9]

Figure 1. Experimental results

Proceedings of the Ninth IEEE International Conference on Computer Vision (ICCV 2003) 2-Volume Set

0-7695-1950-4/03 $17.00 © 2003 IEEE

Example Segmentations: Simple Scenes

Segmentations of simple gray-level images can provide useful infor-mation about the surfaces in the scene.

Original Image Segmentation (by SMC)

Note, unlike edge images, these boundaries delimit disjoint image re-gions (i.e. they are closed).2503: Segmentation Page: 2

Example Segmentations: Simple Scenes

Segmentations of simple gray-level images can provide useful infor-mation about the surfaces in the scene.

Original Image Segmentation (by SMC)

Note, unlike edge images, these boundaries delimit disjoint image re-gions (i.e. they are closed).2503: Segmentation Page: 2

Page 33: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

����������

�����������

�Application: “active contour”

�Initial Curve Evolutions Detected Objects

− giving an image f :Ω→ℜ

− evolve a curve C to detect objects in f− the curve has to stop on the boundaries of the objects

Page 34: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

��Basic idea in classical active contours

Curve evolution and deformation (internal forces):

Min Length(C)+Area(inside(C)) Boundary detection: what is it? What is stopping criteria for curve?

�Initial Curve Evolutions Detected Objects

Page 35: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

����������

��Basic idea in classical active contours

Curve evolution and deformation (internal forces):

Min Length(C)+Area(inside(C)) Boundary detection: stopping edge-function (external forces)

Example:

0)(lim , ,0 =↓≥∞→tggg

t

puGug

||11|)(|

00 ∗∇+

=∇σ

Snake model (Kass, Witkin, Terzopoulos 88)

∫∫ ∇+=1

0

1

0

2 |)))(((||)('|)(inf dssCIgdssCCFC

λ

∫ ∇=1

0

|)))(((||)('|2)(inf dssCIgsCCFC

Geodesic model (Caselles, Kimmel, Sapiro 95)

Page 36: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Sometimes edge detectors find the boundary pretty well.

Strong Stopping Criteria

puGug

||11|)(|

00 ∗∇+

=∇σ

Page 37: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Sometimes it�s not enough.

Fuzzy Stopping Criteria

puGug

||11|)(|

00 ∗∇+

=∇σ

different gaussians

Page 38: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

�����Limitations

��- detects only objects with sharp edges defined by gradients

- the curve can pass through the edge

- smoothing may miss edges in presence of noise

- not all can handle automatic change of topology

Examples

Page 39: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Snakes: Active Contour Models

!  Snakes or Active Contours pose the segmentation as an energy minimization problem.

!  Kass, Witkins & Terzopoulos.

Snake ext intC C

E E dp E dp∫ ∫= +

Initialization Final Segmentation

Page 40: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Local Minima !  One major drawback of Active Contour model is the

tendency to get stuck in “Local minima” caused by subtle irrelevant edges and image features.

Initialization Final Segmentation

Page 41: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

����������

�����������

| f − c1 |inside(C )∫

2dxdy+ | f − c2 |

2 dxdyoutside(C )∫

where

c1 = average( f ) inside C c2 = average( f ) outside C

�������Fit > 0 Fit > 0 Fit > 0 Fit ~ 0

Minimize: (Fitting +Regularization)

Fitting not depending on gradient detects “contours without gradient”

Data Fitting Term

Page 42: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Chan-Vese (CV) Model

!  P.W. Constant Version of Mumford Shah Model

!  Fit constant homogeneous regions while enforcing regularity on boundary of C

!  Active Contours without Edges

∫ ∫ −+−+

⋅+⋅=

)( )(

220

210

21,,

||||

))((||),,(inf21

Cinside Coutside

Ccc

dxdycudxdycu

CinsideAreaCCccF

λλ

�������Fitting + Regularization terms (length, area)

����C = boundary of an open and bounded domain

|C| = the length of the boundary-curve C

Page 43: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

��������Advantages

Automatically detects interior contours!

Works very well for concave objects

Robust w.r.t. noise

Detects blurred contours

The initial curve can be placed anywhere!

Allows for automatic change of topologies

�������������������Experimental Results C of Evolution

270 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 10, NO. 2, FEBRUARY 2001

Fig. 3. Two different regularizations of the (top) heaviside function and(bottom) delta function .

Keeping and fixed, and minimizing with respect to, we deduce the associated Euler–Lagrange equation for .Parameterizing the descent direction by an artificial time ,the equation in (with definingthe initial contour) is

div

in

in

on (9)

where denotes the exterior normal to the boundary , anddenotes the normal derivative of at the boundary.

III. NUMERICAL APPROXIMATION OF THE MODEL

First possible regularization of by functions, as pro-posed in [27], is

ifif

if

Fig. 4. Detection of different objects from a noisy image, with variousshapes and with an interior contour. Left: and the contour. Right:the piecewise-constant approximation of . Size ,

, , noreinitialization, cpu s.

In this paper, we introduce and use in our experiments the fol-lowing regularization of

These distinct approximations and regularizations of the func-tions and (taking ) are presented in Fig. 3. As

, both approximations converge to and . A differ-ence is that has a small support, the interval , while

is different of zero everywhere. Because our energy is non-convex (allowing therefore many local minima), the solutionmay depend on the initial curve. With and , the al-gorithm sometimes computes a local minimizer of the energy,

270 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 10, NO. 2, FEBRUARY 2001

Fig. 3. Two different regularizations of the (top) heaviside function and(bottom) delta function .

Keeping and fixed, and minimizing with respect to, we deduce the associated Euler–Lagrange equation for .Parameterizing the descent direction by an artificial time ,the equation in (with definingthe initial contour) is

div

in

in

on (9)

where denotes the exterior normal to the boundary , anddenotes the normal derivative of at the boundary.

III. NUMERICAL APPROXIMATION OF THE MODEL

First possible regularization of by functions, as pro-posed in [27], is

ifif

if

Fig. 4. Detection of different objects from a noisy image, with variousshapes and with an interior contour. Left: and the contour. Right:the piecewise-constant approximation of . Size ,

, , noreinitialization, cpu s.

In this paper, we introduce and use in our experiments the fol-lowing regularization of

These distinct approximations and regularizations of the func-tions and (taking ) are presented in Fig. 3. As

, both approximations converge to and . A differ-ence is that has a small support, the interval , while

is different of zero everywhere. Because our energy is non-convex (allowing therefore many local minima), the solutionmay depend on the initial curve. With and , the al-gorithm sometimes computes a local minimizer of the energy,

274 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 10, NO. 2, FEBRUARY 2001

Fig. 12. Spiral from an art picture. Size , , five iterations of reinitialization, cpu s.

the geometric model (2)], by which the curve cannot detect thesmooth boundary.

In Fig. 10, we validate our model on a very different problem:to detect features in spatial point processes in the presence of

274 IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 10, NO. 2, FEBRUARY 2001

Fig. 12. Spiral from an art picture. Size , , five iterations of reinitialization, cpu s.

the geometric model (2)], by which the curve cannot detect thesmooth boundary.

In Fig. 10, we validate our model on a very different problem:to detect features in spatial point processes in the presence of

Page 44: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Matlab Demo !  Polygonal P.W. Constant Mumford Shah

Page 45: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Shape Definition

Silhouette of Hand

Four exact copies of same shape under different Euclidean transformations

Mathematician David George Kendall defined shape as: “Shape is all the geometric information that remains when location, scale, and rotational effects are filtered out from an object”

Page 46: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Useful Descriptor Properties ! Invariance to translation

! Invariance to rotation

! Scalability

! Unique I.D. of certain shapes. E.g. Convex Shapes

Page 47: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Descriptor Examples !  Fourier: shape info in low freq. components

!  Moments: mean, variance, skew, kurtosis

!  Centered/Centroid Distance

!  Cliques: Intervertex Distances

!  Inner Distance

!  Landmarks and Statistical Signatures

!  Many others, still very active research topic

Page 48: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Future Work !  Classification Problem

!  Preprocessing Data. Lots of clutter and noise.

!  Segmentation of Tumor Images using Snakes/Active Contours. Difficult due to clutter.

!  TV norm or other norms as a descriptor

!  Meyer G norm to measure oscillation or other Negative Sobolev Norms

Page 49: Image Processing and Shape Tutorial For Malignant …Image Representation: Grayscale ! Grayscale Digital Image ! 8 bits per sampled pixel = 256 different intensities from 0 to 255.

Thank You for Your Attention!