<<

Extended Depth-of- in a Laser Scanning System Employing a Synthesized Difference-of-Gaussians Pupil

by Alexander Kourakos

Thesis submitted to the faculty of the Virginia Polytechnic Institute and State University in partial fulfillment of the requirements for the degree of

Master of Science in Electrical Engineering

Dr. Ting-Chung Poon, Chair Dr. Gary S. Brown Dr. Guy J. Indebetouw

May 1999 Blacksburg, Virginia

Keywords: extended depth of field, optical scanning microscopy, pupil synthesis

Copyright c 1999 Alexander Kourakos

Extended Depth-of-focus in a Laser Scanning System Employing a Synthesized Difference-of-Gaussians Pupil

by Alexander Kourakos

Abstract

Traditional laser scanning systems, such as those used for microscopy, typically image objects of finite thickness. If the depth-of-focus of such systems is low, as is the case when a simple clear pupil is used, the object must be very thin or the image will be distorted. Several methods have been developed to deal with this problem. A microscope with a thin annular pupil has a very high depth-of-focus and can image the entire thickness of a sample, but most of the laser light is blocked, and the image shows poor contrast and high noise. In confocal laser microscopy, the depth-of-focus problem is eliminated by using a small to discard information from all but one thin plane of the sample. However, such a system requires scanning passes at many different depths to yield an image of the entire thickness of the sample, which is a time-consuming process and is highly sensitive to registration errors. In this thesis, a novel type of scanning system is considered. The sample is simultaneously scanned with a combination of two Gaussian laser beams of different widths and slightly different temporal frequencies. Information from scanning with the two beams is recorded with a photodetector, separated electronically, and processed to form an image. This image is similar to one formed by a system using a difference-of-Gaussians pupil, except no light has been blocked or wasted. Also, the entire sample can be scanned in one pass. The depth- of-focus characteristics of this synthesized difference-of-Gaussians pupil are examined and compared with those of well-known functions such as the circular, annular, and conventional difference-of-Gaussians pupils. Acknowledgments

First I would like to thank my advisor, Dr. Ting-Chung Poon, for introducing me to this research topic, and more importantly, for his suggestions, guidance, and patience. I would also like to thank Dr. Gary Brown and Dr. Guy Indebetouw for serving on my committee, and for the insights they’ve given me both in and out of the classroom. I want to thank my mother and father for their understanding and encouragement. No matter what paths I take in life, they are always by my side. I’d like to thank Doug Mauer of Biz Net Technologies for being patient and not making too big a fuss when I basically disappeared from my job for a few months to finish up my thesis. Finally, I’d like to extend heartfelt thanks to Kathleen Rio. With her support and caring, impossible things were made possible. She is a wonderful friend and companion, and I dedicate this thesis to her.

This work was financially supported by a James A. Shannon Director’s Award from the National Institutes of Health.

ii Contents

1 Introduction 1 1.1GeneralIntroduction...... 1 1.2Motivation...... 2 1.3OrganizationofThesis...... 2

2 Background 4 2.1MathematicalPreliminaries...... 4 2.2SimpleLaserScanningSystem...... 4

3 Depth-of-focus Concepts 8 3.1GeneralizedPupilFunction...... 8 3.2AnalysisofPupilFunctions...... 11 3.2.1 PSFandMTFofPupilFunctions...... 12 3.2.2 AmbiguityFunction...... 18 3.2.3 StrehlRatio...... 20 3.2.4 Hopkin’sCriterion...... 21 3.3Post-processingWithCorrectiveFilter...... 23 3.4ImagingSimulations...... 26

iii CONTENTS iv

4 Synthesized Difference-of-Gaussians Pupil 32 4.1Implementation...... 32 4.2EffectsofMisfocus...... 35 4.2.1 FindingOptimumParameterValues...... 36 4.2.2 PSFandMTFResults...... 37 4.2.3 StrehlRatio...... 43 4.2.4 Hopkin’sCriterion...... 45 4.3ImagingSimulations...... 45 4.4Signal-to-noiseConsiderations...... 45

5 Conclusions 53

A Strehl Ratio Derivations 55 A.1Difference-of-Gaussians...... 55 A.2SynthesizedDifference-of-Gaussians...... 56

B Program Listings 57 B.1 p.m — PupilFunctions...... 58 B.2 plot_otf_2d.m — PlotMTF...... 59

B.3 plot_otf_2d_w20.m — Plot MTF vs. W20 ...... 61 B.4 strehl.m — StrehlRatio...... 63

B.5 find_w20_max_strehl.m —FindMaxW20 withStrehlRatio...... 64 B.6 hopkins.m — Hopkin’sCriterion...... 65 B.7 hopkins_dog.m — Hopkin’sCriterion(Difference-of-Gaussians)...... 67

B.8 find_w20_max_hopkins.m —FindMaxW20 with Hopkin’s Criterion . . . 69

B.9 find_best_wb.m — Find Optimal wb (Difference-of-Gaussians)...... 70 B.10 spoke.m — SpokePattern...... 71 B.11 plot_spoke.m — PlotImageofSpokePattern...... 72 B.12 plot_otf_2d_sdog.m — PlotMTF(SDoG)...... 74

B.13 plot_otf_2d_w20_sdog.m — Plot MTF vs. W20 (SDoG)...... 76 CONTENTS v

B.14 strehl_sdog.m — StrehlRatio(SDoG)...... 78

B.15 find_w20_max_strehl_sdog.m —FindMaxW20 with Strehl Ratio (SDoG) 80 B.16 hopkins_sdog.m — Hopkin’sCriterion(SDoG)...... 81

B.17 find_best_wb_sdog.m — Find Optimal wb (SDoG)...... 83 B.18 find_best_beta.m — Find Optimal β (SDoG)...... 84

B.19 find_w20_max_hopkins_sdog.m —FindMaxW20 with Hopkin’s Criterion (SDoG)...... 85 B.20 plot_spoke_sdog.m — PlotImageofSpokePattern(SDoG)...... 86

Bibliography 89

Vita 91 List of Figures

2.1Simplifieddiagramoflaserscanningsystemoptics...... 5

3.1Diagramclarifyingthedefinitionoftheaberrationfunction...... 9 3.2 Plots of circular pupil function...... 12 3.3 Plots of annular pupil function...... 13 3.4 Plots of Gaussian pupil function...... 13 3.5 Plots of difference-of-Gaussians pupil function...... 14

3.6 Plots of PSF vs. W20/λ forcircularpupil...... 15

3.7 Plots of MTF vs. W20/λ forcircularpupil...... 15

3.8 Plots of PSF vs. W20/λ forannularpupil...... 16

3.9 Plots of MTF vs. W20/λ forannularpupil...... 16

3.10 Plots of PSF vs. W20/λ forGaussianpupil...... 17

3.11 Plots of MTF vs. W20/λ forGaussianpupil...... 17

3.12 Plots of PSF vs. W20/λ fordifference-of-Gaussianspupil...... 18

3.13 Plots of MTF vs. W20/λ fordifference-of-Gaussianspupil...... 19 3.14PlotsofStrehlratioforvariouspupils...... 22

3.15 Plots of minimum (u, v; W20)/ (u, v;0) vs. W20/λ for various pupils. . . . 24 |H H | 3.16 Plot of minimum (u, v; W20)/ (u, v;0) vs. wb for difference-of-Gaussians pupil...... |H H | 25 3.17Spokepattern...... 27 3.18Spokepatternimagedwithmisfocusedcircularpupil...... 28 3.19Spokepatternimagedwithmisfocusedannularpupil...... 29 3.20SpokepatternimagedwithmisfocusedGaussianpupil...... 30

vi LIST OF FIGURES vii

3.21Spokepatternimagedwithmisfocuseddifference-of-Gaussianspupil...... 31

4.1SystemtocreatetheSDoGpupil...... 33

4.2 Plot of minimum (u, v; W20)/ (u, v;0) vs. wb for SDoG pupil (β =1).. . 36 |H H | 4.3 Plot of minimum (u, v; W20)/ (u, v;0) vs. β forSDoGpupil...... 37 |H H | 4.4 Plot of minimum (u, v; W20)/ (u, v;0) vs. wb for SDoG pupil (β =1.08). 38 |H H | 4.5 Plots of PSF vs. W20/λ for SDoG pupil (β =1)...... 38

4.6 Plots of MTF vs. W20/λ for SDoG pupil (β =1)...... 39

4.7 Plots of PSF vs. W20/λ for SDoG pupil (β =1.08)...... 39

4.8 Plots of MTF vs. W20/λ for SDoG pupil (β =1.08)...... 40 4.9 Plots of extremely misfocused PSF and MTF for SDoG pupil (β =1)..... 41 4.10 Plots of extremely misfocused PSF and MTF for SDoG pupil (β =1.08). . . 41

4.11 Plots of PSF vs. W20/λ for SDoG pupil (β = βw)...... 42

4.12 Plots of MTF vs. W20/λ for SDoG pupil (β = βw)...... 42 4.13PlotsofStrehlratioforSDoGpupil...... 43

4.14 Plots of minimum (u, v; W20)/ (u, v;0) vs. W20/λ forSDoGpupil..... 44 |H H | 4.15 Spoke pattern imaged with misfocused SDoG pupil (β =1,W20 = λ/3). . . . 46

4.16 Spoke pattern imaged with misfocused SDoG pupil (β =1.08, W20 = λ/3). . 47

4.17 Spoke pattern imaged with misfocused SDoG pupil (β =1,W20 = λ/2). . . . 48

4.18 Spoke pattern imaged with misfocused SDoG pupil (β =1.08, W20 = λ/2). . 49

4.19 Spoke pattern imaged with misfocused SDoG pupil (β =1,W20 = λ)..... 50

4.20 Spoke pattern imaged with misfocused SDoG pupil (β =1.08, W20 = λ). . . 51 List of Tables

3.1 Maximum W20 valuesforvariouspupils,foundusingStrehlratio...... 21

3.2 Maximum W20 values for various pupils, found by applying Hopkin’s criterion. 23

4.1 Maximum W20 valuesforSDoGpupil,foundusingStrehlratio...... 44

4.2 Maximum W20 values for SDoG pupil, found by applying Hopkin’s criterion. 44

5.1 Maximum object thicknesses for various pupil functions...... 54

viii Chapter 1

Introduction

1.1 General Introduction

The term “depth-of-focus” refers to an optical system’s ability to operate away from perfect focus without sacrificing image quality, resolution, contrast, or whatever criteria are appro- priate for the intended application. Many specific types of imaging systems can benefit from increased depth-of-focus:

Biomedical applications such as laser scanning microscopy often image finite-thickness • samples at high magnification. High depth-of-focus would allow for high resolution images of the entire sample.

Machine vision systems and lithographic systems require high precision, which is easier • to achieve in a high depth-of-focus system because of lower sensitivity to misfocus.

Macroscopic is taken of three-dimensional objects, and all parts should • be in focus.

Systems affected by can be improved or corrected by increasing • depth-of-focus.

These types of systems can be naturally divided into two groups. One group includes systems which simultaneously focus light from all points in the object plane to corresponding points in the image plane. These systems include and film projectors. The second group includes those systems which focus light to a single point, and create images one point at a time by scanning. This group includes laser scanners. Because of the point-by-point nature of image formation, and because only intensity information is recorded, scanning systems are incoherent optical systems. In this thesis, we are considering laser scanning systems, although the conclusions drawn apply to any incoherent imaging system.

1 CHAPTER 1. INTRODUCTION 2

Over the past few decades, there has been much research into methods for extending the depth-of-focus of incoherent imaging systems [1, 2, 3, 4]. Basically, the pupil function of the system is responsible for its depth-of-focus performance, but since fast digital computers are readily available, many authors have also examined hybrid systems that combine novel pupil functions with digital post-processing of the resulting images.

1.2 Motivation

The types of laser scanning systems we are considering here usually create images of finite- thickness transparent objects such as human tissue or other biological samples with interest- ing three-dimensional (3-D) structures. Two general methods are used with two-dimensional (2-D) laser scanning systems imaging 3-D objects. The first is the method used in confocal laser scanning microscopy: the thick sample is illuminated in such a way that light from all but a single plane of the object can be rejected by a pinhole aperture placed in front of a detector [5]. This method allows for true 3-D imaging, but the sample must be scanned point-by-point at many depths, which is time-consuming and may result in registration er- rors when the image slices are assembled. The second method simply scans the entire depth of the sample with a single pass, which requires an extended depth-of-focus optical system. The most common way to extend depth-of-focus is to use a pupil function which blocks and wastes light energy, such as an annular pupil, or to precisely fabricate some sort of phase mask. In this thesis, we examine a novel hybrid optical/electronic technique for extending depth-of-focus without wasting light energy: two laser beams at slightly different temporal frequencies are combined and used to simultaneously scan a sample. The results are then separated electronically and used to synthesize a pupil function which is similar to a difference-of-Gaussians function. In the focal plane, the result is identical to a difference-of- Gaussians. We refer to the resulting pupil function as a “synthesized difference-of-Gaussians” pupil. Such a synthesis technique has been used with success in a real-time optical wavelet transform system to create difference-of-Gaussians wavelets [6]. Beyond what is already present in a typical laser scanning system, the implementation studied here requires only simple optical elements, an acousto-optic modulator, and simple electronic circuits. No custom filters or masks need to be fabricated.

1.3 Organization of Thesis

To study the capabilities of the synthesized difference-of-Gaussians pupil, we must begin with some of the basic mathematics required to analyze incoherent optical systems such as a laser scanner. This is presented in Chapter 2. CHAPTER 1. INTRODUCTION 3

Next, Chapter 3 shows a way to introduce the effects of misfocus into the previous results, as well as several methods for evaluating the depth-of-focus properties of a given pupil function. Results are presented for four pupil functions: circular, annular, Gaussian, and difference- of-Gaussians. We will consider both qualitative and quantitative ways to assess each pupil’s depth-of-focus performance. Chapter 4 presents the synthesized difference-of-Gaussians system. The performance of this system will be evaluated with the techniques of the previous chapter, to facilitate compar- isons. Finally, Chapter 5 discusses the results. The results presented here are mostly numerical in nature, and the MATLAB code used in this thesis is listed in Appendix B, which begins on page 57. Chapter 2

Background

2.1 Mathematical Preliminaries

The following definition for the Fourier transform of a 2-D function f(x, y) will be used:

f(x, y) = F (fx,fy)= f(x, y)exp[ j2π(fxx+fyy)] dx dy, (2.1) F{ } − ZZ where fx and fy represent the spatial frequencies associated with the spatial dimensions x and y, respectively. Note that an integral written without explicit limits implies integration over all possible values. The convolution operator “ ” is defined as ∗ f(x, y) g(x, y)= f(ξ,η)g(x ξ,y η)dξ dη. (2.2) ∗ − − ZZ

The correlation operator “~” is defined as

f(x, y) ~ g(x, y)= f(ξ,η)g∗(ξ x, η y) dξ dη. (2.3) − − ZZ 2.2 Simple Laser Scanning System

Figure 2.1 depicts a simplified diagram of the present in a laser scanning system. A monochromatic coherent light field emerges from a pupil p(x, y) and is focused by a of f. The resulting light distribution can be examined at the focal plane, or at some misfocused plane located a distance δz from the focal plane. In this chapter, we assume perfect focus.

4 CHAPTER 2. BACKGROUND 5

lens (focal length f) defocused plane pupil function p(x, y) in-focus plane

incident illuminating field

ffδz (misfocus)

Figure 2.1: Simplified diagram of laser scanning system optics. CHAPTER 2. BACKGROUND 6

In general, the function p(x, y) describes the shape or profile of the beam and may have come from an actual pupil mask placed in the front focal plane or from the the natural profile of the laser beam. Because of the Fourier transform properties of a lens, the intensity h(x, y) of the beam at the focal plane can be written

2 2 h(x, y)= p(x, y) fx=x/fλ = P(x/fλ, y/fλ) , (2.4) F{ }fy=y/fλ | |

where P (fx,fy)= p(x, y) and λ is the wavelength of the incident light field. The function h(x, y) is called theF{ intensity} point-spread function (PSF) of the system. In a 2-D laser scanning system, the location of the PSF h(x, y) is sequentially scanned (for example, with electrically-controlled scanning mirrors) over some object. This object is assumed to be transparent, so that some fraction of the incident light is transmitted through to the other side. Thin biological tissue samples are transparent in this way, for example. The intensity of transmitted light at any point (x, y) is denoted Io(x, y). The PSF is focused onto various points and spatially integrated by the photodetector to create an image Ii(x, y). The system is linear in intensity, because it is an incoherent system, and is space-invariant, because a spatial shift in the transparent object will create a corresponding shift in the output image. We can therefore use linear systems theory and consider the PSF h(x, y)to be the impulse response of the laser scanning system. The intensity of the output image can then be found by

Ii(x, y)= Io(ξ,η)h(x ξ,y η)dξ dη − − (2.5) ZZ = Io(x, y) h(x, y). ∗

The transfer function associated with the impulse response h(x, y) is denoted (fx,fy)andis H called the optical transfer function (OTF). Its magnitude (fx,fy) is called the modulation transfer function (MTF). The OTF is proportional to the|H Fourier transform| of the PSF:

h(x, y) (fx,fy)= F{ } . (2.6) H h(x, y) dx dy

From this point on, as a notational convenience,RR the normalizing factor present in the de- nominator will be ignored (as will any other uninteresting constants). Using (2.4) and the Fourier transform properties of autocorrelation, the OTF of the scanning system can be further developed as

2 (fx,fy)= P(x/fλ, y/fλ) H F | | (2.7)

= p( fλfx, fλfy) ~ p( fλfx, fλfy). − − − − CHAPTER 2. BACKGROUND 7

The OTF is simply proportional to the autocorrelation of the pupil function. Note that since we are only going to deal with symmetric pupils, the signs in the arguments of p(x, y) can be ignored. Using the definition of autocorrelation along with a change of variables allows us to write (2.7) in a simplified form as

(u, v)= p(u0 +u/2,v0 +v/2)p∗(u0 u/2,v0 v/2) du0 dv0. (2.8) H − − ZZ Here, and elsewhere in this thesis, u and v are defined as

f f u = x ,v=y, ρ0 ρ0

where ρ0 =1/fλ. Note that because of the Fourier transform properties of the lens, these values have units of distance but are proportional to spatial frequency. Chapter 3

Depth-of-focus Concepts

3.1 Generalized Pupil Function

Aberrations (including focus error) essentially create unwanted deviations in the phase dis- tribution of the wavefront as it reaches the focal plane. We can define an aberration function W (x, y) which describes the effects of these deviations at the pupil, and Figure 3.1 shows how such a function is defined. A pupil function which creates the same phase deviations may be defined mathematically to create a generalized pupil function q(x, y):

q(x, y)=p(x, y)exp[jkW(x, y)] , (3.1) where W (x, y) is proportional to the phase error at the point (x, y). Also note that k =2π/λ. This generalized pupil function may then be used in calculations which otherwise assume no aberrations [7]. The function W (x, y) may include many types of aberrations, but here we assume only focus error, which results in the spherical wavefront having a center of curvature offset from the focal plane. The generalized pupil function for a misfocused pupil is

2 2 q(x, y)=p(x, y)exp jkW20(x + y ) , (3.2)

where W20 is the defocus coefficient and represents the maximum phase deviation between the focused and misfocused spherical wavefronts. For a radially symmetric pupil, W20 can be related to the actual spatial distance δz from the ideal focal plane by

δz r 2 W = 0 , (3.3) 20 2 f  

where r0 is the pupil radius and f is focal length of the imaging lens.

8 CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 9

point (x, y) W (x, y)

ideal focal point

actual (distorted) wavefront

ideal spherical wavefront

Figure 3.1: Diagram clarifying the definition of the aberration function (from [7]). CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 10

As an observation, note that the PSF of a misfocused system as found by (2.4) is

2 2 2 h(x, y; W20)= p(x, y)exp jkW20(x + y ) fx=x/fλ F fy=y/fλ

   2 x y π k 2 2 (3.4) = P( , ) j exp j x + y fλ fλ ∗ kW − 4f 2W 20  20  2  x y j k 2 2 P ( , ) exp j x + y . ∝ fλ fλ ∗ δz − 2 r2 δz  0  

If the pupil has radius r0 = 1, then this result is proportional to the result we would get if we computed the amplitude PSF at the focal plane and then convolved the result with the free-space transfer function corresponding to propagation over a distance δz. We can also insert this result into (2.8) and simplify, which yields the defocused OTF

(u, v; W20) H

= p(u0 +u/2,v0 +v/2)p∗(u0 u/2,v0 v/2) exp[j2kW20(u0u + v0v)] du0 dv0. (3.5) − − ZZ This result can be used to calculate the defocused OTF of a system with pupil function p(x, y) and defocus coefficient W20. Essentially, introducing misfocus into the 2-D PSF creates a 3-D PSF, which is a function of all three spatial variables [8, 9]. This suggests another way of examining the problem: rather than thinking of the system as a 2-D imaging system with misfocus, we can also think in terms of 3-D imaging, since we are examining the light distribution of 3-D objects. We can define a 3-D OTF as well, by taking the Fourier transform of the 3-D PSF with respect to the δz variable, yielding

(u, v, w) H = p(u0 +u/2,v0 +v/2)p∗(u0 u/2,v0 v/2)δ[w + λ(u0u + v0v)] du0 dv0, (3.6) − − ZZ where w is the normalized spatial frequency corresponding to the longitudinal direction and δ( ) is the Dirac delta function. Because of the finite pupil radius, it can be shown from this· integral that only the spatial frequencies satisfying w2

3.2 Analysis of Pupil Functions

The following circularly symmetric pupil functions will be analyzed using the results of the 2 2 2 previous sections (note that r = x + y ,andthatr0 is the maximum radius of each pupil):

circular pupil (Figure 3.2) •

