简体   繁体   English

邪恶的DICOM-目标阵列的时间不够长,请检查destindex和长度以及该阵列的下限

[英]Evil DICOM -destination array was not long enough check destindex and length and the array's lower bounds

I am using EVIL DICOM image reader, it works well with some files, but some files give me this error: destination array was not long enough check destindex and length and the array's lower bounds I can't find the original website where I have purchased the program. 我正在使用EVIL DICOM图像读取器,它与某些文件配合使用很好,但是某些文件给我以下错误:目标数组不够长,请检查destindex和长度以及数组的下限,我找不到我购买的原始网站该程序。 Would appreciate any assistance. 不胜感激。

By looking at the Evil DICOM code (version 0.5.7), I assume that you are using the ImageMatrix constructor in a way that was not entirely planned for. 通过查看Evil DICOM代码(版本0.5.7),我假设您使用的ImageMatrix构造函数不是完全计划的。

The constructor you are referring to takes an array of DICOM image files, where the size of each image is supposed to be the same for all images. 您所引用的构造函数采用一个DICOM图像文件数组,其中每个图像的大小对于所有图像都应该是相同的。

Upon construction, the Image array property is dimensioned to equal the size of one image times the length of the DICOM image array in the private method IntializeMatrix . 构造后,在私有方法IntializeMatrix ,将Image array属性的尺寸确定为等于一幅图像的大小乘以DICOM图像数组的长度。

Next, the constructor loops over all image files and inserts the pixel data from each file into the Image property in the AppendImageToMatrix method. 接下来,构造函数遍历所有图像文件,并将每个文件中的像素数据插入AppendImageToMatrix方法的Image属性中。 The start position of the copied pixel data in the Image is determined by the DICOM file ImageNumber . 复制的像素数据在Image的开始位置由DICOM文件ImageNumber确定。

If the ImageNumber is too high in relation to the size of the Image array, pixel data is copied to position 0 in the Image array. 如果ImageNumber相对于Image数组的大小太大,则将像素数据复制到Image数组中的位置0。

However! 然而! If the start position is equal to the length of the Image array, which will happen if the ImageNumber is exactly one more than the number of files, the start position will not be modified and there will be an attempt to write to a non-existing position in the Image array! 如果起始位置等于 Image数组的长度(如果ImageNumber正好比文件数大ImageNumber ,则会发生此ImageNumber ),则起始位置将不会被修改,并且将尝试写入不存在的文件在Image数组中的位置!

The line where this is happening is the fourth line in AppendImageToMatrix , which reads: 发生这种情况的行是AppendImageToMatrix的第四行,内容为:

if (offset > Image.Length) { offset = 0; }

If you are building the library yourself, you might want to change the > operator to a >= operator, then the application will at least not throw. 如果您是自己构建库,则可能需要将>运算符更改为>=运算符,那么应用程序至少不会抛出异常。 Alternatively, you could consider a more fail-safe handling altogether of the pixel data copying. 或者,您可以考虑对像素数据复制进行更全面的故障保护。 There is not room to elaborate on that here, though :-) 尽管这里没有详细说明的余地,但:-)

I cannot right away find the ImageMatrix class in the updated version of Evil DICOM . 我无法立即在Evil DICOM更新版本中找到ImageMatrix类。 However, if you run into problems with the old or the new code, consider reporting these problems on the Issues tab of the Evil DICOM Github repository. 但是,如果您在使用旧代码或新代码时遇到问题,请考虑在Evil DICOM Github存储库的“ 问题”选项卡上报告这些问题。

UPDATE Note that the ImageNumber property is equal to the DICOM attribute Instance Number , tag (0020,0013). UPDATE请注意, ImageNumber属性等于DICOM属性Instance Number标记(0020,0013)。

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

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