Need help searching through a DICOM structure

조회 수: 1 (최근 30일)
Patrick Ford
Patrick Ford 2017년 9월 26일
편집: Walter Roberson 2017년 9월 26일
I have a structure ( a DICOMDIR and its files) that I want to search and select certain items for further use. I have been able to read in the DICOMDIR as follows:
dd = dicominfo('path/DICOMDIR');
The next step is to review the items in dd.DirectoryRecordSequence such as
dd.DirectoryRecordSequence.Item_1
There are about 1400 items and I want to index through them with a loop. I can get the proper information with the following:
getfield(dd.DirectoryRecordSequence,'Item_1')
and I can get an array of the field names,
fn = fieldnames(dd.DirectoryRecordSequence);
so that fn(1) is
ans =
1×1 cell array
{'Item_1'}
But
getfield(dd.DirectoryRecordSequence, fn(1))
does not work. How do I go about getting this so I can index it by referencing
fn(i) {where i = 1 to 1400}?
Thank you
  댓글 수: 1
Patrick Ford
Patrick Ford 2017년 9월 26일
편집: Patrick Ford 2017년 9월 26일
I need to use the char function:
dd.DirectoryRecordSequence.(char(fn(3)))

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2017년 9월 26일
편집: Walter Roberson 2017년 9월 26일
getfield(dd.DirectoryRecordSequence, fn{1})
or
dd.DirectoryRecordSequence.(fn{1})
You do not need char() -- just use the right indexing style

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 DICOM Format에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by