1 r r0, pC(r)= ≤ (3.7) (0otherwise. This is the simplest and most common pupil function.

annular pupil (Figure 3.3) •

1 r1 r r0, pA(r)= ≤ ≤ (3.8) (0otherwise,

where r1 is the inner radius. We can also define an obscuration ratio  = r1/r0.This pupil function is well-known for its arbitrarily long depth-of-focus [1, 11].

Gaussian pupil (Figure 3.4) • 2 2 exp( r /w0) r r0, pG(r)= − ≤ (3.9) (0otherwise,

where w0 is the width or waist of the Gaussian profile. Although the Gaussian function never actually reaches zero as r becomes large, we assume that the value of w0 is selected to make pG(r0) 0, so that the physical limitation of a finite pupil size can be ignored when convenient.≈ This pupil function is included here because it describes the profile of a laser beam. It is also a shaded pupil, rather than a binary aperture like the circular and annular pupils. Shaded pupil functions are also known to increase depth-of-focus [2].

Difference-of-Gaussians pupil (Figure 3.5) • 2 2 2 2 exp( r /wa) exp( r /wb ) r r0, pDoG(r)= − − − ≤ (3.10) (0otherwise,

where wa >wb, and the width wa is chosen so that pDoG(r0) 0. This pupil function is a sort of “shaded annular” pupil, which we expect will increase≈ depth-of-focus as other similar pupil functions have been shown to do [12, 13]. In Chapter 4, a system is introduced which scans objects using a “synthesized” difference-of-Gaussians pupil. The depth-of-focus properties of the difference-of-Gaussians pupil are not commonly CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 12

analyzed, and so are included here for comparison with the synthesized difference- of-Gaussians results. Note that the right-hand plot of Figure 3.5 shows a maximum value that is less than unity. We assume that the pupil transmittance varies between completely opaque at the minimum value and completely transparent at the maximum value.

1

0.8

0.6 p(r)

0.4

0.2

0 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 r

Figure 3.2: Plots of circular pupil function.

For the purposes of numerical calculation, r0 = 1. Also, a width of w0 =0.4 is sufficient to ensure that the Gaussian pupil function drops to less than 1% of its maximum value at the edge of the pupil. This width value is used as a maximum in all subsequent numerical calculations involving Gaussian functions, including difference-of-Gaussians functions.

3.2.1 PSF and MTF of Pupil Functions

Next, the PSFs and MTFs (recall that the MTF is simply the magnitude of the OTF) of 1 these pupil functions are plotted as functions of normalized misfocus W20/λ. Note that the PSF plots really depict 3-D PSFs as described at the end of Section 3.1, since W20/λ is proportional to depth. Because all the pupil functions considered are circularly symmetric, the PSFs and MTFs are radially symmetric in the spatial and spatial frequency dimensions, respectively. For each plot, a selection of three one-dimensional (1-D) plots are shown for different W20 values. 1If you are viewing the electronic version of this thesis, the axes may not be legible on the 2-D plots due to decreased resolution. The horizontal axis is proportional to misfocus and the vertical axis is proportional to either distance (for the PSF) or spatial frequency (for the MTF). CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 13

1

0.8

0.6 p(r)

0.4

0.2

0 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 r

Figure 3.3: Plots of annular pupil function.

1

0.8

0.6 p(r)

0.4

0.2

0 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 r

Figure 3.4: Plots of Gaussian pupil function. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 14

1

0.8

0.6 p(r)

0.4

0.2

0 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 r

Figure 3.5: Plots of difference-of-Gaussians pupil function.

When visually examining the PSF and MTF, certain characteristics are desirable:

1. A sharply-peaked PSF, which corresponds to a higher resolving power. A narrower PSF implies a wider MTF, or less attenuation of high spatial frequencies.

2. No zero-crossings in the MTF, which means no information is completely lost at any spatial frequency.

3. Uniformity of MTF shape across a large range of W20 values, which means misfocused planes are imaged similarly to the in-focus plane.

The larger the range over which these criteria are satisfied, the better the depth-of-focus. These characteristics will be quantified further later in this section. Figure 3.6 and Figure 3.7 show plots of the PSF and MTF for the circular pupil. Immediately we can see the poor depth-of-focus properties of this pupil, because the PSF broadens con- siderably and eventually splits into two well-defined peaks, as seen at W20 = λ. Examining the MTF shows zero-crossings at this defocus value. Figure 3.8 and Figure 3.9 show the PSF and MTF for the annular pupil, which has an extremely high depth-of-focus. The PSF and MTF do not change appreciable over the given W20 range; note how the three selected 1-D plots overlap. However, the MTF shows that the annular pupil has very poor contrast. All but the lowest spatial frequencies are strongly attenuated. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 15

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6

0.5 h(r)

0.4

0.3

0.2

0.1

0 −5 −4 −3 −2 −1 0 1 2 3 4 5 r / λ f

Figure 3.6: Plots of PSF versus W20/λ for circular pupil.

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6 ) ρ 0.5 H(

0.4

0.3

0.2

0.1

0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ 0

Figure 3.7: Plots of MTF versus W20/λ for circular pupil. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 16

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6

0.5 h(r)

0.4

0.3

0.2

0.1

0 −5 −4 −3 −2 −1 0 1 2 3 4 5 r / λ f

Figure 3.8: Plots of PSF versus W20/λ for annular pupil with  =0.95.

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6 ) ρ 0.5 H(

0.4

0.3

0.2

0.1

0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ 0

Figure 3.9: Plots of MTF versus W20/λ for annular pupil with  =0.95. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 17

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6

0.5 h(r)

0.4

0.3

0.2

0.1

0 −5 −4 −3 −2 −1 0 1 2 3 4 5 r / λ f

Figure 3.10: Plots of PSF versus W20/λ for Gaussian pupil with w0 =0.4.

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6 ) ρ 0.5 H(

0.4

0.3

0.2

0.1

0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ 0

Figure 3.11: Plots of MTF versus W20/λ for Gaussian pupil with w0 =0.4. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 18

Figure 3.10 and Figure 3.11 show the PSF and MTF for a Gaussian profile. A Gaussian beam broadens and decreases in amplitude as it propagates, but otherwise retains its Gaussian shape [14]. This results in a constant attenuation of high spatial frequencies, or loss of sharp detail in an image. Even with no defocus, the PSF of the Gaussian beam is quite broad.

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6

0.5 h(r)

0.4

0.3

0.2

0.1

0 −5 −4 −3 −2 −1 0 1 2 3 4 5 r / λ f

Figure 3.12: Plots of PSF versus W20/λ for difference-of-Gaussians pupil with wa =0.4and wb =0.35.

Finally, Figure 3.12 and Figure 3.13 show the PSF and MTF for the difference-of-Gaussians pupil. Here the PSF stays fairly narrow (except for some very small “feet” on either side). After more misfocus, however, the PSF broadens much like the Gaussian does, but the PSF remains more peaked. The MTF shows an improvement over the circular and Gaussian pupils as well, but eventually zero-crossings appear. Based on this qualitative appraisal, the difference-of-Gaussians pupil offers definite improvement over both the circular and Gaussian pupils at moderate misfocus levels (W20 λ/2). ∼

3.2.2 Ambiguity Function

In the previous section, we showed plots of the MTF versus W20/λ, which allowed for quick visual assessments of the pupil function’s misfocused performance. Another similar method of visualizing the system’s OTF is with the ambiguity function (AF), a kind of generalized autocorrelation function initially used in radar analysis to determine accuracy in range or speed of a moving target, but with useful applications in Fourier optics as well [15]. The AF relates the spatial and frequency domains and as such can be thought of as a statement of CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 19

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6 ) ρ 0.5 H(

0.4

0.3

0.2

0.1

0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ 0

Figure 3.13: Plots of MTF versus W20/λ for difference-of-Gaussians pupil with wa =0.4and wb =0.35.

the uncertainty principle [16]. The AF is a commonly used tool in extended depth-of-focus literature. Compare (3.5) with the AF of p(x, y), which looks like

A(u, v; x, y)

= p(u0 +u/2,v0 +v/2)p∗(u0 u/2,v0 v/2) exp[j2π(u0x + v0y)] du0 dv0. (3.11) − − ZZ Here u and v are proportional to spatial frequencies and x and y have units of distance. A simple relationship between the AF and the defocused OTF becomes apparent:

2W20 2W20 (u, v; W20)=A(u, v; u, v). (3.12) H λ λ The AF of a given pupil function contains the OTFs of a system employing that pupil at all values of defocus.

2 2 2 For a circularly symmetric pupil pcs(r)=p(x, y), where r = x +y , we could simplify (3.11) somewhat [17]. Such a pupil will have a radially symmetric OTF r(ρ; W20)= (u, v; W20), where ρ2 = u2 + v2.Ifwesetu=ρand v = 0 in (3.12), the resultH can be writtenH as

2W20 r(ρ; W20)=Ar(ρ, ρ), (3.13) H λ CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 20 where

Ar(ρ, x)= p(u0 +ρ/2,v0)p∗(u0 ρ/2,v0)exp(j2πu0x) du0 dv0. (3.14) − ZZ This version of the AF is two-dimensional rather than four-dimensional, which is easier to plot and calculate. The AF for a pupil function is more straightforward to calculate than the 2-D MTF plots shown in the previous section, and it yields the same information. However, it requires the pupil function p(x, y), which is not available for the synthesized system of Chapter 4, so the AF will not be used further in this thesis.

3.2.3 Strehl Ratio

The previous sections describe qualitative ways to evaluate a system’s depth-of-focus. A simple way to quantitatively determine when a system is “well-focused” is to consider the Strehl ratio, which is proportional to the on-axis intensity [18]. The Strehl ratio is expressed as h(0, 0; W ) S(W )= 20 , (3.15) 20 h(0, 0; 0)

where h(x, y; W20) is the misfocused intensity PSF from (3.4). As the on-axis intensity decreases, image quality is reduced because the PSF is broadening and information is no longer received from just the point of interest; a larger area is covered by the PSF and the spatial integration of the photodetector will average out high-frequency information. As an example, note the on-axis intensity shown in the 3-D PSF of Figure 3.6. At W20 = λ, this intensity reaches zero. It is also at this point that the PSF separates into two peaks,± and the MTF contains unwanted zeros. The on-axis PSF (and therefore the Strehl ratio) is straightforward to compute analytically for each of the four pupil functions. The results are

W S (W )=sinc2 20 , (3.16) C 20 λ   2 2 W20 SA(W20)=sinc (1  ) , (3.17) − λ   1 SG(W20)= 2 4 2 2 , (3.18) 1+4π w0W20/λ 1 Ca(W20)Cb(W20) SDoG(W20)= 2 2 2 2 Ca(W20)+Cb(W20) 2 , π (w w ) − Cab(W20) a− b   (3.19) CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 21 corresponding to the circular, annular, Gaussian, and difference-of-Gaussians pupil functions, respectively. In the difference-of-Gaussians result, π2 Ca(W20)= 4 2 2 2 , 1/wa +4π W20/λ π2 Cb(W20)= 4 2 2 2 , 1/wb +4π W20/λ π2 Cab(W20)= 2 2 2 2 2 . 1/wawb +4π W20/λ The results for the circular, annular, and Gaussian pupil functions can be found in the literature, for example [8] or [9]. The derivation for the difference-of-Gaussians pupil is found in Appendix A (Section A.1). Unlike the circular or annular pupil functions, the Strehl ratio of pupil functions containing Gaussian functions will never reach zero. So rather than examine the zero-crossings of the Strehl ratio, we will consider the “3 dB-point”, or the point where the intensity ratio reaches half of its maximum. Figure 3.14 shows plots of the Strehl ratio for the four pupil functions, found using the code in Listing B.4, which computes the Strehl ratio numerically for any pupil function. Only the positive half is shown; for these pupils the negative half is just the mirror image. Listing B.5 uses the bisection method to find the point where the intensity is half of its maximum, and Table 3.1 summarizes these results.

Table 3.1: Maximum W20 values for various pupils, found using Strehl ratio.

pupil maximum W20 circular 0.444λ annular ( =0.95) 4.44λ

Gaussian (w0 =0.4) 0.995λ

difference-of-Gaussians (wa =0.4, wb =0.35) 0.738λ

These results are as expected, except the difference-of-Gaussians pupil has a lower maxi- mum W20 value than the regular Gaussian pupil. The reason for this is that the Strehl ratio only takes into account on-axis behavior. We should use a different way to determine if the system is well-focused, one that takes into account off-axis intensity as well.

3.2.4 Hopkin’s Criterion

Hopkin’s criterion states that for a system to be well-focused, the defocused MTF must never drop below 80% of its in-focus value at any spatial frequency [19]. Specifically, a system is CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 22

1 1

0.9

0.9 0.8

0.7 0.8

0.6 ) ) 0.520 0.720 S(W S(W

0.4

0.6 0.3

0.2 0.5

0.1

0 0.4 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 w / λ w / λ 20 20 (a) (b)

1 1

0.9 0.9

0.8 0.8

0.7 0.7

0.6 0.6 ) ) 0.520 0.520 S(W S(W

0.4 0.4

0.3 0.3

0.2 0.2

0.1 0.1

0 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 w / λ w / λ 20 20 (c) (d)

Figure 3.14: Plots of Strehl ratio for various pupils: (a) circular; (b) annular ( =0.95); (c) Gaussian (w0 =0.4); and (d) difference-of-Gaussians (wa =0.4, wb =0.35). The solid horizontal line shows the 3 dB value. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 23 well-focused if

(u, v; W20) H 0.8 (3.20) (u, v;0) ≥

H

for all (u, v) spatial frequency values. Finding the largest range of W20 values for which this criterion is satisfied is a good way to quantify a system’s depth-of-focus, and unlike the Strehl ratio, takes into account the entire behavior of the system’s response. The code in Listing B.6 computes the ratio in (3.20) for an arbitrary pupil function and Listing B.8 is code which employs the bisection method to find the largest value of W20 which satisfies Hopkin’s criterion. See Figure 3.15 for plots of the minimum value of the MTF ratio as a function of misfocus coefficient for the four pupil functions. As with the Strehl ratio, only the right half of a symmetric plot is shown. Table 3.2 summarizes the maximummisfocusvalues.

Table 3.2: Maximum W20 values for various pupils, found by applying Hopkin’s criterion.

pupil maximum W20 circular 0.215λ annular ( =0.95) 1.53λ

Gaussian (w0 =0.4) 0.256λ

difference-of-Gaussians (wa =0.4, wb =0.35) 0.279λ

These results correspond with the qualitative assessments we made in Section 3.2.1. For instance, the difference-of-Gaussians pupil results offers better performance than the regular Gaussian pupil. Hopkin’s criterion is also useful for finding the optimum values for pupil parameters. For example, Listing B.7 can be used to find the optimum width values for the difference-of- Gaussians pupil. The code finds the value of wb which maximizes (u, v; W20)/ (u, v;0) |H H | for all frequencies, given wa and W20. Conveniently, it turns out that the optimum wb is a weak function of W20. Figure 3.16 shows a plot from this code, which found that a value of around wb =0.35 maximizes depth-of-focus when wa =0.4.

3.3 Post-processing With Corrective Filter

Pupil functions with high depth-of-focus will have OTFs which are different from the ideal circular pupil, usually with lower contrast at certain spatial frequencies. For example, the CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 24

1 1

0.9 0.9

0.8 0.8

0.7 0.7

0.6 0.6 ) / H(u,v;0) ) / H(u,v;0) 20 0.5 0.520

0.4 0.4 min H(u,v;W min H(u,v;W

0.3 0.3

0.2 0.2

0.1 0.1

0 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 W / λ W / λ 20 20 (a) (b)

1 1

0.9 0.9

0.8 0.8

0.7 0.7

0.6 0.6 ) / H(u,v;0) ) / H(u,v;0)

0.520 0.520

0.4 0.4 min H(u,v;W min H(u,v;W

0.3 0.3

0.2 0.2

0.1 0.1

0 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 W / λ W / λ 20 20 (c) (d)

Figure 3.15: Plots of minimum (u, v; W20)/ (u, v;0) versus W20/λ for various pupils: |H H | (a) circular; (b) annular ( =0.95, note the extended W20/λ scale); (c) Gaussian (w0 =0.4); and (d) difference-of-Gaussians (wa =0.4, wb =0.35). CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 25

0.8025

0.802

0.8015

0.801

0.8005 ) / H(u,v;0) 20

0.8

min H(u,v;W 0.7995

0.799

0.7985

0.798 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 w b

Figure 3.16: Plot of minimum (u, v; W20)/ (u, v;0) versus wb for difference-of-Gaussians |H H | pupil. In this plot, wa =0.4andW20 =0.278λ.

annular pupil (see Figure 3.9) has very poor contrast for all but the lowest spatial frequencies. However, if the OTF contains no zero-crossings, it is possible to construct an inverse filter which corrects the OTF and returns it to an ideal shape. Since we are concerned with laser scanning systems which store the image in a digital computer, it is convenient to perform this filtering with the computer as a final step in image formation. Such hybrid optical/digital processing can produce the best results for an extended depth-of-focus system [3, 4].

If the ideal circular pupil has an OTF given by C(u, v; 0) (the solid-line plot on the right- hand side of Figure 3.7), and the pupil of the systemH has an in-focus OTF (u, v;0),wecan H find a corrective inverse filter inv(u, v) as follows: H

C(u, v;0) inv(u, v)=H . (3.21) H (u, v;0) H As mentioned before, (u, v; 0) should not have any zero-crossings. Note that a simple conical shape could alsoH be used to approximate the circular pupil’s OTF. This filter only needs to be calculated once for a given pupil function and can then be stored in the computer system. The in-focus OTF of the system is chosen to generate the corrective filter because we assume a thick sample is being scanned and the focal plane of the system is at the center of the sample. Because the resulting image is a superposition of the intensities along the entire CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 26 depth of the sample, only one inverse filter can be used. Similarly, if a single laser beam is being used for an application where sensitivity to focal depth is high, for instance, in lithography, the misfocus is not known (if it was, the system could be corrected by other means). So it can be assumed the system is close to in-focus as possible, and therefore the OTF is close to the in-focus OTF. If we are within a range where Hopkin’s criterion is satisfied, then the OTF is within 80% of the in-focus OTF. A better technique may be to construct a filter which minimizes error for both in-focus and misfocused OTFs using some sort of least-squares approach (see, for example, the appendix in [20]). Once the image has been scanned, the filter can be easily applied to the resulting 2-D image Ii(x, y) to create a corrected image Ii,c(x, y), as follows:

1 Ii,c(x, y)= − Ii(x, y) inv(u, v) , (3.22) F {F{ }H } 1 where − denotes the inverse Fourier transform. The correction operation can be carried out quicklyF {·} with FFTs. Section 3.4 includes images with corrective filters applied in this way. Corrective filtering doesn’t change the maximum focal depth found by applying Hopkin’s criterion. However, the longer the range of misfocus values over which Hopkin’s criterion is met, the better the results achieved by using the corrective filtering procedure.

3.4 Imaging Simulations

A good way to see the effects of misfocus is by simulating the image that would be created by a laser scanning system employing different pupil functions and different misfocus values. Figure 3.17 shows a spoke pattern, commonly used to visually evaluate2 the OTF of an optical system. The spatial frequency gradually decreases from the center outwards, so variations in the OTF such as zero crossings and such can easily be seen. Listing B.10 generates the spoke pattern and Listing B.11 generates simulations of the pat- tern imaged through various pupils. See Figures 3.18–3.21 for the spoke imaged through the four pupils at a misfocus coefficient of W20 = λ (note that according to Hopkin’s criterion, each system except for the annular pupil is poorly-focused, this is so the effects of misfocus are exaggerated). Also, each figure except for the circular pupil shows the spoke pattern after a corrective filter has been applied as described in Section 3.3.

2As mentioned in a previous footnote, the electronic version of this thesis has lower resolution images, which may make such a visual evaluation difficult. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 27

Figure 3.17: Spoke pattern. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 28

(a)

1

0.9

0.8

0.7

0.6 ) ρ 0.5 H(

0.4

0.3

0.2

0.1

0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ 0 (b)

Figure 3.18: Spoke pattern imaged with misfocused circular pupil (W20 = λ): (a) image and (b) MTF. Note the clearly visible zero-crossings and contrast reversals on the spoke image. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 29

(a) (b)

−3 x 10 1 3.5 1

0.9 0.9 3

0.8 0.8

0.7 2.5 0.7

0.6 0.6 2 ) ) ) ρ 0.5 ρ ρ 0.5 H( H( H(

1.5 0.4 0.4

0.3 1 0.3

0.2 0.2

0.5 0.1 0.1

0 0 0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ ρ / ρ ρ / ρ 0 0 0 (c) (d) (e)

Figure 3.19: Spoke pattern imaged with misfocused annular pupil ( =0.95, W20 = λ): (a) uncorrected image; (b) corrected image; (c) uncorrected MTF; (d) correction filter; and (e) corrected MTF. Note how the poor image contrast is corrected by the filter. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 30

(a) (b)

1 1 1

0.9 0.9 0.9

0.8 0.8 0.8

0.7 0.7 0.7

0.6 0.6 0.6 ) ) ) ρ 0.5 ρ 0.5 ρ 0.5 H( H( H(

0.4 0.4 0.4

0.3 0.3 0.3

0.2 0.2 0.2

0.1 0.1 0.1

0 0 0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ ρ / ρ ρ / ρ 0 0 0 (c) (d) (e)

Figure 3.20: Spoke pattern imaged with misfocused Gaussian pupil (w0 =0.4, W20 = λ): (a) uncorrected image; (b) corrected image; (c) uncorrected MTF; (d) correction filter; and (e) corrected MTF. CHAPTER 3. DEPTH-OF-FOCUS CONCEPTS 31

(a) (b)

1 1 1

0.9 0.9 0.9

0.8 0.8 0.8

0.7 0.7 0.7

0.6 0.6 0.6 ) ) ) ρ 0.5 ρ 0.5 ρ 0.5 H( H( H(

0.4 0.4 0.4

0.3 0.3 0.3

0.2 0.2 0.2

0.1 0.1 0.1

0 0 0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ ρ / ρ ρ / ρ 0 0 0 (c) (d) (e)

Figure 3.21: Spoke pattern imaged with misfocused difference-of-Gaussians pupil (wa =0.4, wb =0.35, W20 = λ): (a) uncorrected image; (b) corrected image; (c) uncorrected MTF; (d) correction filter; and (e) corrected MTF. Chapter 4

Synthesized Difference-of-Gaussians Pupil

In the previous chapter, several common pupil functions were examined along with the difference-of-Gaussians pupil. In this chapter, we present a laser scanning system which employs a synthesized difference-of-Gaussians (SDoG) pupil. The system works by scanning an object simultaneously with two Gaussian beams, each with slightly different temporal frequencies, which are then separated and recombined after scanning to create a “synthetic” pupil function [6, 21]. The PSF and OTF for the system are identical to those of the difference-of-Gaussians pupil in the focal plane, but are slightly different when misfocused. Appropriate results from the previous chapter will be applied to this pupil function to assess its depth-of-focus properties.

4.1 Implementation

Figure 4.1 shows a simplified laser scanning system which can be used to scan an object with the synthesized difference-of-Gaussians pupil. A single laser is used to generate a Gaussian beam at a frequency ω0, which then enters an interferometer (BS1, BS2, M1, M2). In one arm of the interferometer, (COL) are inserted to adjust the width of the beam. An acousto-optic modulator (AOM) is inserted in one arm to shift the frequency of that beam to ω0 + Ω. The frequency Ω is typically several orders of magnitude smaller than the frequency of the laser beam, so the wavelength λ 1/(ω0 + Ω) is essentially unchanged. ∼ The beams are recombined and then exit the interferometer, where they enter a system of scanning mirrors and lens (SM, L1) which focus them to a point on the object being scanned. The intensity of transmitted light is then detected by a photodetector (L2, PD) and this signal is fed to an electrical circuit which will be described below.

32 CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 33

BS1 COL M2 LASER jω t ga(x, y)e 0

AOM SM

M1 BS2 L1 cos Ωt

OBJECT

L2 j(ω +Ω)t gb(x, y)e 0 PD

MONITOR LPF + COMPUTER Σ

− ED BPF β

Figure 4.1: System to create the synthesized difference-of-Gaussians pupil (adapted from [6]). CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 34

The amplitude profiles (equivalently, the pupil functions) of the two beams are Gaussian and are given by

2 2 2 ga(x, y)=aexp (x + y )/wa , − 2 2 2 gb(x, y)=bexp (x + y )/w , − b  where a and b are scale factors. We will assume gb(x, y) is associated with the frequency- shifted beam, and that wa >wb. We also assume that the system has been adjusted so that the two beams have identical maximum amplitudes (a = b) after leaving the interferometer, and that the Gaussian beams do not diffract (broaden) appreciably while passing through the optical system. Next, we define the generalized pupil functions for the two beams:

2 2 qa(x, y)=ga(x, y)exp jkW20(x + y ) , 2 2 qb(x, y)=gb(x, y)expjkW20(x + y ), with associated Fourier transforms  

2 π π 2 2 Qa(fx,fy)= qa(x, y) = 2 exp 2 (fx + fy ) , F{ } 1/wa jkW20 −1/wa jkW20 −  −2  π π 2 2 Qb(fx,fy)= qb(x, y) = 2 exp 2 (fx + fy ) . F{ } 1/w jkW20 −1/w jkW20 b −  b −  The effective misfocused PSF of the two combined beams (including temporal variations) is found using (2.4). The result is

2 h(x, y; W20)= Qa(x/fλ, y/fλ)exp[jω0t]+Qb(x/fλ, y/fλ)exp[j(ω0 +Ω)t] , | | (4.1) where ω0 =2πc/λ is the temporal frequency of the laser (c is the speed of light). Using the 2 fact that z = z∗z, multiplying, and regrouping yields | | 2 2 jΩt jΩt h(x, y; W20)= Qa + Qb +Qa∗Qbe +QaQb∗e−

| |2 | |2 (4.2) \ = Qa + Qb +2QaQb cos(Ωt \Qa + Qb),

| | | | | | − \ where \Qa and Qb represent the phase angles of their respective functions.

As an object is scanned, an image Ii0(x, y) is formed for a given plane Io(x, y). Using (2.5) and (4.2), this image is given by

Ii0(x, y)=Io(x, y) h(x, y; W20)

∗ 2 2 \ = Io(x, y) Qa + Qb +2QaQb cos(Ωt \Qa + Qb) ∗ | | | | | | −

2 2 (4.3) \ = Io(x, y) Qa + Qb + Io(x, y) 2 QaQb cos(Ωt \Qa + Qb). ∗ | | | | ∗ | | −   CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 35

It consists of a DC term and an AC term of frequency Ω. The electrical signal output by

the photodetector is proportional to Ii0(x, y). A low-pass filter (LPF) and a band-pass filter centered at Ω (BPF) are used to separate the two signals, yielding

2 2 Ii,dc(x, y)=Io(x, y) Qa + Qb , (4.4)

∗ | | | | \ Ii,Ω(x, y)=Io(x, y) 2 QaQb cos(Ωt \Qa + Qb). (4.5) ∗ | |  −

An envelope detecter (ED) is used to demodulate the signal Ii,Ω(x, y), resulting in

Ii,ac(x, y)=Io(x, y) 2 QaQb . (4.6) ∗ | |

The signals Ii,dc(x, y)andIi,ac(x, y) are subtracted electronically to create a final image Ii(x, y):

Ii(x, y)=Ii,dc(x, y) βIi,ac(x, y) − 2 2 = Io(x, y) Qa + Qb βIo(x, y) 2 QaQb (4.7) ∗ | | | | − ∗ | | = Io(x, y) hSDoG(x, y; W20), ∗ 

where β is the gain of the AC portion of the circuit. The function hSDoG(x, y) is the synthe- sized difference-of-Gaussians PSF, given by

2 2 hSDoG(x, y; W20)= Qa + Qb 2βQaQb . (4.8) | | | | − | |

The OTF for the system can be found by taking the Fourier transform of hSDoG(x, y; W20), as shown in (2.6). It is important to distinguish (4.8) from the PSF of the “real” difference-of-Gaussians given by (3.10). For that pupil, the misfocused PSF is

2 hDoG(x, y; W20)= PDoG(x/fλ, y/fλ) | 2 | = Qa Qb (4.9) | −2 | 2 = Qa + Qb 2Re QaQ∗ , | | | | − { b}

where Qa and Qb are the generalized pupil functions for the Gaussian beams as before, and Re is the real part of the value in braces. If there is no misfocus, Qa and Qb are real- {·} valued and hSDoG(x, y;0)=hDoG(x, y; 0). Otherwise, the results will differ. There is no pupil function p(x, y) that gives the same results as the synthesized difference-of-Gaussians pupil.

4.2 Effects of Misfocus

We now present numerical analysis of the synthesized difference-of-Gaussians pupil, which can be directly compared with the results of Chapter 3. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 36

4.2.1 Finding Optimum Parameter Values

We need to select values of wa, wb,andβwhich will maximize the depth-of-focus for the synthesized difference-of-Gaussians pupil. As with the original difference-of-Gaussians pupil, Hopkin’s criterion will be used to numerically find optimum parameter values. First, we select wa =0.4, as we have before.

0.803

0.802

0.801

0.8 ) / H(u,v;0) 20

0.799 min H(u,v;W

0.798

0.797

0.796 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 w b

Figure 4.2: Plot of minimum (u, v; W20)/ (u, v;0) versus wb for synthesized difference- |H H | of-Gaussians pupil. In this graph, wa =0.4, β =1,andW20 =0.264λ.

The code in Listing B.17 finds the optimum value for wb. See Figure 4.2 for a plot from this code. A value of wb =0.281 maximizes depth-of-focus when wa =0.4andβ=1.The optimum width wb is again a weak function of misfocus. Next, the code in Listing B.18 is used to find an optimal value for β, given the optimal value for wb. See Figure 4.3 for this plot. The code found an optimum value of β =1.08. It is interesting to note that for higher β values, the depth-of-focus found by applying Hopkin’s criterion drops off very sharply. This is because as this value is approached, side-lobes in the OTF which were previously “hidden” under the main-lobe begin to appear and eventually dominate the OTF as β is increased further.

Listing B.17 was again used to find the optimum value of wb for β =1.08. As with β =1, the optimum value for wa =0.4 was found to be wb =0.281. The associated plot is shown in Figure 4.4. The width wb is a very weak function of β,andβis a weak function of misfocus. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 37

0.92

0.9

0.88

0.86

0.84 ) / H(u,v;0) 20

0.82

min H(u,v;W 0.8

0.78

0.76

0.74 0.9 0.92 0.94 0.96 0.98 1 1.02 1.04 1.06 1.08 1.1 β

Figure 4.3: Plot of minimum (u, v; W20)/ (u, v;0) versus β for synthesized difference-of- |H H | Gaussians pupil. In this graph, wa =0.4, wb =0.281, and W20 =0.264λ.

At this point, we briefly mention that when β = βw,whereβw is given by

2 (wa + wb) βw = 2 2 , 4wawb the PSF of the synthesized difference-of-Gaussians pupil has zero average value, which satis- fies the wavelet admissibility condition [22]. For the optimum width parameters found above, βw =1.13. We will show some results for this value of β to demonstrate the depth-of-focus properties of the optical wavelet transform system described in [6].

4.2.2 PSF and MTF Results

Figure 4.5 and Figure 4.6 show plots of the defocused PSF and MTF for the synthesized difference-of-Gaussians pupil with optimized width parameters and β = 1. We can compare these results to the regular difference-of-Gaussians in Figure 3.12 and Figure 3.13. The central peak of the PSF is more clearly defined. However, the PSF broadens more rapidly. This behavior is mirrored in the MTF, which shows a faster attenuation of high frequencies. In exchange for a longer well-focused range, performance eventually degrades more quickly than in the regular difference-of-Gaussians. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 38

1

0.9

0.8

0.7

0.6 ) / H(u,v;0)

0.520

0.4 min H(u,v;W

0.3

0.2

0.1

0 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 w b

Figure 4.4: Plot of minimum (u, v; W20)/ (u, v;0) versus wb for synthesized difference- |H H | of-Gaussians pupil. In this graph, wa =0.4, β =1.08, and W20 =0.264λ.

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6

0.5 h(r)

0.4

0.3

0.2

0.1

0 −5 −4 −3 −2 −1 0 1 2 3 4 5 r / λ f

Figure 4.5: Plots of PSF versus W20/λ for synthesized difference-of-Gaussians pupil with β =1. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 39

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6 ) ρ 0.5 H(

0.4

0.3

0.2

0.1

0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ 0

Figure 4.6: Plots of MTF versus W20/λ for synthesized difference-of-Gaussians pupil with β =1.

1 W / λ = 0 20 W / λ = 0.5 20 W / λ = 1 0.8 20

0.6

0.4 h(r)

0.2

0

−0.2

−0.4 −5 −4 −3 −2 −1 0 1 2 3 4 5 r / λ f

Figure 4.7: Plots of PSF versus W20/λ for synthesized difference-of-Gaussians pupil with β =1.08. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 40

1 W / λ = 0 20 W / λ = 0.5 0.9 20 W / λ = 1 20 0.8

0.7

0.6 ) ρ 0.5 H(

0.4

0.3

0.2

0.1

0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ 0

Figure 4.8: Plots of MTF versus W20/λ for synthesized difference-of-Gaussians pupil with β =1.08.

Figure 4.7 and Figure 4.8 show the PSF and MTF when β =1.08. The most obvious difference here is that the PSF can sometimes be less than zero. This is impossible for a “real” pupil function, but because of the electronic subtraction process, it occurs here. The MTF shows some interesting behavior as well: there is a “fence” in the MTF where a strip of zero-crossings appear. Inside the fence of zeros, the MTF maintains a fairly constant three-peaked shape, but at the fence and beyond, the MTF distorts greatly. As with the β = 1 case, the synthesized pupil shows greater image defects outside a certain optimal range of misfocus than does the regular difference-of-Gaussians pupil. Figure 4.9 and Figure 4.10 more clearly illustrate what happens outside this range. In the first set of plots (β = 1), extreme misfocus results in a rapid loss of high spatial frequency details, but the MTF maintains its shape fairly well. In the second set of plots (β =1.08), the MTF is simply too distorted to be of any use in imaging.

Finally, in Figure 4.11 and Figure 4.12, we see the results for β = βw (wavelet condition). The fence of zeros described before has now pinched together, creating a zero-average PSF at the focal plane. However, the fence rapidly separates as the system is misfocused, meaning the wavelet admissibility condition is no longer satisfied. An optical wavelet transformer using the synthesized difference-of-Gaussians pupil has extremely poor depth-of-focus. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 41

1 1 W / λ = 1 W / λ = 1 20 20 W / λ = 2 0.9 W / λ = 2 0.9 20 20 W / λ = 3 W / λ = 3 20 20 0.8 0.8

0.7 0.7

0.6 0.6 ) 0.5 ρ 0.5 H( h(r)

0.4 0.4

0.3 0.3

0.2 0.2

0.1 0.1

0 0 −5 −4 −3 −2 −1 0 1 2 3 4 5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ r / λ f 0 (a) (b)

Figure 4.9: Plots of extremely misfocused (a) PSF and (b) MTF for synthesized difference- of-Gaussians pupil with β =1.

1 2 W / λ = 1 20 W / λ = 2 0.9 20 W / λ = 3 0 20 0.8

−2 0.7

0.6 −4 ) ρ 0.5 H( h(r)

−6 0.4

0.3 −8 W / λ = 1 20 W / λ = 2 20 0.2 W / λ = 3 20 −10 0.1

−12 0 −5 −4 −3 −2 −1 0 1 2 3 4 5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ r / λ f 0 (a) (b)

Figure 4.10: Plots of extremely misfocused (a) PSF and (b) MTF for synthesized difference- of-Gaussians pupil with β =1.08. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 42

1 W / λ = 0 20 W / λ = 0.25 20 W / λ = 0.5 0.8 20

0.6

0.4 h(r)

0.2

0

−0.2

−0.4 −5 −4 −3 −2 −1 0 1 2 3 4 5 r / λ f

Figure 4.11: Plots of PSF versus W20/λ for synthesized difference-of-Gaussians pupil with β = βw.

1 W / λ = 0 20 W / λ = 0.25 0.9 20 W / λ = 0.5 20 0.8

0.7

0.6 ) ρ 0.5 H(

0.4

0.3

0.2

0.1

0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ 0

Figure 4.12: Plots of MTF versus W20/λ for synthesized difference-of-Gaussians pupil with β = βw. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 43

4.2.3 Strehl Ratio

Although the Strehl ratio doesn’t give much insight into the depth-of-focus of the more complicated pupil functions, it is still interesting to see the results. The Strehl ratio for the synthesized difference-of-Gaussians pupil was computed analytically (see Section A.2 in Appendix A) and is given by 1 S (W )= SDoG 20 π2(w4+w4 2βw2w2) a b − a b Ca(W20)+Cb(W20) 2β Ca(W20)Cb(W20) , (4.10) × − h p i where Ca(W20)andCb(W20) are defined the same as in Section 3.2.3. Note the similarity of this equation to (3.19).

1 1.2

0.9 1 0.8

0.7 0.8

0.6 0.6 ) ) 20 0.5 20 S(W S(W 0.4 0.4

0.3 0.2

0.2

0 0.1

0 −0.2 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 w / λ w / λ 20 20 (a) (b)

Figure 4.13: Plots of Strehl ratio for synthesized difference-of-Gaussians pupil: (a) β =1 and (b) β =1.08. In these plots, wa =0.4andwb =0.281.

Figure 4.13 shows plots of the Strehl ratio, found with Listing B.14, for the two synthesized difference-of-Gaussians pupils with optimum widths. Table 4.1 summarizes the results of finding the 3 dB-points. For the β =1.08 case, note that the Strehl ratio can be negative, which means the 3 dB-point result is not as meaningful. Also, both cases imply poorer performance than the other conventional pupil functions. From a visual inspection of the PSFs and MTFs, we believe this is not the case, which is why Hopkin’s criterion is used instead. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 44

Table 4.1: Maximum W20 values for synthesized difference-of-Gaussians pupil, found using Strehl ratio. parameters maximum

wa wb β W20 0.4 0.281 1 0.686λ 0.4 0.281 1.08 0.577λ

1 1

0.9 0.9

0.8 0.8

0.7 0.7

0.6 0.6 ) / H(u,v;0) ) / H(u,v;0)

0.520 0.520

0.4 0.4 min H(u,v;W min H(u,v;W

0.3 0.3

0.2 0.2

0.1 0.1

0 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 W / λ W / λ 20 20 (a) (b)

Figure 4.14: Plots of minimum (u, v; W20)/ (u, v;0) versus W20/λ for synthesized |H H | difference-of-Gaussians pupil: (a) β =1and(b)β=1.08. In these plots, wa =0.4and wb=0.281.

Table 4.2: Maximum W20 values for synthesized difference-of-Gaussians pupil, found by applying Hopkin’s criterion. parameters maximum

wa wb β W20 0.4 0.281 1 0.265λ 0.4 0.281 1.08 0.333λ CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 45

4.2.4 Hopkin’s Criterion

The maximum depth-of-focus satisfying Hopkin’s criterion was found for the two β values. These plots are shown together in Figure 4.14, and the results are summarized in Table 4.2. Clearly, the adjusted β value improves depth-of-focus an appreciable amount.

Comparing the maximum W20 values to those in Table 3.2 also shows that the synthesized difference-of-Gaussians has better depth-of-focus performance than all the other pupil func- tions examined, except for the annular pupil. Even if we do not optimize β, the performance is still slightly better than the circular or Gaussian pupils.

4.3 Imaging Simulations

Figures 4.15–4.20 show simulations of the spoke target imaged by the synthesized difference- of-Gaussians system, along with the MTFs, correction filters, and corrected MTFs, as before. At moderate misfocus values (Figures 4.15–4.18) we find that the performance of the system is acceptable with β =1orβ=1.08, with the latter offering slightly sharper images, but with slightly poorer contrast. However, when the misfocus is a little more extreme (Figures 4.19 and 4.20), the result for β = 1 is a little blurry while the β =1.08 result is too distorted to be of any use. If we are using the β =1.08 system to scan a thick object, parts of the object outside the maximum range shown in Table 4.2 will be too distorted and will offer little or no information.

4.4 Signal-to-noise Considerations

One of the improvements the synthesized difference-of-Gaussians pupil should have over a mask such the annular pupil is that no light energy will be lost. If we consider a laser scanning system with a Gaussian laser beam, we can either collimate the laser beam and place a mask in front of it, or employ the synthesized difference-of-Gaussians system. The synthesized difference-of-Gaussians will simply split and recombine the beams to waste no light, but still increases depth-of-focus. Reducing the optical power incident on the object will reduce the light which falls on the photodetector. This will decrease the signal-to-noise ratio. We wish to use as much light as possible to reduce the effects of photodetector noise. Because of the hybrid optical/electronic system involving band-pass and low-pass filtering of the signal, it is difficult to model the effects of noise on the synthesized difference-of-Gaussians pupil in a straightforward way. However, it would be useful to quantify the improvement in signal-to-noise ratio the system would offer over an annular pupil with obscuration ratio chosen to yield the same maximum focal depth. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 46

(a) (b)

1 1 0.035

0.9 0.9

0.03 0.8 0.8

0.7 0.025 0.7

0.6 0.6 0.02 ) ) ) ρ ρ

0.5 ρ 0.5 H( H( H(

0.015 0.4 0.4

0.3 0.3 0.01

0.2 0.2

0.005 0.1 0.1

0 0 0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ ρ / ρ ρ / ρ 0 0 0 (c) (d) (e)

Figure 4.15: Spoke pattern imaged with misfocused synthesized difference-of-Gaussians pupil (wa =0.4, wb =0.281, β =1,W20 = λ/3): (a) uncorrected image; (b) corrected image; (c) uncorrected MTF; (d) correction filter; and (e) corrected MTF. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 47

(a) (b)

1 1 0.03

0.9 0.9

0.8 0.025 0.8

0.7 0.7 0.02 0.6 0.6 ) ) ) ρ ρ

0.5 ρ 0.5

H( 0.015 H( H(

0.4 0.4

0.01 0.3 0.3

0.2 0.2 0.005

0.1 0.1

0 0 0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ ρ / ρ ρ / ρ 0 0 0 (c) (d) (e)

Figure 4.16: Spoke pattern imaged with misfocused synthesized difference-of-Gaussians pupil (wa =0.4, wb =0.281, β =1.08, W20 = λ/3): (a) uncorrected image; (b) corrected image; (c) uncorrected MTF; (d) correction filter; and (e) corrected MTF. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 48

(a) (b)

1 1 0.035

0.9 0.9

0.03 0.8 0.8

0.7 0.025 0.7

0.6 0.6 0.02 ) ) ) ρ ρ

0.5 ρ 0.5 H( H( H(

0.015 0.4 0.4

0.3 0.3 0.01

0.2 0.2

0.005 0.1 0.1

0 0 0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ ρ / ρ ρ / ρ 0 0 0 (c) (d) (e)

Figure 4.17: Spoke pattern imaged with misfocused synthesized difference-of-Gaussians pupil (wa =0.4, wb =0.281, β =1,W20 = λ/2): (a) uncorrected image; (b) corrected image; (c) uncorrected MTF; (d) correction filter; and (e) corrected MTF. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 49

(a) (b)

1 1 0.03

0.9 0.9

0.8 0.025 0.8

0.7 0.7 0.02 0.6 0.6 ) ) ) ρ ρ

0.5 ρ 0.5

H( 0.015 H( H(

0.4 0.4

0.01 0.3 0.3

0.2 0.2 0.005

0.1 0.1

0 0 0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ ρ / ρ ρ / ρ 0 0 0 (c) (d) (e)

Figure 4.18: Spoke pattern imaged with misfocused synthesized difference-of-Gaussians pupil (wa =0.4, wb =0.281, β =1.08, W20 = λ/2): (a) uncorrected image; (b) corrected image; (c) uncorrected MTF; (d) correction filter; and (e) corrected MTF. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 50

(a) (b)

1 1 0.035

0.9 0.9

0.03 0.8 0.8

0.7 0.025 0.7

0.6 0.6 0.02 ) ) ) ρ ρ

0.5 ρ 0.5 H( H( H(

0.015 0.4 0.4

0.3 0.3 0.01

0.2 0.2

0.005 0.1 0.1

0 0 0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ ρ / ρ ρ / ρ 0 0 0 (c) (d) (e)

Figure 4.19: Spoke pattern imaged with misfocused synthesized difference-of-Gaussians pupil (wa =0.4, wb =0.281, β =1,W20 = λ): (a) uncorrected image; (b) corrected image; (c) uncorrected MTF; (d) correction filter; and (e) corrected MTF. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 51

(a) (b)

1 1 0.03

0.9 0.9

0.8 0.025 0.8

0.7 0.7 0.02 0.6 0.6 ) ) ) ρ ρ

0.5 ρ 0.5

H( 0.015 H( H(

0.4 0.4

0.01 0.3 0.3

0.2 0.2 0.005

0.1 0.1

0 0 0 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 ρ / ρ ρ / ρ ρ / ρ 0 0 0 (c) (d) (e)

Figure 4.20: Spoke pattern imaged with misfocused synthesized difference-of-Gaussians pupil (wa =0.4, wb =0.281, β =1.08, W20 = λ): (a) uncorrected image; (b) corrected image; (c) uncorrected MTF; (d) correction filter; and (e) corrected MTF. CHAPTER 4. SYNTHESIZED DIFFERENCE-OF-GAUSSIANS PUPIL 52

Another observation is that the Gaussian functions in the system create a rapid fall-off of high spatial frequencies, which means any corrective filter will have to boost those frequencies (see, for example, plot (d) in Figure 4.15). This will have the unwanted side-effect of considerably increasing noise in the image. It may be best to not use such a filter at all. Chapter 5

Conclusions

As a summary of results, Table 5.1 shows the maximum object thicknesses for each pupil if they are used in a hypothetical system with the following parameters:

r0 =1cm, f=10cm, λ= 600 nm.

It is assumed that the system is focused at the center of the object. The distance from the center to the front or the back of the object corresponds to the maximum W20 value for each pupil found by Hopkin’s criterion. The synthesized difference-of-Gaussians system offers moderate improvement over the circu- lar or Gaussian pupils. The annular pupil, of course, has a very long depth-of-focus. Most of the listed pupil functions can still produce usable images for objects slightly thicker than the maximums listed, except for the synthesized difference-of-Gaussians pupil with β>1. As shown previously, increasing β makes the system much more sensitive to misfocus outside the maximum range found by Hopkin’s criterion. If the thickness of the sample can be kept within the maximum, image defects will be minimized. It could also be possible to set β somewhere between unity and the maximum value, as a trade-off. The parameter β can be adjusted to create an optical wavelet transform system, as described in [6]. A system could be designed which can be switched between conventional 3-D imaging and 2-D wavelet analysis by simply changing β. Some areas for further research include experimental validation of the numerical results in this thesis, and examination of different beam profiles besides two Gaussians as input to the synthesis system. One drawback of a Gaussian beam is that the PSF is constantly broaden- ing as the beam propagates, resulting in steady loss of high spatial frequency information. Another beam profile may give better results, but such a profile should be able to travel

53 CHAPTER 5. CONCLUSIONS 54

Table 5.1: Maximum object thicknesses for various pupil functions.

maximum thickness pupil (µm) circular 51.6 annular ( =0.95) 367

Gaussian (w0 =0.4cm) 61.4

difference-of-Gaussians (wa =0.4cm, wb =0.35 cm) 67.0

synthesized difference-of-Gaussians (wa =0.4cm, wb =0.281 cm, β =1) 63.6

synthesized difference-of-Gaussians (wa =0.4cm, wb =0.281 cm, β =1.08) 79.9

through all the optics without experiencing too much distortion due to diffraction. For ex- ample, using two circular pupils to create a “synthesized annular pupil” would be ineffective because of the diffraction of the beams. The relative amplitudes of the two interferometer arms could be adjusted, yielding another tunable parameter. A more advanced type of system to consider is one which combines more than two beams, to create a sort of synthesized Fresnel (FZP). A FZP used as a pupil in an incoherent

imaging system can extend depth-of-focus [23]. Also, a system could be designed in which \ the phase term \Qa Qb of (4.2) is recovered and used in the synthesis process. Finally, it may be interesting− to see what happens when the beams are not precisely aligned upon recombination, a situation possible in a practical system. Appendix A

Strehl Ratio Derivations

In both derivations presented here, the generalized pupil function for a misfocused Gaussian beam is used. Using (3.1), this result is

2 2 2 2 2 qG(x, y)=exp (x +y )/w exp jkW20(x + y ) , (A.1) − 0 where w0 is the width of the Gaussian (same as in Section 3.2). The Fourier transform of qG(x, y)is

QG(fx,fy)= qG(x, y) F{ } 2 π π 2 2 (A.2) = 2 exp 2 (fx + fy ) . 1/w jkW20 −1/w jkW20 0 −  0 −  A.1 Difference-of-Gaussians

The generalized pupil function for the difference-of-Gaussians pupil can be written

2 2 qDoG(x, y)=[ga(x, y) gb(x, y)] exp jkW20(x + y ) − (A.3) = qa(x, y) qb(x, y), −   where qa(x, y)andqb(x, y) are generalized pupil functions for Gaussians of width wa and wb, respectively. Here we have ignored the finite extent of the pupil. Using (2.4), the on-axis intensity can be written

2

hDoG(0, 0; W20)= qDoG(x, y) fx=0 F{ }f =0 y 2 (A.4) = qa(x, y) qb(x, y) fx=0 F{ − }f =0 y 2 = Qa(0, 0) Qb(0, 0) , | − | 55 APPENDIX A. STREHL RATIO DERIVATIONS 56

where Qa(fx,fy)andQb(fx,fy) are the Fourier transforms of qa(x, y)andqb(x, y), respec- tively. Using the result of (A.2), π π 2 hDoG(0, 0; W20)= . (A.5) 1/w2 jkW − 1/w2 jkW a 20 b 20 − − After multiplying out, we have

hDoG(0, 0; W20) 2 2 2 2 2 2 2 π π π (1/wawb + k W20) = 4 2 2 + 4 2 2 2 4 2 2 4 2 2 . (A.6) 1/wa + k W20 1/wb + k W20 − (1/wa + k W20)(1/wb + k W20) Finally, if we define π2 Ca(W20)= 4 2 2 , 1/wa + k W20 π2 Cb(W20)= 4 2 2 , 1/wb + k W20 π2 Cab(W20)= 2 2 2 2 , 1/wawb + k W20 we may write (A.6) as

Ca(W20)Cb(W20) hDoG(0, 0; W20)=Ca(W20)+Cb(W20) 2 . (A.7) − Cab(W20)

Dividing by hDoG(0, 0; 0) yields the Strehl ratio for the difference-of-Gaussians pupil. This result is shown in (3.19).

A.2 Synthesized Difference-of-Gaussians

There is no pupil function for the synthesized difference-of-Gaussians, but we have the PSF from (4.8). From this, the on-axis intensity is found to be 2 2 hSDoG(0, 0; W20)= Qa(0, 0) + Qb(0, 0) 2β Qa(0, 0)Qb(0, 0) . (A.8) | | | | − | | Using the expressions for Qa(fx,fy)andQb(fx,fy) from (A.2),

hSDoG(0, 0; W20) π2 π2 π π = + 2β (A.9) 1/w4 + k2W 2 1/w4 + k2W 2 4 2 2 4 2 2 a 20 b 20 − 1/wa + k W20 1/wb + k W20

Using the definitions of Ca(W20)andCb(W20) fromp the previous section,p we may write this as

hSDoG(0, 0; W20)=Ca(W20)+Cb(W20) 2β Ca(W20)Cb(W20). (A.10) − As before, dividing this result by hSDoG(0, 0; 0) yields thep Strehl ratio, as shown in (4.10). Appendix B

Program Listings

MATLAB code is included on the following pages. Note that parameters such as focal length f or wavelength λ are set equal to unity wherever they appear in equations, to simplify the numerical calculations. The programs are separated into two basic groups: those that work for any pupil function returned by p.m, and those that perform calculations strictly for the synthesized difference- of-Gaussians pupil.

57 APPENDIX B. PROGRAM LISTINGS 58

B.1 p.m — Pupil Functions

%% %% p.m %% %% Various interesting circularly symmetric pupil functions having %% a radius of 1. %% function z = p(x,y) rho2 = x.^2 + y.^2; %%% circular %z=1; %%% annular % b = 0.95; % z = (rho2 >= b^2); %%% Gaussian % w = 0.4; % z = exp(-rho2 / w^2); %%% Difference-of-Gaussians wa = 0.4; wb = 0.35; z = exp(-rho2 / wa^2) - exp(-rho2 / wb^2); z = z .* (rho2 <= 1.0); APPENDIX B. PROGRAM LISTINGS 59

B.2 plot_otf_2d.m — Plot MTF

%% %% plot_otf_2d.m %% %% Plots the OTF associated with a given 2-D pupil and focus error. %% xn = 256; xm=2; % Focus error coefficients to plot. w20_1 = 0; w20_2 = 0.5; w20_3 = 1; %% dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); fxr = (-xn/2:xn/2-1) * (1/dx) / (xn+1); q_1 = []; % The generalized pupil function. q_2 = []; q_3 = []; xi=1; for x = xr, rho2 = xr.^2 + x^2; q_1(xi,:) = p(xr,x) .* exp(j*2*pi*w20_1*rho2); q_2(xi,:) = p(xr,x) .* exp(j*2*pi*w20_2*rho2); q_3(xi,:) = p(xr,x) .* exp(j*2*pi*w20_3*rho2); xi=xi+1; end % PSF and OTF. h_1 = abs(fft2(q_1)).^2; H_1 = fftshift(fft2(h_1)); h_2 = abs(fft2(q_2)).^2; H_2 = fftshift(fft2(h_2)); h_3 = abs(fft2(q_3)).^2; H_3 = fftshift(fft2(h_3)); Hp_1 = fftshift(h_1 / max(max(h_1))); Hp_2 = fftshift(h_2 / max(max(h_2))); Hp_3 = fftshift(h_3 / max(max(h_3))); figure(1); plot(fxr,Hp_1(xn/2+1,:),‘-’, fxr, Hp_2(xn/2+1,:),‘-.’, fxr, Hp_3(xn/2+1,:),‘:’); xlabel(‘r / \lambda f’); ylabel(‘h(r)’); APPENDIX B. PROGRAM LISTINGS 60

legend([‘W_{20} / \lambda = ’ num2str(w20_1)], ... [‘W_{20} / \lambda = ’ num2str(w20_2)], ... [‘W_{20} / \lambda = ’ num2str(w20_3)]); a = axis; axis([-5 5 a(3:4)]); Hp = abs(H_1); Hp_1 = Hp / max(max(Hp)); Hp = abs(H_2); Hp_2 = Hp / max(max(Hp)); Hp = abs(H_3); Hp_3 = Hp / max(max(Hp)); figure(2); plot(xr,Hp_1(xn/2+1,:),‘-’, xr, Hp_2(xn/2+1,:),‘-.’, xr, Hp_3(xn/2+1,:),‘:’); xlabel(‘\rho / \rho_0’); ylabel(‘H(\rho)’); legend([‘W_{20} / \lambda = ’ num2str(w20_1)], ... [‘W_{20} / \lambda = ’ num2str(w20_2)], ... [‘W_{20} / \lambda = ’ num2str(w20_3)]); APPENDIX B. PROGRAM LISTINGS 61

B.3 plot_otf_2d_w20.m — Plot MTF vs. W20

%% %% plot_otf_2d_w20.m %% %% Plots the 2-D OTF vs. W20 associated with various pupil functions. %% xn = 256; xm=2; wn = 64; wm=5; %% dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); fxr = (-xn/2:xn/2-1) * (1/dx) / (xn+1); dw = 2*wm/wn; wr = -wm:dw:wm; wr = wr(1:wn); otf = []; psf = []; q = []; wi=1; for w20 = wr, xi = 1; for x = xr, q(xi,:) = p(xr,x) .* exp(j*2*pi*w20*(xr.^2 + x^2)); xi=xi+1; end h = abs(fft2(q)).^2; H = fftshift(fft2(h)); h = fftshift(h); psf(wi,:) = h(xn/2+1,:); otf(wi,:) = H(xn/2+1,:); wi=wi+1; end figure(1); pcolor(wr,fxr,psf’.^0.3); % The exponent is for contrast enhancement. colormap(‘gray’); shading interp; xlabel(‘W_{20} / \lambda’); ylabel(‘r / \lambda f’); a = axis; axis([a(1:2) -5 5]); figure(2); APPENDIX B. PROGRAM LISTINGS 62

pcolor(wr,xr,abs(otf)’.^0.3); colormap(‘gray’); shading interp; xlabel(‘W_{20} / \lambda’); ylabel(‘\rho / \rho_0’); APPENDIX B. PROGRAM LISTINGS 63

B.4 strehl.m — Strehl Ratio

%% %% strehl.m %% %% Returns the Strehl ratio for a given misfocus vale for a given pupil %% function. The misfocus coefficient argument can be an array. %% function s = strehl(w20r) xn = 128; xm=2; dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); % First, generate the in-focus OTF. This only needs to be done once, % no matter how many w20 values we have. q0 = zeros(xn,xn); xi=1; for x = xr, q0(xi,:) = p(xr,x); xi=xi+1; end h0 = abs(fftshift(fft2(q0))).^2; s = zeros(size(w20r)); % Strehl ratio values. wi=1; for w20 = w20r, q = zeros(xn, xn); xi = 1; for x = xr, q(xi,:) = q0(xi,:) .* exp(j*2*pi*w20*(xr.^2 + x^2)); xi=xi+1; end % PSF. h = abs(fftshift(fft2(q))).^2; s(wi) = h(xn/2+1, xn/2+1) / h0(xn/2+1, xn/2+1); wi=wi+1; end APPENDIX B. PROGRAM LISTINGS 64

B.5 find_w20_max_strehl.m — Find Max W20 with Strehl Ratio

%% %% find_w20_max_strehl.m %% %% Finds the value of w20 where the Strehl ratio is half of its maximum %% value. %% w20_min = 0; w20_max = 5; %% % These are just used for the plot. n = 100; w20r = w20_min:(w20_max - w20_min)/n:w20_max; % Tolerance for bisection method. tol = 0.0001; a = w20_min; fa = strehl(a) - 0.5; b = w20_max; fb = strehl(b) - 0.5; while (abs(b - a) > tol), c = a + (b - a)/2; fc = strehl(c) - 0.5; if ((fb > 0) == (fc > 0)), b = c; fb = fc; else a = c; fa = fc; end end % Output the max w20_value. w20_max = a figure(1); plot(w20r, strehl(w20r), ‘-’, w20r, 0.5*ones(size(w20r)), ‘:’); xlabel(‘W_{20} / \lambda’); ylabel(‘S(W_{20})’); APPENDIX B. PROGRAM LISTINGS 65

B.6 hopkins.m — Hopkin’s Criterion

%% %% hopkins.m %% %% Returns the minimum value of the ratio of misfocused to focused OTF %% for a given value of misfocus coefficient. The misfocus coefficient %% argument can be an array. %% function m = hopkins(w20r) xn = 128; xm=2; dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); % First, generate the in-focus OTF. This only needs to be done once, % no matter how many w20 values we have. q0 = zeros(xn,xn); xi=1; for x = xr, q0(xi,:) = p(xr,x); xi=xi+1; end h0 = abs(fft2(q0)).^2; H0 = abs(fftshift(fft2(h0))); H0 = H0 / max(max(H0)); m = zeros(size(w20r)); % Next, loop through the w20 values and build an array of the minimum % ratio of out-of-focus to in-focus OTF. wi=1; for w20 = w20r, q = zeros(xn,xn); xi = 1; for x = xr, q(xi,:) = q0(xi,:) .* exp(j*2*pi*w20*(xr.^2 + x^2)); xi=xi+1; end h = abs(fft2(q)).^2; APPENDIX B. PROGRAM LISTINGS 66

