简体   繁体   English

如何在 C# 中将 Dicom 转换为 BMP 图像?

[英]How to convert Dicom to BMP image in C#?

I am currently using the evil-dicom library for opening DICOM files in c#.我目前正在使用 evil-dicom 库在 C# 中打开 DICOM 文件。 I am able to access the dicom file with:我可以通过以下方式访问 dicom 文件:

var dcm = DICOMObject.Read('dicomfilename');

Then open up the pixel stream using然后使用打开像素流

dcm.PixelStream

How can I save the pixelstream as a bmp image?如何将像素流保存为 bmp 图像?

I never used the toolkit;我从未使用过工具包; but at least till Oct-2014, author of the toolkit was saying following:但至少在 2014 年 10 月之前,该工具包的作者是这样说的:

Evil DICOM does not have any image classes to help with this. Evil DICOM 没有任何图像类来帮助解决这个问题。 While that might seem strange to not include image tools in a DICOM library, it is not the original intent of the the library.虽然在 DICOM 库中不包含图像工具似乎很奇怪,但这并不是该库的初衷。 Evil DICOM is more for manipulating and analysis of DICOM data. Evil DICOM 更多用于操作和分析 DICOM 数据。 I used to have some image parts in the old library which I believe is still available on SourceForge.我曾经在旧库中有一些图像部分,我相信它们在 SourceForge 上仍然可用。 You can take a look, but the PixelData tag has the raw bits to put together an image.您可以查看一下,但 PixelData 标签具有用于组合图像的原始位。 .NET has several classes that can help with that, but I don't have anything to write here in this post. .NET 有几个类可以帮助解决这个问题,但我在这篇文章中没有什么可写的。 If I get some time, I will write a blog post about how to do it on the website (rexcardan.com).如果我有时间,我会在网站(rexcardan.com)上写一篇关于如何做的博客文章。

Source: GitHub来源: GitHub

Apparently, it was not original intent of the toolkit to include imaging support in toolkit.显然,在工具包中包含图像支持并不是该工具包的初衷。 Not sure if this is changed since then.不知道从那以后这是否有所改变。 Author was planning to write an article to achieve this through DotNet;作者正计划写一篇文章来通过 DotNet 实现这一点; not sure if he wrote any then after.不知道他是否写了任何然后。 Old library from SourceForge may create other issues as it might not have been updated since long. SourceForge 的旧库可能会产生其他问题,因为它可能很久没有更新了。

You can find some example code here .您可以在此处找到一些示例代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM