public WindowLevelCommand(int lowBit,int highBit,RasterColor[] lookupTable,RasterByteOrder order)
Public Function New( _ByVal lowBit As Integer, _ByVal highBit As Integer, _ByVal lookupTable() As RasterColor, _ByVal order As RasterByteOrder _)
- (instancetype)initWithLookupTable:(NSArray<LTRasterColor *> *)lookupTablelowBit:(NSInteger)lowBithighBit:(NSInteger)highBitorder:(LTRasterByteOrder)order
public WindowLevelCommand(int lowBit,int highBit,RasterColor[] lookupTable,RasterByteOrder order)
public:WindowLevelCommand(int lowBit,int highBit,array<RasterColor>^ lookupTable,RasterByteOrder order)
lowBit
Value indicating the low bit used for leveling. 0 <= lowBit <= highBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale).
highBit
Value indicating the high bit used for leveling. 0 <= lowBit <= highBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale).
lookupTable
Optional 8-bit lookup table that can be used to implement a user defined conversion. For every intensity value between 0 and 2 raised to the power of (highBit - lowBit + 1) - 1 there should be a corresponding entry in the lookup table that contains an RGB quad. If lookupTable is null, the conversion is a normal shift (right or left) and the output image is 8-bit grayscale. If lookupTable is not null, the output image is a 24-bit image.
order
Value indicating the color order if the output image will be 24-bit. If LookupTable is null, this parameter is ignored.
Run the WindowLevelCommand on an image.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Core;public void WindowLevelConstructorExample(){// Load an imageRasterCodecs codecs = new RasterCodecs();codecs.ThrowExceptionsOnInvalidImages = true;RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm"));// Prepare the command//Change the image to 16-bit grayscaleGrayscaleCommand graycommand = new GrayscaleCommand(16);graycommand.Run(image);MinMaxBitsCommand MinMaxBits = new MinMaxBitsCommand();MinMaxBits.Run(image);MinMaxValuesCommand MinMaxValues = new MinMaxValuesCommand();MinMaxValues.Run(image);int Size = (1 << (MinMaxBits.MaximumBit - MinMaxBits.MinimumBit + 1));RasterColor[] LookupTable = new RasterColor[Size];// fill the first half of the LookupTable with RED.for (int x = 0; x < Size / 2; x++)LookupTable[x] = new RasterColor(255, 0, 0);// fill the rest with gray values.for (int x = Size / 2; x < Size; x++){byte y = (byte)((x - MinMaxValues.MinimumValue) * 255 / (MinMaxValues.MaximumValue - MinMaxValues.MinimumValue));LookupTable[x] = new RasterColor(y, y, y);}WindowLevelCommand command = new WindowLevelCommand(MinMaxBits.MinimumBit, MinMaxBits.MaximumBit, LookupTable, RasterByteOrder.Bgr);command.Run(image);}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.CorePublic Sub WindowLevelConstructorExample()Dim codecs As New RasterCodecs()codecs.ThrowExceptionsOnInvalidImages = TrueDim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm"))' Prepare the command'Change the image to 16-bit grayscaleDim graycommand As GrayscaleCommand = New GrayscaleCommand(16)graycommand.Run(leadImage)Dim MinMaxBits As MinMaxBitsCommand = New MinMaxBitsCommandMinMaxBits.Run(leadImage)Dim MinMaxValues As MinMaxValuesCommand = New MinMaxValuesCommandMinMaxValues.Run(leadImage)Dim Size As Integer = (1 << (MinMaxBits.MaximumBit - MinMaxBits.MinimumBit + 1))Dim LookupTable() As RasterColorReDim LookupTable(Size - 1)' fill the first half of the LookupTable with RED.Dim x As IntegerFor x = 0 To (Size \ 2 - 1)LookupTable(x) = New RasterColor(255, 0, 0)Next' fill the rest with gray values.For x = Size \ 2 To Size - 1Dim y As Byte = CType((x) * 255 / (Size), Byte)LookupTable(x) = New RasterColor(y, y, y)NextDim command As WindowLevelCommand = New WindowLevelCommand(MinMaxBits.MinimumBit, MinMaxBits.MaximumBit, LookupTable, RasterByteOrder.Bgr)command.Run(leadImage)End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