H = abs(fftshift(fft2(h))); H = H / max(max(H)); hp = H ./ H0; m(wi) = min(hp(xn/2+1,:)); wi=wi+1; end APPENDIX B. PROGRAM LISTINGS 67

B.7 hopkins_dog.m — Hopkin’s Criterion (Difference- of-Gaussians)

%% %% hopkins_dog.m %% %% Returns the minimum value of the ratio of misfocused to focused OTF %% for the difference-of-Gaussians pupil, with given widths and given value %% of misfocus coefficient. The misfocus coefficient can be an array. %% function m = hopkins_dog(wa,wb,w20r) xn = 128; xm=2; dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); % First, generate the in-focus OTF. This only needs to be done once, % no matter how many w20 values we have. q0 = zeros(xn,xn); xi=1; for x = xr, rho2 = xr.^2 + x^2; q0(xi,:) = (exp(-rho2 / wa^2) - exp(-rho2 / wb^2)) .* (rho2 <= 1); xi=xi+1; end h0 = abs(fft2(q0)).^2; H0 = abs(fftshift(fft2(h0))); H0 = H0 / max(max(H0)); m = zeros(size(w20r)); wi=1; for w20 = w20r, q = zeros(xn,xn); xi = 1; for x = xr, q(xi,:) = q0(xi,:) .* exp(j*2*pi*w20*(xr.^2 + x^2)); xi=xi+1; end h = abs(fft2(q)).^2; APPENDIX B. PROGRAM LISTINGS 68

