Top Banner
Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Robert F. Murphy Copyright Copyright 1996, 1999, 1996, 1999, 2000-2006. 2000-2006. All rights reserved. All rights reserved.
52

Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright 1996, 1999, 2000-2006. All rights reserved.

Dec 14, 2015

Download

Documents

Sarai Appleton
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Computational Biology, Part 23

Biological Imaging II

Computational Biology, Part 23

Biological Imaging II

Robert F. MurphyRobert F. Murphy

Copyright Copyright 1996, 1999, 1996, 1999, 2000-2006.2000-2006.

All rights reserved.All rights reserved.

Page 2: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

OutlineOutline

Image DisplayImage Display Image ProcessingImage Processing Image AnalysisImage Analysis Image InterpretationImage Interpretation

Page 3: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

From Images to Knowledge From Images to Knowledge

Image ProcessingImage Image

Image AnalysisImage

Image InterpretationImage

Numbers

Knowledge

Page 4: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image DisplayImage Display

Operations that change Operations that change display without changing display without changing imageimage LUT - grayscale or colorLUT - grayscale or color Contrast stretchingContrast stretching

Operations that change imageOperations that change image reversiblereversible non-reversible (majority)non-reversible (majority)

Page 5: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image Display - LUT changeImage Display - LUT change

Page 6: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image Display - LUT changeImage Display - LUT change

Page 7: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image Display - Enhance contrastImage Display - Enhance contrast

Page 8: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image DisplayImage Display After enhancement uses full range

Original (before contrast enhancement)

Page 9: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

ThresholdingThresholding

Thresholding refers to the division Thresholding refers to the division of the pixels of an image into two of the pixels of an image into two classes: those below a certain classes: those below a certain value (the value (the thresholdthreshold) and those at ) and those at or above it. The two classes are or above it. The two classes are often shown in white and black, often shown in white and black, respectively.respectively.

Thresholding serves as a means to Thresholding serves as a means to consider only a consider only a subsetsubset of the of the pixels of an images.pixels of an images.

Page 10: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

ThresholdingThresholding

The choice of threshold must be The choice of threshold must be made empirically by considering the made empirically by considering the nature of the sample, the type and nature of the sample, the type and number of objects expected in the number of objects expected in the image, and/or a histogram of pixel image, and/or a histogram of pixel valuesvalues

The threshold can be specified as a The threshold can be specified as a multiple of the background value multiple of the background value (normally the most common value) (normally the most common value) for partial automationfor partial automation

Page 11: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

ThresholdingThresholding

Page 12: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

ThresholdingThresholding

Once a threshold has been Once a threshold has been applied, the resulting image applied, the resulting image may bemay be displayeddisplayed in black and white in black and white displayeddisplayed with above threshold with above threshold pixels at their original pixels at their original intensities and below threshold intensities and below threshold pixels in blackpixels in black

Page 13: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

ThresholdingThresholding

Once a threshold has been Once a threshold has been applied, the resulting image may applied, the resulting image may bebe savedsaved as a new image with only as a new image with only pixels above threshold being pixels above threshold being retained (others set to 0)retained (others set to 0)

savedsaved as or as or convertedconverted to a binary to a binary image (above threshold pixels set to image (above threshold pixels set to 1, below threshold pixels set to 0)1, below threshold pixels set to 0)

Page 14: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Binary image operationsBinary image operations ErosionErosion

Remove pixels from edges of objectsRemove pixels from edges of objects Set “on” pixel to “off” if four or Set “on” pixel to “off” if four or more of its eight neighbors are more of its eight neighbors are whitewhite

DilationDilation Add pixels to edges of objectsAdd pixels to edges of objects Set “off” pixel to “on” if four or Set “off” pixel to “on” if four or more of its neighbors are blackmore of its neighbors are black

Page 15: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Binary image operationsBinary image operations Process/Binary/

Threshold does auto threshold and applies it to make binary image

