我有一个简单的 C# 控制台应用程序,它将 dicom 文件放入流中,然后将该流复制到 .jpg 文件中。我的代码创建了文件,但我无法查看图像。下面是我正在使用的代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using rzdcxLib;
using System.Drawing.Imaging;
namespace ConsoleApplication1
{
class Program
{
public static void CopyStream(Stream input, Stream output) {
byte[] buffer = new byte[8 * 1024];
int len;
while ((len = input.Read(buffer, 0, buffer.Length)) > 0) {
output.Write(buffer, 0, len);
}
}
static void Main(string[] args)
{
Stream myStream =
new FileStream("F:\\MIS\\JLoren\\Projects\\" +
"814-Convert for Chandra\\DICOM\\Test\\IM1",
FileMode.Open,
FileAccess.Read);
Stream OutPut =
new FileStream("F:\\MIS\\JLoren\\Projects\\" +
"814-Convert for Chandra\\DICOM\\Test\\IM1.jpg",
FileMode.Create,
FileAccess.Write);
CopyStream(myStream, OutPut);
}
}
}