フィルターのクリア

Dicomread images with different x and y sizes into a cellarray.

1 回表示 (過去 30 日間)
GioPapas81
GioPapas81 2018 年 5 月 18 日
編集済み: GioPapas81 2018 年 5 月 18 日
Hi. This may be easy for some Matlab users. I am trying to dicomread and process images starting my code with the following commands:
[Filename1,Pathname1]=uigetfile('Multiselect','on');
for i=1:length(Filename1)
images(:,:,i)=dicomread(fullfile(Pathname1,Filename1{i}));
images=double(images);
end
However, my images appear to change size therefore I get the error: 'Subscripted assignment dimension mismatch.'
Any ideas how I could dicomread and place in order all dicom images independently of their size, would be much appreciated.
Thank you

採用された回答

Guillaume
Guillaume 2018 年 5 月 18 日
You've answered your question in its title. Use a cell array:
[Filename1,Pathname1]=uigetfile('Multiselect','on');
images = cell(size(Filename1));
for fileidx = 1:numel(Filename1)
images{fileidx} = double(dicomread(fullfile(Pathname1,Filename1{i})));
end
  4 件のコメント
Image Analyst
Image Analyst 2018 年 5 月 18 日
I'm not even sure that you NEED to have all the images in memory simultaneously. Why do you think you do? Usually it's not necessary. Just process each image one at a time in the loop and don't store them all.
GioPapas81
GioPapas81 2018 年 5 月 18 日
編集済み: GioPapas81 2018 年 5 月 18 日
I re-sorted my files, tried again and it worked (I am not sure why I got this error in first place).
I think that I have mis-used the term 'cellarray', instead of using 3D matrix initially but your are right, I can replace the 3D matrix with a cellarray. I only need to incorporate changes in a relatively long code, but there is no free lunch in life.
Thank you again both.

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by