31
Computational Biology, Part 22 Biological Imaging II Robert F. Murphy Robert F. Murphy Copyright Copyright 1996, 1999, 1996, 1999, 2000. 2000. All rights reserved. All rights reserved.

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

Embed Size (px)

Citation preview

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

Computational Biology, Part 22Biological Imaging II

Computational Biology, Part 22Biological Imaging II

Robert F. MurphyRobert F. Murphy

Copyright Copyright 1996, 1999, 2000. 1996, 1999, 2000.

All rights reserved.All rights reserved.

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

Image DisplayImage Display

Operations that change display without Operations that change display without changing imagechanging image 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 3: Computational Biology, Part 22 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000. All rights reserved

Image DisplayImage Display

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

Image DisplayImage Display

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

Image DisplayImage Display

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

Image DisplayImage Display

Note that image is identical to original (LUT change is reversible)

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

Image DisplayImage Display

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

Image DisplayImage Display After enhancement uses full range

Original (before contrast enhancement)

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

ThresholdingThresholding

Thresholding refers to the division of the Thresholding refers to the division of the pixels of an image into two classes: those pixels of an image into two classes: those below a certain value (the below a certain value (the thresholdthreshold) and ) and those at or above it. The two classes are those at 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 consider Thresholding serves as a means to consider only a only a subsetsubset of the pixels of an images. of the pixels of an images.

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

ThresholdingThresholding

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

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

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

ThresholdingThresholdingWhite on black images need to be inverted before some of NIH Image’s operations work as desired

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

ThresholdingThresholding

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

ThresholdingThresholding

Once a threshold has been applied, the Once a threshold has been applied, the resulting image may beresulting image may be displayeddisplayed in black and white in black and white displayeddisplayed with above threshold pixels at their with above threshold pixels at their

original intensities and below threshold pixels original intensities and below threshold pixels in blackin black

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

ThresholdingThresholding

Once a threshold has been applied, the Once a threshold has been applied, the resulting image may beresulting image may be savedsaved as a new image with only pixels above as a new image with only pixels above

threshold being retained (others set to 0)threshold being retained (others set to 0) savedsaved as or as or convertedconverted to a binary image (above to a binary image (above

threshold pixels set to 1, below threshold pixels threshold pixels set to 1, below threshold pixels set to 0)set to 0)

Page 15: Computational Biology, Part 22 Biological Imaging II Robert F. Murphy Copyright  1996, 1999, 2000. 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 more of its Set “on” pixel to “off” if four or more of its

eight neighbors are whiteeight neighbors are white DilationDilation

Add pixels to edges of objectsAdd pixels to edges of objects Set “off” pixel to “on” if four or more of its Set “off” pixel to “on” if four or more of its

neighbors are blackneighbors are black

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

Binary image operationsBinary image operations

“Make Binary” is necessary before Binary operations can be used

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

Binary image operationsBinary image operations

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

Binary image operationsBinary image operations

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

Binary image operationsBinary image operationsThis image shows just the pixels that were turned off by the erode operation

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

Binary image operationsBinary image operations

OpenOpen Smooth objects and fill in small holesSmooth objects and fill in small holes Erosion followed by dilationErosion followed by dilation

CloseClose Smooth objects and fill in small holesSmooth objects and fill in small holes Dilation followed by erosionDilation followed by erosion

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

Binary image operationsBinary image operations

OutlineOutline Find “on” pixel, trace around outside until Find “on” pixel, trace around outside until

return to first “on” pixelreturn to first “on” pixel SkeletonizeSkeletonize

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

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

Binary image operationsBinary image operations

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

Binary image operationsBinary image operations

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

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

Principle: Identify a contiguous set of pixels Principle: Identify a contiguous set of pixels that are all above some thresholdthat are all above some threshold

Implementation:Implementation: Start with a binary (thresholded) imageStart with a binary (thresholded) image Find a pixel that is “on” and start a list or mapFind a pixel that is “on” and start a list or map Recursively search all nearest neighbors for Recursively search all nearest neighbors for

additional pixels that are on and add them to the additional pixels that are on and add them to the list or maplist or map

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

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

Remember to start with a thresholded image converted to binary!

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

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

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

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

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

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

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

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

Export... gives the same result as Save As...

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

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

Results file can be opened within Simpletext (use fixed width font!) or read by Excel (e.g., for plotting)

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

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

Uses:Uses: Counting objectsCounting objects Obtaining area measurements for objectsObtaining area measurements for objects Obtaining integrated intensityObtaining integrated intensity Isolating objects for other processingIsolating objects for other processing