我正在使用 wpf 应用程序和内存流写入方法来写入 dicom 数据字节。System.OutOfMemoryException
当尝试写入大小超过 70 mb 的大 dicom 数据时,它会显示类型异常。您能否提出解决此问题的任何解决方案。
这段代码是这样的
try
{
using ( MemoryStream imagememoryStream = new MemoryStream())
{
while (true)
{
// Retrieve the DICOMData.
// data comes as chunks; if file size is larger, multiple RetrieveDICOMData() calls
// has to be raised. the return value specifies whether the chunk is last one or not.
dicomData = dicomService.RetrieveDICOMData( hierarchyInfo );
imagememoryStream.Write( dicomData.DataBytes, 0, dicomData.DataBytes.Length );
if (dicomData.IsLastChunk)
{
// data is smaller; completed reading so, end
break;
}
}
imageData=imagememoryStream.ToArray();
}
return imageData;
}
catch( Exception exception )
{
throw new DataException( exception.StackTrace );
}