How to efficiently sample a volume matrix?

Jan 17, 2014 at 1:36pm

How to efficiently sample a volume matrix?

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?

#278489
Jan 18, 2014 at 5:32am

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

#278536
Jan 18, 2014 at 6:52am

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.

#278538
Jan 30, 2014 at 5:39pm

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.

#279620
Jan 31, 2014 at 7:08am

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

#279676

You must be logged in to reply to this topic.