H = abs(fftshift(fft2(h))); H = H / max(max(H)); hp = H ./ H0; m(wi) = min(hp(xn/2+1,:)); wi=wi+1; end APPENDIX B. PROGRAM LISTINGS 69

B.8 find_w20_max_hopkins.m — Find Max W20 with Hopkin’s Criterion

%% %% find_w20_max_hopkins.m %% %% Finds the value of w20 where Hopkin’s criteria is no longer satisfied. %% This is one way of finding the maximum focal depth of a pupil. %% w20_min = 0; w20_max = 1; % These are just used for the plot. n = 50; w20r = w20_min:(w20_max - w20_min)/n:w20_max; % Tolerance for bisection method. tol = 0.0001; a = w20_min; fa = hopkins(a) - 0.8; b = w20_max; fb = hopkins(b) - 0.8; while (abs(b - a) > tol), c = a + (b - a)/2; fc = hopkins(c) - 0.8; if ((fb > 0) == (fc > 0)), b = c; fb = fc; else a = c; fa = fc; end end % Output the max w20_value. w20_max = a figure(1); plot(w20r,hopkins(w20r),‘-’,w20r,0.8*ones(size(w20r)),‘:’); xlabel(‘W_{20} / \lambda’); ylabel(‘min H(u,v;W_{20}) / H(u,v;0)’); APPENDIX B. PROGRAM LISTINGS 70

