简体   繁体   English

使用github的最新版本无法在Evil Dicom中找到Open方法

[英]Can not find Open method in Evil Dicom using latest version from github

I am trying to follow the tutorial here: 我正在尝试按照本教程进行操作:

http://www.rexcardan.com/2014/10/evil-dicom-basics/ http://www.rexcardan.com/2014/10/evil-dicom-basics/

and process my DICOM file to show the image. 并处理我的DICOM文件以显示图像。 In the tutorial, the DICOMObject.Open() method is called to process the file path. 在本教程中,将调用DICOMObject.Open()方法来处理文件路径。 My issue is that intellisense does not pick this up for me. 我的问题是,intellisense无法为我解决这个问题。 Would anyone be able to assist with this? 有人可以协助吗?

I downloaded this version: 我下载了此版本:

https://github.com/rexcardan/Evil-DICOM https://github.com/rexcardan/Evil-DICOM

EDIT 编辑

Using the following: 使用以下内容:

var dcm = DICOMObject.Read(@"C:\file\path\filename.dcm");

While stepping through the code of DICOMObject everything seems to be working fine up to this point: 在逐步执行DICOMObject的代码时, DICOMObject一切似乎都可以正常工作:

public static IDICOMElement ReadElementImplicitLittleEndian(DICOMBinaryReader dr)
{
    var tag = TagReader.ReadLittleEndian(dr);
    var vr = TagDictionary.GetVRFromTag(tag);
    int length = LengthReader.ReadLittleEndian(VR.Null, dr);
    var data = DataReader.ReadLittleEndian(length, dr, TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN);
    var el = ElementFactory.GenerateElement(tag, vr, data, TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN);
    return el;
}

When the code gets to: 当代码到达:

int length = LengthReader.ReadLittleEndian(VR.Null, dr);

length returns an int of 1919252000 bytes which is ~2GB. length返回一个1919252000 bytesint ,约为2GB。 Then the code steps to: 然后,代码将执行以下操作:

var data = DataReader.ReadLittleEndian(length, dr, TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN);

Which checks to see if there are any bytes to read (which there is) and goes to the read bytes here: 哪个检查是否有要读取的字节(有),然后转到此处的读取字节:

public byte[] ReadBytes(int count)
{
    byte[] buffer = new byte[count];
    _binaryReader.Read(buffer, 0, count);
    return buffer;
}

byte[] buffer = new byte[count]; is where the actual exception occurs in the code. 是代码中实际发生异常的地方。 I have tested the amount of bytes that it can handle and it seems to be around .6 - .7 GB which is not even half of what I need. 我已经测试了它可以处理的字节数,似乎在.6 - .7 GB ,这甚至不到我需要的一半。 Is there away to expand the buffer to accept all of what I need? 是否可以扩展缓冲区以接受我需要的所有内容?

I have not looked at the video, but as far as I know you should use: 我没有看过视频,但据我所知您应该使用:

var dicomObj = DICOMObject.Read(filePath);

to read a DICOM file using Evil DICOM . 使用Evil DICOM读取DICOM文件。

Please see the source code here . 请在此处查看源代码。 I am not sure, but there may have been a recent API change that explains this confusion. 我不确定,但是最近的API更改可能解释了这种混淆。

Sorry for the late response. 回复晚了非常抱歉。

My first thought is that the file is not actually encoded in Implicit VR Little Endian. 我的第一个想法是该文件实际上并未在Implicit VR Little Endian中编码。 This is the default transfer syntax that is presumed if the DICOM preamble and metadata are missing. 如果缺少DICOM前导和元数据,这是默认的传输语法。 Normally, in the metadata (Tags starting with 0002), the transfer syntax is revealed. 通常,在元数据(以0002开头的标签)中,会显示传输语法。 On the actual file (in Windows explorer, not from ED), is the size really 600+MB? 在实际文件上(在Windows资源管理器中,而不是从ED),大小真的是600 + MB吗? If so, what kind of file is that so I can play with one? 如果是这样,那是什么样的文件,所以我可以一起玩?

I added a new method to the DICOMObject class that let's you try another syntax on a read fail: 我向DICOMObject类添加了一个新方法,让您在读取失败时尝试另一种语法:

    /// <summary>
    ///     Reads a DICOM file from a path
    /// </summary>
    /// <param name="filePath">the path to the file</param>
    /// <param name="trySyntax">the transfer syntax to use in case there is no metadata explicitly included</param>
    /// <returns></returns>
    public static DICOMObject Read(string filePath,
        TransferSyntax trySyntax = TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN)
    {
        return DICOMFileReader.Read(filePath, trySyntax);
    }

I've run across some badly formatted DICOM in my experiences that have caused me errors like the one you are mentioning. 在我的经历中,我遇到了一些格式错误的DICOM,这些错误导致了我所提到的错误。 Of course, it could really be that you are running out of memory, which I would like to dive into further if you are sure the transfer syntax is correct. 当然,实际上可能是您的内存不足,如果您确定传输语法正确,我想进一步研究。 Try "Explicit VR Little Endian" and see if that fixes your problem. 尝试“ Explicit VR Little Endian”,看看是否可以解决您的问题。

Try this 尝试这个

var bdcm= File.ReadAllBytes(@"AbsolutePath");
var dcm = DICOMObject.Read(bdcm);

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

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