Projective transformation extends to two dimensions the correction that is typically only performed in one dimension to correct slit-image curvature (smile or line curvature). Spatial and spectral axes are simultaneously corrected using a projective transformation to reduce distortions from detector misalignment. We show with experimental and simulated Raman data that minor distortions have large effects on the apparent background complexity of spectra collected with dispersive spectrographs.

Simulated Checkerboard Data

The principles of projective transformation are shown on high-contrast images using checkerboard patterns, shown in , as an ideal test image for emphasizing spatial distortion. The initial undistorted checkerboard image is shown in . Because there is no simple method for producing a spectral checkerboard pattern on a spectrograph, an inverse spatial transform was applied to the checkerboard image to simulate the distortion present in experimental spectral images. The initial checkerboard pattern was larger than the desired output image and the inverse spatial transform resampled an image output area corresponding to the actual detector size, as shown by the rectangle in . As shown in , the inverse transform distorted the checkerboard image. Horizontal lines in the checkerboard pattern are slightly rotated and also shifted vertically downwards by 2 pixels over the 1024 horizontal pixels. This can be seen in the top-right corner of where the bottom of a black square is slightly visible. Horizontal and vertical alignment was restored to the checkerboard image after application of the forward projective transformation, shown in . Dark boundaries in the top left and bottom right edges of the image were formed because the boundaries were truncated by the transform. The bilinear interpolation used in the projective transformation reduced the spatial and spectral resolution by interpolation between adjacent pixels.

Experimental Raman Data

We first applied the projective transformation to Raman microscopy images of equine bone, which does not have uniform fluorescence in the sampling volume. In the example selected for , the CCD had a rotation angle of −0.69 degrees (corresponding to a 12-pixel shift across the 1024 spectral axis), indicating poor alignment of the camera with the dispersion axis. The spectral image was preprocessed using a manual cosmic ray correction step, subtraction of a reference dark image, and normalization by the measured reference white intensity. This spectral image was then processed in different ways. Spectra shown in have a fluorescence background that varied with position in the image. As shown in , spectra in the transformation-corrected image had almost identically shaped backgrounds. The adaptive minmax method by Cao et al. was used to correct the baseline using the iterative method and taking the minimum of four fitted polynomial functions in each iteration (first- and second-order polynomials were used, both with and without endpoint constraints).^{27} This method allows background to be closely fitted with low-order polynomials without any of the edge effects that are otherwise problematic in polynomial baseline corrections. show the baseline-corrected and normalized spectra corresponding to the spectra in . Higher-order polynomials are clearly required to remove additional background complexity from .

As shown in , fluorescence backgrounds in biological specimen spectra are less complex and more similar to each other at different positions in the field of view. The Cao baseline-subtraction method was repeated with third- and fourth-order polynomials to further reduce the residual background. The resulting baselined spectra are shown in . The image transform correction has reduced the background complexity, and less background correction is required to remove the residual background.

There are many methods for selecting the polynomial order for the correction, such as visually examining the spectra after background correction using different algorithm options (polynomial orders) and selecting the one that appears to have the simplest background. Two simple automated (operator-independent) methods can be used to examine the background-corrected spectra. Principal component analysis (PCA) methods can be used to determine the number of principal components required to describe the data (fewer principal components indicating less background). A simple numeric indicator spectral variance can also be calculated by taking the mean of the standard deviations calculated from each baselined and normalized spectral row. Numeric results for the data shown in are included in , from which it can be seen that results improve only gradually beyond a third-order correction (indicating that we should select third- and fourth-order polynomials in the Cao method). The total difference in the variance estimate between the first-order correction and higher correction orders is much greater for the initial data than for the transformed data, due to the apparent background complexity.

| **TABLE I**The required polynomial correction order can be determined by taking an estimate of the spectral variance after applying different background-correction steps (and correction options). Spectral variance was calculated using the Matlab code “var=mean(std(data,[],2));” (more ...) |

