フィルターのクリア

Longitudinal Cut View at Certain Angle

3 ビュー (過去 30 日間)
Arsalan Akbar
Arsalan Akbar 2018 年 5 月 3 日
回答済み: Jun Tan 2018 年 5 月 13 日
Hi
I'm a beginner in Image processing . I have a Multi frame Image with consist of 271 frames . i want to cut this image at certain angle (like 45 deg) to get its longitudinal view . I have the upper part of the image and want to get lower view . But i'm not able to get this . here i have attached the code . can anyone please help me in this
for frame=1:271
[mri(:,:,:,frame),map] = imread('image.tif',frame);
end
for slice = 1: 271
angle = 45;
xcentre = floor(size(Image, 2) / 2);
ycentre = floor(size(Image, 1) / 2);
xtop = xcentre + ycentre / tan(angle);
yright = ycentre - (size(Image, 2) - xcentre) * tan(angle);
xbottom = xcentre - (size(Image, 1) - ycentre) / tan(angle);
yleft = ycentre + xcentre * tan(angle);
if xtop < 0 || xtop > size(Image, 2)
x = [1, size(Image, 2)];
y = [yright, yleft];
else
x = [xbottom, xtop];
y = [size(Image, 1), 1];
end
% x = [1, size( mri(:,:,:,slice), 2)];
% y = [1, size( mri(:,:,:,slice), 1)];
[linex, liney, ~] = improfile(mri(:, :,:, slice), x, y);
sliceimage = mri(sub2ind(size(mri), ...
repmat(round(liney), 1, size(mri, 3)), ...
repmat(round(linex), 1, size(mri, 3)), ...
repmat(1:size(mri, 3), numel(linex), 1)));
if slice == 1
image3D = sliceimage;
else
image3D = cat(2, image3D, sliceimage);
end
end
image(image3D);
colormap(gray(256))

回答 (2 件)

Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018 年 5 月 3 日
Check below link.
https://in.mathworks.com/matlabcentral/answers/210394-how-to-divide-an-image-diagonally-into-two-part
  1 件のコメント
Arsalan Akbar
Arsalan Akbar 2018 年 5 月 3 日
this is not what i'm looking for...
as it cut the image in upper and lower triangle but i want to cut the image with some angle

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


Jun Tan
Jun Tan 2018 年 5 月 13 日
You can use "imrotate" on each slice then obtain the longitudinal cut view along the central axis without worrying about interpolation.

カテゴリ

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