Kate
Posts:
83
Registered:
8/28/10
|
|
gaussian convolution of XYZ data (code provided)
Posted:
Jan 9, 2013 10:59 PM
|
|
Good day everyone,
I have a dataset of XYZ points. I then convert the dataset to a voxelized model. Here is the data of the XYZ points and the code showing the relating voxels for this data (NOTE: I use a function called "VOXEL_IMAGE" you an download at: http://www.mathworks.com/matlabcentral/fileexchange/30374-voxel-image
%-------------begin---------------------------
data=[0 0.33333 0.5 0.18182 0.44444 0.625 0 0.66667 0 0 0.22222 0.125 0.27273 0.66667 0.25 0.36364 0.44444 0.4375 0.27273 0 0.625 0.54545 0.55556 0.75 0.54545 0.22222 0.875 1 1 1]
% for i=1:size(data,1) % varargout = voxel(data(i,:)); % end color = 'y'; alpha = 1; edgec = 'k';
vs = 0.05; voxel_image(data, vs, color, alpha, edgec);
%---------------------end---------------------------------
Now, I want to apply a 3D Gaussian Filter to convolute with this 3D voxel data. The voxelized model is represented as:
M(x,y,z)
So I want to convolute as follows using the 3d gaussian, G(x,y,z,sigma ):
M(x,y,z)*G(x,y,z,sigma) ;% where * represents the convolution
So, I created my own 3D Gaussian function. Here is the 3DGaussian filter:
%---------------------------- function f=gaussian3d(sigma) % N is grid size set as 7, sigma speaks for itself
N =7;
[x y z]=meshgrid(round(-N/2):round(N/2), round(-N/2):round(N/2), round(-N/2):round(N/2));
f=(1/(sqrt(2*pi)*sigma)^3)*exp(-x.^2/(2*sigma^2)-y.^2/(2*sigma^2)-z.^2/(2*sigma^2)); %----------------------------
I have no issues with the function or anything, my problem is that my gaussian3d filter is essentially a 3D array, whereas my Data is just a single XYZ matrix, and I do not know how to go about doing the 3d convolution. This is what I have so far.
Any help would be appreciated.
cheers.
|
|