Commit 6156690fca9488d4878172d506cb6ebc5627037e

Authored by David Mayerich
1 parent 8b7be670

added ability to save a single image

Showing 1 changed file with 14 additions and 14 deletions   Show diff stats
grids/image_stack.h
... ... @@ -58,6 +58,17 @@ public:
58 58 }
59 59 }
60 60  
  61 + void save_image(std::string file_name, unsigned int i){
  62 +
  63 + //create an image
  64 + stim::image<T> I;
  65 +
  66 + //retrieve the interlaced data from the image - store it in the grid
  67 + I.set_interleaved(&ptr[ i * R[0] * R[1] * R[2] ], R[1], R[2], R[0]);
  68 +
  69 + I.save(file_name);
  70 + }
  71 +
61 72 void save_images(std::string file_mask){
62 73  
63 74 stim::filename file_path(file_mask);
... ... @@ -71,22 +82,11 @@ public:
71 82 //create a list of file names
72 83 std::vector<std::string> file_list = stim::wildcards::increment(file_path.str(), 0, R[3]-1, 1);
73 84  
74   - for(int i=0; i<R[3]; i++){
75   -
76   - //create an image
77   - stim::image<T> I;
78   -
79   - //retrieve the interlaced data from the image - store it in the grid
80   - I.set_interleaved(&ptr[ i * R[0] * R[1] * R[2] ], R[1], R[2], R[0]);
81   -
82   - I.save(file_list[i]);
83   -
84   -
85   - std::cout<<file_list[i]<<std::endl;
86   - }
  85 + for(int i=0; i<R[3]; i++)
  86 + save_image(file_list[i], i);
  87 + }
87 88  
88 89  
89   - }
90 90  
91 91  
92 92  
... ...