Removing tag that contains multiple tags inside

20 views
Skip to first unread message

Picasso

unread,
Mar 12, 2024, 10:20:05 PMMar 12
to Fellow Oak DICOM

I have a dicom sequence that contains several “Item” (fffe,e000). 

Each item contains two tags  (300a,004a) & (300a,00b8)

  One of the tags (type string -has a value of “xyz”)  I want to remove belongs inside the item

delTag.jpg

So what I tried so far:

//find out how many items in the sequence

Intcount=dicomDataset.GetSequence(DicomTag.ToleranceTableSequence).Items[0].GetSequence(DicomTag.BeamLimitingDeviceToleranceSequence).Items.Count();

 

//look for specific string e.g. “xyz”

      for(int i = 0; i < count; i++)

{

        if(tagName == "xyz")

 {

    //tag found , now remove complete item ()

     var remove = DicomTag.Parse("300a,004a");

     openedDicom.Dataset.Remove(remove);

    openedDicom.Save(Path.Combine(dirPath, "Test.dcm"));

 }}

Is there a better way to do this and remove complete Item, the correct item?

Also if I remove one tag at a time, the Length is mar as “undefined”

Reply all
Reply to author
Forward
0 new messages