Page 16: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Binary image operationsBinary image operations

Page 17: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Binary image operationsBinary image operations

This image shows just the pixels that were turned off by the erode operation

Page 18: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Binary image operationsBinary image operations OpenOpen

Smooth objects and fill in small Smooth objects and fill in small holesholes

Erosion followed by dilationErosion followed by dilation CloseClose

Smooth objects and fill in small Smooth objects and fill in small holesholes

Dilation followed by erosionDilation followed by erosion

Page 19: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Binary image operationsBinary image operations OutlineOutline

Find “on” pixel, trace around Find “on” pixel, trace around outside until return to first outside until return to first “on” pixel“on” pixel

SkeletonizeSkeletonize Remove pixels from the edges of Remove pixels from the edges of objects until the objects are objects until the objects are one pixel wideone pixel wide

Page 20: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Binary image operationsBinary image operations

Page 21: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Binary image operations - outlineBinary image operations - outline

Page 22: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Basic Image Processing OperationsBasic Image Processing Operations

Image MathImage Math Kernel/Filter OperationsKernel/Filter Operations Image CalculatorImage Calculator

Page 23: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Arithmetic OperationsArithmetic Operations

Two cases:Two cases: Perform a Perform a singlesingle operand operation operand operation (e.g., logarithm, square root) on each (e.g., logarithm, square root) on each pixel of an imagepixel of an image

Perform a Perform a dualdual operand operation operand operation (e.g., add, multiply) on each pixel of (e.g., add, multiply) on each pixel of an image using a an image using a constantconstant as the as the second operandsecond operand

In both cases, the result is In both cases, the result is usually stored in the same pixel usually stored in the same pixel location (“storing in place”)location (“storing in place”)

Page 24: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Arithmetic OperationsArithmetic Operations

Page 25: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Kernel/Filter OperationsKernel/Filter Operations Basic idea: Use a matrix (usually Basic idea: Use a matrix (usually square and of odd dimension, e.g., square and of odd dimension, e.g., 3x3) in combination with an image to 3x3) in combination with an image to generate a new imagegenerate a new image

Algorithm:Algorithm: For each pixel in the image (the For each pixel in the image (the currentcurrent pixelpixel))

Align the matrix to center it on that Align the matrix to center it on that pixelpixel

For each position in the matrix, For each position in the matrix, multiply the corresponding pixel value multiply the corresponding pixel value in the image by the value in the matrix in the image by the value in the matrix and sum the resultsand sum the results

Store the result in the Store the result in the currentcurrent pixelpixel

Page 26: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Kernel/Filter OperationsKernel/Filter Operations A matrix used in this fashion is A matrix used in this fashion is called a called a kernel kernel oror filter filter

Note that the operation is Note that the operation is different from matrix different from matrix multiplication of the kernel by multiplication of the kernel by the image becausethe image because the dimensions don’t match, andthe dimensions don’t match, and all elements of the matrix are all elements of the matrix are combined to give one resultcombined to give one result

Page 27: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Common Kernel Operations used in Image Processing

Common Kernel Operations used in Image Processing SmoothingSmoothing SharpeningSharpening Edge FindingEdge Finding

Page 28: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

OrigiOriginal nal imageimage

Page 29: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Examples of Kernel Operations using NIH Image

Examples of Kernel Operations using NIH Image

SmoothSmooth

Page 30: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

ResulResults of ts of one one SmootSmooth h

Page 31: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

ResulResults of ts of a a seconsecond d SmootSmooth h

Page 32: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Examples of Kernel Operations using NIH Image

Examples of Kernel Operations using NIH Image

Close smoothed image, reopen original Close smoothed image, reopen original image, then Sharpenimage, then Sharpen

Page 33: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

OrigiOriginal nal imageimage

Page 34: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image Image after after one one SharpSharpenen

Page 35: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image Image after after a a seconsecond d SharpSharpenen

Page 36: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Examples of Kernel Operations using NIH Image

