MATLAB Answers

making a 2d image from 3d shape

조회 수: 35(최근 30일)
Nnebunne Melisa
Nnebunne Melisa 18 Apr 2021 19:50
댓글: Nnebunne Melisa 23 Apr 2021 1:24
Hello. I have a shape that I would like to cut out a slice of. I also have coordinates from an XY plane at a particular Z value that I'd like to use. So because I'm expecting 2 circles, I calculate their radii and see if my XY plane coordinates match up. However, I'm not getting any good there a better way to do this
This is my shape
This is the way the slice is supposed to look (but upside down)
This is what I'm getting. So my result is suposed to be a 64 by 64 double image. The reason my shape is to the left is because my coordinates also contain negative values. My shape is in the positive side.
This is what my code looks like to make the slice. X_pixels, Y_pixels etc are the coordinates I'm checking.
  댓글 수: 6
Nnebunne Melisa
Nnebunne Melisa 19 Apr 2021 12:36
oh I'm sorry

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

채택된 답변

Matt J
Matt J 18 Apr 2021 23:50
편집: Matt J 18 Apr 2021 23:54
It seems like it would be better if you would just generate your spheres direclty as a 3D image volume. Then you could just use the slice() commnd to get get the slice images that you want.
[X,Y,Z]=ndgrid( xl,yl,zl);
Spheres=((X+1.1).^2+Y.^2+Z.^2)<=2^2 | (X-1.1).^2 + Y.^2 +Z.^2<=2^2;
  댓글 수: 10
Nnebunne Melisa
Nnebunne Melisa 23 Apr 2021 1:24
Thank you!

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by