Skip to content

How to delete a complete private tag #1881

Answered by mrbean-bremen
bec1442 asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry, missed your reply.
You didn't write (or I didn't understand) that the sequence you want to delete is inside another sequence.
In this case you have to navigate to that sequence first - the snippet above only works for top-level tags.
You would need something like:

var ds = DicomFile.Open("your_file.dcm").Dataset;
var fractionGroupSeqItems = ds.GetSequence(DicomTag.FractionGroupSequence).Items;
var refBeamSeqItems = fractionGroupSeqItems[0].GetSequence(DicomTag.ReferencedBeamSequence).Items;
var seqToRemove = new DicomTag(0x3249, 0x20, "CSS Medical Systems 3249");
refBeamSeqItems[0].Remove(seqToRemove);

(this is out of my head, so may not be completely correct)

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@bec1442
Comment options

@mrbean-bremen
Comment options

Answer selected by bec1442
@bec1442
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants