如何使用 C# 将普通 jpeg 图像字节转换为 DICOM 本机图像字节
目前我正在编写一个用于将 JPEG
转换为 DICOM 图像
的模块。经过分析,我已经完成了标签渲染,现在图像在 DICOM 文件中未正确渲染。
是否有任何算法可以将JPEG
转换为DICOM
。
Currently I'm writing a module for the conversion of JPEG
to DICOM Image
Conversion. On analysis I've completed the tag rendering, now the image is not properly rendered in the DICOM
file.
Is there any algorithm to convert the JPEG
to DICOM
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
继续Matthieu的回应,这里有一个非常简单的方法,使用优秀的GDCM库和他引用的示例为JPEG流创建DICOM信封(注意我使用了一些辅助类,但非常简单):
Continuing from Matthieu's response, here is a very simple way of creating a DICOM envelope for a JPEG stream using the excellent GDCM library and his referenced example (note I have used some helper classes, but is quite simple):
请查看 mdcm C# DICOM 库,最初由 Colby Dillion 编写。他开发了通往 IJG/LibJPEG 和 OpenJPEG 代码库,因此 mdcm 提供 8/12/16 位有损和无损 JPEG 支持以及 JPEG-2000 支持。
Colby 的原始库具有 WinForms 依赖项。我在此处创建了一个针对 Silverlight 和 WPF 的 mdcm 分支。该库的 WPF 版本可以充分利用 Colby 最初实现的相同 JPEG(-2000) 编解码器。
另一方面,Silverlight 版本目前无法从这些编解码器中受益。我已尝试应用 FJCore 和 LibJpeg.Net 库,用于在 Silverlight 中支持有损 JPEG,但这些库目前仅支持 8 位图像。
问候,
安德斯@Cureos
please have a look at the mdcm C# DICOM library, originally written by Colby Dillion. He has developed managed C++ "bridges" to the IJG/LibJPEG and OpenJPEG code bases, so mdcm provides both 8/12/16-bit lossy and lossless JPEG support as well as JPEG-2000 support.
Colby's original library has WinForms dependencies. I have created a Silverlight and WPF targeted fork of mdcm here. The WPF version of the library can fully utilize the same JPEG(-2000) codecs that Colby originally implemented.
The Silverlight version on the other hand currently cannot benefit from these codecs. I have made some attempts to apply the FJCore and LibJpeg.Net libraries for lossy JPEG support in Silverlight, but these libraries only support 8-bit images at the moment.
Regards,
Anders @ Cureos
.NET 本身没有支持 DICOM 的功能。您将需要使用图书馆。我不知道有什么免费的,但我使用过 LeadTools,它可以做到这一点(需要付费)。但我只会给它 4/10,并且我会重新开始你寻找其他选择。
There is no functionality in .NET itself for DICOM support. You will need to use a library. I do not know of any free ones but I have used LeadTools and it will do it (for a price). But I would only give it a 4/10, and I would recommenced you look for other options too.
您不需要将 JPEG“转换”为 DICOM。 DICOM 只是 JPEG 流的“信封”。以下是我在 GDCM 中封装(=放入 DICOM 信封)现有 MPEG2 文件的方法:
http://gdcm.sourceforge.net/html/MpegVideoInfo_8cs-example.html
只需针对输入 JPEG 文件调整该代码即可。例如,看看:
http://gdcm.sourceforge.net/html/DecompressJPEGFile_8cs- example.html
不需要解压/重新压缩,那样会浪费资源。
You do not need to 'convert' JPEG to DICOM. DICOM is simply an 'envelope' for your JPEG stream. Here is what I did in GDCM to encapsulate (= put into a DICOM envelope) an existing MPEG2 file:
http://gdcm.sourceforge.net/html/MpegVideoInfo_8cs-example.html
Simply adapt that code for an input JPEG file. For instance have a look at:
http://gdcm.sourceforge.net/html/DecompressJPEGFile_8cs-example.html
No need to decompress/recompress, that would be a waste of resource.