Multidimensional array (76x93x76), displaying as [x y z]

3 views (last 30 days)
Hi all, I'm a beginner in matlab and i'd like some help with this problem. I have a 3D data file(.nii), loads into a messy looking array with many columns and rows, and >> [m n o] = size(Array) gives a 76x93x76 data array.
How can I display this as a [DimensionX DimensionY DimensionZ] array? I need it for simple matrice calculations. Also, how do i turn it back into that [76x93x76] again for saving?
Thanks!
--Robertte
  5 Comments
Robert Te
Robert Te on 7 Mar 2015
Yes you got it! Apologies for the awkward phrasing. I have the 3D array stored in a 76x93x76 array, and i need to find a way to extract each dimension(x,y,z) and make it into an [x y z] array.
The "x,y,z co-ordinates" make up the 3D array i am talking about. Hope this clarifies!
Stephen23
Stephen23 on 8 Mar 2015
The problem is you have not described how the X, Y and Z dimensions can be extracted from this array. If this is a a simple numeric data array (which you don't say), then the coordinates of the data locations are completely unknown. Lets have a look at a simple 2D example:
data = [1,2,3;4,5,6]; % 2x3
If we only have this data matrix, then _we know nothing about its X and Y coordinates of these data points, ie where the data was sampled. It is possible to define them separately:
X = [-40,20,80]; % 3
Y = [0.3,0.6]; % 2
You can see that the data matrix itself does not imply anything about the values of these coordinates. Until you actually tell us how to "extract" the coordinates from your 3D array there is not much more that we can do for you.

Sign in to comment.

Answers (1)

Jan
Jan on 7 Mar 2015
Did you ask your favorite internet search engine already? Perhaps others have solved the problem already, e.g. FEX: nifti-data-viewer or FEX: tools for nifti images.

Community Treasure Hunt

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

Start Hunting!