Closed bobred closed 6 years ago
It has nothing to do with anonymization. It has to do with the format used for writing the DICOM file to bytes. If you use EXPLICIT VR in your DICOM settings, it will write the VR. Otherwise, it just writes the tag, and on reading back, if the tag is not in the Evil DICOM dictionary, it won't know which kind of VR it is. Here is a test that shows you what I mean:
var dcm = new DICOMObject();
dcm.Add(new LongString(new Tag("32751000"), "Online3D"));
var dcmBytes = new byte[0]; //Start empty
using (var ms = new MemoryStream())
{
using (var dw = new DICOMBinaryWriter(ms))
{
//Explicity
DICOMObjectWriter.Write(dw, DICOMIOSettings.DefaultExplicit(), dcm);
}
dcmBytes = ms.ToArray(); //Store to read back
}
var dcmBack = DICOMObject.Read(dcmBytes);
//This passes
Assert.IsTrue(dcmBack.FindFirst("32751000").VR == EvilDICOM.Core.Enums.VR.LongString);
using (var ms = new MemoryStream())
{
using (var dw = new DICOMBinaryWriter(ms))
{
//Implicit
DICOMObjectWriter.Write(dw, DICOMIOSettings.Default(), dcm);
}
dcmBytes = ms.ToArray(); //Store to read back
}
dcmBack = DICOMObject.Read(dcmBytes);
//This fails
Assert.IsTrue(dcmBack.FindFirst("32751000").VR == EvilDICOM.Core.Enums.VR.LongString);
HiMany thanks, I thought it was something l had missed.Thank you for your time.James
On Thursday, 1 February 2018, 23:04, Rex Cardan <notifications@github.com> wrote:
It has nothing to do with anonymization. It has to do with the format used for writing the DICOM file to bytes. If you use EXPLICIT VR in your DICOM settings, it will write the VR. Otherwise, it just writes the tag, and on reading back, if the tag is not in the Evil DICOM dictionary, it won't know which kind of VR it is. Here is a test that shows you what I mean:` var dcm = new DICOMObject(); dcm.Add(new LongString(new Tag("32751000"), "Online3D")); var dcmBytes = new byte[0]; //Start empty using (var ms = new MemoryStream()) { using (var dw = new DICOMBinaryWriter(ms)) { //Explicity DICOMObjectWriter.Write(dw, DICOMIOSettings.DefaultExplicit(), dcm); } dcmBytes = ms.ToArray(); //Store to read back }
var dcmBack = DICOMObject.Read(dcmBytes);
//This passes
Assert.IsTrue(dcmBack.FindFirst("32751000").VR == EvilDICOM.Core.Enums.VR.LongString);
using (var ms = new MemoryStream())
{
using (var dw = new DICOMBinaryWriter(ms))
{
//Implicit
DICOMObjectWriter.Write(dw, DICOMIOSettings.Default(), dcm);
}
dcmBytes = ms.ToArray(); //Store to read back
}
dcmBack = DICOMObject.Read(dcmBytes);
//This fails
Assert.IsTrue(dcmBack.FindFirst("32751000").VR == EvilDICOM.Core.Enums.VR.LongString);`
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I have a DICOM dataset that I wish to anonymize which I do using the anonymization queue. I have a possible problem with the DICOM RT REG files where a private tag is changed (remove private tags settings false). The original is (3275,1000), VR=LO and value 'Online3D' but when passed through the anonymization queue (3275,1000), VR=unknown and value appears to be Online3d as an ascii array.
I am using the current version.
Any Ideas