C#: Online Guide
How To: Dicom SDK
Dicom to Other Images (Jpeg, Png, ...)
Dicom to Other Images (Jpeg, Png, ...)
  |  
Home ›› XDoc.Dicom ›› C# Dicom: Convert Dicom to Other Images

C# DICOM - Convert DICOM to Other Raster Images


C#: How to Convert DICOM to JPEG, GIF, PNG, BMP and JBIG2 Raster Images




C#: DICOM to Raster Images Conversion Overview



RasterEdge .NET DICOM Document Conversion SDK provides several high performance DLL libraries that can be used to render and convert DICOM file to commonly used images and documents. For DICOM to raster images conversion in C#.NET programming, three DLLs will be used, which include RasterEdge.Imaging.Basic.dll, RasterEdge.Imaging.Basic.Codec.dll and RasterEdge.Imaging.DICOM.dll.


Related .net document control helps:
c# asp.net word document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net edit pdf image using c#: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
c# asp.net dicom viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net document viewer open source: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
asp.net edit pdf page using c#: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net pdf viewer using c#: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
c# asp.net mvc document viewer: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...


And here, we list the main features that supported by these .NET DICOM Document Conversion Libraries:


Well designed and written in C#.NET managed code, complying with .NET Framework 2.0+


Support loading a file, stream or byte[] containing a DICOM document as a DCMDocument object into C#.NET program


High-end .NET document imaging solution, capable of converting DICOM with one or multiple pages to raster images collection


Raster images including JPEG, GIF, PNG, BMP and JBIG2 are supported by .NET DICOM Conversion SDK


Enable C# programmers to get a specific DICOM document page to convert to raster image files


Provide affordable developer and server licenses for .NET DICOM Conversion SDK




C# DLLs for DICOM to Images Conversion



Add necessary references references;


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.JPEG2000.dll


  RasterEdge.Imaging.DICOM.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.Imaging.DICOM;




C#: DICOM to Raster Images Conversion Demo



Now, let's move on to how to render and convert DICOM image file to JPEG, GIF, PNG, BMP or JBIG2 raster image(s) using C#.NET programming. Fistly, you will see C#.NET demo code for rendering and converting DICOM to raster image PNG in the following code table.


Please note that, C# DICOM conversion to other raster images is just the same as conversion to PNG. You may only need to change the output image format in the C#.NET code accordingly.




// load a DCMDocument
DCMDocument doc = new DCMDocument(@"c:\a.dcm");

// convert DICOM document to image(s) in PNG format and save image(s) under specified directory and name
doc.ConvertToImages(RasterEdge.Imaging.Basic.ImageType.PNG, @"c:\dicom", "dicom");




Also, you can get a specific DICOM document page to convert to PNG or other raster images. Here is the C#.NET demo code.




// load a DCMDocument
DCMDocument doc = new DCMDocument(@"c:\a.dcm");

// get the first page
DCMPage page = (DCMPage)doc.GetPage(0);

// convert the first page
page.ConvertToImage(RasterEdge.Imaging.Basic.ImageType.PNG, @"c:\dicom1.png");



public override void ConvertToImages(ImageType targetType, string directory, string fileName)
Parameters:
public override void ConvertToImages(ImageType targetType, Stream[] streams)
Parameters:
public override void ConvertToImages(ImageType targetType, float zoomValue, Stream[] streams)
Parameters:
public override void ConvertToImages(ImageType targetType, int resolution, Stream[] streams)
Parameters:
public override void ConvertToImages(ImageType targetType, float zoomValue, string directory, string fileName)
Parameters:
public override void ConvertToImages(ImageType targetType, int resolution, string directory, string fileName)
Parameters: