*2.2. HyperLCA Initialization*

The HyperLCA algorithm needs to accomplish two main operations before performing the HyperLCA transform according to the characteristics of the image to be compressed and parameters introduced by the user.

#### 2.2.1. Determining the Number of Pixels to be Extracted by the HyperLCA Transform

The compression ratio achieved by the HyperLCA transform is directly determined by the number of extracted vectors and the number of bits used for representing the compressed vectors *V* = [*<sup>v</sup>*1, *v*2, ..., *vp*max ]. Accordingly, the maximum number of vectors to be extracted by the HyperLCA transform for each block of pixels, *p*max, is previously calculated according to the number of bands and the dynamic range of the image to be compressed, and the input parameters, *CR*, *blockSize* and *N*bits as shown in Equation (1), where *Np*block is the number of pixels per block (*blockSize*), *CR* is the minimum compression ratio desired, *N*bits is the number of bits used for representing the compressed vectors *V* = [*<sup>v</sup>*1, *v*2, ..., *vp*max ], and *DR* and *Nb* refer to the dynamic range and number of bands of the hyperspectral image to be compressed, respectively:

$$p\_{\text{max}} \le \frac{DR \cdot \left(N\_b \cdot \left(N\_{\text{Pbck}} - 1\right)\right)}{CR \cdot \left(DR \cdot N\_b + N\_{\text{bits}} \cdot N\_{\text{Pbck}}\right)}.\tag{1}$$

The process can be simplified by using the same precision for representing the compressed vectors *V* = [*<sup>v</sup>*1, *v*2, ..., *vp*max ], *N*bits, than for representing the image to be compressed, *DR*, and the Equation (1) would result in Equation (2)

$$p\_{\text{max}} \le \frac{N\_b \cdot (N\_{\text{Pbck}} - 1)}{CR \cdot (N\_b + N\_{\text{Pbck}})}.\tag{2}$$

#### 2.2.2. Calculating the Centroid Pixel for Each Block of Pixels

The HyperLCA transform requires the previous calculation of the average or centroid pixel, *c*, for every block of pixels to be processed. With independence of the data precision used for calculating *c*, it is rounded to the closest integer value before starting the HyperLCA transform stage. This has two main purposes. First of all, it eases the preprocessing and entropy coding stages, since these two stages need to work with integer values, as described in Section 2.5. Additionally, rounding *c* to integer values before performing the transformation stage ensures using the exact same vector *c* in both the HyperLCA transform and inverse transform, which increases the overall accuracy of the compression–decompression process.
