computational biology, part 23 biological imaging iii g. steven vanni robert f. murphy copyright ...

27
Computational Biology, Part 23 Biological Imaging III G. Steven Vanni G. Steven Vanni Robert F. Murphy Robert F. Murphy Copyright Copyright 1998, 2000. 1998, 2000. All rights reserved. All rights reserved.

Upload: kristopher-burke

Post on 02-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Computational Biology, Part 23Biological Imaging III

Computational Biology, Part 23Biological Imaging III

G. Steven VanniG. Steven Vanni

Robert F. MurphyRobert F. Murphy

Copyright Copyright 1998, 2000. 1998, 2000.

All rights reserved.All rights reserved.

Basic Image Processing OperationsBasic Image Processing Operations

Arithmetic OperationsArithmetic Operations Kernel OperationsKernel Operations Image MathImage Math

Arithmetic OperationsArithmetic Operations

Two cases:Two cases: Perform a Perform a singlesingle operand operation (e.g., operand operation (e.g.,

logarithm, square root) on each pixel of an imagelogarithm, square root) on each pixel of an image Perform a Perform a dualdual operand operation (e.g., add, operand operation (e.g., add,

multiply) on each pixel of an image using a multiply) on each pixel of an image using a constantconstant as the second operand as the second operand

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

Arithmetic OperationsArithmetic Operations

Kernel OperationsKernel Operations Basic idea: Use a matrix (usually square and Basic idea: Use a matrix (usually square and

of odd dimension, e.g., 3x3) in combination of odd dimension, e.g., 3x3) in combination with an image to generate a new imagewith an image to generate 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 pixelAlign the matrix to center it on that pixel For each position in the matrix, multiply the For each position in the matrix, multiply the

corresponding pixel value in the image by the corresponding pixel value in the image by the value in the matrix and sum the resultsvalue in the matrix and sum the results

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

Kernel OperationsKernel Operations

A matrix used in this fashion is called a A matrix used in this fashion is called a kernelkernel

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

one resultone result

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

Examples of Kernel Operations using NIH ImageExamples of Kernel Operations using NIH Image

Open an example file (from Mellon: BioServer: File Open an example file (from Mellon: BioServer: File Service: Courses: 03310: Demos: NIH Image files)Service: Courses: 03310: Demos: NIH Image files)

Original Original imageimage

Examples of Kernel Operations using NIH ImageExamples of Kernel Operations using NIH Image

SmoothSmooth

Results Results of one of one Smooth Smooth

Results Results of a of a second second Smooth Smooth

Examples of Kernel Operations using NIH ImageExamples of Kernel Operations using NIH Image

Close smoothed image, reopen original image, then Close smoothed image, reopen original image, then SharpenSharpen

Original Original imageimage

Image Image after after one one SharpenSharpen

Image Image after a after a second second SharpenSharpen

Examples of Kernel Operations using NIH ImageExamples of Kernel Operations using NIH Image

Close sharpened image, reopen original image, then Find Close sharpened image, reopen original image, then Find EdgesEdges

Image Image after after Find Find EdgesEdges

Example kernelsExample kernels

SmoothingSmoothing

1 1 11 4 11 1 1

Example kernelsExample kernels

SharpenSharpen

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

Example kernelsExample kernels

Edge detection (Sobel)Edge detection (Sobel)

1 2 10 0 0-1 -2 -1

Image MathImage Math

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

Algorithm:Algorithm: For each pixel in the first image, operate on it For each pixel in the first image, operate on it

using the corresponding pixel in the second using the corresponding pixel in the second image and store the result in the corresponding image and store the result in the corresponding pixel in a new (output) imagepixel in a new (output) image

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 another one image with another

(usually binary) image(usually binary) image

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

Ratio of Ratio of sharp to sharp to original original image image (shows (shows regions regions affected affected by by sharpen)sharpen)

Image Math vs. Arithmetic OperationsImage Math vs. Arithmetic Operations Note difference between Image Math which does Note difference between Image Math which does

an operation on two images and Arithmetic which an operation on two images and Arithmetic which does an operation on a single image and a constantdoes an operation on a single image and a constant

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

Inputs: Image, Constant (optional)Inputs: Image, Constant (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