MATLAB Answers

0

I need to create a 2d image from the data given for 3d image

Asked by Mandar Malve on 21 Sep 2015
Latest activity Answered by Walter Roberson
on 21 Sep 2015
I have a data file (.txt file) which contains 3D image data which if we read in Matlab comes out to be 1x16777216 (i.e. 1x 256*256*256). Currently I am reading the whole data as a 256*65536 image and it comes out to be an image in the XZ directon (as given in one of my research paper). But now I need to plot an image in the XY direction using the same data. I have tried changing the axis data but still I am getting the same image in the XZ direction, can any body give me some insight in order to get the image in XY direction.

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 21 Sep 2015

reshape() the data to 256,256,256 . You might then have to permute() the data to get the order right, depending on the order the inputs were in. MATLAB stores data down columns first. Keep in mind that MATLAB normally uses row as the Y coordinate, column as the X coordinate, and the third dimensional as Z.
Once you have the data in the cube arrangement you want, you can permute and reshape to form 256 * 65536 arrays, or you can extract slices corresponding to constant X, Y, or Z, or you can use slice() to get some stranger extracted data.

  0 Comments

Sign in to comment.