Dicom metadata mxArray fault

Hello everyone. Iam trying to read metadata from a DICOM file and display them.in a listbox.
I read the data with
info = dicominfo(filename);
Then I tried to display the data with
Set(handles.listbox1,'string',info);
Unfortunately that does not work. Matlab says something about a mxArray.
So my question is how can I read the data from the mxArray in a listbox?
Thanks in advance,
Mike

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 10 月 23 日

0 投票

dicominfo() does not return a string: it returns a structure. You will need to convert the parts of the structure to strings to display them.
A quick and dirty method would be to use an edit box instead of a text box, and to use
Set(handles.editbox1, 'string', evalc(disp(info)) );

3 件のコメント

MikeSv
MikeSv 2015 年 10 月 23 日
Hi Walter and thanks for your quick reply. Could I read the structure like this? (Maybe in a for loop)
s = info(field,value)
 
Walter Roberson
Walter Roberson 2015 年 10 月 23 日
I do not know what the "value" would represent there?
If you want to loop over the field names you can do so:
fn = fieldnames(info);
for K = 1 : length(fn)
thisvalue = info.(fn{K});
... do something with thisvalue
end
MikeSv
MikeSv 2015 年 10 月 25 日
Thank you very much Walter. This works to a certain point. I seems like there are some nested structures inside the DICOM as well...

この質問は閉じられています。

タグ

質問済み:

2015 年 10 月 23 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by