MATLAB Answers

Volume Visualization for multidimensional array.

37 views (last 30 days)
Hari Tejas Iyer
Hari Tejas Iyer on 2 Dec 2015
Answered: James Ryland on 11 May 2017
I am trying to visualize 4-columns of data in volume plot.
Here the first 3 columns are the variable inputs, for my answer which is listed alongside in the 4th column.
The idea is to input the 4th column as a function of the first three columns, and plot it (4th column) as a 3d colourmap/contours.
There are two problems I am encountering with my current attempt;
-1)_ I am not able to generate the 3d image/ object, which could be sliced to observe the colormap.
-2)_ Not able to increase the size of the mesh-grid above 100, (low memory error).
following is the code that I attempted . . .
X = B(:,1);
Y = B(:,2);
Z = B(:,3);
xlin = linspace(min(X),max(X),50);
ylin = linspace(min(Y),max(Y),50);
zlin = linspace(min(Z),max(Z),50);
V = B(:,4);
[xx,yy,zz] = ndgrid(xlin,ylin,zlin);
% griddata(X,Y,Z,xx,yy,zz,V);
% vv = TriScatteredInterp(xx,yy,zz,V);
vv = griddata3(X,Y,Z,V,xx,yy,zz);
I managed to obtain in 'vv' the interpolated answers for small mesh sizes. It is a 3d array of interpolated numbers of column-4.
Could anyone please advise me on how to go about volumetric plotting, and also how to increase the mesh size.
Is it necessary to define a function V(X,Y,Z) to obtain such a plot, can it be done with random numbers in the columns?
I have been through volumetric visualization section on mathworks, but am not sure about how and which syntax to employ.
I intend to obtain a final result something like the following, which I found in ( MRI IMAGE mathworks link ).
-hari tejas


Hari Tejas Iyer
Hari Tejas Iyer on 15 Dec 2015
Hello again
This kind of gives me the slice images I wanted,
for i = 1:5:100;
hold on
but it is tedious to extract the data from a 'brushed' slice.
is there any simpler method?
Hari Tejas Iyer
Hari Tejas Iyer on 15 Dec 2015
I did try using 'contourslice', somehow doesn't render a figure for my trials, but no error was shown ..
does the input data need to be in a specific dimension, or does this command work with 3d-data generated using the commands 'ndgrid & griddata3', i.e - - ' vv' (in the question above).
because the example for contourslice in mathworks uses the * _ 'flow' command_* to generate a 3d matrix of data of dimension (25 x 50 x 25), for contourslice procedure . . which works, as in the following link
could anybody tell me where I may be going wrong

Sign in to comment.

Answers (1)

James Ryland
James Ryland on 11 May 2017
If you can reformat your data in terms of a regularly sampled 3D array you can use this application written in matlab for visualizing said array volumetrically. Though designed tow work with fmri data it can work with arbitrary 3D arrays saved as .mat files.


Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!