# how to view 4D-single Image

31 views (last 30 days)
mohd akmal masud on 6 Jul 2022
Commented: Walter Roberson on 7 Jul 2022
Dear All,
I have 4D-Single types of images.
How to view it?
my images can get as link below
Walter Roberson on 7 Jul 2022
When you represent data, you can encode:
• one dimension horizontally (x)
• one dimension vertically (y)
• one dimension up/down (z); in 2D plots, this can be approximated by using perspective
• one dimension by color, such as a temperature map overlayed on an object; when using perspective instead of true 3D, then color and perspective can interfere (we use color for depth cues)
Additional potential ways to encode dimensions include:
• marker size -- negatives not permitted
• marker shape -- this one is not continuous and so is difficult for humans to understand
• marker color (interfers with encoding by surface color)
• transparency -- this one is difficult for humans to understand
To represent four independent dimensions and one dependent dimension, you need five of the above.
In my experience, x, y, z (through perspective), marker color with transparency, and marker size is about the only combination that has a hope of being understood.
N = 20;
xv = linspace(0,2*pi,N);
yv = linspace(-1,1,N);
zv = linspace(0,2,N);
wv = linspace(-pi, pi, N);
[X, Y, Z, W] = ndgrid(xv, yv, zv, wv);
P = sin(3*X + Y) + Y.^3 + exp(-Z.^2) + cos(W);
markersize = 5*(W(:) - min(W(:)) + 5);
markercolor = P(:);
scatter3(X(:), Y(:), Z(:), markersize, markercolor, 'filled', 'MarkerFaceAlpha', 0.3);
c = colorbar(); c.Label.String = 'P';
I don't think the markersize representation can be said to work out there.
... And, besides, with there being a grid of X Y Z W, there are multiple W values for each particular (X, Y, Z) triple, so you are trying to distinguish a dimension of values according to the size of different markers that are all overlayed at the same X Y Z position. I think that is unlikely to be understandable at the best of times. Perhaps if you happened to be working with a scattered points rather than a regular grid... but you are not, you are working with a grid.
You can play with exactly which dimension is encoded which way, but you end up with the fundamental problem of having multiple points (corresponding to the W dimension) at the same (X, Y, Z).
Unless you can somehow figure out a way to encode the W dimension as a sort of second perspective, you have fundamental problems making something comprehendable.
Walter Roberson on 7 Jul 2022
A common work-around for these issues is to represent one of the dimensions as time -- that is, to create an animation.

Edited: Walter Roberson on 7 Jul 2022
Hello
It depends very much what you want and where you data comes from. A 4D data set may be a 3D + time data set and thus you could display partially your data by selecting just some 2Ds, for example
imagesc(yourdata(:,:,1,1))
and change the dimensions to see other slices. Now, that is limited and will not allow you to analyse volumes or other interesting things. I have written a book about Matlab for image processing and in the last chapter there is a section about 3D graphics. Have a look:
PS you may need access from your institution to view the chapters.

### Categories

Find more on Images in Help Center and File Exchange

R2022a

### Community Treasure Hunt

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

Start Hunting!