|
a |
|
b/test_6_voxel_visualization.m |
|
|
1 |
% This scrypt illustrates the use of VoxelPlotter function to visualize |
|
|
2 |
% voxel data stored in a 3d matrix |
|
|
3 |
|
|
|
4 |
clear all |
|
|
5 |
close all |
|
|
6 |
clc |
|
|
7 |
%Generating sinthetic input |
|
|
8 |
gridesize=16; |
|
|
9 |
R=8; |
|
|
10 |
VoxelMat=zeros(gridesize,gridesize,gridesize); |
|
|
11 |
for i=1:gridesize |
|
|
12 |
for j=1:gridesize |
|
|
13 |
for k=1:gridesize |
|
|
14 |
if (i-gridesize/2)^2+(j-gridesize/2)^2+(k-gridesize/2)^2<R^2 |
|
|
15 |
VoxelMat(i,j,k)=1; |
|
|
16 |
end |
|
|
17 |
|
|
|
18 |
end |
|
|
19 |
end |
|
|
20 |
end |
|
|
21 |
[vol_handle]=VoxelPlotter(VoxelMat,1); |
|
|
22 |
%visual effects (I recommend using the FigureRotator function from MATLAB |
|
|
23 |
%Centeral |
|
|
24 |
view(3); |
|
|
25 |
daspect([1,1,1]); |
|
|
26 |
set(gca,'xlim',[0 gridesize], 'ylim',[0 gridesize], 'zlim',[0 gridesize]); |