A MATLAB user recently asked how we could make a visualization similar to this one.
I was a little surprised that we were able to do the visualization, with interactivity in less that 15 lines of code.
%%
d = flow; d = shiftdim(d,2);
x = 25;
y = 26;
z = 21.59561;
v = 3.22068;
h = slice(d,x,y,z)
d(:,:,z:end) = nan;
isosurface(d,-v)
set(h,'edgeColor','none')
axis equal
zlim([0 size(d,3)])
colormap spring
This video makes use of cell mode to get the interactivity. You can see how something like this could be done with a GUI to get the interactivity that you might want.
If you like this kind of thing, Slice-o-matic, will be good for you.
Good job Doug, I wasn’t quite sure what those +- cell modes were until I saw this video. Another thing I was expecting in this code was “hold on” somewhere, I believe either slice or isosurface has it by default?
I am doing something similar to your work, I’m building 3d human head using 377 image slices.
I have wrote this following code:
myFolder = 'C:\Users\shaffy\Desktop\Design 4\HEAD';
head = imread([myFolder, 'a_vm1001.png']); %read first one to get sizes
V = zeros(size(head,1),size(head,2),377,class(head));
V(:,:,1) = head;
for ii = 2:377 %loop through the rest
file_name = ['a_vm1' num2str(ii,'%03i') '.png'];
V(:,:,ii) = imread([myFolder file_name]);
end
But when I run this I get errors such as : ??? Assignment has more non-singleton rhs dimensions than
non-singleton
subscripts
Run this with the debugger at the line that is giving your problems, run just the left hand side and the right hand side, see what is coming out. You might have to reshape, or gather the outputs or something. Hard to tell without your data.
Doug
Leave a Reply
About
Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.
Good job Doug, I wasn’t quite sure what those +- cell modes were until I saw this video. Another thing I was expecting in this code was “hold on” somewhere, I believe either slice or isosurface has it by default?
Hey Doug,
I am doing something similar to your work, I’m building 3d human head using 377 image slices.
I have wrote this following code:
But when I run this I get errors such as : ??? Assignment has more non-singleton rhs dimensions than
non-singleton
subscripts
Can you help me?
Thanks man
Shaffy,
Run this with the debugger at the line that is giving your problems, run just the left hand side and the right hand side, see what is coming out. You might have to reshape, or gather the outputs or something. Hard to tell without your data.
Doug