Image with Horizontal Longitudinal View

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 Comments

How is the multiframe image stored in matlab? A 4D array (height x width x RGB x frame)?
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.
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?
yes. Its save in 4D array

Sign in to comment.

 Accepted Answer

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 Comments

1st 100 frame are not showing properly . i an sending you 1st 10 images can you please apply on this .
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.
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));
This is what i'm looking for...
cutting the image with different angles but always from center of image
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)));
I'm not able to get your point
Who are you replying to and what does I'm not able to get your point actually mean?
Sorry Brother
I'm not able to calculate the endpoints of a line segments at certain angle . can you please help me
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
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
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.
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
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

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!