The reduction of background complexity improved reproducibility in calculating Raman intensity ratios. The means and standard deviations of the ratio of the carbonate ν_{1} to phosphate ν_{1} Raman band (1068 cm^{−1} : 958 cm^{−1}) and the ratio of phosphate ν_{1} to amide I (958 cm^{−1} : 1650 cm^{−1}) were calculated from spectra preprocessed by correcting for cosmic rays and dark subtracting. Spectra were then processed with and without the projective transformation. In both cases, the spectra were intensity corrected using a NIST-traceable intensity calibration source, and band intensity ratios were calculated. The mean values of the carbonate-to-phosphate ratio are similar (0.174 initially and 0.157 with the transform). However, the standard deviation in the ratio decreased from ±0.032 to ±0.021 (to 65% of the initial value) after projective transformation correction. The phosphate-to-amide I ratio showed a small increase in the mean value (6.55 to 7.19), and the standard deviation was reduced from ±2.00 to ±1.58 (to 79% of the initial value). Because this image was of a heterogeneous biological specimen, we would not expect a zero standard deviation. However, some of the variation is due to instrumental error. By taking 5-point windows in calculation of the band intensities, we have removed much of the influence of random noise (standard deviations of the individual band intensities for the two methods all varied by less than 2%). The decrease in error after application of the image transform is pronounced. The phosphate-to-amide I ratio is more susceptible to rotational misalignments in the CCD because the bands span a large wavenumber range and is complicated by a lower CCD efficiency for the high wavenumber band (1650 cm^{−1}). As a result, the relative standard deviations are greater for the phosphate-to-amide I ratio. For the carbonate-to-phosphate ratio, the relative standard deviation dropped from 18.4% to 13.4% after application of the image transform. For the mineral-to-matrix ratio, the relative standard deviation dropped from 30.5% to 22.0%.

We expect that the projective transformation method will improve recovery of spectra and may enable detection of very subtle changes in tissue. Background complexity in biological Raman images is routinely reduced using the projective transformation correction. In our laboratory, we have observed reductions in polynomial background complexity required to correct for background signals. With the projective transformation, we now use much lower order (first to third) polynomials for background correction as compared to the high-order (fourth to ninth) polynomials previously required. Low-order polynomials more closely resemble theoretical approximations of biological fluorescence, which should not have a complex shape in the near-infrared region.

As previously observed, band position shifts with respect to CCD row position and must be corrected to compare or sum the spectral information.^{8}^{,}^{10}^{,}^{11}^{,}^{15}^{,}^{17} Likewise, row-to-row variations in image intensity combine with very slight image rotation to compound the effective background complexity of the spectra more than expected. This is exacerbated in fiber-optic systems because the Gaussian spatial profile of each optical fiber leads to substantial intensity variations from row to row. Likewise, microscopy of specimens with variable optical scattering or absorption coefficients over the relevant spatial scale will show variation of intensity. Biological specimens commonly have optical heterogeneity over relevant microscopy scales (hence the use of microscopy), and exhibit strong row-to-row intensity variations. As a result, even slight rotations between the detector axis and grating dispersion direction influence the effective background complexity.

Compared to microscopy images, 2D images collected with fiber-optic probes can be more complicated to interpret. Nonuniformity may be increased by tissue heterogeneity over a large sampling area and by nonuniform collection efficiency. In the example shown in , the CCD had a rotation angle of 0.11 degrees (a misalignment of less than 2 pixels across the 1024 pixel spectral axis). This misalignment of the CCD to the spectrograph is usually considered negligible. shows representative spectra of exposed human bone from regions in the fiber-optic image that were globally illuminated. The effects of image distortion correction are striking, even for images collected from an instrument with vanishingly small distortions. shows spectra from two regions of a fiber-optic image after preprocessing spectra using traditional preprocessing techniques. A large variability in background signal is observed and bands in the 200 to 600 pixel region are obscured because of the large and varying background. After preprocessing spectra using the corrective transform, shown in , variability in background is significantly reduced and enables visualization of bands even before background correction.

