有个人,他们使用ClearCanvas库在C#中发布加载和显示DICOM图像的代码。但是,我尝试运行代码,我收到一个错误,并有一个缺少库DLL组件。我想知道个人在哪里获得了库dll文件ClearCanvas.Dicom.ImageViewwer.StudyManagement。我一直无法在互联网上找到该文件。错误后显示代码。我很感激。
Usings:
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();
}
}
答案 0 :(得分:0)
除了引用正确的程序集(here ...它是从clearcanvas.ca的主页面链接的)我在评论中提到,考虑使用using
关键字,因为{{1}像这样实现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
(所以位图,字体,流等)
答案 1 :(得分:0)
我实际发布了代码..
这些是我在项目中使用的DLL:
Clearcanvas:
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.