I'm trying to use the library to anonymize a dicom image.
In some cases it works fine, but in other cases the final image is corrupted. I mean, the pixels of the image are wrong and also the FileMetaInformationGroupLength
tag of final image has changed.
This also happen when I don't anonymize the image, I just read and write the image in a new file.
This is my code: //---------------------------------------------------------------------
string dir = @"C:\Users\Desktop\CT.dcm";
var dcmBytes = System.IO.File.ReadAllBytes(@dir);
try
{
var dcm = EvilDICOM.Core.DICOMObject.Read(dcmBytes);
var refName = new EvilDICOM.Core.Element.PersonName
{
FirstName = "",
Tag = EvilDICOM.Core.Helpers.TagHelper.PATIENT_NAME
};
dcm.ReplaceOrAdd(refName);
dcm.Write(@"C:\Users\Desktop\CT2.dcm");
}
catch(Exception ex)
{
throw new Exception("EXCEPTION: " + ex.Message);
}
//---------------------------------------------------------------------
Following is the original image with which I have the problem: https://www.dropbox.com/s/s5ase23jl9908jm/3DSlice1.dcm?dl=0
Following is the screenshot with the original image and the final image (the corrupted image). https://www.dropbox.com/s/12liy3gbw7dkb4d/Image_corrupted.PNG?dl=0
I don't know what is happening with the pixel data. But I have seen that the FileMetaInformationGroupLength
tag changes.