Sample heterogeneity contributes to calculated variance. In the examples above it is not clear how much of the initial variance is due to sample heterogeneity versus instrumental error. Here the method is demonstrated with a spectral image of Teflon, which is expected to have homogeneous properties. We demonstrate the effect with measurements of Teflon using an offset reflection fiber-optic probe (pen-like probe^{37}), without focusing optics so that the collection cones of the fibers are overlapped. The collection fibers sampled a small area of the Teflon, such that spectra are expected to be identical. Teflon data were collected on a spectrograph with a rotational misalignment of less than two pixels across the detector. Moreover, the peaks located near pixels 350 (732 cm^{−1}) and 700 (1382cm^{−1}) span a short enough range across the spectral axis to make the rotational misalignment less than 1 pixel. In , the ratio of Teflon band intensities at 732 cm^{−1} and 1382 cm^{−1} was calculated for each spatial pixel position for an image before performing the transform (left-hand panel) and after the transform was applied (right-hand panel). As shown in the left-hand panel of , the value of the 732 cm^{−1} : 1382 cm^{−1} intensity ratio was highly variable across the image (7.32 ± 2.00). After the image transform, the ratio was less variable across the image (6.81 ± 0.40). The image transform reduced the error in ratios recovered at the edges of the image, particularly where individual fibers are in better focus and where row-to-row intensity variations are maximized. The decrease in relative standard deviation of the band ratio from 27.4% to 5.9% across the single image shows the effect of a corrective transform, even for images with nearly imperceptible distortion.

To determine whether the improvement in intensity ratio variation is due to interpolation, we compared the effects of smoothing due to different image correction methods. A major concern was that the interpolation used in the image transform might smooth the spectral image and cause an apparent reduction of variability of the intensity ratio. A degree of smoothing accompanies all software corrections for slit-image curvature and image rotation. Interpolation is inherent to the band-shifting methods used to correct slit-image curvature. However, the interpolation is along only one dimension of the CCD. This will smooth intensity along rows where there is potentially intensity variation due to CCD rotation misalignment (interpolation between pairs of pixels). Software corrections for rotation use an image transformation based on sine and cosine pixel position transformations. Like rotation correction, image transformations using bilinear interpolation combine signal from groups of four pixels according to position of the new virtual pixel within the four surrounding pixels from the initial image.

We compared the degree of smoothing associated with different software correction approaches. A test image was simulated and contained normally (Gaussian) distributed random numbers with a standard deviation of 1. Four methods were applied to the simulated test image: (1) curvature correction only, (2) rotation correction only, (3) rotation correction followed by curvature correction, and (4) projective transformation. The standard deviation was calculated over all pixels in the image, and the results are shown in . The reduction in standard deviation is correlated to the total amount of smoothing, with a lower number associated with a greater smoothing effect.

| **TABLE II**The effects of smoothing in each preprocessing step are indicated by the reduction in standard deviation of a simulated image of normally distributed random noise (with mean of 0 and standard deviation of 1). Preprocessing steps were identical to those (more ...) |

The initial image (815 × 127 pixels, corresponding to microscopy data) had a measured standard deviation of 0.997. Using only slit-image curvature for the measured microscopy band positions imposed only a moderate amount of smoothing and resulted in a standard deviation of 0.830. Rotational correction for a −0.69 degree rotation reduced the standard deviation to 0.647. Sequential rotational and slit-image curvature corrections produced the greatest level of smoothing, with a standard deviation of 0.570. Projective transformation produced a standard deviation of 0.687, which was similar to the result produced after only rotational correction. Moderate data smoothing is observed for the projective transformation correction, which was expected because the algorithm employs interpolation functions. However, smoothing alone cannot account for the dramatic improvements in band ratio standard deviations for Teflon data. Variability of the Teflon image band ratios decreased to 21% of the initial value after the image transform, far more than explained by interpolation alone (which reduced the standard deviation of the image to 69% of the initial value).

To further demonstrate this, we used PCA to demonstrate that the number of principal components required to model the data decreased after performing the spectral image corrections. The fundamental concept is that there are a limited number of chemical species that additively contribute some spectral component to the experimentally recorded data. Likewise, the fluorescence background should be composed of one or more fluorophores generating a background. The number of linear terms required to model the data is indicative of the number of chemical species contributing to the data. Three different automated methods were used for determining the number of PCA components required to model the Teflon spectral image, results from which are shown in . The three methods used to determine the number of components were significant factor analysis (SFA), residual percent variance (using a 0.1% threshold), and the average eigenvalue or “eigenvalue-one criterion”.^{38} Though the three methods ultimately select different numbers of components, the transformation-corrected data always resulted in the fewest principal components. Differences are illustrated by the scree plot in , where the initial and transformed data differ substantially. The initial image (without preprocessing) required the most components to model, followed closely by the slit-image curvature corrected image. This trend continued, with the rotated image being composed of fewer linear terms. The combined rotation and slit-image curvature corrected image and the image-transformed images were approximately equal, both being modeled with fewer terms than the other images. Note that the effects of smoothing are also evident in the scree plots. Increased smoothing results in lower global minima, and lines in the scree plots are ordered according to the total level of smoothing in each processing method at higher numbers of PCA components. The method using rotation followed by slit-image curvature correction has the global minimum in the scree plot but also imposes the greatest interpolation cost (as seen in the standard deviations above).

