Hi. I'm new in image processing. I have a multi frame image which consist of 271 frames . and i want to cut each slice to get longitudinal view as shown in attached figure. I have the upper portion of image . and want to get lower view . any one please help me

댓글 수: 4

Guillaume
Guillaume 2018년 4월 26일
How is the multiframe image stored in matlab? A 4D array (height x width x RGB x frame)?
Arsalan Akbar
Arsalan Akbar 2018년 4월 26일
편집: Arsalan Akbar 2018년 4월 26일
i have discussed this with some friends . they said that make 3D dataset (x, y, z). Here z is no of frames.
Cross-sectional image consists of (x, y) data set with z is from 1 to 271 (assuming we have 271 frames)
Longitudinal cut image consists of (y, z) data set with x is from 1 to 360 degrees.
Walter Roberson
Walter Roberson 2018년 4월 26일
Please recheck the bounds and sizes. 0 to 271 is 272 different values. 0 to 360 is 361 different values.
When the slicing is done, is the location to be specified as an index, or is it to be specified by value that might not happen to correspond exactly to an index? If it is by value that might be between the locations of two stored locations, then should the nearest location be taken or should linear interpolation be used to blend the adjacent locations?
Arsalan Akbar
Arsalan Akbar 2018년 4월 26일
yes. Its save in 4D array

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

 채택된 답변

Guillaume
Guillaume 2018년 4월 26일

0 개 추천

If I understood correctly. The multiframe image is greyscale or indexed, since each image is 2D, and the frame are the pages of a 3D matrix. From that you want a slice of each frame, a single column of each image, concatenated together horizontally as a single image. If so:
sliceimage = permute(yourmultiframeimage(:, slicecolumn, :), [1 3 2]);

댓글 수: 18

Arsalan Akbar
Arsalan Akbar 2018년 4월 26일
1st 100 frame are not showing properly . i an sending you 1st 10 images can you please apply on this .
Arsalan Akbar
Arsalan Akbar 2018년 4월 26일
the images are attached
Arsalan Akbar
Arsalan Akbar 2018년 4월 26일
please check this brother
%going in reverse order effectively takes care of pre-allocation
for K = 271:-1:1;
yourmultiframeimage(:,:,:,K) = imread(sprintf('%d.tif',K));
end
slicecolumn = 173;
sliceimage = permute(yourmultiframeimage(:, slicecolumn, :), [1 3 2]);
image(sliceimage);
colormap(gray(256));
Looks okay to me on the 10-image subset you provided.
Arsalan Akbar
Arsalan Akbar 2018년 4월 27일
how i can cut the image longitudinal by changing its x-axis from 0 to 180 degree to get different view of circular shape?
slicerow = 57;
sliceimage_x = permute(yourmultiframeimage(slicerow, :, :), [2 3 1]);
image(sliceimage_x);
colormap(gray(256));
Arsalan Akbar
Arsalan Akbar 2018년 4월 28일
This is what i'm looking for...
cutting the image with different angles but always from center of image
Walter Roberson
Walter Roberson 2018년 4월 28일
Use interp3() with y = m*(x-xc)+yc and m = tand(angle) (but watch out for vertical) . You might want to have a look at the improfile() source code to see how it calculates which intermediate points to sample at.
I assume you're capable of calculating the coordinates of the end points of the line segment going through the image at whichever angle you want. E.g, for 45° (for a square image),
x = [1, size(yourmultiframeimage, 2)];
y = [1, size(yourmultiframeimage, 1)];
Then the simplest thing is to ask improfile for the coordinates of the pixels in between, then use that to extract the pixels of each frame:
[linex, liney, ~] = improfile(yourmultiframeimage(:, :, 1), x, y);
sliceimage = yourmultiframeimage(sub2ind(size(yourmultiframeimage), ...
repmat(round(liney), 1, size(yourmultiframeimage, 3)), ...
repmat(round(linex), 1, size(yourmultiframeimage, 3)), ...
repmat(1:size(yourmultiframeimage, 3), numel(linex), 1)));
Arsalan Akbar
Arsalan Akbar 2018년 4월 30일
I'm not able to get your point
Guillaume
Guillaume 2018년 4월 30일
Who are you replying to and what does I'm not able to get your point actually mean?
Arsalan Akbar
Arsalan Akbar 2018년 4월 30일
Sorry Brother
I'm not able to calculate the endpoints of a line segments at certain angle . can you please help me
Arsalan Akbar
Arsalan Akbar 2018년 5월 1일
Guillaume
can you please help me to cut image on different angles
I'm not able to calculate the endpoints of a line segments at certain angle
Seriously? It's elementary math. Do put in some effort
%angle: angle in degree, clockwise from vertical
xcentre = floor(size(yourimage, 2) / 2);
ycentre = floor(size(yourimage, 1) / 2);
xtop = xcentre + ycentre / tan(angle);
yright = ycentre - (size(yourimage, 2) - xcentre) * tan(angle);
xbottom = xcentre - (size(yourimage, 1) - ycentre) / tan(angle);
yleft = ycentre + xcentre * tan(angle);
if xtop < 0 | xtop > size(yourimage, 2)
x = [1, size(yourimage, 2)];
y = [yright, yleft];
else
x = [xbottom, xtop];
y = [size(yourimage, 1), 1];
end
Arsalan Akbar
Arsalan Akbar 2018년 5월 3일
Brother when i cut the image with some angle it not give me the correct result. i have attached the images can you please check this . the 1st one is the result which i want but i 'm getting the second one . can you please have i look where i am doing error.
i have attached the code also
please your help needed
Guillaume
Guillaume 2018년 5월 3일
In the very first line of my answer, I wrote: "If I understood correctly, the multiframe image is greyscale or indexed". (i.e. each frame is 2D and the multiframe image is 3D). All my answers were written with that assumption.
From your code, it looks like each frame is RGB (3D), which means the answer you accepted wouldn't have worked unless you converted the frame to greyscale. If so, do the same for the other angles.
Arsalan Akbar
Arsalan Akbar 2018년 5월 3일
its a gray scale image and i have change the code to 3d but again the output is wrong . here i have attached the output image
Arsalan Akbar
Arsalan Akbar 2018년 5월 3일
I have a gray scale image .which consist of 271 frames . i created a 3D array and store all the frame in that array . after it i take one frame cut it with some angle and get its longitudinal view . store it and goes to next frame. i dont know this approach is good or not

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

추가 답변 (0개)

질문:

2018년 4월 26일

댓글:

2018년 5월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by