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
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”