Examples of Kernel Operations using NIH Image

Close sharpened image, reopen original Close sharpened image, reopen original image, then Find Edgesimage, then Find Edges

Page 37: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image Image after after Find Find EdgesEdges

Page 38: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Example kernelsExample kernels

SmoothingSmoothing

1 1 11 4 11 1 1

Page 39: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Example kernelsExample kernels

SharpenSharpen

-1 -1 -1-1 12 -1-1 -1 -1

Page 40: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Example kernelsExample kernels

Edge detection (Sobel)Edge detection (Sobel)

1 2 10 0 0-1 -2 -1

Page 41: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image MathImage Math

Basic idea: Combine two images Basic idea: Combine two images using an dual operand operator to using an dual operand operator to generate a new imagegenerate a new image

Algorithm:Algorithm: For each pixel in the first image, For each pixel in the first image, operate on it using the operate on it using the corresponding pixel in the second corresponding pixel in the second image and store the result in the image and store the result in the corresponding pixel in a new corresponding pixel in a new (output) image(output) image

Page 42: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image MathImage Math

Any operator can be usedAny operator can be used Most common operators:Most common operators:

division: generate ratio imagedivision: generate ratio image logical AND: logical AND: maskmask one image with one image with another (usually binary) imageanother (usually binary) image

Page 43: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Examples of Image Math using NIH ImageExamples of Image Math using NIH Image

Open original image and sharpen once (save as Open original image and sharpen once (save as Abdomen.sharpen1), reopen original imageAbdomen.sharpen1), reopen original image

Page 44: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Ratio Ratio of of sharp sharp to to originaoriginal image l image (shows (shows regions regions affecteaffected by d by sharpensharpen))

Page 45: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image Math vs. Arithmetic OperationsImage Math vs. Arithmetic Operations Note difference between Image Math Note difference between Image Math which does an operation on two which does an operation on two images and Arithmetic which does images and Arithmetic which does an operation on a single image and an operation on a single image and a constanta constant

Page 46: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Summary: Basic Image Processing OperationsSummary: Basic Image Processing Operations Arithmetic OperationsArithmetic Operations

Inputs: Image, Constant Inputs: Image, Constant (optional)(optional)

Common use: Subtract backgroundCommon use: Subtract background Kernel OperationsKernel Operations

Inputs: Image, KernelInputs: Image, Kernel Common use: SmoothingCommon use: Smoothing

Image MathImage Math Inputs: Two imagesInputs: Two images Common use: Generate ratio imageCommon use: Generate ratio image

Page 47: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Image ProcessingImage Processing

Basic example of image Basic example of image processing: find objects in processing: find objects in an image and describe them an image and describe them numericallynumerically

Page 48: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Object finding (Particle analysis)Object finding (Particle analysis) Principle: Identify a contiguous Principle: Identify a contiguous set of pixels that are all above set of pixels that are all above some thresholdsome threshold

Implementation:Implementation: Start with a binary (thresholded) imageStart with a binary (thresholded) image Find a pixel that is “on” and start a Find a pixel that is “on” and start a list or maplist or map

Recursively search all nearest Recursively search all nearest neighbors for additional pixels that neighbors for additional pixels that are on and add them to the list or mapare on and add them to the list or map

Page 49: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Object finding (Particle analysis)Object finding (Particle analysis)

Start with a thresholded image (Image/Adjust/Threshold)

Page 50: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Object finding (Particle analysis)Object finding (Particle analysis)

Page 51: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Object finding (Particle analysis)Object finding (Particle analysis)

Save as Excel file using Save As...

Page 52: Computational Biology, Part 23 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000-2006. All rights reserved.

Object finding (Particle analysis)Object finding (Particle analysis) Uses:Uses:

Counting objectsCounting objects Obtaining area measurements for Obtaining area measurements for objectsobjects

Obtaining integrated intensityObtaining integrated intensity Isolating objects for other Isolating objects for other processingprocessing