←Select platform

GetAutoScaleData(DicomAutoScaleDataFlags) Method


Returns a DicomAutoScaleData object that specifies autoscale information about the DICOM pixel data.

Public Function GetAutoScaleData( 
   ByVal flags As DicomAutoScaleDataFlags 
) As DicomAutoScaleData 
   DicomAutoScaleData^ GetAutoScaleData( 
      DicomAutoScaleDataFlags^ flags 



Indicates the type of autoscale information that is returned.

Return Value

A DicomAutoScaleData object that specifies autoscale information about the DICOM pixel data.


The DicomAutoScaleDataFlags passed to this function determines the contents of the DicomAutoScaleData object that is returned.

If flags is DicomAutoScaleDataFlags.AutoScaleSlopeIntercept , then the returned DicomAutoScaleData object specifies if the DICOM pixel data has been autoscaled, and if so, the autoscale slope and autoscale intercept. Note that this is equivalent to calling GetAutoScaleData with no arguments.

If flags is DicomAutoScaleDataFlags.InverseModalityLut , then the returned DicomAutoScaleData object defines a linear transformation that is the inverse of the linear transformation specified in the DicomDataSet. In other words, with the slope (m) being specificed by the DICOM tag (0028,1053) Rescale Slope , and the intercept (b) being specified by the DICOM tag (0028,1052) Rescale Intercept , then the linear transformation specified in the DicomDataSet is y = mx + b . Passing the DicomAutoScaleDataFlags.InverseModalityLut flag means that the returned linear transformation is x = (1/m)y - (b/m). So DicomAutoScaleData.AutoScaleSlope will be (1/m) and DicomAutoScaleData.AutoScaleIntercept will be -(b/m) .


This example calls the different versions of GetAutoScaleData, and displays the results.

using Leadtools; 
using Leadtools.Dicom; 
public void Test_DicomDataSet_GetAutoScaleData() 
   string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm"); 
   using (DicomDataSet ds = new DicomDataSet()) 
      ds.Load(dicomFileName, DicomDataSetLoadFlags.None); 
      DicomElement element = ds.FindFirstElement(null, DicomTag.PixelData, true); 
      // Get the image and apply autoscaling 
      ds.GetImage(element, 0, 0, RasterByteOrder.Gray, DicomGetImageFlags.AutoScaleModalityLut | DicomGetImageFlags.AutoScaleVoiLut | DicomGetImageFlags.AutoApplyModalityLut | DicomGetImageFlags.AutoApplyVoiLut); 
      // 1. Use the overload that takes not arguments 
      DicomAutoScaleData data = ds.GetAutoScaleData(); 
      DumpAutoScaleData("GetAutoScaleData()", data); 
      // 2. Use the overload that takes arguments, and pass 'DicomAutoScaleDataFlags.AutoScaleSlopeIntercept' 
      //    Note that this gives the same result as (1) 
      data = ds.GetAutoScaleData(DicomAutoScaleDataFlags.AutoScaleSlopeIntercept); 
      DumpAutoScaleData("GetAutoScaleData(DicomAutoScaleDataFlags.AutoScaleSlopeIntercept)", data); 
      // 3. Use the overload that takes arguments, and pass 'DicomAutoScaleDataFlags.InverseModalityLut' 
      data = ds.GetAutoScaleData(DicomAutoScaleDataFlags.InverseModalityLut); 
      DumpAutoScaleData("GetAutoScaleData(DicomAutoScaleDataFlags.InverseModalityLut)", data); 
void DumpAutoScaleData(string title, DicomAutoScaleData data) 
   string message = string.Format("IsAutoScaled: {0}\nAutoScaleSlope: {1}\nAutoScaleIntercept: {2}", 
   MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Information); 
static class LEAD_VARS 
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 


Target Platforms

Help Version 20.0.2020.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom Assembly