Extract 2D slice parallel to an arbitrary plane in 3D image.

7 ビュー (過去 30 日間)
M W
M W 2020 年 1 月 21 日
コメント済み: M W 2020 年 1 月 23 日
Hi,
I have a 3D medical image (IM) containing grayvalues. (size: 352 229 277, data type double).
I want slice through the 3D image, parallel to a plane.
The plane is defined by a line.
The line is defined by selecting 2 points in 2D view of the 3D image. (This 2D view is obtained by IM(:,123,:) )
Points:
A=[104,123,111];
B=[253,123,153];
The plane is defined with a normal vector orthogonal to this line.
I want to slice the 3D image with a slice parallel to this plane.
Then I want to view these slices in 2D setting. Like the function sliceViewer. (sliceViewer doesn't support arbitrary angle slices).
I tried to use the slice function, following this example: https://www.mathworks.com/help/releases/R2016b/matlab/ref/slice.html#f33-509125.
Tbh I don't understand much:
Firstly I don't understand how to define a surface with this:
I seems that I can't give a value to the meshgrid indices from my image: slice(x,y,z,V,XI,YI,ZI)
Secondly:
I have 3 points to define the plane.
I have the normal vector.
But I don't know how to use it with the slice function: slice(x,y,z,V,XI,YI,ZI)
Thanks in advance!
%% load
I=Tiff('im','r');
im=read(I);
im=uint8(squeeze(im));
imf=imgaussfilt3(im,0.5);
imf=im2double(imf);
%% isometric
sz_im=size(imf);
average=(sum(sz_im))./3;
imc=imresize3(imf,[average,average,average]);
%% plane equation
% points on slice y=123. Line runs through A and B. http://www2.math.umd.edu/~jmr/241/lines_planes.html
A=[104,123,111];
B=[253,123,153];
%third point for determining the plane
C=[104,124,111];
%normal is cross product
normal = cross(A-B,A-C);
%% meshgrid
[row,col,z] = meshgrid(0:1:average,0:1:average,0:1:average);
v = imc(row,col,z); %ERROR: dimensions
row_slice= %WHAT should I enter here?
col_slice= %WHAT should I enter here?
z_slice= %WHAT should I enter here?
slice(row,col,z,V,row_slice,col_slice,z_slice)

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 1 月 22 日
I want to slice the 3D image with a slice parallel to this plane.
Let suppose image3d is 3D image, which you want to slices
Slice 1
image3d_1= image3d(:,:,1);
Slice 2
image3d_2= image3d(:,:,2);
so on... or you can store the all slices in cell array
  5 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 1 月 23 日
Have you seen this example in MATLAB documentation?
[X,Y,Z] = meshgrid(-2:.2:2);
V = X.*exp(-X.^2-Y.^2-Z.^2);
xslice = [-1.2,0.8,2];
yslice =0;
zslice = 0;
slice(X,Y,Z,V,xslice,yslice,zslice);
Here xslice,yslice,zslice represents the position of slices with respect to x,y,z axis
xslice = [-1.2,0.8,2] represents the position of slices in the x axis, where yslice =0 (Parellel to y axis) & zslice = 0(Parellel to z axis)
678.png
M W
M W 2020 年 1 月 23 日
Yes I did!
But I don't understand how to define an plane that is not parallel to one of the axis, by matrices.
For example a plane that runs through these points:
A=[104,123,111];
B=[253,123,153];
%third point for determining the plane
C=[104,124,111];

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by