Following the MATLAB documentation for 3D visualisation, I created the following script to visualise their sample MRI data:
%3D visualisation of MRI images
%From document visualize.pdf
load mri
D = squeeze(D); %gets rid of the redundant 4th dimension which was time = 1
figure
colormap(map)
image_num = 8;
image(D(:,:,image_num)) %shows z slice 'image_num'
axis image
x = xlim;
y = ylim;
cm = brighten(jet(length(map)),-.5); %reduces brightness by 50%
figure
colormap(cm)
contourslice(D,[],[],image_num)
axis ij
xlim(x)
ylim(y)
daspect([1,1,1])
figure
colormap(cm)
contourslice(D,[],[],[1,12,19,27],8); %displays four contours 1,12,19,27 in 3D
view(3);
axis tight
%Applying isosurfaces to 3D data
figure
colormap(map)
Ds = smooth3(D); %using smoothing function to smooth data
hiso = patch(isosurface(Ds,5),...
'FaceColor',[1,.75,.65],...
'EdgeColor','none');...
isonormals(Ds,hiso) %renders the isosurface using vertex normals obtained
%from the smoothed data
%Adding Isocaps to Show Cut-Away Surface
hcap = patch(isocaps(D,5),'FaceColor','interp','EdgeColor','none');
%Defining the View
view(35,30)
axis tight
daspect([1,1,.4])
%Add lighting
lightangle(45,30);
lighting gouraud
hcap.AmbientStrength = 0.6;
hiso.SpecularColorReflectance = 0;
hiso.SpecularExponenet = 50;
%From document visualize.pdf
load mri
D = squeeze(D); %gets rid of the redundant 4th dimension which was time = 1
figure
colormap(map)
image_num = 8;
image(D(:,:,image_num)) %shows z slice 'image_num'
axis image
x = xlim;
y = ylim;
cm = brighten(jet(length(map)),-.5); %reduces brightness by 50%
figure
colormap(cm)
contourslice(D,[],[],image_num)
axis ij
xlim(x)
ylim(y)
daspect([1,1,1])
figure
colormap(cm)
contourslice(D,[],[],[1,12,19,27],8); %displays four contours 1,12,19,27 in 3D
view(3);
axis tight
%Applying isosurfaces to 3D data
figure
colormap(map)
Ds = smooth3(D); %using smoothing function to smooth data
hiso = patch(isosurface(Ds,5),...
'FaceColor',[1,.75,.65],...
'EdgeColor','none');...
isonormals(Ds,hiso) %renders the isosurface using vertex normals obtained
%from the smoothed data
%Adding Isocaps to Show Cut-Away Surface
hcap = patch(isocaps(D,5),'FaceColor','interp','EdgeColor','none');
%Defining the View
view(35,30)
axis tight
daspect([1,1,.4])
%Add lighting
lightangle(45,30);
lighting gouraud
hcap.AmbientStrength = 0.6;
hiso.SpecularColorReflectance = 0;
hiso.SpecularExponenet = 50;
This outputted the following images:
Standard MRI slice
Contour Slice
Four contour slices stacked
Isosurface
Isocaps function to show head with slice where MRI data is
Now will use this function to plot concentration matrix and diffusion tensor with isosurface of head from original scan.
- Plan/Potential issues: Will need to register diffusion scan from which we derived the original diffusion tensor and brain mask to create head isosurface. Tjis should not be too much of a problem as the box dimension will be the same.
- Future higher definition work may need a T1 scan we can register with a 64 direction diffusion scan so have a high res anatomical scan and a diffusion data set we can derive a diffusion tensor for the tumour model and also has enough data to overlay tractography.
I appreciated your work very thanks
ReplyDeleteForrender