From 904614c3987dfd1ad775ca77ee2d023e803a8e88 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 23 May 2016 09:43:13 -0500 Subject: [PATCH] added normalization for BIP files, and added get_noninterleaved to stim::image --- stim/envi/bil.h | 35 ++++++++++++++++++++++++++++++++++- stim/envi/bip.h | 29 ++++++++++++++++++++++++++++- stim/image/image.h | 12 ++++++++++++ stim/parser/arguments.h | 34 +++++++++++++++++++++++++++++++++- 4 files changed, 107 insertions(+), 3 deletions(-) diff --git a/stim/envi/bil.h b/stim/envi/bil.h index 6890885..f576d4b 100644 --- a/stim/envi/bil.h +++ b/stim/envi/bil.h @@ -386,7 +386,40 @@ public: return true; } - void normalize(std::string outfile, unsigned char* mask = NULL, bool PROGRESS = false){} + void normalize(std::string outfile, unsigned char* mask = NULL, bool PROGRESS = false){ + std::cout<<"ERROR: algorithm not implemented"< channel(size_t c){ diff --git a/stim/parser/arguments.h b/stim/parser/arguments.h index 41231f6..3ca819e 100644 --- a/stim/parser/arguments.h +++ b/stim/parser/arguments.h @@ -23,18 +23,50 @@ namespace stim{ //argument name std::string name; - //description of the argument + //description of the option std::vector desc; //argument values std::vector vals; + //integral and numerical flags for each argument + std::vector integral; + std::vector numerical; + //range or example std::string range; //flag is true when the argument is user-specified bool flag; + bool char_numerical(char c){ + if( (c >= '0' && c <= '9') || c == '-' || c == '.') + return true; + } + + bool char_integral(char c){ + if( (c >= '0' && c <= '9') || c == '-') + return true; + } + + /// Test if a given string contains a numerical (real) value + bool test_numerical(std::string v){ + for(size_t i = 0; i < v.length(); i++){ //for each character in the string + if(!char_numerical(v[i])) + return false; + } + return true; + } + + /// Test if a given string contains an integer value + bool test_integral(std::string v){ + for(size_t i = 0; i < v.length(); i++){ //for each character in the string + if(!char_integral(v[i])) + return false; + } + return true; + } + void parse_val(const std::string &s){ vals.clear(); -- libgit2 0.21.4