C#: Online Guide
How To: Dicom SDK
Set Dicom Rendering Option
Set Dicom Rendering Option
  |  
Home ›› XDoc.Dicom ›› C# Dicom: Set Dicom Rendering Option

C# DICOM - Set DICOM Rendering Options


Online C# Tutorial for DICOM Image File Conversion Options Setting




Set DICOM Image File Rendering Options in C# Overview



RasterEdge .NET Document Imaging SDK enables C# programmers to render and convert DICOM image file to documents and images, like PDF, TIFF, GIF, JPEG, PNG, BMP, JBIG2, etc. Moreover, C# programmers can have full control over DICOM document rendering and converting options, like setting image resolution/size, window center and window width to get high quality rendered file, and defining C# DICOM document rendering through page-by-page or converting the whole document at a time.


Related .net document control helps:
mvc pdf editor: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net annotate pdf: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net dicom viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net ppt viewer: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net tiff viewer control: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
asp.net edit pdf text color: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET


As we mentioned, C# programmers can adjust window center and window width values for DICOM image during converting DICOM document to other images and documents. As for window center and window width, they are similar to the notions of contrast and brittleness in common image processing.


In this section, we will illustrate the C#.NET class code for you to set and control DICOM image file conversion through window center and window width. If you want to know other DICOM rendering options mentioned above, please directly download the package of DocImage SDK for .NET and see its developer guide.




C# Class Code for DICOM Rendering Options Setting



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;


Below is C# sample code to set DICOM image file rendering options: window center and window width. Please note that, some .NET DICOM Conversion DLLs should be added to your C#.NET project first.




            DCMDocument doc = new DCMDocument(@"C:\demo1.dcm");
            // get the first page
            DCMPage page = (DCMPage)doc.GetPage(0);

            // you can get recommended range for value of window width and window center
            int[] centerRange = page.GetRecommendedWindowCenter();
            int[] widthRange = page.GetRecommendedWindowWidth();

            // for illustration purpose, we choose random value in the range
            Random randomGenerater = new Random();
            int randomCenter = randomGenerater.Next(centerRange[0], centerRange[1]);
            int randomWidth = randomGenerater.Next(widthRange[0], widthRange[1]);

            // get REImage with specified values of width and center
            Bitmap img = page.GetModifiedREImage(randomWidth, randomCenter);

            // save the image in file
            img.Save(@"c:\dicom.png");