The Two-Pass algorithm is designed to accelerate hyperspectral acquisition, traditionally performed point-by-point (e.g., snake scan, raster scan).
The acquisition process is as follows:
-
A fast initial acquisition (at low SNR) is performed for each point in the imaged area.
-
The data undergoes two processing paths:
- Spatial Compression:
- Dimension reduction is applied along the spectral axis to generate a single, high-contrast image of the sample.
- The resulting image is segmented into super-pixels.
- For each super-pixel, a representative (centroid) is selected, effectively performing spatial compression.
- Spectral Compression:
- Each spectrum from the hyperspectral image is decomposed in the Fourier domain using the DFT.
- The first harmonics are extracted to identify the essential pixels, corresponding to spectral compression.
- Spatial Compression:
-
The subset of centroid pixels is unmixed relative to the essential pixels to produce a concentration matrix.
-
The essential pixels are rescanned at a slower pace (with high SNR).
Finally, the super-pixel map, the concentration matrix of centroids, and the high-SNR essential pixels are recombined to reconstruct the hyperspectral image.
Using this protocol, the following results can be obtained (the "UnSCR" column corresponds to Two-Pass):
Clone the repository and navigate to the project directory:
conda create -n twopass python=3.9 -y
conda activate twopass
git clone https://github.com/ValentinGilet/Two-Pass.git
cd Two-Pass
pip install -r requirements.txt
V. Gilet et al., “Superpixels meet essential spectra for fast Raman hyperspectral microimaging,” Opt. Express, vol. 32, no. 1, p. 932, Jan. 2024, doi: 10.1364/OE.509736.



