*3.1. Processing Framework 1 (PF1): Sampling Interval Analysis and Training Dataset Reduction*

The *PF1* (Figure 3a) aims to perform a sampling interval analysis of the HS raw data in order to reduce as much as possible the number of bands required to obtain accurate classification results, removing the redundant information provided by the high spectral resolution of the HS camera. In addition, in this processing framework a training dataset reduction algorithm is proposed with the goal of reducing the high training times of the SVM classifier. The best pre-processing chain obtained in this analysis, involving also the sampling interval selection, together with the optimal training dataset selection, will be employed in the next proposed processing frameworks.

#### 3.1.1. Data Pre-Processing

A pre-processing chain composed of three main steps was applied to the HS raw data in order to homogenize the spectral signatures of the dataset. The first stage in this chain is the radiometric calibration of the HS images, performed to avoid the interference of environmental illumination and the dark currents of the HS sensor. The raw data was calibrated using white and dark reference images following Equation (1), where *Ci* is the calibrated image, *Ri* is the raw image, and *Wr* and *Dr* are the white and dark reference images, respectively. The white reference image was captured from a material that reflects the 99% of the incoming radiation in the full spectral range considered in this work (Spectralon® tile). This tile was placed at the same location where the patient's head will be placed during the surgery, thus taking into account the real light condition. On the other hand, the dark reference image was acquired by keeping the camera shutter closed. This calibration procedure ensures the consistence of data and the reproducibility of the results independent of the operating room where the system is used.

$$C\_i = 100 \cdot \frac{R\_i - D\_r}{W\_r - D\_r} \tag{1}$$

The second stage consists in the application of a noise filter in order to reduce the high spectral noise generated by the camera sensor using a smooth filter. Except for the first case of the sampling interval analysis, presented in the next section, the preprocessing applied involves an extreme band-removing step before the noise filter with the goal of eliminating the bands with high noise in the first and last bands of the HS data produced with the low performance of the sensor in these bands. After this procedure, the operating bandwidth of the HS data is between 440 and 902 nm. Finally, in the third stage, the spectral signatures are normalized between zero and one in order to homogenize reflectance levels in each pixel of the HS image produced by the non-uniform surface of the brain. Equation (2) shows this process, where the normalized pixel (*P*- *<sup>i</sup>*) is computed by subtracting the minimum reflectance value in a certain pixel (*Pmin*) by the reflectance value of such pixel in a certain wavelength (*Pi*) and dividing it by the difference between the maximum and minimum reflectance values (*Pmax* − *Pmin*).

$$P'\_i = \frac{P\_i - P\_{\text{min}}}{P\_{\text{max}} - P\_{\text{min}}} \tag{2}$$
