Help Getting Images into Montage from a Cell Array
4 views (last 30 days)
Show older comments
I have a loop that pulls 2D images out of a 3D matrix and puts them in a cell vector. I then want to take those images and use the 'montage' function so that I can put them all together. So far it works up until I get to montage. I can get the images into the cell array, but I am having a very difficult time figuring out how to get them out of the cell array in a way that I can put them into montage without selecting each and every one. There are 40 of them so that is not something I want to do. Here is my code so far:
data_group1_mouse116 = load('Mouse116CT.mat');
Matrix = permute(data_group1_mouse116.preImg,[2,3,1]);
Size_Matrix = size(Matrix); height = Size_Matrix(3); cell_info = floor(height./40);
n = 1; s = 1; x = 1;
while s <= 40
%rotating data with transpose and imaging slices pre_slice{s} = transpose(Matrix(:,:,n));
s = s + 1; n = n + cell_info;
end
while x <= 1;
pre_slice{x};
x = x + 1;
end
Image = montage(('trial.m'));
%cell2mat(pre_slice)
%setting image parameters colormap(gray) colorbar caxis([0,2.5*10^4]) axis equal tight
0 Comments
Answers (1)
Image Analyst
on 9 Apr 2015
You need to pass montage() a 3D or 4D array of images, not a string.
Also, don't use Image as the name of a variable since image is the name of a built-in function.
4 Comments
See Also
Categories
Find more on Orange in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!