4.83333

4.8 | 6 ratings Rate this file 352 downloads (last 30 days) File Size: 8.73 MB File ID: #21993

Viewer3D

by Dirk-Jan Kroon

 

04 Nov 2008 (Updated 01 Oct 2009)

Code covered by BSD License  

MIP, Color, Slice and Shaded 3D (shearwarp) Volume Rendering, interactive 3D view/measurement GUI

Download Now | Watch this File

File Information
Description

This function(s) can be used to interactively view any kind of 3D image volumes like CT and MRI, and for distance measurements or ROI selection in 2D slices.

It includes Maximum intensity projections (MIP), Volume Rendering (VR) , Slice render, and colored and Phong shaded Volume rendering.

Voxel opacity and color tables can be changed on the fly allowing also iso surface kind of renders.

The fast render algorithm which renders a 3D volume to a 2D image, is based on a Matlab coded implementation of the Shear-Warp transform, in which instead of rotating the viewer rays the slices are sheared.

There are two major Matlab files:
- viewer3d.m : The interactive GUI
- render.m : The function which renders volume data with the shear-warp transform to an 2D image.
 
Note:
This version is 100% Matlab code, but to make it faster you can run "compile_c_files.m" to use c-coded multi-threaded image warp (only windows). I also included an older version with the shearwarp algorithm in c-code / mex-code

New in this version ( 7 ) :
- Slice view, with ROI selection and distance measurements.
- Faster, with new multi-threaded warp c-code.

Please report bugs, successes and if you know some possible code speedups.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.8 (R2009a)
Zip File Content  
HTML Files Viewer3D Help
Other Files
affine_transform_2d_double.c,
affine_transform_2d_double.m,
compile_c_files.m,
default_config.mat,
help/help001.png,
help/help002.png,
help/help003.png,
help/help004.png,
help/help005.png,
help/help006.png,
help/help007.png,
help/help008.png,
help/help009.png,
icon_mouse_pan.png,
icon_mouse_rotate1.png,
icon_mouse_rotate2.png,
icon_mouse_zoom.png,
license.txt,
makeViewMatrix.m,
render.m,
TestData.mat,
TestVolume.mat,
viewer3d.fig,
viewer3d.m,
viewer3d_about.fig,
viewer3d_about.m,
viewer3d_console.fig,
viewer3d_console.m,
viewer3d_contrast.fig,
viewer3d_contrast.m,
viewer3d_dicom.m,
viewer3d_error.fig,
viewer3d_error.m,
viewer3d_histogram.fig,
viewer3d_histogram.m,
viewer3d_lightvector.fig,
viewer3d_lightvector.m,
viewer3d_qualityspeed.fig,
viewer3d_qualityspeed.m,
viewer3d_version5_with_mex_code.zip,
viewer3d_voxelsize.fig,
viewer3d_voxelsize.m,
viewer3d_workspacevars.fig,
viewer3d_workspacevars.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (14)
04 Nov 2008 Joaquim Luis

Dirk,
There is absolutely no help on how to use this. When I try to "Load view" than an endless number of errors occur.

04 Nov 2008 Joaquim Luis

OK
Sorry, I found a little help on the function's help section.

04 Nov 2008 Dirk-Jan Kroon

*Joaquim
Load View only works with Matlab files created by Save View. Some help can be found in menu -> help, and with help function.m in the console window.

05 Nov 2008 Jean-Yves Tinevez

Tested successfully on MacOSX-Tiger, MATLAB 2008b & a.

Worked absolutely fine with matrices entered from command line (e.g. viewer3d(I)).

I had plenty of errors when trying to load a .mat file (e.g. the 2 ones given in demo), and putting tyhe mouse over the window. Here is the 1st one

??? Reference to non-existent field 'histogram_positions'.

Error in ==> viewer3d>createAlphaColorTable at 154
        if (i<data.histogram_positions(1)), alpha=0; color=data.histogram_colors(1,:);

Error in ==> viewer3d>menu_load_view_Callback at 542
createAlphaColorTable();

Error in ==> gui_mainfcn at 96
        feval(varargin{:});

Error in ==> viewer3d at 50
    gui_mainfcn(gui_State, varargin{:});

