diff --git a/stim/grids/image_stack.h b/stim/grids/image_stack.h index 1c27f6c..549417f 100644 --- a/stim/grids/image_stack.h +++ b/stim/grids/image_stack.h @@ -63,40 +63,44 @@ public: // grid::spacing((F)1.0, sx, sy, sz); //} - ///Load an image stack based on a file mask. Images are loaded in alphanumeric order - /// @param file_mask is the mask describing images to be loaded - void load_images(std::string file_mask){ - - stim::filename file_path(file_mask); - - //get the list of files - std::vector file_list = file_path.get_list(); + /// Load all of the images specified by a list of strings + /// @param string_list is a list of file names specifying images + void load_images(std::vector string_list){ //if there are no matching files, exit - if(file_list.size() == 0){ + if(string_list.size() == 0){ std::cout<<"STIM ERROR (image_stack): No matching files for loading a stack."< I(file_list[0].str()); + stim::image I(string_list[0]); //load the first image and set all of the image_stack proparties - //set the image resolution and number of channels - R[0] = I.channels(); - R[1] = I.width(); + R[0] = I.channels(); //set the number of color channels + R[1] = I.width(); //set the stack height and width based on the image size R[2] = I.height(); - R[3] = file_list.size(); + R[3] = string_list.size(); //set the stack z-resolution based on the number of images - //allocate storage space - ptr = (T*)malloc(sizeof(T) * samples()); + ptr = (T*)malloc(sizeof(T) * samples()); //allocate storage space //load and copy each image into the grid - for(unsigned int i = 0; i I(file_list[i].str()); //load the image + for(unsigned int i = 0; i I(string_list[i]); //load the image I.get_interleaved_rgb(&ptr[ i * R[0] * R[1] * R[2] ]); //retrieve the interlaced data from the image - store it in the grid } } + /// Load a stack of images based on a file mask. Images are loaded in alphanumeric order + /// @param file_mask is the mask describing the images to be loaded + void load_images(std::string file_mask){ + stim::filename file_path(file_mask); //get the path for the images + std::vector file_list = file_path.get_list(); //get the list of files + std::vector string_list(file_list.size()); //allocate space for an array of strings + for(size_t f = 0; f < file_list.size(); f++){ //for each file name in the list + string_list[f] = file_list[f].str(); //convert the file name to a string + } + load_images(string_list); //load all of the images in the list + } + ///Inserts image I into slot i. /// @param stim::image I; image to insert. /// @int I, where to place the image. diff --git a/stim/parser/arguments.h b/stim/parser/arguments.h index 148893f..3a67bee 100644 --- a/stim/parser/arguments.h +++ b/stim/parser/arguments.h @@ -523,7 +523,11 @@ namespace stim{ std::string arg(size_t a){ return args[a]; } - + + /// Returns an std::vector of argument strings + std::vector arg_vector(){ + return args; + } ///Returns an object describing the argument /// @param _name is the name of the requested argument -- libgit2 0.21.4