MATLAB Answers


How to create slices of a 3D Volume?

Asked by Layla
on 21 Mar 2014
Latest activity Commented on by Sean de Wolski
on 26 Mar 2014

Hi everyone,

I have 14 sets of 3D points where each set represents a sub-nucleus of a region in the brain. I'd like to do two things with this data:

1. Create volumes (not surfaces!) of each sub-nuclei data set

2. Plot all 14 volumes at once, and view (orthogonal) slices at whatever X-value (for YZ, or Sagittal Images), Y-value (for XZ, or Coronal Images), or Z-value (for XY, or Axial images) I choose.

So far, I've done this by generating Delaunay Triangulations, and changing the limits of the axes. However, the resulting plots are quite messy. I dislike being able to see the lines that show the triangles. The sub-nuclei are color-coded, so I'd rather not see any connectivity lines. Is there a cleaner, smoother way of doing this?


  1 Comment

on 21 Mar 2014

I have edited the code for simplicity to demonstrate what I'm doing:

 for i = 1:14
%Generate the Delaunay Triangulation for each nucleus
Nuclei(i,1).Delaunay = delaunay(Nuclei(i).XCoordinates,  Nuclei(i).YCoordinates, Nuclei(i).ZCoordinates);
 %Specify color for each nucleus from a pre-defined Colormap cell
Nuclei(i,1).Color = Colormap{i};
 %Plot all nuclei
tri = trisurf(Nuclei(i).Delaunay, Nuclei(i).XCoordinates, Nuclei(i).YCoordinates, Nuclei(i).ZCoordinates);
    set(tri, 'FaceColor', Nuclei(i,1).Color)
 %View this plot at roughly Z = 4 for an Axial projection

I've attached a picture of what the result looks like. It's messy. I wish I could get rid of the black lines! Maybe there's a different way of generating volumes out of this XYZ-coordinate data though?


No products are associated with this question.

1 Answer

Answer by Sean de Wolski
on 21 Mar 2014
Edited by Sean de Wolski
on 21 Mar 2014
 Accepted answer

Well I can help you with the lines, set the 'edgecolor' to 'none'

[x,y] = meshgrid(1:15,1:15);
tri = delaunay(x,y);
z = peaks(15);


on 21 Mar 2014

Thanks Sean! That certainly makes the slices look nicer.

Would a Delaunay Triangulation be your choice for creating the 3D volume in the first place?

That really depends on your end goal. For just viewing it? Sure!

For more complicated analysis, I would probably first voxelize it and then work on it as a three dimensional image (at least to get started).

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!