diff --git a/envi/bsq.h b/envi/bsq.h index d8d7b13..4bc6004 100644 --- a/envi/bsq.h +++ b/envi/bsq.h @@ -52,7 +52,6 @@ public: file.read((char *)p, sizeof(T) * R[0] * R[1]); -// getSlice(p, 2, page); return true; } @@ -64,10 +63,10 @@ public: return band_index(p, (unsigned int)wavelength); unsigned int XY = R[0] * R[1]; //calculate the number of pixels in a band - unsigned page=0; //bands around the wavelength + unsigned page = 0; - //get the bands numbers around the wavelength + //get the two neighboring bands (above and below 'wavelength') //if wavelength is smaller than the first one in header file if ( w[page] > wavelength ){ @@ -78,14 +77,16 @@ public: while( w[page] < wavelength ) { page++; - //if wavelength is larger than the last wavelength in header file + //if wavelength is larger than the last wavelength in the header file + // (the wavelength is out of bounds) if (page == R[2]) { - getSlice(p, 2, R[2]-1); + band_index(p, R[2]-1); //return the last band return true; } } - if ( wavelength < w[page] ) - { + //when the page counter points to the first band above 'wavelength' + if ( wavelength < w[page] ){ + //do the interpolation T * p1; T * p2; p1=(T*)malloc( XY * sizeof(T)); //memory allocation @@ -99,9 +100,9 @@ public: free(p1); free(p2); } - else //if the wavelength is equal to a wavelength in header file - { - band_index(p, page); + //if the wavelength is equal to a wavelength in header file + else{ + band_index(p, page); //return the band } return true; -- libgit2 0.21.4