MATLAB Answers

Storing multiple images in one 4D Array

26 views (last 30 days)
Hello Matlab Users,
I have multiple ultrasound images in a 3D plot. They are all at different angles and irregularly scattered. For computational reasons I constructed a simple surface and used the CData command to place the image inside the surface rather than computing the image pixel per pixel at the right position in 3D.
[I] = imread('picture.png'])
h=surf(xPicture,yPicture,zPicture); %Position of the ultrasound image in 3D
set(h,'CData',I,'FaceColor','texturemap');
set(h,'EdgeColor','none');
Now I want to store all the surfaces in a single 4D Array. But I don't get how I can access the gray scale values of each picture in cartesian coordinates and write them in an array without using countless for-loops.
Your help would be greatly appreciated.
Kevin

  0 Comments

Sign in to comment.

Accepted Answer

Bruno Pop-Stefanov
Bruno Pop-Stefanov on 10 Oct 2014
I am not sure I understand what you would like to achieve exactly, but here are a few suggestions:
If you have p images, each of size n-by-m, why not simply store them in an (n x m x p) matrix?
What do you mean by 4-D array? What does each dimension correspond to? If you want to store, for each pixel, the 3-D position and the intensity at that position, you could have a simple N-by-4 matrix (2-D): the three first columns are for the x, y and z positions and the fourth column is the intensity value.
You won't be able to get the intensity at an xyz position from the 3-D plot directly. To link intensity values with xyz positions, you would have to find the transformation from pixel locations in the image space to the 3-D coordinates, as defined by xPicture, yPicture, and zPicture.
If you have some data we can play with, that would be easier to help you.

  2 Comments

Kevin
Kevin on 15 Oct 2014
Thank you Bruno Pop-Stefanov for your suggestions. I got the 4D array idea from the matlab MRI example, where the 4 dimension were for x,y,z and the intesity value.
Shivang Patel
Shivang Patel on 13 Feb 2015
I have Question for you Mr. Bruno Pop-Stefanov...
Suppose, If i have 72 color(RGB) images with 3 dimension([row column depth]) , Then how to store in array? and how to access for feature use... I don't want to use cell...
Actually, whenever I was tried this thing, error msg was "dimension mismatch..."
Thanks in advanced...

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Products