|
Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.6.27
|
| Leadtools.ImageProcessing.Core Namespace : WindowLevelExtCommand Class |







public class WindowLevelExtCommand : Leadtools.ImageProcessing.RasterCommand, Leadtools.ImageProcessing.IRasterCommand
'Declaration
Public Class WindowLevelExtCommand Inherits Leadtools.ImageProcessing.RasterCommand Implements Leadtools.ImageProcessing.IRasterCommand
'Usage
Dim instance As WindowLevelExtCommand
public sealed class WindowLevelExtCommand : Leadtools.ImageProcessing.IRasterCommand
@interface LTWindowLevelExtCommand : LTRasterCommand
public class WindowLevelExtCommand extends RasterCommand
function Leadtools.ImageProcessing.Core.WindowLevelExtCommand()
public ref class WindowLevelExtCommand : public Leadtools.ImageProcessing.RasterCommand, Leadtools.ImageProcessing.IRasterCommand
Run the WindowLevelExtCommand on an image.
Copy Code
Imports Leadtools Imports Leadtools.Codecs Imports Leadtools.ImageProcessing Imports Leadtools.ImageProcessing.Core Public Sub WindowLevelExtCommandExample() 'Load an image Dim codecs As New RasterCodecs() codecs.ThrowExceptionsOnInvalidImages = True Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm")) ' Prepare the command Dim x As Long Dim y As Long Dim Size As Long Dim 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(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 Size y = CLng(((x - MinMaxValues.MinimumValue) * RasterColor16.MaximumComponent / (MinMaxValues.MaximumValue - MinMaxValues.MinimumValue))) LookupTable(CInt(x)) = New RasterColor16(CInt(y), CInt(y), CInt(y)) Next Command.HighBit = MinMaxBits.MaximumBit Command.LowBit = MinMaxBits.MinimumBit Command.LookupTable = LookupTable Command.Order = RasterByteOrder.Bgr Command.Run(image) 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; using Leadtools.ImageProcessing.Core; public void WindowLevelExtCommandExample() { // Load an image RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm")); // Prepare the command int 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"; }
function WindowLevelExtCommandExample() { var codecs = new Leadtools.Codecs.RasterCodecs(); codecs.throwExceptionsOnInvalidImages = true; // Load the image var srcFileName = "Assets\\Image2.dcm"; var processedImage; return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function (loadFile) { return codecs.loadAsync(Leadtools.LeadStreamFactory.create(loadFile)); }).then(function (image) { // Prepare the command with (Leadtools.ImageProcessing.Core) { var x; var y; var Size; var LookupTable = new Array(); var MinMaxBits = new MinMaxBitsCommand(); var MinMaxValues = new MinMaxValuesCommand(); var command = new WindowLevelExtCommand(); MinMaxBits.run(image); MinMaxValues.run(image); Size = (1 << (MinMaxBits.maximumBit - MinMaxBits.minimumBit + 1)); // 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 = (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.Codecs;
using Leadtools.ImageProcessing.Core;
public async Task WindowLevelExtCommandExample()
{
// 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
int 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 command int 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 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 WindowLevelExtCommandExample(ByVal image As RasterImage, ByVal outStream As Stream) ' Prepare the command Dim x As Integer Dim y As Integer Dim Size As Integer Dim 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 = 0 Do While x < Size / 2 LookupTable(x) = New RasterColor16(RasterColor16.MaximumComponent, 0, 0) x += 1 Loop ' fill the rest with gray values. x = Size / 2 Do While x < Size y = CInt((x - MinMaxValues.MinimumValue) * RasterColor16.MaximumComponent / (MinMaxValues.MaximumValue - MinMaxValues.MinimumValue)) LookupTable(x) = New RasterColor16(y, y, y) x += 1 Loop command.HighBit = MinMaxBits.MaximumBit command.LowBit = MinMaxBits.MinimumBit command.LookupTable = LookupTable command.Order = RasterByteOrder.Bgr command.Run(image) ' Save result image Dim codecs As RasterCodecs = New RasterCodecs() codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24) image.Dispose() End Sub
WindowLevelExtCommand Members
Leadtools.ImageProcessing.Core Namespace
Introduction to Image Processing With LEADTOOLS
Grayscale Images
WindowLevelCommand Class
ApplyVoiLookupTableCommand Class
Leadtools.RasterPalette.WindowLevelFillLookupTable(Leadtools.RasterColor[],Leadtools.RasterColor,Leadtools.RasterColor,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,Leadtools.RasterPaletteWindowLevelFlags)
Leadtools.ImageProcessing.Color.GrayScaleToDuotoneCommand
Leadtools.ImageProcessing.Color.GrayScaleToMultitoneCommand
SelectDataCommand Class
ShiftDataCommand Class