0

I am trying to re-grid non-uniform data onto a uniform grid defined in a 4-D space. The data measurement is given by a function d = f(xp,yp,zp,wp), where xp, yp, zp, and wp are the 4-D coordinates. I would like to re-grid the non-uniformaly spaced xp, yp, zp, and wp onto a uniformly spaced grid of x, y , z, and w.

For ease of conversation, let's define the gridding kernel to be the product of separable Hanning kernels:

1/a(1+cos(2*pi*x/a))
1/b(1+cos(2*pi*y/b))
1/c(1+cos(2*pi*z/c))
1/d(1+cos(2*pi*w/d))

Then, I believe to re-grid what I need to do is perform a 4-D convolution and resample onto the uniform grid. However, I'm not sure how to implement this using discrete data. My questions are as follows:

1) How should I sample each of the gridding kernels? For example, should I use the non-uniform xp, yp, zp, and wp values when calculating my discrete convolution values? Or should I use the uniformly spaced values, x, y, z, and w? Or are neither of those ideas correct?

2) How can I then implement the 4-D convolutions? I think I may need to use four for loops but am not exactly sure how to organize my data, i.e., a 4-D data structure or simply a matrix with 4 columns?

I'm not interested in the fastest approach but more so in finding the most intuitive or straight forward approach.

I believe I understand the basics of sinc interpolation and gridding algorithms. I have read multiple papers including such classics by J.D. O'Sullivan and J.I. Jackson, discussing the properties and differences in different gridding kernels. I've also read some papers from MRI reconstruction that use gridding but most of these methods assume a 2-D grid.

I am at a loss of how to actually implement the method, preferably in Matlab, or else C++, in a discrete manner and even more confused how to implement such a thing in four dimensions.

I've looked at several threads and my problem is somewhat similar to these, however I want to use convolution with a general kernel, not linear interpolation, and neither of these really suggest how to organize the 4-D data or perform the convolution:

Python 4D linear interpolation on a rectangular grid

Python 4D linear interpolation on a rectangular grid

Thanks for any advice, insight, or suggestions!

Community
  • 1
  • 1
  • @horchler: Are you still looking for an answer to this question? – KDN Nov 21 '13 at 01:23
  • @KDN: It's not my question. I just edited it to clean up the formatting and typography. You're always welcome to post a new answer on StackOverflow, no matter how long after the fact. Whether or not the OP will see it and recognize it as useful is another matter, but years in the future others may. – horchler Nov 21 '13 at 16:25

1 Answers1

0

Can you use the interpn function?

[X Y Z W]=ndgrid(x,y,z,w); % unequally spaced
[XR YR ZR WR]=ndgrid(x_regular,y_regular,z_regular,w_regular); % equally spaced
volume=interpn(X,Y,Z,W,d,XR,YR,ZR,WR);

The documentation for interpn and ndgrid give more details; their usage would give you a framework for how to construct d.

EDIT: Oh sorry sorry, I saw your comment about not wanting to use interpolation after posting this.

Well, you could use interpolation as above to position your values onto the grid linearly, and then use

volume=convn(volume,general_kernel);

To convolve the values with your kernel?

Hugh Nolan
  • 2,508
  • 13
  • 15
  • Thank you Hugh, that is a good idea and gives me something to pursue. I've considered the top part of your comment but didn't think to add the convn. I am going to spend some time thinking about and implementing this and will write back with what I find. – Michael Edward Jul 16 '13 at 22:07