Extending 1D window functions to 3D (or higher) (cross post of SO: https://stackoverflow.com/questions/27345861/extending-1d-function-across-3-dimensions-for-data-windowing )

For the sake of image (volume) registration, I'd like to apply a windowing function to input data, such that the non-periodic image boundaries do not cause streaking in the FFT. I'm using the example from here for 2D data:

http://mail.scipy.org/pipermail/numpy-discussion/2008-July/036112.html

h = scipy.signal.hamming(n)
ham2d = sqrt(outer(h,h))


Is this extensible to 3D or even N-D?
this question is old, but  I needed same function.

I wrote a function that receive one-dimensional window as parameter and transformed into a cube window

function [win] = window3D(w)

    L = size(w,1);
    m1 = w(:)*w(:).';
    win1 = repmat(m1, [1 1 L]);
    m2 = w(:)*ones(1,L);
    win2 = repmat(m2, [1 1 L]);
    win2 = permute(win2, [3, 2, 1]);
    win = win1.*win2;
end