From c512fb944de14b88ed7a2228ba843aa16f2152a2 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 28 Aug 2016 05:04:21 -0500 Subject: [PATCH] fixed file series loading error in stim::gl_texture --- stim/gl/gl_texture.h | 22 ++++++++++++++++------ stim/grids/image_stack.h | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/stim/gl/gl_texture.h b/stim/gl/gl_texture.h index db3e9b6..4cb3a64 100644 --- a/stim/gl/gl_texture.h +++ b/stim/gl/gl_texture.h @@ -192,6 +192,12 @@ class gl_texture : public virtual image_stack } CHECK_OPENGL_ERROR } + void guess_parameters(){ + setTextureType(); //set the texture type: 1D, 2D, 3D + format = guess_format(); //guess the texture format based on the number of image channels + cpu_type = guess_cpu_type(); //guess the CPU type based on the template + gpu_type = guess_gpu_type(); //guess the GPU type based on the format and template + } public: @@ -253,16 +259,20 @@ class gl_texture : public virtual image_stack vec getDims(){ vec dims(grid::S[1], grid::S[2], grid::S[3]); return dims; - } + } + + /// Loads a series of files specified by a list of strings + /// @param file_list is the vector of file names as strings + void load_images(std::vector file_list){ + image_stack::load_images(file_list); //load the images + guess_parameters(); + } ///@param file_mask specifies the file(s) to be loaded /// Sets the path and calls the loader on that path. - void load(std::string file_mask){ + void load_images(std::string file_mask){ image_stack::load_images(file_mask); //load images - setTextureType(); //set the texture type: 1D, 2D, 3D - format = guess_format(); //guess the texture format based on the number of image channels - cpu_type = guess_cpu_type(); //guess the CPU type based on the template - gpu_type = guess_gpu_type(); //guess the GPU type based on the format and template + guess_parameters(); } /// Returns the GLuint id of the texture created by/associated with the diff --git a/stim/grids/image_stack.h b/stim/grids/image_stack.h index 549417f..79d1a10 100644 --- a/stim/grids/image_stack.h +++ b/stim/grids/image_stack.h @@ -80,7 +80,7 @@ public: R[2] = I.height(); R[3] = string_list.size(); //set the stack z-resolution based on the number of images - ptr = (T*)malloc(sizeof(T) * samples()); //allocate storage space + ptr = (T*)malloc(bytes()); //allocate storage space //load and copy each image into the grid for(unsigned int i = 0; i