←Select platform

ApplyLinearVoiLookupTableCommand Class

Summary

Sets up the paint or paint and image processing methods window leveling options for a specific image through a linear transformation described by the window center and width.

Syntax

C#
VB
Java
Objective-C
WinRT C#
C++
public sealed class ApplyLinearVoiLookupTableCommand : Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommand
@interface LTApplyLinearVoiLookupTableCommand : LTRasterCommand
public class ApplyLinearVoiLookupTableCommand extends RasterCommand
function Leadtools.ImageProcessing.Core.ApplyLinearVoiLookupTableCommand()

Remarks

This command is available in the Document and Medical Imaging toolkits.

  • This class sets up the window-leveling options for paint or paint and image processing methods for a specific image through a linear transformation described by the window center and width. In the DICOM world, this remapping of the Lookup Table is referred to as "applying a linear VOI LookupTable (LookupTable)".
  • The DICOM standard states:
  • "Window Center and Window Width specify a linear conversion from stored pixel values (after any Modality LookupTable or Rescale Slope and Intercept specified in the IOD have been applied) to values to be displayed. Window Center contains the input value that is the center of the window. Window Width contains the width of the window." Refer to "VOI LookupTable (LookupTable) Module Attributes" in the DICOM standard for more details.
  • This class does not change the image data; it only updates the entries inside the image LookupTable.
  • It is best to always set the VoiLookupTableCommandFlags.UpdateMinMax flag.
  • In the DICOM world you must set the VoiLookupTableCommandFlags.ReverseOrder flag if the photometric interpretation of the image is "MONOCHROME1", where the minimum grayscale value is intended to be displayed as white after any VOI gray scale transformations have been performed.
  • This class supports 12 and 16-bit grayscale. Support for 12 and 16-bit grayscale is available only in the Document/Medical toolkits.
  • This command does not support 32-bit grayscale images.

For more information, refer to Changing Brightness and Contrast. In Silverlight versions of LEADTOOLS, this image processing command will fail if the image data for the RasterImage object is stored internally using a Silverlight WriteableBitmap object. For more information, refer to Image Processing Command Limitations in Silverlight.

Example

Run the ApplyLinearVoiLookupTableCommand on an image.

C#
VB
WinRT C#
Silverlight C#
Silverlight VB
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.ImageProcessing.Core 
 
    
Public Sub ApplyLinearVoiLookupTableCommandExample() 
   Dim codecs As New RasterCodecs() 
   codecs.ThrowExceptionsOnInvalidImages = True 
   Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE2.dcm")) 
 
   ' Prepare the command 
   Dim command As ApplyLinearVoiLookupTableCommand = New ApplyLinearVoiLookupTableCommand 
   command.Flags = VoiLookupTableCommandFlags.None 
   command.Center = 330.0 
   command.Width = 600.0 
   ' Apply "Abdomen T1" window-level , high bit is assumed  
   ' to be "11" and low bit "0.  
   command.Run(leadImage) 
 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Core; 
 
       
public void ApplyLinearVoiLookupTableCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE2.dcm")); 
 
   // Prepare the command 
   ApplyLinearVoiLookupTableCommand command = new ApplyLinearVoiLookupTableCommand(); 
   command.Flags  = VoiLookupTableCommandFlags.None; 
   command.Center = 330.0; 
   command.Width  = 600.0; 
   // Apply "Abdomen T1" window-level , high bit is assumed  
   // to be "11" and low bit "0.  
   command.Run(image); 
 
} 
 
static class LEAD_VARS 
{ 
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
} 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Core; 
 
       
public async Task ApplyLinearVoiLookupTableCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
   // Load the image 
   string srcFileName = @"Assets\IMAGE2.dcm"; 
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName); 
   RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile)); 
 
   // Prepare the command 
   ApplyLinearVoiLookupTableCommand command = new ApplyLinearVoiLookupTableCommand(); 
   command.Flags  = VoiLookupTableCommandFlags.None; 
   command.Center = 330.0; 
   command.Width  = 600.0; 
   // Apply "Abdomen T1" window-level , high bit is assumed  
   // to be "11" and low bit "0.  
   command.Run(image); 
 
} 
using Leadtools; 
using Leadtools.Examples; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Core; 
 
public void ApplyLinearVoiLookupTableCommandExample(RasterImage image, Stream outStream) 
{ 
   // Prepare the command 
   ApplyLinearVoiLookupTableCommand command = new ApplyLinearVoiLookupTableCommand(); 
   command.Flags = VoiLookupTableCommandFlags.None; 
   command.Center = 330.0; 
   command.Width = 600.0; 
   // Apply "Abdomen T1" window-level , high bit is assumed  
   // to be "11" and low bit "0.  
   command.Run(image); 
   // Save result image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24); 
   image.Dispose(); 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.ImageProcessing.Core 
 
Public Sub ApplyLinearVoiLookupTableCommandExample(ByVal image As RasterImage, ByVal outStream As Stream) 
   ' Prepare the command 
   Dim command As ApplyLinearVoiLookupTableCommand = New ApplyLinearVoiLookupTableCommand() 
   command.Flags = VoiLookupTableCommandFlags.None 
   command.Center = 330.0 
   command.Width = 600.0 
   ' Apply "Abdomen T1" window-level , high bit is assumed  
   ' to be "11" and low bit "0.  
   command.Run(image) 
   ' Save result image 
   Dim codecs As RasterCodecs = New RasterCodecs() 
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24) 
   image.Dispose() 
End Sub 

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.ImageProcessing.Core Assembly
Click or drag to resize