Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private tags after anonymization #51

Closed
bobred opened this issue Feb 1, 2018 · 2 comments
Closed

Private tags after anonymization #51

bobred opened this issue Feb 1, 2018 · 2 comments

Comments

@bobred
Copy link

bobred commented Feb 1, 2018

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

@rexcardan
Copy link
Owner

rexcardan commented Feb 1, 2018

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);

@bobred
Copy link
Author

bobred commented Feb 2, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants