diff --git a/stim/envi/bil.h b/stim/envi/bil.h index b1a6ed1..826bf05 100644 --- a/stim/envi/bil.h +++ b/stim/envi/bil.h @@ -884,7 +884,7 @@ public: /// using the following indexing: i = p*B + b /// @param matrix is the destination for the pixel data /// @param mask is the mask - bool sift(T* matrix, unsigned char* mask){ + bool sift(T* matrix, unsigned char* mask = NULL){ size_t Lbytes = sizeof(T) * X(); T* line = (T*) malloc( Lbytes ); //allocate space for a line @@ -897,7 +897,7 @@ public: pl = 0; //initialize the pixel offset for the current line to zero (0) file.read( (char*)line, Lbytes ); //read the current line for(size_t x = 0; x < X(); x++){ - if(mask[y * X() + x]){ //if the current pixel is masked + if(mask == NULL || mask[y * X() + x]){ //if the current pixel is masked size_t i = (p + pl) * Z() + b; //calculate the index in the sifted matrix matrix[i] = line[x]; //store the current value in the line at the correct matrix location pl++; //increment the pixel pointer diff --git a/stim/envi/bip.h b/stim/envi/bip.h index 639a251..648e925 100644 --- a/stim/envi/bip.h +++ b/stim/envi/bip.h @@ -817,7 +817,7 @@ public: /// using the following indexing: i = p*B + b /// @param matrix is the destination for the pixel data /// @param mask is the mask - bool sift(T* matrix, unsigned char* mask){ + bool sift(T* matrix, unsigned char* mask = NULL){ size_t Bbytes = sizeof(T) * Z(); size_t XY = X() * Y(); T* band = (T*) malloc( Bbytes ); //allocate space for a line @@ -826,7 +826,7 @@ public: size_t p = 0; //create counter variables for(size_t xy = 0; xy < XY; xy++){ //for each pixel - if(mask[xy]){ //if the current pixel is masked + if(mask == NULL || mask[xy]){ //if the current pixel is masked file.read( (char*)band, Bbytes ); //read the current line for(size_t b = 0; b < Z(); b++){ //copy each band value to the sifted matrix size_t i = p * Z() + b; //calculate the index in the sifted matrix diff --git a/stim/envi/bsq.h b/stim/envi/bsq.h index afdaf96..840906f 100644 --- a/stim/envi/bsq.h +++ b/stim/envi/bsq.h @@ -809,7 +809,7 @@ public: /// using the following indexing: i = p*B + b /// @param matrix is the destination for the pixel data /// @param mask is the mask - bool sift(T* matrix, unsigned char* mask){ + bool sift(T* matrix, unsigned char* mask = NULL){ unsigned long long XY = X() * Y(); //Number of XY pixels unsigned long long L = XY * sizeof(T); //size of XY plane (in bytes) diff --git a/stim/envi/envi.h b/stim/envi/envi.h index 0ea815f..305540f 100644 --- a/stim/envi/envi.h +++ b/stim/envi/envi.h @@ -665,7 +665,7 @@ public: /// using the following indexing: i = b*P + p /// @param matrix is the destination for the pixel data /// @param p is the mask - bool sift(void* matrix, unsigned char* p){ + bool sift(void* matrix, unsigned char* p = NULL){ if (header.interleave == envi_header::BSQ){ //if the infile is bsq file if (header.data_type == envi_header::float32) @@ -1181,6 +1181,7 @@ public: else if (header.interleave == envi_header::BIP){ if (header.data_type == envi_header::float32){ ((bip*)file)->spectrum((float*)temp, n, PROGRESS); + float test = ((float*)temp)[0]; cast(ptr, (float*)temp, header.bands); } else if (header.data_type == envi_header::float64){ diff --git a/stim/parser/table.h b/stim/parser/table.h index d43b663..4dede69 100644 --- a/stim/parser/table.h +++ b/stim/parser/table.h @@ -34,6 +34,8 @@ namespace stim{ template T operator<<(T i){ std::stringstream ss; + if(std::is_fundamental()) //if the data type is numeric + ss<::digits10 + 3); //set the precision to account for all digits ss<