#define NOMINMAX #include "stim/visualization/colormap.h" #include "stim/envi/envi.h" #include "stim/parser/filename.h" #include extern stim::envi ENVI; void progress_thread_envi(stim::envi* e); //progress bar threaded function extern unsigned long long X, Y, B; //converts a string to a colormap stim::colormapType str2cmap(std::string str){ if(str == "brewer") return stim::cmBrewer; else if(str == "grey" || str == "gray") return stim::cmGrayscale; else{ std::cout<<"Invalid color map specified"<(image, filename, X, Y, (float)minVal, (float)maxVal, cmap); //convert band image to a picture and save free(image); } else{ std::cout<<"ERROR: only float binary files are workable"<::max(); for (size_t i = 0; i < X * Y; i++) { if (!MASK || MASK[i]) { if (image[i] > maxval) maxval = image[i]; if (image[i] < minval) minval = image[i]; if (abs(image[i]) < abs(minmag)) minmag = image[i]; } } std::cout << "Saving " << X << " x " << Y << " image, with values in (" << minval << ", " << maxval << ") and |min| = " << minmag << "..." << std::endl; stim::filename f(filename); //create a stim::filename if(f.extension() == "" || f.extension() == "raw"){ //if there is no extension or the extension is "raw" std::ofstream outfile(filename, std::ios::binary); //open the file for binary writing outfile.write((char*)image, X * Y * sizeof(float)); //write the data outfile.close(); } else stim::cpu2image(image, filename, X, Y, cmap); //convert band image to a picture and save free(image); } else { std::cout<<"ERROR: only float binary files are workable"<