我需要访问BeamSequence属性中每个ControlPointSequence属性中的所有GantryAngle值。
以下是嵌套的快速可视化
Beam Sequence
...
Control Point Sequence
Gantry Angle
...
...
Control Point Sequence
Gantry Angle
...
...
Control Point Sequence
Gantry Angle
...
如何使用pixelmed库访问每个龙门架角度?
编辑:
感谢cnellar的帮助,以下是最终的工作
private ArrayList<Double> getAngles( SequenceAttribute beamSequence ) {
ArrayList<Double> n = new ArrayList<Double>();
Iterator is = beamSequence.iterator();
while (is.hasNext()) {
SequenceItem item = (SequenceItem)is.next();
if (item != null) {
AttributeList itemList = item.getAttributeList();
if (itemList != null) {
SequenceAttribute ctrlPoint = (SequenceAttribute)itemList.get( TagFromName.ControlPointSequence );
//System.out.print(ctrlPoint);
Iterator is1 = ctrlPoint.iterator();
while (is1.hasNext()) {
SequenceItem item1 = (SequenceItem)is1.next();
if (item1 != null) {
AttributeList itemList1 = item1.getAttributeList();
if (itemList1 != null) {
Attribute gantry_angle = itemList1.get( TagFromName.GantryAngle );
if(gantry_angle!=null)
n.add(gantry_angle.getSingleDoubleValueOrDefault(0));
}
}
}
}
}
}
return n;
}
答案 0 :(得分:1)
我期待的是:
private double[] getAngles( SequenceAttribute beamSequence ) {
Iterator is = beamSequence.iterator();
while (is.hasNext()) {
SequenceItem item = (SequenceItem)is.next();
if (item != null) {
AttributeList itemList = item.getAttributeList();
if (itemList != null) {
Attribute ctrlPoint = itemList.get( TagFromName.ControlPointSequence );
// Do the same sifting through this sequence to get your gantry angle
// and add it to your list of values.
}
}
}