diff --git a/stim/envi/binary.h b/stim/envi/binary.h index 22dafec..5483a3d 100644 --- a/stim/envi/binary.h +++ b/stim/envi/binary.h @@ -81,7 +81,7 @@ protected: //if the file isn't open, the user may only have read access if(!file.is_open()){ - std::cout<<"class BINARY - failed to open file, trying for read only"< operator=(T v){ + + unsigned int X = width() * height() * depth() * channels(); + + for(unsigned x = 0; x < X; x++) + img.data()[x] = v; + + return *this; + + } + /// Copy the given data to the specified channel /// @param c is the channel number that the data will be copied to @@ -134,6 +152,10 @@ public: return img.height(); } + unsigned int depth(){ + return img.depth(); + } + T* data(){ return img.data(); diff --git a/stim/parser/filename.h b/stim/parser/filename.h index 69e9ba0..d7f221a 100644 --- a/stim/parser/filename.h +++ b/stim/parser/filename.h @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -290,6 +291,25 @@ public: return result; } + /// This function replaces a wildcard in the prefix with the specified string + stim::filename insert(std::string str){ + + stim::filename result = *this; //initialize the result filename to the current filename + size_t loc = result.prefix.find('*'); //find a wild card in the string + if(loc == std::string::npos) //if a wildcard isn't found + return result; //return the original string + + result.prefix.replace(loc, 1, str); //replace the wildcard with the string + return result; //return the result + } + + stim::filename insert(unsigned i, unsigned int n = 2){ + + std::stringstream ss; + ss << std::setw(n) << std::setfill('0') << i; + return insert(ss.str()); + } + bool is_relative(){ return !absolute; } -- libgit2 0.21.4