Forums > Gen

How to efficiently sample a volume matrix?

January 17, 2014 | 1:36 pm

I would like to create a 3D matrix of values (jit.matrix 1 float32 32 32 32), then use a second matrix with three planes representing x,y,z coordinates as a look up (e.g., jit.matrix 3 float32 1000). The output would be a 1 x 1000 matrix (in the above case) with values corresponding to the value in the volume at that coordinate.
Unless I’m missing something, sample and nearest do not seem to do what I was thinking.
Any thoughts?


January 18, 2014 | 5:32 am

just to be clear, you’re looking to save 1000 values at each location in the 32^3 cube?


January 18, 2014 | 6:52 am

Thanks for the question. No, I am merely looking to use the 1000 points as probe points to find specific values in the 32^3 volume. I can iterate through the 1000 points and create 1000 getcell messages with those points and pack the results into a separate 1000 x 1 matrix with the values I want — but I am looking for an efficient way to do that rather than iterating, unpacking, creating message,and repacking the results.


January 30, 2014 | 5:39 pm

Hi,
Currently jit.gen’s input matrices all have to be the same format. This means same type, planecount, and dimensionality. This will likely be relaxed in the future, but for now, it’s not possible. You can sample an ND matrix, but any data you use to sample the matrix will also have to be packed in an ND matrix.


January 31, 2014 | 7:08 am

OK. Thanks for clarifying. I’ll look forward to trying this again in that more "relaxed" future.


Viewing 5 posts - 1 through 5 (of 5 total)