Error in ==>
guidemfile>@(hObject,eventdata)viewer3d('menu_load_view_Callback',hObject,eventdata,guidata(hObject))

 

05 Nov 2008 Dirk-Jan Kroon

Tommorow (06-2008) a version with extended HTML help will be online

* Jean-Yves Tinevez
The TestVolume.mat example:
load TestVolume;
viewer3d(V);

01 Dec 2008 Cris Luengo

Very nice! But it's not very fast. I will try the old MEX-file code next, to see if that speeds it up or not. I tried it with an image 1000x500x250 pixels and found the rendering took 30 s or more.

Some suggestions:

- Don't update the display every time a node is moved in the alpha colors window. Instead, have a button "preview" to update the rendered image.

- Add checkmarks next to the menu items of the activated modes (render and config menus).

- Add an option to enter pixel spacing for non-isotropically sampled images (common in 3D imaging)

- Put the support M-files either within the main M-file or into a private/ subdirectory. That would make it easier to get started...

Great tool! Thanks!

01 Dec 2008 Dirk-Jan Kroon

*Cris Luengo
Thanks for your Feedback, I will use it in my nex file update.
(non-isotropically display, can done by viewer3d(Image, [2 1 1]) with [2 1 1] the scaling)

16 Apr 2009 Shi vera

Fantastic

15 Jul 2009 jichao zhao

it is very cool staffs. many thanks

21 Jul 2009 Wenyuan

Must it be run in the matlab 7.8 version? My matlab version is 7.0, will it be OK? I can't even run the sample: load TestVolume;viewer3d(V). Is it because of the lower matlab version?? Thanks..

22 Jul 2009 Dirk-Jan Kroon

*Wenyuan
It runs on most Matlab versions, but not on the very old ones because Matlab figure file format changed in time, and saving to an older figure-file-format doesn't work that well.

10 Sep 2009 Siyi Deng

awesome!

30 Sep 2009 Aaron Schurger

Outstanding! Sometimes has an error when I switch to a different rendering mode. Thanks for this application.

21 Oct 2009 Ted Teng

excellent work. thanks for sharing!

Please login to add a comment or rating.
Updates
05 Nov 2008

Extended the help (with pictures) and updated error check

06 Nov 2008

fixed small dimension bug in major viewing axis. And files to folders

22 Nov 2008

Now 100% Matlab code, no mex files needed. Also warp 2D interpolation bug and save/load bug fixed.

26 Feb 2009

Configuration screen, with trade off between quality, memory and speed. Implemented most suggestions by Cris Luengo. Some small bug fixes and optimizations.

03 Apr 2009

Slice rendering and measurements, multi-threaded image warp code, bugs fixed.

28 Jul 2009

Removed unnecessary code from mouse position read out. Maybe this fixed the mouse position out of sync bug, which occurred sometimes.

01 Oct 2009

Linux Ubuntu tested

Tag Activity for this File
Tag Applied By Date/Time
volume render Dirk-Jan Kroon 04 Nov 2008 13:35:43
volume rendering Dirk-Jan Kroon 04 Nov 2008 13:35:43
mip Dirk-Jan Kroon 04 Nov 2008 13:35:43
maximum intensity projections Dirk-Jan Kroon 04 Nov 2008 13:35:43
isosurface render Dirk-Jan Kroon 04 Nov 2008 13:35:43
shearwarp Dirk-Jan Kroon 04 Nov 2008 13:35:43
rays Dirk-Jan Kroon 04 Nov 2008 13:35:43
interactive Dirk-Jan Kroon 04 Nov 2008 13:35:43
phong shading Dirk-Jan Kroon 04 Nov 2008 13:35:43
viewer3d Dirk-Jan Kroon 04 Nov 2008 13:35:43
shaded Dirk-Jan Kroon 04 Nov 2008 13:35:43
3d Dirk-Jan Kroon 04 Nov 2008 13:35:43
2d Cristina McIntire 07 Nov 2008 12:42:06
3d Cristina McIntire 10 Nov 2008 10:45:35
image Cristina McIntire 10 Nov 2008 10:45:39
image processing Cristina McIntire 10 Nov 2008 10:45:45
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com