## 2 Materials and Methods
### Data Preprocessing  
Several image preprocessing steps are necessary before the quantitative data analysis of kidney samples' HSI images. These aim to remove irrelevant information, noise, and physical phenomena from the data to improve the subsequent multivariate data analysis. The data preprocessing includes the following steps:  
Step 1: ROI Segmentation  
The segmentation process removes pixels of the background from the hyperspectral data cube, which do not contain chemical information about the sample. The determination of region-of-interest (ROI), representing the sample within the hyperspectral images, was performed by manual ROI selection using the _roipoly_ function of MATLAB. Step 2: Removal of Specular Reflections  
Within the ROI, specular reflections can occur and appear as bright spots in absorbance images. These are caused by the presence of moisture on the kidney's surface, which acts like a mirror reflecting the light of the illumination system. Since specular reflections overlap the sample's actual chemical properties, they can also influence the subsequent data analysis and must, therefore, be removed. For data preprocessing, absorbance images were used to determine the pixels affected by specular reflections, which cause low intensities and can, therefore, be detected and segmented using a threshold-based method. The elimination of 10% of the darkest pixels in the absorbance image was achieved with the _Thresholding Tool_ implemented in MATLAB [43]. Step 3: Spectral Normalization  
For a reasonable comparison of spectra, it is useful to scale their values to the same range by normalization. In order to compare the influence of normalization method on the prediction performance of the model, three different methods (min-max, area, and vector normalization) were applied to the spectra [44]. Min-max normalization is a common method to preprocess data. For each spectrum, the minimum value of that spectrum was set to 0, and the maximum value to 1, while the other values are distributed accordingly. The min-max normalized absorbance and reflectance image were calculated as follows:  
\[\mathrm{I_{ABS\;x,y,\lambdanorm}}=\;\frac{\mathrm{I_{ABS\;x,y,\lambda}-\;Min( I_{ABS\;x,y,\lambda})}}{\mathrm{Max(I_{ABS\;x,y,\lambda})-\;Min(I_{ABS\;x,y, \lambda})}}\;, \tag{4}\]  
\[\mathrm{I_{REFL\;x,y,\lambdanorm}}=\;\frac{\mathrm{I_{REFL\;x,y,\lambda}-\;Min( I_{REFL\;x,y,\lambda})}}{\mathrm{Max(I_{REFL\;x,y,\lambda})-\;Min(I_{REFL\;x,y, \lambda})}}\;. \tag{5}\]  
In the second approach, the area normalization is calculated by dividing each spectrum by a constant that corresponds to the sum of all intensities over the wavelength range (see Equations (6) and (7)):  
\[\mathrm{I_{ABS\;x,y,\lambdanorm}}=\;\frac{\mathrm{I_{ABS\;x,y,\lambda}}}{ \mathrm{I_{ABS\;x,y,\lambda}}}, \tag{6}\]  
\[\mathrm{I_{REFL\;x,y,\lambdanorm}}=\;\frac{\mathrm{I_{REFL\;x,y,\lambda}}}{ \mathrm{I_{REFL\;x,y,\lambda}}}. \tag{7}\]  
Vector normalization, in which the spectrum is considered a vector and each vector value is divided by the square root of the sum of the squares of all vector values, is calculated as follows:  
\[\mathrm{I_{ABS\;x,y,\lambdanorm}}=\;\frac{\mathrm{I_{ABS\;x,y,\lambda}}}{ \sqrt{\sum\mathrm{I_{ABS\;x,y,\lambda}}^{2}}}, \tag{8}\]\[\mathrm{I}_{\mathrm{REFL\ x,y,\lambda\mathrm{norm}}}=\ \frac{\mathrm{I}_{ \mathrm{REFL\ x,y,\lambda}}}{\sqrt{\sum\mathrm{I}_{\mathrm{REFL\ x,y,\lambda}} \mathrm{{}^{2}}}}. \tag{9}\]  
Step 4: Scatter Correction and Spectral Derivates  
Three different methods were considered for noise correction to reduce the influence of distorted spectra on the prediction model. Two methods--multiplicative scatter correction (MSC) and standard normal variate (SNV)--for scatter correction, and the Savitzky-Golay method (SG) for spectral derivation [45]. All preceding methods intend to remove distorted signal portions that would otherwise impede the construction of a valid prediction model. MSC is the most commonly used scatter correction method for NIR data.