| **TABLE III**Three automated methods were used to automatically determine the number of principal components required to represent the Teflon spectral image. |

Simulated Raman Data

We used simulated microscopy and fiber-optic images to validate the projective transformation as a corrective method for imaging spectrographs. Simulated data with known spectral properties were inverse transformed to introduce distortions that were observed in experimental data. Forward transformation of the distorted simulated images allowed recovery of the initial input spectra with no loss of spectral integrity.

Simulated Raman microscopy images are shown in and the corresponding spectra in . Importantly, the initial undistorted image was generated using a single spectrum repeated across the entire spatial axis. Intensities of each spectrum in the image were randomly scaled. The spectral and spatial axes in the initial spectral image are perfectly aligned to the image axes, as shown in . Spectra from the initial image reflect a constant fluorescence pattern and constant relative band intensities throughout the spatial axis, shown in . After applying the inverse transform, Raman bands are slightly curved along the vertical axis and the image is slightly rotated clockwise. Distortion in the image is imperceptible in , even with the vertical and horizontal lines added for emphasis; however, there were significant differences in the individual spectra, shown in . The forward transform was used to correct the distorted image. Individual spectra from the corrected image have a fluorescence background consistent with spectra from the initial undistorted image.

A comparison of spectra in emphasizes the importance of correcting for distortions even when they are not visually apparent in the recorded dispersion image. shows several rows of spectra from the initial image taken from rows near the middle of the image shown in . There were significant differences in the apparent fluorescence background, shown in , and individual spectra no longer appeared as scaled versions of a single spectrum. Apparent differences in the fluorescence background of simulated Raman data result only from collating different spectral regions of spatially adjacent image rows. Distortion also affected row-to-row variation in spectral band intensities because different spatial positions contributed to the intensity of a spectral band in a single pixel row. shows the spectra after the corrective forward transform is applied, where individual spectra are scaled versions of a single spectrum with the same apparent fluorescence background. Minor bands, such as the one near pixel 175, were broadened because of the interpolation process. Exact row positions of spectra in were not identical because the images were truncated and the row positions shift slightly during image transformation.

Simulated Raman fiber-optic spectral images are shown in with the corresponding spectra shown in . The signal from each optical fiber is shown as a horizontal stripe across the image, with many fibers making up the whole image. Because of the inherent brightness contrast in our fiber-optics system, rotational misalignment in fiber-optic-coupled systems is more easily observed than in our Raman microscopy image. Additionally, slit-image curvature is more pronounced because the fiber-optic probe system is fitted with a 256-row CCD, while the microscope is fitted with a 128-row CCD. In the 256-row detector system, the vertical angle between incident light and the central optical axis is increased because a taller input slit is imaged. As a result, the vertical curvature of spectral bands in is more evident than in because of the increased vertical detector size (256 pixels vs. 128 pixels). shows the image after the corrective forward transform is applied.

Spectra from the simulated Raman fiber-optic probe are shown in . The initial spectra are scaled versions of a single spectrum. The initial spectrum is shown in . As shown in , spectra no longer appeared identical after application of the inverse transform. Significantly, background contributions from the fused-silica optical fibers appeared to vary from spectrum to spectrum. Variations are subtle in because the spectra are scaled to accommodate the full intensity range. Differences in the spectra manifest as inconsistencies in the vertical spacing between spectra along the wavenumber axis. Upon examination, the most intense Raman features were less than 10% of the background fluorescence intensity and fluctuations in the background intensity were substantial. These relatively large fluctuations in background intensity had a significant effect on the intensity of weak Raman bands in the simulated spectra. The spectra in are shown after the corrective forward transform is applied, and spectra are consistent with the initial simulation.