Commit b66bbf3f7efcddbfc6a2cbad4ac5cad5ac615240

Authored by David Mayerich
1 parent 11ff9d7e

added some details to image_stack for Shihao - may not be used

Showing 1 changed file with 10 additions and 0 deletions   Show diff stats
stim/grids/image_stack.h
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 #include <stim/parser/filename.h> 5 #include <stim/parser/filename.h>
6 #include <stim/grids/grid.h> 6 #include <stim/grids/grid.h>
7 #include <stim/image/image.h> 7 #include <stim/image/image.h>
  8 +#include <stim/math/vec3.h>
8 9
9 namespace stim{ 10 namespace stim{
10 11
@@ -166,6 +167,15 @@ public: @@ -166,6 +167,15 @@ public:
166 return ptr[z * R[0] * R[1] * R[2] + y * R[0] * R[1] + x * R[0] + c]; 167 return ptr[z * R[0] * R[1] * R[2] + y * R[0] * R[1] + x * R[0] + c];
167 } 168 }
168 169
  170 + /// Returns the world-space position at an index point (i, j, k)
  171 + vec3<F> p(size_t i, size_t j, size_t k){
  172 + vec3<F> result;
  173 + result[0] = (F)i * S[0];
  174 + result[1] = (F)j * S[1];
  175 + result[2] = (F)j * S[2];
  176 + return result;
  177 + }
  178 +
169 void read(std::string file, unsigned int X, unsigned int Y, unsigned int Z, unsigned int C = 1, unsigned int header = 0){ 179 void read(std::string file, unsigned int X, unsigned int Y, unsigned int Z, unsigned int C = 1, unsigned int header = 0){
170 read(file, stim::vec<unsigned long>(C, X, Y, Z), header); 180 read(file, stim::vec<unsigned long>(C, X, Y, Z), header);
171 } 181 }