Commit ebe94c9dcecc1cae2c652490f86e3b9a00f207e1
1 parent
b0fee590
modified comments
Showing
1 changed file
with
11 additions
and
10 deletions
Show diff stats
envi/bsq.h
... | ... | @@ -52,7 +52,6 @@ public: |
52 | 52 | |
53 | 53 | file.read((char *)p, sizeof(T) * R[0] * R[1]); |
54 | 54 | |
55 | -// getSlice(p, 2, page); | |
56 | 55 | return true; |
57 | 56 | } |
58 | 57 | |
... | ... | @@ -64,10 +63,10 @@ public: |
64 | 63 | return band_index(p, (unsigned int)wavelength); |
65 | 64 | |
66 | 65 | unsigned int XY = R[0] * R[1]; //calculate the number of pixels in a band |
67 | - unsigned page=0; //bands around the wavelength | |
66 | + unsigned page = 0; | |
68 | 67 | |
69 | 68 | |
70 | - //get the bands numbers around the wavelength | |
69 | + //get the two neighboring bands (above and below 'wavelength') | |
71 | 70 | |
72 | 71 | //if wavelength is smaller than the first one in header file |
73 | 72 | if ( w[page] > wavelength ){ |
... | ... | @@ -78,14 +77,16 @@ public: |
78 | 77 | while( w[page] < wavelength ) |
79 | 78 | { |
80 | 79 | page++; |
81 | - //if wavelength is larger than the last wavelength in header file | |
80 | + //if wavelength is larger than the last wavelength in the header file | |
81 | + // (the wavelength is out of bounds) | |
82 | 82 | if (page == R[2]) { |
83 | - getSlice(p, 2, R[2]-1); | |
83 | + band_index(p, R[2]-1); //return the last band | |
84 | 84 | return true; |
85 | 85 | } |
86 | 86 | } |
87 | - if ( wavelength < w[page] ) | |
88 | - { | |
87 | + //when the page counter points to the first band above 'wavelength' | |
88 | + if ( wavelength < w[page] ){ | |
89 | + //do the interpolation | |
89 | 90 | T * p1; |
90 | 91 | T * p2; |
91 | 92 | p1=(T*)malloc( XY * sizeof(T)); //memory allocation |
... | ... | @@ -99,9 +100,9 @@ public: |
99 | 100 | free(p1); |
100 | 101 | free(p2); |
101 | 102 | } |
102 | - else //if the wavelength is equal to a wavelength in header file | |
103 | - { | |
104 | - band_index(p, page); | |
103 | + //if the wavelength is equal to a wavelength in header file | |
104 | + else{ | |
105 | + band_index(p, page); //return the band | |
105 | 106 | } |
106 | 107 | |
107 | 108 | return true; | ... | ... |