加载 Dicom 图像并显示它 - 使用 ClearCanvas 库
这是一个非常狭窄和具体的问题,但我知道还有其他人在使用这个问题,所以我会祈祷并希望你们中的任何人都能解决这个问题。
我正在开发一个 WPF 应用程序,其中一部分是 Dicom 查看器。我们希望使用第 3 方组件来处理 Dicom 内容,而 ClearCanvas 是迄今为止我们印象最深刻的组件。我们能够加载 Dicom 文件并获取属性,但将图像数据放在 Image 控件的 Source 属性上以显示它时遇到问题。有人有关于如何实现这一点的提示吗?
这是我用于提取图像数据的代码:
var file = new DicomFile(dicomFilePath);
var patientName = file.DataSet.GetAttribute(DicomTags.PatientsName);
var imageData = file.DataSet.GetAttribute(DicomTags.PixelData);
也尝试过使用 ImageViewer 库,但它仍然是相同的数据..
var localSopDataSource = new LocalSopDataSource(new DicomFile(dicomFilePath));
var patientName = localSopDataSource.File.DataSet.GetAttribute(DicomTags.PatientsName);
var imageData = localSopDataSource.File.DataSet.GetAttribute(DicomTags.PixelData);
This is a very narrow and specific question, but I know there are someone else out there using this, so I'll keep my fingers crossed and hope anyone of you pics this question up.
I'm working on a WPF application where one part of it is a Dicom viewer. We'd like to use a 3rd party component to handle the Dicom stuff, and ClearCanvas is the one we've got the best impression of this far. We're able to load a Dicom file and fetch the attributes, but we're having problems putting the image data on the Source property of an Image control to show it. Anyone with hints on how to make this happen?
Here's the code I use for extracting the image data:
var file = new DicomFile(dicomFilePath);
var patientName = file.DataSet.GetAttribute(DicomTags.PatientsName);
var imageData = file.DataSet.GetAttribute(DicomTags.PixelData);
Have also tried using the ImageViewer library, but it is still the same data..
var localSopDataSource = new LocalSopDataSource(new DicomFile(dicomFilePath));
var patientName = localSopDataSource.File.DataSet.GetAttribute(DicomTags.PatientsName);
var imageData = localSopDataSource.File.DataSet.GetAttribute(DicomTags.PixelData);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我想通了..可能还有更多方法可以实现这一目标,但这就是我所做的。现在我有一个 Wpf 图像绑定到提供位图数据的属性。以下是用于提供位图数据的属性。
请注意,这是一个非常直接的解决方案。例如,人们可能想要做一些事情,例如预加载图片等,以避免滚动多帧图像时的重载。但对于“如何显示图像”问题 - 这应该回答它..
Okay, I figured it out.. There might be some more ways of achieving this, but this is what I did. Now I have a Wpf Image bound to a property which provides the bitmap data. The following is the property used to provide the Bitmap data.
Note that this is a very straight forward solution. One might e.g. want to do stuff like preloading the pictures etc to avoid heavy load when scrolling multiframe images. But for the "howto display the image" question - this should answer it..
好的,我已经设法使用以下代码在 Picturebox 中显示 DICOM 图像:
以下是我使用的程序集:
我还必须将这些 dll 复制到 bin/debug 中:
BilinearInterpolation.dll (这个我无法将其引用为程序集,所以我只是将其复制到 bin/degug 文件夹中)
WindowsBase.dll(我能够将其作为程序集引用)
代码(我的项目中有一个按钮,可让您选择 dcm 文件,然后将其显示在图片框)
Ok, I've managed to show a DICOM image in a Picturebox using this code:
Here are the assemblies I used:
I also had to copy these dll into bin/debug:
BilinearInterpolation.dll (this one I could'nt reference it as assemblie so I just copied it into the bin/degug folder)
WindowsBase.dll (This one I was able to reference it as an assemblie)
Code (There's a button in my project that lets you select the dcm file and then show it in a picturebox)