B.9 find_best_wb.m — Find Optimal wb (Difference- of-Gaussians)

%% %% find_best_wb.m %% %% Given a value of misfocus coefficient and a value for wa, this M-file %% attempts to find the ‘‘best‘’ value of wb (the one with the greatest ratio %% of out-of-focus to in-focus OTFs). %% w20 = 0.278; wa = 0.4; % Scans through n values between wb_min and wb_max. wb_min = 0.3; wb_max = 0.39; n = 50; wbr = wb_min:(wb_max-wb_min)/n:wb_max; hr = []; max_hr = -1; wi=1; for wb = wbr, hr(wi) = hopkins_dog(wa,wb,w20); if (hr(wi) > max_hr) max_hr = hr(wi); best_wb = wb; end wi=wi+1; end figure(1); plot(wbr,hr,‘-’,wbr,0.8*ones(size(wbr)),‘:’); xlabel(‘w_b’); ylabel(‘min H(u,v;W_{20}) / H(u,v;0)’); a = axis; axis([wb_min wb_max a(3:4)]); % Output the best value for wb. best_wb APPENDIX B. PROGRAM LISTINGS 71

B.10 spoke.m — Spoke Pattern

%% %% spoke.m %% %% Generate a spoke pattern with n spokes and resolution s x s. %% function m = spoke(s,n) m = []; for x = 1:s, xt = (2 * (x-1) / (s-1)) - 1; for y = 1:s, yt = (2 * (y-1) / (s-1)) - 1; r = xt^2 + yt^2; t = floor(atan2(yt, xt)/pi * n); m(x,y) = 1 - (r <= 0.90) * (mod(t,2) > 0.5); end end APPENDIX B. PROGRAM LISTINGS 72

