View License

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

» Watch video

Highlights from
3D Volume Visualization

4.5 | 6 ratings Rate this file 85 Downloads (last 30 days) File Size: 7.47 KB File ID: #37268 Version: 1.1
image thumbnail

3D Volume Visualization



22 Jun 2012 (Updated )

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

| Watch this File

File Information

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.


Ortho View inspired this file.

This file inspired 4 D Volume Visualization and Pcolor3.

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Other requirements Tested in Linux FC14, Matlab R2012a
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (13)
13 Jan 2017 Rachel

Rachel (view profile)

13 Oct 2016 Jonathan Boxshall

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:

Change str2num to str2double, seemed to work

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

03 Oct 2016 tala

tala (view profile)

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?

Comment only
25 Apr 2016 Andreas Benedikter

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?


Comment only
24 Mar 2016 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.

08 Aug 2015 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;

Comment only
24 Apr 2015 Don Catanzaro

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

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

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

Comment only
12 Dec 2014 Joao

Joao (view profile)

22 Aug 2014 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.

Comment only
31 Jul 2014 Richard McCulloch

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!

06 Jul 2013 Joshua Stough

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:

Good luck,

Comment only
05 Jul 2013 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

Comment only
23 Apr 2013 1.1

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

Contact us