File Exchange

image thumbnail

3D Volume Visualization

version 1.1 (7.47 KB) by

3D volume viz with interactive slice selection, colored ortho-planes, windowing, colormap selection.

4.14286
7 Ratings

68 Downloads

Updated

View License

This tool provides an interactive 3D volume visualization. The function accepts as arguments any 3D matrix (of type double or uint8) and optional colormap, and displays a 2x2 figure of the 3 orthogonal planar views (neurological coordinate system) along with the built-in 'slice' visualization. Further, as you select slices through click and drag or scroll, the 3D view and color-coded orthogonal planes are updated accordingly. You may rotate the 3D view by manually selecting the 'Rotate 3D' figure button, and the 3D perspective (CameraPosition) is maintained as you continue changing slices.

This tool is more sparse than other volume visualizations out there, but it serves its purpose, and may offer an advantage with the added windowing and colormap selection capability.

Comments and Ratings (15)

Jonas Reber

Jonas Reber (view profile)

Reading your code's comments just made my day... love it! :D

Rachel

Rachel (view profile)

Hi Joshua,

Thanks very much for producing this tool, it's been very useful in allowing me to visualise radar data. To get around the couple of errors encountered, here's what I came up with:

Line(272)?
Change str2num to str2double, seemed to work

Line(355)?
Replaced whichView = find(cell2mat(handles) == gca);
with a for loop that seems to do the trick:
for ii=1:4
if handles{ii}==gca
whichView=ii;
end
end
I hope this helps anyone that was struggling with errrors like I was.

tala

tala (view profile)

hi
thanks for the work
im a beginner i matlab. i have 368, 512*512 ct images and i make a [512 512 368] .mat file.
how can i use this function?

Hi Joshua,
thanks for the work.

But I still get an error concerning the cell2mat.

"Error using cell2mat (line 52)
CELL2MAT does not support cell arrays containing cell arrays or objects.

Error in vis3d/buttonDownCallback (line 355)
whichView = find(cell2mat(handles) == gca);"

Do you have any advice how I can solve this Problem?

Thanks!

Jab

Jab (view profile)

Excellent Work!

Hi Joshua,
I am using your code to visualize a large 3D matrix and it's working perfectly. However, in my project, I have to generate multiple 3D figures (more than 100) at a time and for this reason, I want to stop the figures which are being pop-up every iteration. Can you please tell me, how do I enable this feature? I have used "set(gcf,'Visible', 'off'): in my code. But it is not working.

Another question is, how do I save the figures in a directory in jpeg or other formats through Matlab script? I have used "saveas(a1,'myfig.jpg')" command, but it's also not working.

David

David (view profile)

Yes there are some problems in the recent version of Matlab. Specifically with handling cells

Here is a way to make it work. Patches for the errors that Matlab encounters:

for i=1:length(myx) myx_aux=myx{i}; end
set(gca, 'XTickLabel', flippedx(str2num(myx_aux)));

for i =1:max(size(handles))
if(handles{i}==gca) whichView =i;
end
end

Don Catanzaro

When opening an 512x512x190 uint16 I get the following error:

vis3d(double(CT))
Error using str2num (line 32)
Requires string or character array input.

Error in vis3d (line 272)
set(gca, 'XTickLabel', flippedx(str2num(myx)));

Joao

Joao (view profile)

Abeera Tariq

Can someone help me that how to use this function if i have MxLxN matrix
where N is number of slices and MxL are 2D image slices.

I used this tool for visualizing a 3D matrix of radiation particles. It worked pretty well. My results were more meaningful using colormap(jet), but that is an easy adjustment. (Just enter 'colormap(jet)' in the command window after opening the gui). Thank you, Joshua!

Joshua Stough

Joshua Stough (view profile)

Response to Gustavo: My code doesn't care how you got the image. If it, say 'I', exists in matlab as a 3d array of any class (use size and class functions to determine this), then just try 'vis3d(double(I));' instead of whatever you were doing.

For loading nifti images, exchange #8797 seems popular: http://www.mathworks.com/matlabcentral/fileexchange/8797-tools-for-nifti-and-analyze-image

Good luck,
stough

Gustavo

Hi. I have started working with you toolboxes but i can't get any results. I have NIFTI images to work with. How can i adapt them to your toolbox?

Thanks in advance

Updates

1.1

-windowing capability
-changing colormap through popupmenu
-fixed slice number and 3d view misrepresentations
-neurological coordinate perspective

MATLAB Release
MATLAB 7.14 (R2012a)
Acknowledgements

Inspired by: OrthoView

Inspired: pcolor3, 4D Volume Visualization

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today