On Iterative Pre‐Compensation of 3D Laser‐Printed Micro‐Optical Components Using Confocal‐Optical Microscopy

State‐of‐the‐art 3D two‐photon laser printing systems already use pre‐compensation algorithms to reduce systematic deviations between the printed and the targeted structures. Nevertheless, the remaining deviations are often still larger than the uncontrollable or “statistical” deviations. In principle, it is straightforward to correct for systematic deviations by measuring the difference between printed structure and target and by subtracting the difference from the first target to obtain the next‐iteration target. However, in reality, one faces several issues such as noise and systematic errors of the characterization measurement itself, as well as unwanted translations and rotations between the coordinate systems of the characterization setup and the printer, respectively. Two examples of printed structures requiring sub‐micrometer accuracy are considered, a large 1D micro‐lens array and a specific diffractive optical element. For both, the device performance before the pre‐compensation workflow described herein is insufficient for the targeted application and has become sufficient after this workflow. The workflow involving optimizations using cross‐correlations with confocal‐optical‐microscopy data is documented by an open‐access program (available via GitLab). This program includes an easy‐to‐use graphical user interface so that other researchers can immediately profit from it.


Introduction
The flexible fabrication of micro-optical components by 3D laser nanoprinting [1] enables a large variety of applications due to its ability to produce transparent polymer structures with optical-grade surface quality.Therefore, a wide range of applications, such as micro-lenses, [2][3][4][5][6][7][8][9] diffractive optical elements, [10][11][12][13][14] and optical gratings [15][16][17] already established in the past.Recently, twophoton grayscale lithography (2GL) [18] has especially improved the capabilities of fabricating micro-optics [19,20] since it enables smoother surfaces by automatically varying the voxel size during the print job.However, already very small deviations of the printed structure with respect to the designed or targeted structure open the door to numerous diffraction or refraction errors. [19]Of particular importance is the shrinkage before and during the development process. [21]Due to the need of precise printing results, many different approaches have been developed to improve the shape accuracy.One example is an optimization of the development routine to reduce the shrinkage. [22,23]Another facile and popular approach takes advantage of the fact that the shrinkage occurs mainly systematically.For the pre-compensation, the input file is adapted for these systematic distortions prior to printing, such that the result is closer to the originally wanted design. [21]All of these pre-compensation approaches start with the printing of the first design.Afterward, the structure is characterized, for example using a scanning-electron microscope (SEM) [24] or a confocal-optical microscope, [20,25,26] to get feedback.The latter is non-invasive, whereas the former requires coating by a conductive layer, rendering a micro-optical component useless.Possibly, by machine-learning algorithms, [27] one can in the future altogether avoid this feedback step to obtain an ideal structure after the first printing iteration already.In the last step of the procedure, the deviation of the printed structure with respect to the targeted structure is calculated to derive a new design that compensates for the expected deviations such as shrinkage.If necessary, all of these steps can be iterated multiple times to improve the result even further.
In this work, we present a technique for pre-compensation using reflection-based confocal-optical height measurements as feedback.We optimize this technique for so-called 2.5D structures, which are of particular interest for industry as the laser-printed structure can be taken as a "master" for mass replication. [28,29]We present two examples, one refractive-optical micro-lens array, and one diffractive optical element.One crucial step for this pre-compensation is the alignment of the coordinate systems of the design and the measurement data, respectively.If this alignment is not correct, the deviation cannot be calculated correctly and, as a consequence, additional artefacts will be introduced to the next print step.For certain structures, a very effective way of alignment may be a function fit. [20,25,26]This approach works very well for micro-optics designed via an analytic function, for example, micro-lenses.However, there are two major disadvantages: First, it cannot be applied to free-form micro-optics that cannot be described by an analytic function, for example, diffractive optical elements.Second, if the pre-compensation is only applied to the function parameters and not the design image pixelwise, it cannot correct for small local deviations.Examples for such deviations are stitching errors and higher-order optical aberrations in the printing beam path.
Therefore, in this paper, we focus on a different and more generally applicable approach to achieve precise alignment.By image cross-correlation of the design data with the confocaloptical measurement data, we determine the displacement between the two data sets down to the level of just one pixel.This algorithm can be expanded with an additional degree of freedom to also account for rotations between the two coordinate systems and a slight stretching in the lateral directions.Thus, it is possible to align all types of structures, measured with a confocal microscope, precisely with their design.Lastly, since we do not assume any analytic model, the difference is not calculated for any function parameters, but rather pixelwise between the two data sets.Therefore, our approach also corrects local deviations, such as, for example, stitching errors.
Additionally, we present a procedure for post-processing the calculated difference between the design structure and the measurement to eliminate the detrimental effects of the measurement errors on the next-iteration printed structures.Especially local errors in the confocal measurement, for example, a dust particle, shall not be pre-compensated since it has nothing to do with the printing procedure and will not appear systematically.Therefore, we apply specific filters in a certain order to reduce the magnitude of such errors and measurement noise -without removing the deviations that come from the printing itself.Since this distinction is difficult to accomplish and often also depends on the structure itself, this aspect has not yet been fully automated.
All these methods and algorithms are collected in a MATLAB program termed Quandalf (QUANtum x Data Analysis tool using Light or Fluorescence microscopy).With this tool, we provide an automated and flexible tool for the pre-compensation of 2.5D printed structures, without overhangs, measured with a confocaloptical microscope that is needed for the calibration of the stateof-the-art QuantumX laser printer, which we focus onto in this work.