B.11 plot_spoke.m — Plot Image of Spoke Pattern

%% %% plot_spoke.m %% %% Generate an image of a two-dimensional spoke test pattern (from spoke.m) %% which was scanned with a given pupil function at a given focus error. %% xn = 512; xm=2; % Focus error coefficient. w20=1; %% % Generate a spoke pattern, I prefer to use a prime number for the number % of spokes because that reduces -based artifacts. if (xn == 512) load(‘spoke-512.mat’, ‘s’); else s = spoke(xn, 37); end dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); qc = []; % Circular pupil. q0 = []; % In-focus generalized pupil. q = []; % Out-of-focus generalized pupil. xi=1; for x = xr, rho2 = xr.^2 + x^2; qc(xi,:) = rho2 <= 1; q0(xi,:) = p(xr,x); q(xi,:) = q0(xi,:) .* exp(j*2*pi*w20*rho2); xi=xi+1; end % PSF and OTF for circular pupil. hc = abs(fft2(qc)).^2; Hc = fft2(hc); % PSF and OTF of in-focus pupil. h0 = abs(fft2(q0)).^2; H0 = fft2(h0); APPENDIX B. PROGRAM LISTINGS 73

% PSF and OTF of defocused pupil. h = abs(fft2(q)).^2; H = fft2(h); % Fourier transform of spoke pattern’s intensity. S = fft2(abs(s).^2); % Build an inverse filter which will correct the in-focus OTF to that % of a circular pupil. C = Hc ./ H0; % Build the resulting intensities. im = ifft2(H .* S); im_corrected = ifft2(H .* S .* C); figure(1); pcolor(xr,xr,abs(im).^0.3); % Exponent is for contrast enhancement. colormap(‘gray’); shading interp; axis square; axis off; figure(2); pcolor(xr,xr,abs(im_corrected).^0.3); colormap(‘gray’); shading interp; axis square; axis off; % Plot out-of-focus OTF. figure(3); tmp = fftshift(abs(H)); tmp = tmp / max(max(tmp)); plot(xr,tmp(xn/2+1,:)); xlabel(‘\rho / \rho_0’); ylabel(‘H(\rho)’); % Plot corrective filter. figure(4); tmp = fftshift(abs(C)); tmp = tmp / max(max(tmp)); plot(xr,tmp(xn/2+1,:)); xlabel(‘\rho / \rho_0’); ylabel(‘H(\rho)’); % Plot corrected OTF. figure(5); tmp = fftshift(abs(H .* C)); tmp = tmp / max(max(tmp)); plot(xr,tmp(xn/2+1,:)); xlabel(‘\rho / \rho_0’); ylabel(‘H(\rho)’); APPENDIX B. PROGRAM LISTINGS 74

B.12 plot_otf_2d_sdog.m — Plot MTF (SDoG)

%% %% plot_otf_2d_sdog.m %% %% Plots the OTF associated with a synthesized 2-D difference-of-Gaussians %% pupil having a given beta and focus error. %% xn = 256; xm=2; w20_1 = 1; w20_2 = 2; w20_3 = 3; wa = 0.4; wb = 0.281; beta = 1.0; % Wavelet beta %beta = (wa^2 + wb^2)^2 / (4 * wa^2 * wb^2) dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); fxr = (-xn/2:xn/2-1) * (1/dx) / (xn+1); qa_1 = []; % Generalized pupil function for wide beam. qb_1 = []; % Generalized pupil function for narrow beam. qa_2 = []; qb_2 = []; qa_3 = []; qb_3 = []; xi=1; for x = xr, rho2 = xr.^2 + x^2; circ = (rho2 <= 1); qa_1(xi,:) = exp(-rho2 / wa^2) .* exp(j*2*pi*w20_1*rho2) .* circ; qb_1(xi,:) = exp(-rho2 / wb^2) .* exp(j*2*pi*w20_1*rho2) .* circ; qa_2(xi,:) = exp(-rho2 / wa^2) .* exp(j*2*pi*w20_2*rho2) .* circ; qb_2(xi,:) = exp(-rho2 / wb^2) .* exp(j*2*pi*w20_2*rho2) .* circ; qa_3(xi,:) = exp(-rho2 / wa^2) .* exp(j*2*pi*w20_3*rho2) .* circ; qb_3(xi,:) = exp(-rho2 / wb^2) .* exp(j*2*pi*w20_3*rho2) .* circ; xi=xi+1; end Qa_1 = fft2(qa_1); Qb_1 = fft2(qb_1); APPENDIX B. PROGRAM LISTINGS 75

Qa_2 = fft2(qa_2); Qb_2 = fft2(qb_2); Qa_3 = fft2(qa_3); Qb_3 = fft2(qb_3); %% PSF of synthesized DoG h_1 = abs(Qa_1).^2 + abs(Qb_1).^2 - 2 * beta * abs(Qa_1) .* abs(Qb_1); h_2 = abs(Qa_2).^2 + abs(Qb_2).^2 - 2 * beta * abs(Qa_2) .* abs(Qb_2); h_3 = abs(Qa_3).^2 + abs(Qb_3).^2 - 2 * beta * abs(Qa_3) .* abs(Qb_3); %% PSF of real DoG (for verification) %h_1 = abs(Qa_1).^2 + abs(Qb_1).^2 - 2 * real(Qa_1 .* conj(Qb_1)); %h_2 = abs(Qa_2).^2 + abs(Qb_2).^2 - 2 * real(Qa_2 .* conj(Qb_2)); %h_3 = abs(Qa_3).^2 + abs(Qb_3).^2 - 2 * real(Qa_3 .* conj(Qb_3)); % OTF H_1 = fftshift(fft2(h_1)); H_2 = fftshift(fft2(h_2)); H_3 = fftshift(fft2(h_3)); Hp_1 = fftshift(h_1 / max(max(h_1))); Hp_2 = fftshift(h_2 / max(max(h_2))); Hp_3 = fftshift(h_3 / max(max(h_3))); figure(1); plot(fxr,Hp_1(xn/2+1,:),‘-’, fxr, Hp_2(xn/2+1,:),‘-.’, fxr, Hp_3(xn/2+1,:),‘:’); xlabel(‘r / \lambda f’); ylabel(‘h(r)’); legend([‘W_{20} / \lambda = ’ num2str(w20_1)], ... [‘W_{20} / \lambda = ’ num2str(w20_2)], ... [‘W_{20} / \lambda = ’ num2str(w20_3)]); a = axis; axis([-5 5 a(3:4)]); Hp = abs(H_1); Hp_1 = Hp / max(max(Hp)); Hp = abs(H_2); Hp_2 = Hp / max(max(Hp)); Hp = abs(H_3); Hp_3 = Hp / max(max(Hp)); figure(2); plot(xr,Hp_1(xn/2+1,:),‘-’, xr, Hp_2(xn/2+1,:),‘-.’, xr, Hp_3(xn/2+1,:),‘:’); xlabel(‘\rho / \rho_0’); ylabel(‘H(\rho)’); legend([‘W_{20} / \lambda = ’ num2str(w20_1)], ... [‘W_{20} / \lambda = ’ num2str(w20_2)], ... [‘W_{20} / \lambda = ’ num2str(w20_3)]); APPENDIX B. PROGRAM LISTINGS 76

B.13 plot_otf_2d_w20_sdog.m — Plot MTF vs. W20 (SDoG)

%% %% plot_otf_2d_w20_sdog.m %% %% Plots the 2-D OTF vs. W20 associated with a synthesized 2-D %% difference-of-Gaussians pupil. %% xn = 64; xm=2; wn = 64; wm=5; wa = 0.4; wb = 0.281; beta = 1.0; % Wavelet beta %beta = (wa^2 + wb^2)^2 / (4 * wa^2 * wb^2) %% dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); fxr = (-xn/2:xn/2-1) * (1/dx) / (xn+1); dw = 2*wm/wn; wr = -wm:dw:wm; wr = wr(1:wn); psf = []; otf = []; qa = []; qb = []; wi=1; for w20 = wr, xi = 1; for x = xr, rho2 = xr.^2 + x^2; circ = (rho2 <= 1); qa(xi,:) = exp(-rho2 / wa^2) .* exp(j*2*pi*w20*rho2) .* circ; qb(xi,:) = exp(-rho2 / wb^2) .* exp(j*2*pi*w20*rho2) .* circ; xi=xi+1; end APPENDIX B. PROGRAM LISTINGS 77

Qa = fft2(qa); Qb = fft2(qb); %% Synthesized DoG h = abs(Qa).^2 + abs(Qb).^2 - 2 * beta * abs(Qa) .* abs(Qb); %% Real DoG (for verification). %h = abs(Qa).^2 + abs(Qb).^2 - 2 * real(Qa .* conj(Qb)); H = fftshift(fft2(h)); h = fftshift(h); psf(wi,:) = h(xn/2+1,:); otf(wi,:) = H(xn/2+1,:); wi=wi+1; end psf = psf - min(min(psf)); figure(1); pcolor(wr,fxr,psf’.^0.3); % The exponent is for contrast enhancement. colormap(‘gray’); shading interp; xlabel(‘W_{20} / \lambda’); ylabel(‘r / \lambda f’); a = axis; axis([a(1:2) -5 5]); figure(2); pcolor(wr,xr,abs(otf)’.^0.3); colormap(‘gray’); shading interp; xlabel(‘W_{20} / \lambda’); ylabel(‘\rho / \rho_0’); APPENDIX B. PROGRAM LISTINGS 78

B.14 strehl_sdog.m — Strehl Ratio (SDoG)

%% %% strehl_sdog.m %% %% Returns the Strehl ratio for a given misfocus vale for the synthesized %% difference-of-Gaussians pupil with given parameters. The misfocus %% coefficient argument can be an array. %% function s = strehl_sdog(wa,wb,beta,w20r) xn = 128; xm=2; dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); % First, generate the in-focus OTF. This only needs to be done once, % no matter how many w20 values we have. q0a = zeros(xn, xn); q0b = zeros(xn, xn); xi=1; for x = xr, rho2 = xr.^2 + x^2; q0a(xi,:) = exp(-rho2 / wa^2) .* (rho2 <= 1); q0b(xi,:) = exp(-rho2 / wb^2) .* (rho2 <= 1); xi=xi+1; end Q0a = fftshift(fft2(q0a)); Q0b = fftshift(fft2(q0b)); %% Synthesized DoG PSF h0 = abs(Q0a).^2 + abs(Q0b).^2 - 2 * beta * abs(Q0a) .* abs(Q0b); %% Real DoG PSF (for verification) %h0 = abs(Q0a).^2 + abs(Q0b).^2 - 2 * real(Q0a .* conj(Q0b)); s = zeros(size(w20r)); % Strehl ratio values. wi=1; for w20 = w20r, qa = zeros(xn, xn); qb = zeros(xn, xn); xi = 1; for x = xr, rho2 = xr.^2 + x^2; APPENDIX B. PROGRAM LISTINGS 79

qa(xi,:) = q0a(xi,:) .* exp(j*2*pi*w20*rho2); qb(xi,:) = q0b(xi,:) .* exp(j*2*pi*w20*rho2); xi=xi+1; end Qa = fftshift(fft2(qa)); Qb = fftshift(fft2(qb)); %% Synthesized DoG PSF h = abs(Qa).^2 + abs(Qb).^2 - 2 * beta * abs(Qa) .* abs(Qb); %% Real DoG PSF (for verification) %h = abs(Qa).^2 + abs(Qb).^2 - 2 * real(Qa .* conj(Qb)); s(wi) = h(xn/2+1, xn/2+1) / h0(xn/2+1, xn/2+1); wi=wi+1; end APPENDIX B. PROGRAM LISTINGS 80

B.15 find_w20_max_strehl_sdog.m — Find Max W20 with Strehl Ratio (SDoG)

%% %% find_w20_max_strehl_sdog.m %% %% Finds the value of w20 where the Strehl ratio is half of its maximum %% value for the synthesized difference-of-Gaussians pupil. %% wa = 0.4; wb = 0.281; beta = 1.08; w20_min = 0; w20_max = 5; %% % These are just used for the plot. n = 80; w20r = w20_min:(w20_max - w20_min)/n:w20_max; % Tolerance for bisection method. tol = 0.0001; a = w20_min; fa = strehl_sdog(wa,wb,beta,a) - 0.5; b = w20_max; fb = strehl_sdog(wa,wb,beta,b) - 0.5; while (abs(b - a) > tol), c = a + (b - a)/2; fc = strehl_sdog(wa,wb,beta,c) - 0.5; if ((fb > 0) == (fc > 0)), b = c; fb = fc; else a = c; fa = fc; end end % Output the max w20_value. w20_max = a figure(1); plot(w20r, strehl_sdog(wa,wb,beta,w20r), ‘-’, w20r, 0.5*ones(size(w20r)), ‘:’); xlabel(‘W_{20} / \lambda’); ylabel(‘S(W_{20})’); APPENDIX B. PROGRAM LISTINGS 81

B.16 hopkins_sdog.m — Hopkin’s Criterion (SDoG)

