0

有个人发布了一个代码,以使用 ClearCanvas 库在 C# 中加载和显示 DICOM 图像。但是,我尝试运行代码并且收到错误并且缺少库 dll 组件。我想知道个人从哪里获得的库dll文件ClearCanvas.Dicom.ImageViewwer.StudyManagement。我一直无法在互联网上找到该文件。代码显示在错误之后。我很感激谢谢。

用途:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ClearCanvas.Common;
using ClearCanvas.Dicom;
using System.Windows.Media.Imaging;
using ClearCanvas.ImageViewer;
using ClearCanvas.ImageViewer.StudyManagement;
using System.Windows.Interop;
using System.Windows.Media;

这是身体:

        OpenFileDialog ofd = new OpenFileDialog();
        ofd.Filter = "DICOM Files(*.*)|*.*";
        if (ofd.ShowDialog() == DialogResult.OK)
        {
            if (ofd.FileName.Length > 0)
            {

                var imagen = new DicomFile(ofd.FileName);

                LocalSopDataSource DatosImagen = new LocalSopDataSource(ofd.FileName);

                ImageSop imageSop = new ImageSop(DatosImagen);

                IPresentationImage imagen_a_mostrar = PresentationImageFactory.Create(imageSop.Frames[1]);

                int width = imageSop.Frames[1].Columns;

                int height = imageSop.Frames[1].Rows;

                Bitmap bmp = imagen_a_mostrar.DrawToBitmap(pictureBox1.Width, pictureBox1.Height);

                pictureBox1.Image = bmp;

                imageOpened = true;

            }
            ofd.Dispose();
        }
    }
4

2 回答 2

0

除了引用正确的程序集(这里......它从 clearcanvas.ca 的主页链接)之外,我在评论中提到,考虑使用using关键字,因为OpenFileDialog实现IDisposable如下:

using(OpenFileDialog ofd = new OpenFileDialog())
{
   ofd.Filter = "DICOM Files(*.*)|*.*";
   if (ofd.ShowDialog() == DialogResult.OK)
   {
      // rest of your code goes here
   }
}

这具有ofd.Dispose() 自动调用的好处,即使using块内的代码抛出异常。这适用于任何实现IDisposable(如位图、字体、流等)

于 2013-07-18T17:00:20.537 回答
0

我实际上发布了代码..

这些是我在项目中使用的 DLL:

透明画布:

ClearCanvas.Common.dll
ClearCanvas.Desktop.dll
ClearCanvas.Dicom.dll
ClearCanvas.ImageViewer.Common.dll
ClearCanvas.ImageViewer.dll
ClearCanvas.Utilities.Manifest.dll

我还添加了其他内容,因为我在尝试显示图像时遇到错误..

log4net.dll
nunit.framework.dll
WindowsBase.dll
BilinearInterpolation.dll --> For this one make sure you add either the 32 or 64 bits dll depending on what's your project defaults.
于 2013-07-19T19:30:44.267 回答