简体   繁体   中英

How to convert Dicom to BMP image in C#?

I am currently using the evil-dicom library for opening DICOM files in c#. I am able to access the dicom file with:

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

Then open up the pixel stream using

dcm.PixelStream

How can I save the pixelstream as a bmp image?

I never used the toolkit; but at least till Oct-2014, author of the toolkit was saying following:

Evil DICOM does not have any image classes to help with this. While that might seem strange to not include image tools in a DICOM library, it is not the original intent of the the library. Evil DICOM is more for manipulating and analysis of DICOM data. I used to have some image parts in the old library which I believe is still available on SourceForge. You can take a look, but the PixelData tag has the raw bits to put together an image. .NET has several classes that can help with that, but I don't have anything to write here in this post. If I get some time, I will write a blog post about how to do it on the website (rexcardan.com).

Source: 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; 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.

You can find some example code here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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