Converts a 12 or 16-bit grayscale image to an 16-bit grayscale or a 48-bit RGB image. This class is available in Document/Medical toolkits only.
public class WindowLevelExtCommand : Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommand, Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommandPublic Class WindowLevelExtCommandInherits Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommandImplements Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommand
public sealed class WindowLevelExtCommand : Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommand@interface LTWindowLevelExtCommand : LTRasterCommandpublic class WindowLevelExtCommand extends RasterCommandfunction Leadtools.ImageProcessing.Core.WindowLevelExtCommand()public ref class WindowLevelExtCommand : public Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommand, Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommandOnly TIFF and DICOM file formats are capable of saving images that have been window-leveled. Images can be window-leveled by calling WindowLevelExtCommand and specifying RasterWindowLevelMode.PaintAndProcessing for the flags parameter, by using the WindowLevelExtCommand or by loading an image from a file format that supports Window Leveling. If a window-leveled image is saved as any other file format, the image data will be converted before being saved. For more information, refer to Saving Window-Leveled Images. See WindowLevelCommand for a version of this class using 8-bit lookup tables. LEADTOOLS supports two types of LUTs for 10-16-bit grayscale images (8-bit LUT and 16-bit LUT). Typical grayscale image display and processing is done using an 8-bit LUT. But, you can also use a 16-bit LUT, which offers more precision. Some special video cards and monitors also support display of grayscale images using a 16-bit LUT. For more information, refer to Introduction to Image Processing With LEADTOOLS. For more information, refer to Grayscale Images.
Run the WindowLevelExtCommand on an image.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.CorePublic Sub WindowLevelExtCommandExample()'Load an imageDim codecs As New RasterCodecs()codecs.ThrowExceptionsOnInvalidImages = TrueDim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm"))' Prepare the commandDim x As LongDim y As LongDim Size As LongDim LookupTable() As RasterColor16Dim MinMaxBits As MinMaxBitsCommand = New MinMaxBitsCommand()Dim MinMaxValues As MinMaxValuesCommand = New MinMaxValuesCommand()Dim Command As WindowLevelExtCommand = New WindowLevelExtCommand()MinMaxBits.Run(image)MinMaxValues.Run(image)Size = (1 << (MinMaxBits.MaximumBit - MinMaxBits.MinimumBit + 1))LookupTable = New RasterColor16(CInt(Size)) {}' fill the first half of the LookupTable with RED.For x = 0 To CInt(Size / 2)LookupTable(CInt(x)) = New RasterColor16(RasterColor16.MaximumComponent, 0, 0)Next' fill the rest with gray values.For x = CInt(Size / 2) To Sizey = CLng(((x - MinMaxValues.MinimumValue) * RasterColor16.MaximumComponent / (MinMaxValues.MaximumValue - MinMaxValues.MinimumValue)))LookupTable(CInt(x)) = New RasterColor16(CInt(y), CInt(y), CInt(y))NextCommand.HighBit = MinMaxBits.MaximumBitCommand.LowBit = MinMaxBits.MinimumBitCommand.LookupTable = LookupTableCommand.Order = RasterByteOrder.BgrCommand.Run(image)End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Core;public void WindowLevelExtCommandExample(){// Load an imageRasterCodecs codecs = new RasterCodecs();codecs.ThrowExceptionsOnInvalidImages = true;RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm"));// Prepare the commandint x;int y;int Size;RasterColor16 [] LookupTable;MinMaxBitsCommand MinMaxBits = new MinMaxBitsCommand();MinMaxValuesCommand MinMaxValues = new MinMaxValuesCommand();WindowLevelExtCommand command = new WindowLevelExtCommand();MinMaxBits.Run(image);MinMaxValues.Run(image);Size = (1 <<(MinMaxBits.MaximumBit - MinMaxBits.MinimumBit + 1));LookupTable = new Leadtools.RasterColor16[Size];// fill the first half of the LookupTable with RED.for(x = 0; x < Size / 2; x++)LookupTable[x] = new Leadtools.RasterColor16(Leadtools.RasterColor16.MaximumComponent, 0, 0);// fill the rest with gray values.for(x = Size / 2; x < Size; x++){y = (int)((x - MinMaxValues.MinimumValue) * Leadtools.RasterColor16.MaximumComponent / (MinMaxValues.MaximumValue - MinMaxValues.MinimumValue));LookupTable[x] = new Leadtools.RasterColor16(y, y, y);}command.HighBit = MinMaxBits.MaximumBit;command.LowBit = MinMaxBits.MinimumBit;command.LookupTable = LookupTable;command.Order = Leadtools.RasterByteOrder.Bgr;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 WindowLevelExtCommandExample(){// Load an imageRasterCodecs codecs = new RasterCodecs();codecs.ThrowExceptionsOnInvalidImages = true;// Load the imagestring srcFileName = @"Assets\Image2.dcm";StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile));// Prepare the commandint x;int y;int Size;RasterColor16 [] LookupTable;MinMaxBitsCommand MinMaxBits = new MinMaxBitsCommand();MinMaxValuesCommand MinMaxValues = new MinMaxValuesCommand();WindowLevelExtCommand command = new WindowLevelExtCommand();MinMaxBits.Run(image);MinMaxValues.Run(image);Size = (1 <<(MinMaxBits.MaximumBit - MinMaxBits.MinimumBit + 1));LookupTable = new Leadtools.RasterColor16[Size];// fill the first half of the LookupTable with RED.for(x = 0; x < Size / 2; x++)LookupTable[x] = Leadtools.RasterColor16Helper.Create(Leadtools.RasterColor16Helper.MaximumComponent, 0, 0);// fill the rest with gray values.for(x = Size / 2; x < Size; x++){y = (int)((x - MinMaxValues.MinimumValue) * Leadtools.RasterColor16Helper.MaximumComponent / (MinMaxValues.MaximumValue - MinMaxValues.MinimumValue));LookupTable[x] = Leadtools.RasterColor16Helper.Create(y, y, y);}command.HighBit = MinMaxBits.MaximumBit;command.LowBit = MinMaxBits.MinimumBit;command.LookupTable = LookupTable;command.Order = Leadtools.RasterByteOrder.Bgr;command.Run(image);}
using Leadtools;using Leadtools.Examples;using Leadtools.Codecs;using Leadtools.ImageProcessing.Core;public void WindowLevelExtCommandExample(RasterImage image, Stream outStream){// Prepare the commandint x;int y;int Size;RasterColor16[] LookupTable;MinMaxBitsCommand MinMaxBits = new MinMaxBitsCommand();MinMaxValuesCommand MinMaxValues = new MinMaxValuesCommand();WindowLevelExtCommand command = new WindowLevelExtCommand();MinMaxBits.Run(image);MinMaxValues.Run(image);Size = (1 << (MinMaxBits.MaximumBit - MinMaxBits.MinimumBit + 1));LookupTable = new Leadtools.RasterColor16[Size];// fill the first half of the LookupTable with RED.for (x = 0; x < Size / 2; x++)LookupTable[x] = new Leadtools.RasterColor16(Leadtools.RasterColor16.MaximumComponent, 0, 0);// fill the rest with gray values.for (x = Size / 2; x < Size; x++){y = (int)((x - MinMaxValues.MinimumValue) * Leadtools.RasterColor16.MaximumComponent / (MinMaxValues.MaximumValue - MinMaxValues.MinimumValue));LookupTable[x] = new Leadtools.RasterColor16(y, y, y);}command.HighBit = MinMaxBits.MaximumBit;command.LowBit = MinMaxBits.MinimumBit;command.LookupTable = LookupTable;command.Order = Leadtools.RasterByteOrder.Bgr;command.Run(image);// Save result imageRasterCodecs codecs = new RasterCodecs();codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24);image.Dispose();}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.CorePublic Sub WindowLevelExtCommandExample(ByVal image As RasterImage, ByVal outStream As Stream)' Prepare the commandDim x As IntegerDim y As IntegerDim Size As IntegerDim LookupTable As RasterColor16()Dim MinMaxBits As MinMaxBitsCommand = New MinMaxBitsCommand()Dim MinMaxValues As MinMaxValuesCommand = New MinMaxValuesCommand()Dim command As WindowLevelExtCommand = New WindowLevelExtCommand()MinMaxBits.Run(image)MinMaxValues.Run(image)Size = (1 << (MinMaxBits.MaximumBit - MinMaxBits.MinimumBit + 1))LookupTable = New RasterColor16(Size - 1) {}' fill the first half of the LookupTable with RED.x = 0Do While x < Size / 2LookupTable(x) = New RasterColor16(RasterColor16.MaximumComponent, 0, 0)x += 1Loop' fill the rest with gray values.x = Size / 2Do While x < Sizey = CInt((x - MinMaxValues.MinimumValue) * RasterColor16.MaximumComponent / (MinMaxValues.MaximumValue - MinMaxValues.MinimumValue))LookupTable(x) = New RasterColor16(y, y, y)x += 1Loopcommand.HighBit = MinMaxBits.MaximumBitcommand.LowBit = MinMaxBits.MinimumBitcommand.LookupTable = LookupTablecommand.Order = RasterByteOrder.Bgrcommand.Run(image)' Save result imageDim codecs As RasterCodecs = New RasterCodecs()codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24)image.Dispose()End Sub
Leadtools.ImageProcessing.Core Namespace
Introduction to Image Processing With LEADTOOLS
ApplyVoiLookupTableCommand Class
Leadtools.ImageProcessing.Color.GrayScaleToDuotoneCommand
|
Products |
Support |
Feedback: WindowLevelExtCommand Class - Leadtools.ImageProcessing.Core |
Introduction |
Help Version 19.0.2017.3.21
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.