%% %% hopkins_sdog.m %% %% Returns the minimum value of the ratio of misfocused to focused OTF %% for the synthesized difference-of-Gaussians pupil, with given widths and %% and given value of misfocus coefficient. The misfocus coefficient can be %% an array. %% function m = hopkins_sdog(wa,wb,beta,w20r) xn = 128; xm=2; dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); % First, generate the in-focus OTFs. This only needs to be done once, % no matter how many w20 values we have. q0a = zeros(xn,xn); q0b = zeros(xn,xn); xi=1; for x = xr, rho2 = xr.^2 + x^2; q0a(xi,:) = exp(-rho2 / wa^2) .* (rho2 <= 1); q0b(xi,:) = exp(-rho2 / wb^2) .* (rho2 <= 1); xi=xi+1; end Q0a = fft2(q0a); Q0b = fft2(q0b); %% Synthesized DoG PSF h0 = abs(Q0a).^2 + abs(Q0b).^2 - 2 * beta * abs(Q0a) .* abs(Q0b); %% Real DoG PSF (for verification) %h0 = abs(Q0a).^2 + abs(Q0b).^2 - 2 * real(Q0a .* conj(Q0b)); H0 = abs(fftshift(fft2(h0))); H0 = H0 / max(max(H0)); % Due to some rounding errors (numbers involved are near MATLAB’s epsilon), % we need to chop some small values out. No big deal, because they are in the % area where the OTF approaches zero anyway, nothing interesting there. We % need to do this to the out-of-focus OTF as well. i = find(H0 < 1e-4); H0(i) = 1e-4; APPENDIX B. PROGRAM LISTINGS 82

m = zeros(size(w20r)); % Next, loop through the w20 values and build an array of the minimum % ratio of out-of-focus to in-focus OTF. wi=1; for w20 = w20r, qa = zeros(xn,xn); qb = zeros(xn,xn); xi = 1; for x = xr, rho2 = xr.^2 + x^2; qa(xi,:) = q0a(xi,:) .* exp(j*2*pi*w20*rho2); qb(xi,:) = q0b(xi,:) .* exp(j*2*pi*w20*rho2); xi=xi+1; end Qa = fft2(qa); Qb = fft2(qb); %% Synthesized DoG PSF h = abs(Qa).^2 + abs(Qb).^2 - 2 * beta * abs(Qa) .* abs(Qb); %% Real DoG PSF (for verification) %h = abs(Qa).^2 + abs(Qb).^2 - 2 * real(Qa .* conj(Qb)); H = abs(fftshift(fft2(h))); H = H / max(max(H)); % See comment above about rounding error. H(i) = 1e-4; hp = H ./ H0; % figure(3); % plot(H0(xn/2+1,:)); % figure(4); % plot(H(xn/2+1,:)); % figure(5); % plot(hp(xn/2+1,:)); m(wi) = min(hp(xn/2+1,:)); wi=wi+1; end APPENDIX B. PROGRAM LISTINGS 83

B.17 find_best_wb_sdog.m — Find Optimal wb (SDoG)

%% %% find_best_wb_sdog.m %% %% Given a value of misfocus coefficient and a value for wa and beta, this %% M-file attempts to find the ‘‘best‘’ value of wb for the synthesized %% DoG pupil (the one with the greatest ratio of out-of-focus to in-focus %% OTFs). %% w20 = 0.264; wa = 0.4; beta = 1.08; % Scans through n values between wb_min and wb_max. wb_min = 0.2; wb_max = 0.3; n = 50; wbr = wb_min:(wb_max-wb_min)/n:wb_max; hr = []; max_hr = -1; wi=1; for wb = wbr, hr(wi) = hopkins_sdog(wa,wb,beta,w20); if (hr(wi) > max_hr) max_hr = hr(wi); best_wb = wb; end wi=wi+1; end figure(1); plot(wbr,hr,‘-’,wbr,0.8*ones(size(wbr)),‘:’); xlabel(‘w_b’); ylabel(‘min H(u,v;W_{20}) / H(u,v;0)’); a = axis; axis([wb_min wb_max a(3:4)]); % Output the best value for wb. best_wb APPENDIX B. PROGRAM LISTINGS 84

B.18 find_best_beta.m — Find Optimal β (SDoG)

%% %% find_best_beta.m %% %% Given a value of misfocus coefficient and a value for wa and wb, this %% M-file attempts to find the ‘‘best‘’ value of beta for the synthesized %% DoG pupil (the one with the greatest ratio of out-of-focus to in-focus %% OTFs). %% w20 = 0.264; wa = 0.4; wb = 0.281; % Scans through n values between b_min and b_max. b_min = 0.9; b_max = 1.1; n = 30; br = b_min:(b_max-b_min)/n:b_max; hr = []; max_hr = -1; wi=1; for b = br, hr(wi) = hopkins_sdog(wa,wb,b,w20); if (hr(wi) > max_hr) max_hr = hr(wi); best_beta = b; end wi=wi+1; end figure(1); plot(br,hr,‘-’,br,0.8*ones(size(br)),‘:’); xlabel(‘\beta’); ylabel(‘min H(u,v;W_{20}) / H(u,v;0)’); a = axis; axis([b_min b_max a(3:4)]); % Output the best value for beta. best_beta APPENDIX B. PROGRAM LISTINGS 85

B.19 find_w20_max_hopkins_sdog.m — Find Max W20 with Hopkin’s Criterion (SDoG)

%% %% find_w20_max_hopkins_sdog.m %% %% Finds the value of w20 where Hopkin’s criteria is no longer satisfied. %% This is one way of finding the maximum focal depth of the synthesized %% difference-of-Gaussians pupil. %% wa = 0.4; wb = 0.281; beta = 1.08; w20_min = 0; w20_max = 1; %% % These are just used for the plot. n = 40; w20r = w20_min:(w20_max - w20_min)/n:w20_max; % Tolerance for bisection method. tol = 0.0001; a = w20_min; fa = hopkins_sdog(wa,wb,beta,a) - 0.8; b = w20_max; fb = hopkins_sdog(wa,wb,beta,b) - 0.8; while (abs(b - a) > tol), c = a + (b - a)/2; fc = hopkins_sdog(wa,wb,beta,c) - 0.8; if ((fb > 0) == (fc > 0)), b = c; fb = fc; else a = c; fa = fc; end end figure(1); plot(w20r,hopkins_sdog(wa,wb,beta,w20r),‘-’,w20r,0.8*ones(size(w20r)),‘:’); xlabel(‘W_{20} / \lambda’); ylabel(‘min H(u,v;W_{20}) / H(u,v;0)’); % Output the max w20_value. w20_max = a APPENDIX B. PROGRAM LISTINGS 86

B.20 plot_spoke_sdog.m — Plot Image of Spoke Pattern (SDoG)

%% %% plot_spoke_sdog.m %% %% Generate an image of a two-dimensional spoke test pattern (from spoke.m) %% which was scanned with a synthesized difference-of-Gaussians pupil. %% xn = 512; xm=2; % Focus error coefficient. w20 = 1/3; w20=1; % SDoG parameters. wa = 0.4; wb = 0.281; beta = 1.0; beta = 1.08; % Wavelet beta %beta = (wa^2 + wb^2)^2 / (4 * wa^2 * wb^2) %% % Generate a spoke pattern, I prefer to use a prime number for the number % of spokes because that reduces pixel-based artifacts. if (xn == 512) load(‘spoke-512.mat’, ‘s’); else s = spoke(xn, 37); end dx = 2*xm/xn; xr = -xm:dx:xm; xr = xr(1:xn); qc = []; % Circular pupil. q0a = []; % Generalized pupil for in-focus wide beam. q0b = []; % Generalized pupil for in-focus narrow beam. qa = []; % Generalized pupil for out-of-focus wide beam. qb = []; % Generalized pupil for out-of-focus narrow beam. xi=1; for x = xr, rho2 = xr.^2 + x^2; circ = (rho2 <= 1); qc(xi,:) = circ; APPENDIX B. PROGRAM LISTINGS 87

q0a(xi,:) = exp(-rho2 / wa^2) .* circ; q0b(xi,:) = exp(-rho2 / wb^2) .* circ; qa(xi,:) = q0a(xi,:) .* exp(j*2*pi*w20*rho2); qb(xi,:) = q0b(xi,:) .* exp(j*2*pi*w20*rho2); xi=xi+1; end % PSF & OTF for circular pupil. hc = abs(fft2(qc)).^2; Hc = fft2(hc); Q0a = fft2(q0a); Q0b = fft2(q0b); Qa = fft2(qa); Qb = fft2(qb); %% Synthesized DoG PSF h0 = abs(Q0a).^2 + abs(Q0b).^2 - 2 * beta * abs(Q0a) .* abs(Q0b); h = abs(Qa).^2 + abs(Qb).^2 - 2 * beta * abs(Qa) .* abs(Qb); %% Real DoG PSF (for verification) %h0 = abs(Q0a).^2 + abs(Q0b).^2 - 2 * real(Q0a .* conj(Q0b)); %h = abs(Qa).^2 + abs(Qb).^2 - 2 * real(Qa .* conj(Qb)); % OTF‘s of in-focus and out-of-focus PSF’s. H0 = fft2(h0); H = fft2(h); % Fourier transform of spoke pattern’s intensity. S = fft2(abs(s).^2); % Build an inverse filter which will correct the in-focus OTF to that % of a circular pupil. C = Hc ./ H0; % Build the resulting intensities. im = ifft2(H .* S); im_corrected = ifft2(H .* S .* C); figure(1); pcolor(xr,xr,abs(im).^0.3); % Exponent is for contrast enhancement. colormap(‘gray’); shading interp; axis square; axis off; figure(2); pcolor(xr,xr,abs(im_corrected).^0.3); colormap(‘gray’); shading interp; axis square; axis off; % Plot out-of-focus OTF. figure(3); APPENDIX B. PROGRAM LISTINGS 88

tmp = fftshift(abs(H)); tmp = tmp / max(max(tmp)); plot(xr,tmp(xn/2+1,:)); xlabel(‘\rho / \rho_0’); ylabel(‘H(\rho)’); % Plot corrective filter. figure(4); tmp = fftshift(abs(C)); tmp = tmp / max(max(tmp)); plot(xr,tmp(xn/2+1,:)); xlabel(‘\rho / \rho_0’); ylabel(‘H(\rho)’); % Plot corrected OTF. figure(5); tmp = fftshift(abs(H .* C)); tmp = tmp / max(max(tmp)); plot(xr,tmp(xn/2+1,:)); xlabel(‘\rho / \rho_0’); ylabel(‘H(\rho)’); Bibliography

[1] W. T. Welford, “Use of annular to increase focal depth,” Journal of the Optical Society of America, vol. 50, pp. 749–753, Aug. 1960.

[2] M. Mino and Y. Okano, “Improvement in the OTF of a defocused optical system through the use of shaded apertures,” Applied Optics, vol. 10, pp. 2219–2225, Oct. 1971.

[3] T.-C. Poon and M. Motamedi, “Optical/digital incoherent image processing for ex- tended depth of field,” Applied Optics, vol. 26, pp. 4612–4615, Nov. 1987.

[4] E. R. Dowski, Jr. and W. T. Cathey, “Extended depth of field through wave-front coding,” Applied Optics, vol. 34, pp. 1859–1866, Apr. 1995.

[5] “Introduction to confocal laser microscopy.” World Wide Web, University of Waterloo. (http://science.uwaterloo.ca/physics/research/confocal/intro.html).

[6] T.-C. Poon and K. C. Ho, “Real-time optical image processing using difference-of- Gaussians wavelets,” Optical Engineering, vol. 33, pp. 2296–2302, July 1994.

[7] J. W. Goodman, Introduction to Fourier Optics. McGraw-Hill, second ed., 1996.

[8] C. W. McCutchen, “Generalized aperture and the three-dimensional diffraction image,” Journal of the Optical Society of America, vol. 54, pp. 240–244, Feb. 1964.

[9] N. Streibl, “Depth transfer by an imaging system,” Optica Acta, vol. 31, no. 11, pp. 1233–1241, 1984.

[10] N. Streibl, “Fundamental restrictions for 3-D light distributions,” Optik, vol. 66, no. 4, pp. 341–354, 1984.

[11] J. T. McCrickerd, “Coherent processing and depth of focus of annular aperture imagery,” Applied Optics, vol. 10, pp. 2226–2230, Oct. 1971.

[12] J. Ojeda-Casta˜neda, P. Andr´es, and A. D´ıaz, “Annular apodizers for low sensitivity to defocus and to spherical aberration,” Optics Letters, vol. 11, pp. 487–489, Aug. 1986.

89 BIBLIOGRAPHY 90

[13] J. Ojeda-Casta˜neda, L. R. Berriel-Valdos, and E. Montes, “Bessel annular apodizers: imaging characteristics,” Applied Optics, vol. 26, pp. 2770–2772, July 1987.

[14] P. P. Banerjee and T.-C. Poon, Principles of Applied Optics. Irwin, 1991.

[15] J. Ojeda-Casta˜neda, L. R. Berriel-Valdos, and E. Montes, “Ambiguity function as a design tool for high focal depth,” Applied Optics, vol. 27, pp. 790–795, Feb. 1988.

[16] A. Papoulis, “Ambiguity function in Fourier optics,” Journal of the Optical Society of America, vol. 64, pp. 779–788, June 1974.

[17] A. R. FitzGerrell, E. R. Dowski, Jr., and W. T. Cathey, “Defocus transfer function for circularly symmetric pupils,” Applied Optics, vol. 36, pp. 5796–5804, Aug. 1997.

[18] J. Ojeda-Casta˜neda, L. R. Berriel-Valdos, and E. Montes, “Spatial filter for increasing the depth of focus,” Optics Letters, vol. 10, pp. 520–522, Nov. 1985.

[19] H. Bartelt and J. Ojeda-Casta˜neda, “Misfocus tolerance seen by simple inspection of the ambiguity function,” Applied Optics, vol. 23, pp. 2693–2696, Aug. 1984.

[20] S. Bradburn, W. T. Cathey, and E. R. Dowski, Jr., “Realizations of focus invariance in optical-digital systems with wave-front coding,” Applied Optics, vol. 36, pp. 9157–9166, Dec. 1997.

[21] T.-C. Poon, “Method of two-dimensional bipolar incoherent image processing by acousto-optic two-pupil synthesis,” Optics Letters, vol. 10, pp. 197–199, May 1985.

[22] Y. Sheng, D. Roberge, and H. H. Szu, “Optical wavelet transform,” Optical Engineering, vol. 31, pp. 1840–1845, Sept. 1992.

[23] G. Indebetouw and H. Bai, “Imaging with Fresnel zone pupil masks: extended depth of field,” Applied Optics, vol. 23, pp. 4299–4302, Dec. 1984. Vita

Alexander William Kourakos was born in Phoenix, Arizona on May 16, 1974. He now lives in Charlotte, North Carolina. He received the B.S. degree in Electrical Engineering in December 1997, cum laude, and the M.S. degree in Electrical Engineering in May 1999, both from Virginia Tech. He is currently pursuing his other major interest, information technology, but hopes to earn an optics-related Ph.D. in the near future.

91