Experimental Section
The general iterative procedure of fabrication and precompensation consists of three steps: The printing itself, the topography measurement, for example, by using a spinningdisk confocal-optical microscope, and the data processing to calculate the new design.In what follows, we describe all of these steps in more detail.

2-Photon printing process
The 2.5D micro-optics was printed by using a Nanoscribe Quan-tumX instrument, Nanoscribe IP-S as a resist, and the Zeiss LCI Plan-Neofluar 25x/NA = 0.8 objective lens as in the medium feature set (MF-set).Following the recommendation of the manufacturer Nanoscribe, [30] a field curvature correction was performed with printed blocks measured under the spinning-disk confocaloptical microscope.The optical-element structures was imported into the software GrayScribeX (v.3.7.2) as 16-bit grayscale images with a pixel size of 200 nm.In this software, several parameters were set: The slice distance was chosen to be 1 μm and the hatching distance as 100 nm for the micro-lens array and 200 nm for the diffractive optical element, respectively.Additionally, to reduce stitching effects, the field overlap between neighboring printing fields was set to 60 μm and the 2GL stitching method was activated.At the beginning of a print job, the tilt of the substrate was measured by the machine and compensated automatically by the QuantumX software (NanoSQX v. 3.7.3).
The printing process itself follows the standard procedure of the QuantumX machine and includes an 1 h waiting period after inserting the sample and prior to printing to reduce the influence of thermally or mechanically induced movements in the photoresist.After the printing was finished, the samples need to be developed.Therefore, they were put in a bath of propylene glycol methyl ether acetate (PGMEA) for 20 min followed by isopropanol for another 5 min.Last, the samples was rinsed with fresh isopropanol and blown dry with nitrogen.

