How do I remove some Items from a nested sequence?

17 views
Skip to first unread message

Picasso

unread,
May 15, 2024, 1:22:13 AMMay 15
to Fellow Oak DICOM

I have tried this w/o luck

//get number of items in Beam Sequence

 var bmSQ = dicomDataset.GetSequence(DicomTag.BeamSequence).Items.Count();

 Console.WriteLine($"Number of items in BeamSequence  {bmSQ}");

                         

for(int x = 0;x < bmSQ; x++)

{

     //get number of items in BeamSequence>ControlPointSequence

     var ctlpntSQ = dicomDataset.GetSequence(DicomTag.BeamSequence).Items[x].GetSequence(DicomTag.ControlPointSequence).Items.Count();

     Console.WriteLine($"Beam Item:{x}, ControlPointsSequence Items {ctlpntSQ}");

   //Delete the items

 var delItem = dicomDataset.GetSequence(DicomTag.BeamSequence).Items[x].GetSequence(DicomTag.ControlPointSequence).Items;

 

 delItem.RemoveAt(x);

Like to keep the first two then delete the rest (Item#3-Item#200).nestedSequence.jpg

Reply all
Reply to author
Forward
0 new messages