Image Enhancement in the Spatial Domain Lecture 1: Image Enhancement Spatial Domain o o o o Image Intensity/Contrast Transforms Image Histogram Analysis Arithmetic/Logical Image Operations Spatial Filtering (Klifa) BioE 244 Medical Image Processing and Analysis T.R. .R. McKnight, Colin Studholme UCSF 2 1 Spatial Domain Image Operations Intensity/Contrast Transformations o Point Pixel/Voxel Processing o Spatial operators act directly on the pixels comprising the image, unlike frequency domain operators which act on the frequency representation of the image. o g(x,y) = T[ f(x,y) ] 1 x 1 neighborhood: s = T(r) Intensity or graylevel transformation, pixel mapping S = T(r) Output Image Value f(x,y) - input image g(x,y) - output image T - spatial operator g(x,y) f(x,y) Input Image Value r Typically implemented with a lookup table S = T(r) S = T(r) T Contrast Stretching r Dark Contrast Stretch T.R. .R. McKnight, Colin Studholme Light UCSF 3 Threshold Light T.R. .R. McKnight, Colin Studholme Dark Dark = r Light Dark Light UCSF 4 Thresholding S = T(r) thr1 = im2bw(byt,.35); S = T(r) Dark r S = T(r) Dark Light r Dark thr1 = im2bw(byt,.50); Light Light r Dark Light S = T(r) J = imadjust(I) maps the values in intensity image I to new values in J such that 1% of data is saturated at low and high intensities of I. This increases the contrast of the output image J. This T.R. .R. McKnight, syntax is equivalent to imadjust(I,stretchlim(I)). Colin Studholme thr1 = im2bw(byt,.75); T.R. .R. McKnight, Colin Studholme UCSF 5 UCSF 6 r CT intensity Range and Intensity Windowing Gray Level Transforms o Image Negative, Inverse Transform o s=L-1-r L-1 3L/4 S L/2 L/4 0 0 L/4 L/2 3L/4 L-1 r imadjust(I, [0 ; 1], [1 ; 0]); or imcomplement(I) -1000HU to 1000 HU mapped to 128 gray levels -0HU to 100 HU mapped to 128 grayT.R. levels .R. McKnight, Colin Studholme T.R. .R. McKnight, Colin Studholme UCSF 7 UCSF 8 Gray Level Transforms Gray Level Transforms o Log Transform o s = c log(1+r) o Compresses dynamic range of images that have large variation in intensities L-1 o Most common display for FFTs o o Gamma Correction, Power-Law Transform s=cr = 1 => identity image < 1: maps narrow I range (dark) to a wider dynamic range > 1: maps wide range of I to narrow range o Predominantly used for image capture, display, and printing 3L/4 S = 0.4 L-1 3L/4 S =1 L/2 L/4 0 0 L/2 L/4 L/2 r L/4 3L/4 0 0 L/4 L/2 3L/4 L-1 r =1 T.R. .R. McKnight, Colin Studholme = 0.4 = 2.5 imadjust(I, [ ], [ ], 0.4); T.R. .R. McKnight, Colin Studholme imadjust(I, [ ], [ ], 2.5); UCSF 9 Histogram Analysis UCSF 10 Histogram Equalization o The histogram (h) of an image with L graylevels is defined as h(rk) = nk, where rk is the k-th gray level and nk is the number of pixels with intensity rk o Image Transformations (T): s = T(r) o Histogram normalization: p(rk ) = nk /ntotal, for k = 0, 1, 2, , L-1 o Histogram equalization: o Useful for image enhancement, obtaining image statistics, segmentation, and compression o Spreads the histogram of the input image over a larger range of intensities T.R. .R. McKnight, Colin Studholme UCSF 11 k s k = j=0 nj n L-1 = 2.5 0 r 1 (normalized intensities) for k = 0, 1, 2, , L-1 Histogram transformation function (T) T.R. .R. McKnight, Colin Studholme UCSF 12 Histogram Matching o Histogram matching, Histogram specification o Histogram mapping of Image 1: o Histogram of Image 1: k s k = j=0 nj for k = 0,1,2, ,L-1 n for k = 0,1,2, ,L-1 k G z k =i=0 p z z i o Histogram matching to Image 2: for k = 0,1,2, ,L-1 z k =G1 s k T.R. .R. McKnight, Colin Studholme UCSF 14 Image subtraction in medical Imaging: DSA: digital Subtraction Angiography Arithmetic & Logic Image Operations o Pixel-by-pixel mathematical operations o Arithmetic (eg addition, subtraction, division, etc) o Logic (eg AND, OR, NOT) => used in masking operations T.R. .R. McKnight, Colin Studholme T.R. .R. McKnight, Colin Studholme UCSF 15 UCSF 16 Subtraction SPECT imaging (after registration) Image Subtraction Problem: We have used physiologic MRI data to simulate (predict) the distribution of gadolinium-labeled liposomes infused into pig brain by convection-enhanced delivery (CED). How do we evaluate the accuracy of our simulation? Actual CED Difference (Actual - Sim) Simulated CED - = T.R. .R. McKnight, Colin Studholme T.R. .R. McKnight, Colin Studholme UCSF 17 UCSF 18 Image Subtraction: Masking Actual CED Image Logic: Masking Simulated CED Quantify Volume of Difference or Standard Error Simulated CED mask Actual CED Actual CED mask - & Difference |RealMask- SimMask| Simulated CED mask = T.R. .R. McKnight, Colin Studholme T.R. .R. McKnight, Colin Studholme UCSF 19 UCSF 20 Spatial Filters o Kernal Small 2D array eg 3x3 neighborhood filter, kernal, template, window y y y y y . . . x x y x y x x y y y . . . x x = x x y x x T.R. .R. McKnight, Colin Studholme UCSF 21
© Copyright 2026 Paperzz