# Use 2D ROI slices to create 3D surface?

조회 수: 43 (최근 30일)
Alexander Moody 2022년 11월 6일
댓글: Alexander Moody 2022년 11월 15일
I have 15 MR image slices of my heart (left-ventricle) that I have contoured using drawfreehand. I would like to line them up as they would be in my body, and then create a surface model of the ventricle. I've already experimented with several ways of doing this:
I tried to plot them all as polygons with fill3, which looks good, but I want to connect these contours together:
I've also tried reorganizing the data and plotting it as lines using plot3:
It makes a 'groovy' picture, but also not what I wanted. I have also of course tried surf:
but, I keep getting this garbage. I can see why I'm getting that, but I would like help getting something that looks more like a left ventricle (kind of a cone/volcano looking shape). I tried using meshgrid, but I'm not very good at 3D plotting, so I could just be doing something wrong. I've also tried triangulation and a 3d surface fit, which both gave me a mess and connected points from opposite sides of the volume. Can anyone help me get on the right track?

댓글을 달려면 로그인하십시오.

### 채택된 답변

Suvansh Arora 2022년 11월 9일
One way to do this is the following example. However instead of using ‘imread’ with ‘me.jpg’, the data can be used.
imshow(I)
% Figure 1 is the original image
f = figure
level = graythresh(I);
BW = im2bw(I,level);
imshow(BW)
% Figure 2 is the threshold image
% Create the stacked image by stacking the binary image repeatedly
f = figure;
binaryFile = []
for i = 1:200
binaryFile(:,:,i) = BW;
end
% Sample the binary file
binaryFile = binaryFile(1:5:end, 1:5:end, 1:5:end)
% Smooth the image
binaryFile = smooth3(binaryFile);
[x,y,z] = meshgrid(1:size(binaryFile,2),1:size(binaryFile,1),1:size(binaryFile,3));
[faces,verts] = isosurface(x,y,z,binaryFile,0.5);
% Creates a surface between 1's and 0's.
p = patch('Vertices', verts, 'Faces', faces, ...
'FaceColor','interp', ...
'edgecolor', 'interp');
% Remove the color
p.FaceColor = 'none';
% Leave color on the edges
p.EdgeColor = 'red';
% Figure 3 is figure 2 stacked repeatedly
colormap jet
axis equal
view(3)
Kindly go through the following links for reference:
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Alexander Moody 2022년 11월 15일
Thank you! This is a thorough answer, and it's much appreciated.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by