フィルターのクリア

how can save some 3d images in a 4d array?

3 ビュー (過去 30 日間)
sara
sara 2014 年 10 月 8 日
コメント済み: sara 2014 年 10 月 8 日
how can save some 3d images in a 4d array? I use this code:
if true
folder = 'C:\Users\sara\Desktop\inodastnazan\azmayeshi';
files = dir([folder '\*.tiff']);
array4d = zeros(512, 512,3, numel(files));
for slice = 1:numel(files)
filename = [folder files(slice).name];
array4d(:,:,:,slice) = strcat(filename) ;
end end
but I have this error
if true
Subscripted assignment dimension mismatch.
end
.... thanks

採用された回答

Image Analyst
Image Analyst 2014 年 10 月 8 日
You're not even reading in the images. You're just concatenating filename strings. Try inserting images.
folder = 'C:\Users\sara\Desktop\inodastnazan\azmayeshi';
files = dir(fullfile(folder, '*.tiff'));
array4d = zeros(512, 512,3, numel(files));
% Loop over filenames, inserting the image.
for slice = 1 : length(files)
filename = fullfile(folder, files(slice).name);
thisImage = imread(filename);
[rows, columns, numberOfColorChannels) = size(thisImage);
if numberOfColorChannels < 3
message = 'Error: Image is not RGB Color!';
uiwait(warndlg(message));
continue;
end
if rows ~= 512 || columns ~= 512
message = 'Error: Image is not 512x512!';
uiwait(warndlg(message));
continue; % Skip this image.
end
% Image is okay. Insert it.
array4d(:,:,:,slice) = thisImage;
end
  1 件のコメント
sara
sara 2014 年 10 月 8 日
Image Analyst
Endless thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by