Easy visualization of volumetric data

Brett's Pick this week is "vol3d v2", by Oliver Woodford.

Today's Pick is brought to you by Oliver Woodford, one of the most popular contributors to the File Exchange, and author of export_fig, the long-time "most-downloaded-file" award winner--itself the recipient of a coveted :) Pick of the Week banner.

When I'm demonstrating the use of MATLAB for image processing, I often show how one can use the output of the isosurface command as an input to the patch command to create easily a rotatable model of a 3D image stack.

>> whos data

Name       Size                   Bytes    Class    Attributes
data       60x256x256             3932160  uint8

white_vol = isosurface(data,2.5);
gray_vol  = isosurface(data,1.5);
figure('renderer','openGL','windowstyle','normal','color','w');
patch(white_vol,'FaceColor','b','EdgeColor','none');
patch(gray_vol,'FaceColor','y' ,'EdgeColor','none', 'FaceAlpha',0.3);


I recognize that that visualization could be improved--there are all kinds of options for controlling the rendering, the lighting, the smoothing, the coloration, etc. But the ease with which MATLAB can create such visualizations impresses me.

Oliver's "vol_3d v2" provides yet another approach to visualization that I will likely be incorporating into my "3D visualization story." With a simple interface modified from the (quite old!) code of fellow MathWorker Joe Conti, Oliver allows us to visualize data, and manipulate its display quite easily:

vol3d('cdata',data,'texture','3D');
view(45,15); daspect(1./voxel_size2); axis tight;axis off;
camlight; camlight(-90,-10); camlight(180,-10);lighting phong;
alphamap('rampup');
alphamap(0.05 .* alphamap);


Oliver writes really nice code, and has the downloads and reviews to prove it. Thanks, Oliver, for this cool submission! (And thank you, Joe, for being amenable to having your code modified and improved by others in the user community. I love to see the File Exchange utilized in this manner!)

As always, I welcome your thoughts and comments. Or leave feedback for Oliver here.

Published with MATLAB® R2013b

|