Search code examples
c#dicomevil-dicom

How to sort a tag with evil-DICOM?


I need to add a tag 'Dose Rate Set', but when i add the tag with this code.

         var dcm = DICOMObject.Read(nom_du_fichier);

var refDoseRate = new DecimalString { Tag = TagHelper.DoseRateSet, Data = 400 }; dcm.Add(refDoseRate);

The tag is add int the bottom of the file.

I desire to put the tag 'Dose Rate Set' with tags with this other properties of beams.


Solution

  • I am unfamiliar with evildicom, the framework you are using.

    Since DICOM is organized in modules and sequences, you will have to add your item it to the proper sequence in your DICOM file instead of just adding it to the file as you are doing now.

    I have taken a look at the examples of teh EvilDicom framework and I think you need something along the lines of the Selecting Multiple Elements example.

    var dcm = DICOMFileReader.Read("inputfile.dcm");
    var sel = new DICOMSelector(dcm);
    
    var beamSequences = sel.ReferencedBeamSequence;
    
    foreach (var beamSequence in beamSequences)
    {
        beamSequence.Add(refDoseRate)
    }