dicom metadata I need some loop to read item_1,item_2,item_3 in a dicom file

조회 수: 5 (최근 30일)
robbie hakeem
robbie hakeem 2017년 11월 1일
댓글: Walter Roberson 2023년 8월 22일
I have a file that contains a number of control points. Each one has several values that repeat and change from field to field:Here is an example
item_1
item_2
item_3
item_4
What kind of loop can I use to define these as an array like
for i=1,control points
Segment(i) = (item_1 then Item_2 then item _3) or really item_i resulting in 3 separate segments segment1 segment2 segment3.
The underscore is driving me insane.
Nothing I have tried seems to work.
  댓글 수: 1
robbie hakeem
robbie hakeem 2017년 11월 1일
I understand that but these values are already in a Dicom file I am reading . So how do I read them .
Item-1 2 etc and those repeat very often .

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

답변 (1개)

Walter Roberson
Walter Roberson 2017년 11월 1일
  댓글 수: 3
Harlan Romsdahl
Harlan Romsdahl 2023년 8월 22일
Yes, it does returns a nested struct. The problem is there can be variable length sequences in the metadata. For example, a multi-frame object will have PerFrameFunctionalGroupsSequence with an item per frame. In my case, I have a 152 frame image and I want to iterate through the frame sequence. However, it is a structure with eement names: Item_1, Item_2, ... Item_152. How do I iterate through the 152 named elements of the structure? This is what MATLAB function"dicomCollection()" returns. \
Walter Roberson
Walter Roberson 2023년 8월 22일
dinfo = dicominfo(FILENAME);
N = 152;
item_values = cell(N,1);
for K = 1 : N
varname = "item_" + K;
item_values{K} = dinfo.(varname);
end

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

카테고리

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