Confocal Measurement
After printing and development, a sample is placed under the Mahr MarSurf CM explorer spinning-disk confocal-reflectionoptical microscope to measure the topography.A 50x/NA = 0.95 air objective lens was used since the high numerical aperture (NA) provides good spatial resolution, while free-working distance was still sufficient for the height of the samples.
The samples was placed on a rotation stage to be able to coarsely align the orientation of the printed structure with the coordinate system of the confocal-optical microscope.
Since the structures was generally larger than one field-of-view of the microscope, again stitching is required.Here, additionally, printed high contrast features, like crosses or rulers, was helpful to improve the stitching quality.For the diffractive optical element, the structure itself already has enough steep edges that act as such features.The micro-lens array does not have such features and, therefore, we printed a ruler shaped feature near the structure to reduce the stitching artefacts.After the measurement is completed, the data was first processed with the corresponding MarSurf MfM 8.1.9413software.Here, the sample tilt is corrected by fitting a plane through the data points corresponding to the glass substrate.Second, the data was cropped such that only the print itself is contained in the data.For the later processing in Quandalf, it is important that there were at least 100 pixels (≈27 μm with the used 50x objective lens) on the substrate surrounding the structure to give it some room for rotation.
We note in passing that this pixel size of 267 nm is comparable in size to the lateral diameter of the diffraction-limited light spot of the confocal-optical microscope (505 nm center wavelength of the light-emitting diode (LED) and microscope objective lens' numerical aperture of NA = 0.95).This means that the surface height value (or z-position) of one pixel is the lateral height average over about one pixel size.Therefore, surface roughness on a sub-pixel scale cannot be captured by such optical measurements.It does, however, capture height variations on a larger scale up to the overall size of the micro-optical component.The two-photon printing approach (here 780 nm center wavelength and NA = 0.8) does not provide control of the height on a scale smaller than the lateral spatial resolution of the printer, whereas such control is possible on a scale larger than the spatial resolution.In other words, even if one were able to measure surface roughness on a nanometer lateral scale, one could not correct for this roughness in the two-photon laser printing process.

Data Processing and Pre-Compensation
In the following, the program Quandalf is described in detail.
Here, the calculations of the pre-compensation was performed.The important steps was summarized in a flowchart in Figure 1.The main idea behind the pre-compensation routine is that parts of the structure that appear too low (or high) will be printed higher (or lower) in the next iteration to compensate for this deviation.This can be accomplished by calculating the difference between the height of the confocal-optical measurement and the targeted design and subtracting it from the previous design.The result can be printed as the next design and should lead to reduced deviations.We solve the following issues: First, we align the confocal-optical measurement with the design.Second, we perform adjustable filtering to reduce statistical errors from the confocal-optical measurements because these errors should not be pre-compensated for.

Aligning and Subtracting the Confocal Data
while D x and D y contain the x-and y-coordinates of the pixels in the design and D z contains the corresponding height values.Here, n x and n y describe the number of pixels in x-and ydirection.The pixel size of the design will be referenced as px D in the following.Subsequently, the measurement data was imported in the same way (as * .sur,* .mat,or * .txtfiles).Here, more than one file can be imported if the structure is printed or measured several times.This is very useful to eliminate statistical errors in a later step.These statistical errors can arise from either the printing process or the measurement process or from both.We will come back to these errors below.Let N be the number of imported measurements of the same structure.Then, the data was saved again in three variables for each measurement set: The variables z were structured the same way as the ones of the design.Again, N x and N y describe the number of pixels in x-and y-direction.The pixel size for the measurement is called px M .
Offset and Tilt Correction: The following procedure subtracts possible offsets and corrects for tilts.The software MarSurf MfM (see above) already performs a basic tilt correction.However, we further improve this tilt correction.Therefore, a region of interest surrounding the structure is defined by index sets: It describes a rectangle with a width of 10 pixels width and a spacing of 10 pixels to the edge of the measurement area.We introduce a goal function using the corresponding x-, y-and zcoordinates: to perform a least-square fit of a plane.The optimal parameters A, B, and C were found by minimizing the goal function : using the Matlab function fit.The thereby defined plane is subtracted from the measurement height data: Coarse positioning: In the following two sections, the alignment of the measured structure and the design will be described.In the first step, the lateral displacement will be roughly estimated so that a later finer positioning procedure is more robust.
First, a function h(z) is calculated that describes a histogram of all height values found in the measurement data The interpretation of T is that all measurement points with a value larger than the height threshold T correspond to a printed structure, and that all points with a lower value correspond to the substrate.In the histogram function, one usually encounters two peaks in the low-height region: One corresponding to the substrate and the other one to the structure.By finding the minimum between those two peaks, one gets the best value to separate both features.Now, all the indices I was obtained, that correspond to measurement points within the printed structure, such that: By calculating the center coordinates x cog and y cog of the so recognized structure one can define a region of interest (ROI) for each measurement set: This region of interest is so to say a rectangle with the size of the design, converted to the measurement pixels size.Additionally, the region of interest is increased by a certain number of pixels in each direction.This number results from a trade-off.If it is chosen too large, the computational effort increases unnecessarily.If it is chosen too small, parts of the data are cropped for rotation angles between the design and characterized printed structure.For the examples to be discussed below, a value of 100 pixels has been proven to be a good compromise.By design of the ROI, its center matches the calculated center of the printed structure.However, the precision is typically ≈5-10 pixels.With the upcoming steps, this alignment will be improved significantly.
Fine-Positioning by Cross-Correlation: In the second step of the alignment, the measurement and the design will be brought to optimal overlap.In general, the measurement can be rotated, stretched in one or both lateral directions, and shifted by a lateral displacement.All of these three sources of misalignment will be treated separately in the following steps.This separate treatment increases performance and stability and is justified by the fact that only small corrections were required.Therefore, it is necessary that the coordinate systems of design and measurement were already well pre-aligned.This alignment is accomplished by adjusting a manual rotation stage before the confocal-optical measurement and by the above-described coarse-positioning routine.
To get started, it is important that the design and the measurement have the same lateral size and pixel size.Therefore, the design is rescaled to the discretization of the measurement.For this purpose, the built-in MATLAB function imresize is used.Additionally, the rescaled design matrix is zero padded by 100 pixels in each direction, such that it matches the dimensions of the ROI discussed in the section before.The new temporary design matrix is called Dz .
Additionally, also the measurement data sets are cut to the ROI found in the step before: Adv. Funct.Mater.2024, 34, 2309356 At first, the correct rotation angle is determined.Therefore, an objective function is defined: where imrotate is a built-in MATLAB function that rotates M(i) z by the angle  around its center and ⋆ is the cross-correlation operation.The correct rotation angle  ∈ [ − , ] between the measurement and the design is found when the maximum of the cross-correlation function between the design and the rotated image is maximal.Therefore, this angle can be found by minimizing f: where the minimum is computed using the MATLAB function fminsearch.
In the next step, the lateral scaling is corrected.Differences in scaling can occur if the confocal measurement is not perfectly calibrated in one or two lateral directions with respect to the coordinate system of the 3D printer.Here, again an objective function is defined as: The function scale hereby scales the already rotated image by the given scaling factors, where a factor of 1 means no scaling, >1 means a shrinkage, and <1 means an elongation or stretching.This step is again realized by using the function imresize.The correct scaling factors (s x , s y ) ∈ ℝ 2 are again found via the minimum of g: Last, the two data sets need to be aligned in the lateral direction.This can be performed by calculating the cross-correlation function once again.The position of the maximum value in the cross-correlation function contains the information of the lateral displacement.Hence, the objective function here is: where the correct lateral displacement (Δx, Δy) is this time found by the maximum: Here, since the lateral displacements was integers, it is not necessary to use fminsearch, but the MATLAB max function can be used.
Crop, Rotate and Scale Measurement: In the next step, all the measurement data M(i) z (∀i ∈ {1, … , N}) were rotated, using imrotate, by the previously found specific angle , scaled by the scaling factors s x and s y , and cropped to a region of interest with the size of the design and the position according to the lateral shifts Δx and Δy.Note, that all of these factors were individual for each measurement and not valid for the whole set.
After this process, the measurements was also rescaled to the discretization of the design.This direction is chosen because at the end of the routine, the new design should have the same resolution of 200 nm pixel size as the original design.
Calculate Difference: Now, since measurement and design data are aligned and have the same pixel size and number, their difference can be calculated.Optionally, the height of the design is shifted by an offset, such that measurement and design match in average in the center 30 μm.Apart from this, the difference is calculated for each measurement: Evaluate Difference: To quantify each measurement two figures-of-merit were calculated for the corresponding difference matrix.First, all height thresholds T (i) were calculated again: where h (i) is the histogram function of the measurement data set i ∈ {1, …, N}.Next, all measurement points with a value larger than T (i) were considered using a mask matrix: in order to evaluate two figures-of-merit.First, the mean-absolute difference of all pixels containing structure is calculated: (i) jk (24)   and second the standard deviation (root-mean-square) of the same pixels: Both values give information about the quality of the measured printed structure.In the ideal case, the difference matrix contains only 0 and both  (i) and  (i) are 0. In general, a smaller value means less deviation from the design and therefore a better quality.
On the basis of those values, the user can now decide whether a certain measurement set should be used for the precompensation or be abandoned: This decision can be important to exclude obviously incorrect measurements, for example, due to dust particles, large printing errors, confocal stitching errors, etc.The selected measurements are averaged: and again, the figures-of-merit μ and  was calculated for the average difference.This time, a general mask is used containing the structural information of all data sets: The average difference matrix Diff will now be filtered before the next design is calculated in the next step.The corresponding values of μ and  can be used to judge the quality of the print in general and serve as an indicator for improvement for ongoing pre-compensation steps.We give examples below.

Filtering the Difference and Calculating the Next Design
In the ideal case, the values in the difference matrix would only arise from the systematic deviation of the printing and developing process, such as, for example, shrinkage.However, in reality, there were more sources of deviations, for example, arising from the confocal-optical microscope as noise or as outliers at steep edges of the sample.Additionally, also dust particles or small surface imperfections contribute to the difference matrix.Since these deviations will not appear again in the next print, a precompensation is not useful.It would even negatively influence the next print.Therefore, the difference matrix is filtered in such a way that noise and large local deviations from dust particles were eliminated.
Gradient and Height Threshold: At first, all pixels, that correspond to a large gradient or a large difference value, are excluded.Therefore, a mask is defined: where the parameters T ∇ and T can be set by the user.Default values are T ∇ = 300 nm and T = 2 μm.The goal of this procedure is to detect large local deviations in the difference matrix.These usually arise from dirt or local destruction of the sample.Shrinkage rather usually occurs more evenly distributed over the whole sample.Expansion of the Marked Areas: If a pixel is marked in the step before, because either its gradient value or the difference value itself is too large, the probability that the neighboring pixels was also corrupted is high, even though they may not be marked in the first step.Therefore, the marked regions was expanded.This can be done by applying the MATLAB function imdilate with a circle as a structuring element.The radius of this circle determines the range of that neighboring pixels were also marked and can be set by the user.The default value is r = 2 μm.
Exclusion and Interpolation of the Marked Areas: Next, the marked pixels need to be excluded from the difference matrix.In the programmatic implementation, this is done by setting their values to NaN (not a number): After that, these NaN values need to be interpolated to real values again using the information of the surrounding pixels.This approach is justified since generally only small regions were excluded and, therefore, a lot of information is maintained.If this is not the case and large regions had to be excluded, the quality of the measurement or print is so poor, that it is not suitable for the pre-compensation algorithm.The interpolation is done with the third-party function inpaint_nans, [31] published on the MATLAB file exchange.
Border Treatment: The described interpolation is only performed in the central area of the structure.Pixels that were closer to the border than a given width, with the default value set to 5 μm, was treated separately.The reason for this is that at the border typically very large deviations from the design occur.This can, for example, happen due to a lateral shrinkage.If lateral shrinkage occurs, the edges of the design cannot be aligned with the measured structure and, therefore, very large differences were the consequence.A pre-compensation makes no sense in this case and will most likely diverge over the number of iterations.Additionally, since the printed micro-optical components were usually much larger than the beam diameter for that they were designed, it is also not necessary to pre-compensate close to the edges.
Therefore, at first, all pixels in the difference matrix close to the edges was set to NaN.Next, they were filled again using the MATLAB function fillmissing.This means, that the borders was now an extrusion of the pixel values further inside the sample.
Noise Filter: Now that the systematic measurement errors were eliminated, it is time to take care of the noise.Therefore, a gaussian filter is applied to the difference matrix using the MATLAB function imgaussfilt with a user-defined gaussian standard deviation.By default, this value is set to 2 μm.The justification for this approach is that the deviations that should be precompensated usually appear on a much larger spatial scale than this length.Therefore, the influence on the pre-compensation quality is low, but the noise is reduced significantly.Further details was described in the Supporting Information.
Calculate Next Design: In the last step, the next design is calculated.Therefore, the previous design needs to be imported.For the first iteration step, this is the original design already used during the calculations.However, for further iterations, always the pre-compensated design from the step before needs to be used.The next design is then simply the difference between the previous design and the filtered difference.It can be saved as a * .matfile and a 16-bit grayscale image so that it can be directly imported into GrayScribeX again.

Results
In this section, we will quantitatively test the effectiveness of the pre-compensation routine in regard to the shape fidelity of micro-optical components.We present two different samples, a refractive-optical element and a diffractive optical element.These types of elements were widely recognized as the most prevalent forms of micro-optical components.

The Micro-Lens Array
The first sample was a micro-lens array (MLA) consisting of 128 lenses in a single row.It was an example of a demanding refractive-optical element.The envisioned application in the framework of a European-Union project was to serve in a compact spectrometer to focus the different spectral components onto a single-photon avalanche-detector (SPAD) array consisting of 128 detectors in a single row.Since SPADs vary in their geometry, for example, pixel size, number, and spacing, it can be beneficial to custom-make the micro-lens array fitting to the characteristics of the detector array.

Design of the Micro-Lens Array
In the considered case, the distance between two detector pixels was 75 μm and, therefore, also the lenses have a width of 75 μm.
The length of the lenses was chosen to be 100 μm.The distance between the glass substrate and the detectors, where the light should be focused, was 2 mm.The lenses were printed on the substrate side facing the detector array.The shape of the lenses was calculated analytically using ray optics.In Figure 2a, a sketch of the lens shape was shown in a coordinate system.Two incoming light rays from the righthand side was focused on the coordinate origin.The distance of the center point of the lens to the focus is the back focal length f.The central ray travels a distance d in the lens material and afterward the distance f in air.The off-center ray travels a shorter distance in the lens material before it reaches the lens surface at the coordinate x.If the lens profile is described by a function l(x), the distance for this ray in the material is d − (l(x) − f) and the distance in the air can be calculated via Pythagoras to For two rays to be in phase on the right-hand side, they should also be in phase at the focus.This means that the two optical pathlengths have to be equal, [32] leading to: Next, the value of f must be matched to the required distance l of the substrate to the detectors.Let r be the largest lateral distance of a lens point, mostly a corner, to the center point of the lens.Then, Equation ( 1) can be used with the condition l(r) = l to calculate: Now, Equation ( 1) gives an implicit definition of the lens form function l(x) and can be compared with the general aspheric lens equation [33] : Here,  describes the inverse radius of curvature of the lens at the center position and k was the conic number of the lens.By comparing the first four derivatives with Equation (1), these parameters can be determined to: Now, all lens parameters are known.The refractive index n() of the photoresist can be found in the literature [34] and is evaluated for the wavelength in the spectrometer at the specific detector.Here, the wavelength range is 500 nm to 628 nm, corresponding to 1 nm wavelength separation between two neighboring lenses.As the polymer refractive index exhibits only a very weak dispersion, all lenses are nearly identical.
In Figure 2b, the design for the four lenses in the center of the micro-lens array was shown, corresponding to the wavelengths: 563, 564, 565, and 566 nm.An overview of the structures can be seen from the scanning-electron microscopy (SEM) images in Figures 2c,d.While the sample shown in Figure 2c the sample was not pre-compensated, Figure 2d shows a sample after two steps of pre-compensation.A visual inspection of these images shows no notable differences.In the below confocal-optical characterization measurements, we do find significant differences though.

Influence of the Pre-Compensation on the Printing Quality and the Optical Performance
In Figure 3, different iterations of the pre-compensation routine were compared with each other and with the initial design.In the first row, where the measured height topographies were shown, only the first print without a preceding pre-compensation sticks out.The profiles after one and two pre-compensation steps look very similar to the design shown in the left column.This impression is justified by looking at the different maps in the second row.In the ideal case, all values would be zero (left column), but for the measurements, we do find regions with a finite difference value.However, the first print shows larger deviations from the design in comparison with the pre-compensated samples.In the difference map of the first print, there were almost equidistant vertical lines visible that correspond to the stitching seams between different writing fields.The disappearance of these lines in the difference maps of the pre-compensated samples shows that the presented pre-compensation routine successfully corrects for the stitching artefacts.
In the third row of Figure 3, the quality improvement was quantified.Here the histograms of the relative occurrence of difference values were shown.In the left column, since all pixels in the difference have a value of zero, there is only one bin visible containing all pixels.However, for the measured samples, the histogram peaks have a finite width.This width was a good indicator for the achieved sample quality.For the direct print, the peak wa comparably wide, corresponding to high values of the root-mean-square () > 200 nm and the mean-absolute (μ) > 100 nm.Both values already strongly decrease after the first precompensation step < 100 nm and < 50 nm, respectively.Another iteration of pre-compensation results in an additional decrease of these figures-of-merit, yet the degree of improvement is significantly smaller, indicating rapid saturation of the process.It was likely that the remaining errors result from statistical errors caused by the printer and from imperfections of the confocaloptical measurement.
Last, the impact of the pre-compensation on the optical performance was evaluated.Therefore, the micro-lens arrays were placed in an optical test setup where a 561 nm laser was rapidly scanned along the row of lenses to mimic a homogeneous illumination across the central 4 mm (only 1 mm shown in Figure 3 for better visibility) region of the microlens array.In the focal plane of the micro-lenses, a camera chip was placed, with which images of the spots were acquired.The results were shown in the fourth row of Figure 3 and can be compared to a wave-propagation simulation of the design, for which the spots are all identical and have a distance of 75 μm.For the first print, every fifth spot was different in terms of its ellipticity.This effect was likely caused by the stitching period.In this form, the micro-lens array would not be usable because it would lead to inhomogeneities in the spectral sampling when using a periodic SPAD array (see above).After the first step of pre-compensation, this effect disappears.To quantify the usability, we have determined the mean and the standard deviation,   , of the ellipticity of the spots (see Supporting Information).Compared to the initial print,   decreases by about a factor of 4.9 after the second pre-compensation.This improved optical performance of the device as result of the pre-compensation procedure positively correlates with the decreased topographic difference of the 3D printed micro-optical components compared to the design.

The Diffractive Optical Element
The second component was a representative for diffractive optical elements (DOEs) and acts as a beam splitting element, splitting a Gaussian laser beam into 7 × 7 beamlets in a square array of the same shape and intensity.The DOE was used in multiphoton multi-focus 3D laser nanoprinter, in which the print rate increases with the number of foci. [35,36]igure 3.Comparison of different pre-compensation iterations for the micro-lens array.In the first column, the ideal case is shown, that is, the design data themselves.The columns to the right show the measurement results after different pre-compensation iterations.In the first row, the topography of the design and the confocal-optical measurement is shown.For the measurements, ten samples are printed for each pre-compensation step.To avoid the influence of clearly failed prints or measurements on the results of the evaluation routine, only data sets with a sufficient quality are considered for the pre-compensation (10/10 for the 1 st print, 5/10 for the 1 st compensation, and 7/10 for the second compensation).Note, that the x-and y-axis are intentionally scaled very differently.In the second row, the differences are compared to the design.In the design column, this difference is obviously zero, while nonzero values appear in the other columns.This can also be seen in the third row, exhibiting histograms of the difference data.With each iteration of pre-compensation, the peaks of the measurement histograms become narrower, accompanied by lower values of the root-mean-square  and mean-absolute μ.The last row shows a comparison of the optical focussing capabilities of the lens array, with the simulation results displayed on the left and the actual optical measurements shown on the right.The white scale bars are 500 μm.For clarity, only a part of the overall 128 foci are depicted.

Design of the DOE
In contrast to the micro-lens array, the DOE was calculated by an iterative phase retrieval algorithm, as described by Gerchberg and Saxton. [37]SEM images of the result without and after two steps of pre-compensation were provided in Figure 4.The sample has a lattice constant of 155 μm and a stitching period of 420 μm.Again, no stitching artefacts were visible from the SEM images even though the field of view of Figure 4a,c was >420 μm -neither before nor after the pre-compensation.

Influence of the Pre-Compensation on the Printing Quality and the Optical Performance
A quantitative comparison of the pre-compensation steps for the DOE can be seen in Figure 5.As for the MLA, the panel in the first column and first row shows the full design of the DOE, whereas in the other columns, the measured topographies of the different pre-compensation steps were shown.The second row exhibits the corresponding differences with respect to the design, which should clearly be zero in the ideal case (first column).It can be seen that the difference maps even out with increasing order of pre-compensation.The stitching seams, which were quite visible for the first print, vanish after pre-compensation.Due to the steep edges, however, small outliers in the different maps remain.These were caused by a non-perfect alignment of the measurement and the design and would be filtered out for the precompensation as described in the previous section.Upon closer inspection, we find that the outliers in the different images do not exhibit an evenly distributed pattern as one might expect.The cause of this behavior was that the outliers do not originate from a global misalignment, but rather from local distortions in the lateral directions.These distortions can be attributed to factors such as imperfect stitching from the confocal-optical microscope itself.Clearly, artefacts from the imaging modality cannot be improved by pre-compensation of the printing.
The histograms of the different images were again shown in the third row.The peaks of the difference distribution get a lot sharper, even after only a single step of pre-compensation.The second iteration does not improve the result significantly.This trend can also be seen in the figures-of-merit.The Even though the SEM field of view is large enough to reveal stitching seams, these seams are not apparent from a visual inspection of the SEM images -neither before nor after the pre-compensation.In the below confocal-optical characterization measurements, we do find significant differences though.
root-mean-square () starts at a value > 250 nm and reduces to nearly 150 nm.Similarly, the mean-absolute (μ) decreases from more than 150 nm for the first print to < 100 nm after the second pre-compensation.
Finally, the performance of the DOEs was also characterized optically.Corresponding results were shown in the last row of Figure 5.In comparison to the wave-propagation simulation on the left-hand side, the measurements show a significantly larger intensity in between the foci and an uneven distribution of the intensities among the 49 foci.We find a noticeable evening-out of the intensity already after the first pre-compensation step.Furthermore, we observe a significant reduction in the intensity between the spots and the variation of their ellipticities.To quantify this variation, we have again determined the mean and the standard deviation,   , of the ellipticity of the spots (see Supporting Information).Compared to the initial print,   decreases by about a factor of 2.6 after the first pre-compensation.This improvement demonstrates a substantial positive impact on the optical performance of the DOE, as already shown from the topography measurements.Again, the second iteration of pre-compensation does not notably improve the behavior beyond that.In summary, the DOE was not usable before applying the precompensation procedure, while it has become usable thereafter.In fact, we have successfully been using such DOEs for many experiments. [36]

Conclusion
Custom-made micro-optical components are receiving increasing interest for various applications in academia and industry.With new 3D laser nanoprinting technologies such as 2GL print-ing, the surface quality is sufficiently high even for complex applications such as complex diffractive optical elements.However, systematic deviations of the printed elements from the targeted design, for example, by photoresist shrinkage or stitching artifacts, tend to hinder achieving the required optical performance.To tackle this issue, we have introduced and demonstrated a flexible procedure to modify the print files in order to pre-compensate for these systematic errors.Its flexibility allows it to be used not only on a variety of optical components.Since it does not rely on fitting parameters (as previous approaches have), it can also be used for numerically designed elements and works for both, refractive and diffractive optical elements.Already a single pre-compensation iteration substantially improves the quality-as evidenced by confocal-optical microscopy as well as optical experiments on the device-function performance.Especially for diffractive optical elements, this quality boost is critical for the applications envisioned by us.A second pre-compensation iteration step can still further improve the results, but this further improvement is currently limited by the quality of the available device-topography characterization methods.Therefore, as a good trade-off between quality and effort, a single pre-compensation step seems to be good enough for many applications.
The program Quandalf to perform this pre-compensation is openly provided to the community via the following GitLab-link (https://gitlab.kit.edu/kit/aph/AGW/quandalf.git).The above paper can be seen as a definition of the procedure and as an illustration of relevant examples.We foresee that this software will help many users in the growing multi-photon 3D laser printing community to manufacture high-quality micro-optical components.In the first column, the ideal case is shown from the design data themselves.In the first row, the topography of the design or the confocal-optical measurement respectively is shown.For the measurements, four samples are printed.The two best samples are considered for the pre-compensation.In the second row, the differences with respect to the design are compared.In the design column, this difference is obviously zero, while for the other columns nonzero values appear.The third row exhibits corresponding histograms of the difference data.Herein, the peaks for the measurements get narrower with each iteration of pre-compensation, which is accompanied by lower values of  and .In the last row, the optical capabilities are compared, either from a simulation on the left-hand side or from optical measurements on the right-hand side.The white scale bars represent a diffraction angle of 0.5°.
The data used for this paper can be found on a public data repository. [38]

Figure 1 .
Figure 1.Flowchart of the Quandalf program.The imported design and measurement data are aligned to each other in several steps.Subsequently, the difference is calculated and evaluated by certain figures of merit.Last, a new design is calculated by adding this difference to the previous design.

Figure 2 .
Figure 2. The shape of the micro-lenses in the micro-lens array is analytically calculated from a ray-optics model (a).The result are aspheric lenses.The four center lenses are displayed in b.The scanning-electron microscopy (SEM) images serve to provide an overview.They are taken from a printed micro-lens array before pre-compensation (c) and after two iterations of pre-compensation (d).Even though both microstructures contain stitching seams, which would be visible within the shown field of view, a visual inspection of the SEM images alone does not reveal these stitching seamsneither before nor after the pre-compensation procedure.Therefore, we consider more detailed optical characterization means below.The three sets of equidistant ticks serve to aid the alignment of the stitching fields in the confocal-optical-microscopy measurement (not to be confused with the stitching in the printing process).

Figure 4 .
Figure 4. SEM images of parts of a diffractive optical element to provide an overview.Two images (a and b) were taken on a DOE sample without any pre-compensation steps.Even though the SEM field of view is large enough to reveal stitching seams, these seams are not apparent from a visual inspection of the SEM images -neither before nor after the pre-compensation.In the below confocal-optical characterization measurements, we do find significant differences though.

Figure 5 .
Figure 5.Comparison of different iterations of pre-compensation for the diffractive optical element.In the first column, the ideal case is shown from the design data themselves.In the first row, the topography of the design or the confocal-optical measurement respectively is shown.For the measurements, four samples are printed.The two best samples are considered for the pre-compensation.In the second row, the differences with respect to the design are compared.In the design column, this difference is obviously zero, while for the other columns nonzero values appear.The third row exhibits corresponding histograms of the difference data.Herein, the peaks for the measurements get narrower with each iteration of pre-compensation, which is accompanied by lower values of  and .In the last row, the optical capabilities are compared, either from a simulation on the left-hand side or from optical measurements on the right-hand side.The white scale bars represent a diffraction angle of 0.5°.