How do i save a .tif stack of grayscale or RGB images into a 4d-array like in the "mri example" of MATLAB?

1 view (last 30 days)
Hi, i want to save a stack of grayscale or RGB images, already converted to one .tif file, into a 4D-array, where the fourth value is the number of the slice, just like in the MATLAB example "mri", to do some analysis, e.g displaying 3-D Contour Slices.
I think in the example they used indexed images, so i already did this:
I = imread('D:\Images\Test\1.tif');
[D, map] = gray2ind(I,255);
imshow(D, map);
Can anybody please help? Thanks in advance.

Accepted Answer

Image Analyst
Image Analyst on 16 Oct 2016
Use cat(4,)
rgb4D = cat(4, rgbImage1, rgbImage2);
  6 Comments
Anand P
Anand P on 10 Jun 2019
How did you view your resultant volulme? Were you able to view the volume using the same colors as that of the individual images ?

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!