Commit 23dbe2348715061d0f4c5f2c99f95bb8dc2e9e07

Authored by david
1 parent 256b431c

fixed linux compiler errors for stim::gl_texture

Showing 2 changed files with 28 additions and 20 deletions   Show diff stats
stim/grids/image_stack.h
@@ -63,40 +63,44 @@ public: @@ -63,40 +63,44 @@ public:
63 // grid<T, 4, F>::spacing((F)1.0, sx, sy, sz); 63 // grid<T, 4, F>::spacing((F)1.0, sx, sy, sz);
64 //} 64 //}
65 65
66 - ///Load an image stack based on a file mask. Images are loaded in alphanumeric order  
67 - /// @param file_mask is the mask describing images to be loaded  
68 - void load_images(std::string file_mask){  
69 -  
70 - stim::filename file_path(file_mask);  
71 -  
72 - //get the list of files  
73 - std::vector<stim::filename> file_list = file_path.get_list(); 66 + /// Load all of the images specified by a list of strings
  67 + /// @param string_list is a list of file names specifying images
  68 + void load_images(std::vector<std::string> string_list){
74 69
75 //if there are no matching files, exit 70 //if there are no matching files, exit
76 - if(file_list.size() == 0){ 71 + if(string_list.size() == 0){
77 std::cout<<"STIM ERROR (image_stack): No matching files for loading a stack."<<std::endl; 72 std::cout<<"STIM ERROR (image_stack): No matching files for loading a stack."<<std::endl;
78 exit(1); 73 exit(1);
79 } 74 }
80 75
81 - //load the first image and set all of the image_stack properties  
82 - stim::image<T> I(file_list[0].str()); 76 + stim::image<T> I(string_list[0]); //load the first image and set all of the image_stack proparties
83 77
84 - //set the image resolution and number of channels  
85 - R[0] = I.channels();  
86 - R[1] = I.width(); 78 + R[0] = I.channels(); //set the number of color channels
  79 + R[1] = I.width(); //set the stack height and width based on the image size
87 R[2] = I.height(); 80 R[2] = I.height();
88 - R[3] = file_list.size(); 81 + R[3] = string_list.size(); //set the stack z-resolution based on the number of images
89 82
90 - //allocate storage space  
91 - ptr = (T*)malloc(sizeof(T) * samples()); 83 + ptr = (T*)malloc(sizeof(T) * samples()); //allocate storage space
92 84
93 //load and copy each image into the grid 85 //load and copy each image into the grid
94 - for(unsigned int i = 0; i<R[3]; i++){  
95 - stim::image<T> I(file_list[i].str()); //load the image 86 + for(unsigned int i = 0; i<R[3]; i++){ //for each image in the list
  87 + stim::image<T> I(string_list[i]); //load the image
96 I.get_interleaved_rgb(&ptr[ i * R[0] * R[1] * R[2] ]); //retrieve the interlaced data from the image - store it in the grid 88 I.get_interleaved_rgb(&ptr[ i * R[0] * R[1] * R[2] ]); //retrieve the interlaced data from the image - store it in the grid
97 } 89 }
98 } 90 }
99 91
  92 + /// Load a stack of images based on a file mask. Images are loaded in alphanumeric order
  93 + /// @param file_mask is the mask describing the images to be loaded
  94 + void load_images(std::string file_mask){
  95 + stim::filename file_path(file_mask); //get the path for the images
  96 + std::vector<stim::filename> file_list = file_path.get_list(); //get the list of files
  97 + std::vector<std::string> string_list(file_list.size()); //allocate space for an array of strings
  98 + for(size_t f = 0; f < file_list.size(); f++){ //for each file name in the list
  99 + string_list[f] = file_list[f].str(); //convert the file name to a string
  100 + }
  101 + load_images(string_list); //load all of the images in the list
  102 + }
  103 +
100 ///Inserts image I into slot i. 104 ///Inserts image I into slot i.
101 /// @param stim::image<T> I; image to insert. 105 /// @param stim::image<T> I; image to insert.
102 /// @int I, where to place the image. 106 /// @int I, where to place the image.
stim/parser/arguments.h
@@ -523,7 +523,11 @@ namespace stim{ @@ -523,7 +523,11 @@ namespace stim{
523 std::string arg(size_t a){ 523 std::string arg(size_t a){
524 return args[a]; 524 return args[a];
525 } 525 }
526 - 526 +
  527 + /// Returns an std::vector of argument strings
  528 + std::vector<std::string> arg_vector(){
  529 + return args;
  530 + }
527 ///Returns an object describing the argument 531 ///Returns an object describing the argument
528 532
529 /// @param _name is the name of the requested argument 533 /// @param _name is the name of the requested argument