Authored by David Mayerich
1 parent a7ed4b2e

added an is_open() boolean function

`You can now test if an ENVI file has been opened.`
Showing 4 changed files with 47 additions and 82 deletions
stim/envi/binary.h

 @@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@ 3 #ifndef RTS_BINARY_H 3 #ifndef RTS_BINARY_H 4 #define RTS_BINARY_H 4 #define RTS_BINARY_H 5 5 6 -#include "../envi/envi_header.h" 7 -#include "../math/vector.h" 6 +#include 7 +#include 8 #include 8 #include 9 #include 9 #include 10 #include 10 #include @@ -134,73 +134,6 @@ public: @@ -134,73 +134,6 @@ public: 134 } 134 } 135 } 135 } 136 } 136 } 137 - 138 - /*// this function updates the optimizer, given the number of bytes processed in an interval and time spent processing 139 - size_t update(size_t bytes_processed, size_t ms_spent){ 140 - interval_B += bytes_processed; //increment the number of bytes processed 141 - interval_ms += ms_spent; //increment the number of milliseconds spent processing 142 - 143 - //if we have sufficient information to evaluate the optimization function at this point 144 - if(interval_ms >= window_ms){ //if sufficient time has passed to get a reliable Bps measurement 145 - size_t new_Bps = interval_B / interval_ms; //calculate the current Bps 146 - 147 - if(sample_step){ //if this is a sample step, collect the information for Bps = f(n0) 148 - Bps = new_Bps; //set the Bps to the evaluated value 149 - n[1] = n[0] - dn; //reduce the batch size by one delta to take a second sample 150 - if(n[1] == 0){ //if the resulting batch size is zero 151 - n[1] = 2*dn; //we're at the left edge: set the new sample point to 2*dn 152 - } 153 - 154 - interval_B = interval_ms = 0; //start a new interval at the new sample point 155 - sample_step = false; //next step will calculate the new batch size via optimization 156 - return n[1]; //return the new batch size 157 - } 158 - else{ //if we have sufficient information to evaluate the derivative and optimize 159 - double f = (double)new_Bps; //we have evaluated the function at this location 160 - double fprime; 161 - if(n[1] < n[0] ){ //if the new point is less than the previous point (usually the case) 162 - fprime = (double)(Bps - new_Bps) / (double)dn; //calculate the forward difference 163 - } 164 - else{ //if the new point is larger (only happens at the minimum limit) 165 - fprime = (double)(new_Bps - Bps) / (double)dn; //calculate the backward difference 166 - } 167 - size_t bestn = n[1] - (size_t)(f / fprime); //calculate the best value for B using Newton's method 168 - n[0] = round_limit( (size_t)bestn ); //set the new dependent point 169 - sample_step = true; //the next step will be a sample step 170 - } 171 - 172 - } 173 - if(sample_step) return n[0]; 174 - return n[1]; //insufficient information, keep the same batch size 175 - }*/ 176 - 177 - /*size_t update(size_t bytes_processed, size_t ms_spent){ 178 - interval_B += bytes_processed; //increment the number of bytes processed 179 - interval_ms += ms_spent; //increment the number of milliseconds spent processing 180 - 181 - //if( Bps[0] == 0 ){ //if the left boundary hasn't been processed 182 - 183 - 184 - //if we have sufficient information to evaluate the optimization function at this point 185 - if(interval_ms >= window_ms){ 186 - size_t new_Bps = interval_B / interval_ms; //calculate the current Bps 187 - 188 - if(Bps[0] == 0) //if the left interval Bps hasn't been calculated 189 - Bps[0] = interval_B / interval_ms; //that is the interval being processed 190 - else 191 - Bps[1] = interval_B / interval_ms; //otherwise the right interval is being processed 192 - 193 - if(Bps[0] != 0 && Bps[1] != 0){ //if both intervals have been processed 194 - 195 - 196 - } 197 - }*/ 198 - 199 - /*size_t update(size_t bytes_processed, size_t ms_spent, size_t& data_rate, bool VERBOSE){ 200 - size_t time = update(bytes_processed, ms_spent, VERBOSE); 201 - data_rate = Bps[0]; 202 - return time; 203 - }*/ 204 }; 137 }; 205 138 206 /** This class manages the streaming of large multidimensional binary files. 139 /** This class manages the streaming of large multidimensional binary files. @@ -356,6 +289,10 @@ public: @@ -356,6 +289,10 @@ public: 356 return test_file_size(); 289 return test_file_size(); 357 } 290 } 358 291 292 + bool is_open() { 293 + return file.is_open(); 294 + } 295 + 359 /// Creates a new binary file for streaming 296 /// Creates a new binary file for streaming 360 297 361 /// @param filename is the name of the binary file to be created 298 /// @param filename is the name of the binary file to be created
stim/envi/bsq.h

 1 #ifndef STIM_BSQ_H 1 #ifndef STIM_BSQ_H 2 #define STIM_BSQ_H 2 #define STIM_BSQ_H 3 3 4 -#include "../envi/envi_header.h" 5 -#include "../envi/hsi.h" 6 -#include "../envi/bil.h" 4 +#include 5 +#include 6 +#include 7 #include 7 #include 8 #include 8 #include 9 #include 9 #include
stim/envi/envi.h