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:
asp.net tiff document viewer: ASP.NET Tiff Document Viewer: view, annotate Tiff files in HTML using C# Control
asp.net pdf editor: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net powerpoint document viewer: ASP.NET PowerPoint Document Viewer Control: view pptx files online in C# using ASP.NET
document redact asp.net: Redact document ASP.NET: add, delete, apply redaction on PDF files in web browser using C#.net
asp.net annotate pdf: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net pdf document viewer: ASP.NET PDF Document Viewer in C#: view, annotate, redact Adobe PDF files online in ASP.NET
asp.net edit pdf page: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#

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;





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