Commit e933c14efac817f4542b6e10cfd18868a1ffb3c1
1 parent
6708cc25
cleaned up the code
Showing
4 changed files
with
23 additions
and
24 deletions
Show diff stats
envi/bil.h
... | ... | @@ -54,7 +54,7 @@ public: |
54 | 54 | return true; |
55 | 55 | } |
56 | 56 | |
57 | - bool getBand( T * p, double wavelength){ | |
57 | + bool band( T * p, double wavelength){ | |
58 | 58 | |
59 | 59 | unsigned int XY = R[0] * R[1]; //calculate the number of pixels in a band |
60 | 60 | unsigned int S = XY * sizeof(T); //calculate the number of bytes of a band |
... | ... | @@ -147,7 +147,7 @@ public: |
147 | 147 | } |
148 | 148 | |
149 | 149 | //save one pixel of the BIP file into the memory, and return the pointer |
150 | - bool getSpectrum(T * p, unsigned x, unsigned y){ | |
150 | + bool spectrum(T * p, unsigned x, unsigned y){ | |
151 | 151 | |
152 | 152 | if ( x >= R[0] || y >= R[1]){ //make sure the sample and line number is right |
153 | 153 | std::cout<<"ERROR: sample or line out of range"<<std::endl; |
... | ... | @@ -292,7 +292,7 @@ public: |
292 | 292 | } |
293 | 293 | |
294 | 294 | // normalize the BIL file |
295 | - bool normalize(std::string outname, double band) | |
295 | + bool normalize(std::string outname, double w) | |
296 | 296 | { |
297 | 297 | unsigned int B = R[2]; //calculate the number of bands |
298 | 298 | unsigned int Y = R[1]; |
... | ... | @@ -311,7 +311,7 @@ public: |
311 | 311 | b = (T*)malloc( S ); //memory allocation |
312 | 312 | c = (T*)malloc( L ); |
313 | 313 | |
314 | - getBand(b, band); //get the certain band into memory | |
314 | + band(b, w); //get the certain band into memory | |
315 | 315 | |
316 | 316 | for(unsigned j = 0; j < Y; j++) |
317 | 317 | { | ... | ... |
envi/bip.h
... | ... | @@ -58,7 +58,7 @@ public: |
58 | 58 | return true; |
59 | 59 | } |
60 | 60 | |
61 | - bool getBand( T * p, double wavelength){ | |
61 | + bool band( T * p, double wavelength){ | |
62 | 62 | |
63 | 63 | unsigned int XY = R[0] * R[1]; //calculate the number of pixels in a band |
64 | 64 | |
... | ... | @@ -242,7 +242,7 @@ public: |
242 | 242 | } |
243 | 243 | |
244 | 244 | //save one pixel of the BIP file into the memory, and return the pointer |
245 | - bool getSpectrum(T * p, unsigned x, unsigned y){ | |
245 | + bool spectrum(T * p, unsigned x, unsigned y){ | |
246 | 246 | |
247 | 247 | if ( x >= R[0] || y >= R[1]){ //make sure the sample and line number is right |
248 | 248 | std::cout<<"ERROR: sample or line out of range"<<std::endl; |
... | ... | @@ -381,7 +381,7 @@ public: |
381 | 381 | } |
382 | 382 | |
383 | 383 | // normalize the BIP file |
384 | - bool normalize(std::string outname, double band) | |
384 | + bool normalize(std::string outname, double w) | |
385 | 385 | { |
386 | 386 | unsigned int B = R[2]; //calculate the number of bands |
387 | 387 | unsigned int Y = R[1]; |
... | ... | @@ -400,7 +400,7 @@ public: |
400 | 400 | b = (T*)malloc( S ); //memory allocation |
401 | 401 | c = (T*)malloc( L ); |
402 | 402 | |
403 | - getBand(b, band); //get the certain band into memory | |
403 | + band(b, w); //get the certain band into memory | |
404 | 404 | |
405 | 405 | for(unsigned j = 0; j < Y; j++) |
406 | 406 | { |
... | ... | @@ -433,7 +433,7 @@ public: |
433 | 433 | bil(temp); |
434 | 434 | |
435 | 435 | rts::bil<T> n; |
436 | - if(n.bil::open(temp, R[0], R[1], R[2], offset, w)==false){ //open infile | |
436 | + if(n.open(temp, R[0], R[1], R[2], offset, w)==false){ //open infile | |
437 | 437 | std::cout<<"ERROR: unable to open input file"<<std::endl; |
438 | 438 | exit(1); |
439 | 439 | } | ... | ... |
envi/bsq.h
... | ... | @@ -28,14 +28,9 @@ public: |
28 | 28 | using binary<T>::getSlice; |
29 | 29 | using binary<T>::R; |
30 | 30 | |
31 | - //open a file, given the file and its header's names | |
31 | + //open a file, given the file name and dimensions | |
32 | 32 | bool open(std::string filename, unsigned int X, unsigned int Y, unsigned int B, unsigned int header_offset, std::vector<double> wavelengths){ |
33 | 33 | |
34 | - /*if (header.load(headername)==false){ | |
35 | - std::cout<<"ERROR: unable to load header file: "<<headername<<std::endl; | |
36 | - return false; | |
37 | - }*/ | |
38 | - | |
39 | 34 | //copy the wavelengths to the BSQ file structure |
40 | 35 | w = wavelengths; |
41 | 36 | //copy the wavelengths to the structure |
... | ... | @@ -47,7 +42,7 @@ public: |
47 | 42 | |
48 | 43 | } |
49 | 44 | |
50 | - //save one band of the file into the memory, and return the pointer | |
45 | + //retrieve one band (specified by the band index) | |
51 | 46 | bool band_index( T * p, unsigned int page){ |
52 | 47 | |
53 | 48 | if (page >= R[2]){ //make sure the bank number is right |
... | ... | @@ -59,7 +54,8 @@ public: |
59 | 54 | return true; |
60 | 55 | } |
61 | 56 | |
62 | - bool getBand( T * p, double wavelength){ | |
57 | + //retrieve one band (specified by the wavelength) | |
58 | + bool band( T * p, double wavelength){ | |
63 | 59 | |
64 | 60 | unsigned int XY = R[0] * R[1]; //calculate the number of pixels in a band |
65 | 61 | |
... | ... | @@ -104,7 +100,7 @@ public: |
104 | 100 | } |
105 | 101 | |
106 | 102 | //save one pixel of the file into the memory, and return the pointer |
107 | - bool getSpectrum(T * p, unsigned x, unsigned y){ | |
103 | + bool spectrum(T * p, unsigned x, unsigned y){ | |
108 | 104 | |
109 | 105 | unsigned int i; |
110 | 106 | |
... | ... | @@ -168,11 +164,11 @@ public: |
168 | 164 | //else get the low band |
169 | 165 | else{ |
170 | 166 | control += 1; |
171 | - getBand(a, ai); | |
167 | + band(a, ai); | |
172 | 168 | bi = wls[control]; |
173 | 169 | } |
174 | 170 | //get the high band |
175 | - getBand(b, bi); | |
171 | + band(b, bi); | |
176 | 172 | |
177 | 173 | //correct every band |
178 | 174 | for(unsigned cii = 0; cii < B; cii++){ |
... | ... | @@ -188,7 +184,7 @@ public: |
188 | 184 | |
189 | 185 | ai = bi; |
190 | 186 | bi = wls[control]; |
191 | - getBand(b, bi); | |
187 | + band(b, bi); | |
192 | 188 | |
193 | 189 | } |
194 | 190 | //if the last BL point on the last band of the file? |
... | ... | @@ -227,7 +223,7 @@ public: |
227 | 223 | } |
228 | 224 | |
229 | 225 | // normalize the BSQ file |
230 | - bool normalize(std::string outname, double band) | |
226 | + bool normalize(std::string outname, double w) | |
231 | 227 | { |
232 | 228 | unsigned int B = R[2]; //calculate the number of bands |
233 | 229 | unsigned int XY = R[0] * R[1]; //calculate the number of pixels in a band |
... | ... | @@ -242,7 +238,7 @@ public: |
242 | 238 | b = (T*)malloc( S ); //memory allocation |
243 | 239 | c = (T*)malloc( S ); |
244 | 240 | |
245 | - getBand(b, band); //get the certain band into memory | |
241 | + band(b, w); //get the certain band into memory | |
246 | 242 | |
247 | 243 | for(unsigned j = 0; j < B; j++) |
248 | 244 | { |
... | ... | @@ -271,7 +267,7 @@ public: |
271 | 267 | bil(temp); |
272 | 268 | |
273 | 269 | rts::bil<T> n; |
274 | - if(n.bil::open(temp, R[0], R[1], R[2], offset, w)==false){ //open infile | |
270 | + if(n.open(temp, R[0], R[1], R[2], offset, w)==false){ //open infile | |
275 | 271 | std::cout<<"ERROR: unable to open input file"<<std::endl; |
276 | 272 | exit(1); |
277 | 273 | } | ... | ... |
envi/envi.h
... | ... | @@ -127,6 +127,7 @@ public: |
127 | 127 | std::cout<<"ERROR: unidentified file type"<<std::endl; |
128 | 128 | exit(1); |
129 | 129 | } |
130 | + return false; | |
130 | 131 | } |
131 | 132 | |
132 | 133 | //perform baseline correction |
... | ... | @@ -268,6 +269,7 @@ public: |
268 | 269 | std::cout<<"ERROR: unidentified interleave type"<<std::endl; |
269 | 270 | exit(1); |
270 | 271 | } |
272 | + return false; | |
271 | 273 | |
272 | 274 | } |
273 | 275 | |
... | ... | @@ -304,6 +306,7 @@ public: |
304 | 306 | exit(1); |
305 | 307 | } |
306 | 308 | } |
309 | + return false; | |
307 | 310 | } |
308 | 311 | |
309 | 312 | bool save_header(std::string filename){ | ... | ... |