简体   繁体   English

EvilDicom图片损坏

[英]EvilDicom Image Corrupted

I'm trying to use the library to anonymize a dicom image. 我正在尝试使用该库来匿名化dicom图像。 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. 我的意思是,图像的像素错误,并且最终图像的FileMetaInformationGroupLength标记也已更改。 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 以下是我遇到问题的原始图像: 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 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. 但是我已经看到FileMetaInformationGroupLength标记发生了变化。

Original image is compressed with Transfer syntax 1.2.840.10008.1.2.4.70. 原始图像使用传输语法1.2.840.10008.1.2.4.70压缩。 The output image is encoded with 1.2.840.10008.1.2 which means uncompressed. 输出图像使用1.2.840.10008.1.2编码,表示未压缩。 You need to check if this change in transfer syntax is applied correctly while calling dcm.Write . 您需要检查在调用dcm.Write传输语法中的更改是否正确应用。

Or may be that the transfer syntax is already changed while read operation. 或者可能是读取操作时传输语法已更改。

In any case, make sure the change in transfer syntax is intended, it is done correctly and consistent with DICOM tags. 在任何情况下,请确保更改传输语法是有意的,且更改正确且与DICOM标签一致。

I never used Evil DICOM toolkit so I may not help you with code. 我从未使用过Evil DICOM工具包,因此可能无法帮助您编写代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM