Remaps the image pixels using a LookupTable (LookupTable).
public class ApplyModalityLookupTableCommand : Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommand, Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommandPublic Class ApplyModalityLookupTableCommandInherits Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommandImplements Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommand
public sealed class ApplyModalityLookupTableCommand : Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommand@interface LTApplyModalityLookupTableCommand : LTRasterCommandpublic class ApplyModalityLookupTableCommand extends RasterCommandfunction Leadtools.ImageProcessing.Core.ApplyModalityLookupTableCommand()public ref class ApplyModalityLookupTableCommand : public Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommand, Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommandThis command is available in the Document and Medical Imaging toolkits.
This class is similar to RemapIntensityCommand because it remaps the image pixel values through a LookupTable. The class differs from RemapIntensityCommand as follows: ApplyModalityLookupTableCommand allows you to specify an incomplete LookupTable. Values less than the first mapped index will be mapped to the first entry in the palette. Values higher than "first mapped index" + "LookupTable length" will be mapped to the last entry in the LookupTable. ApplyModalityLookupTableCommand only works on grayscale images. ApplyModalityLookupTableCommand can create signed images. The output image will be signed (if ModalityLookupTableCommandFlags.SignedLookupTable is set), or unsigned (ModalityLookupTableCommandFlags.SignedLookupTable is not set).
The values in the LookupTable will be masked such that only the useful bits in the image are considered. The values are considered as if the image pixel values are normalized, LowBit = 0.
For example, let's say the image is: BitsPerPixel = 12 LowBit = 4 HighBit = 10 In this case, there are 10-4+1=7 valid bits. This means that there are 128 values to remap. For every pixel, ApplyModalityLookupTableCommand will do the following:
Take the pixel value, shift it to the right by 4 and mask out the high bits, producing a value (val = 0..127).
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.
Run the ApplyModalityLookupTableCommand on an image.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.CorePublic Sub ApplyModalityLookupTableCommandExample()Dim codecs As New RasterCodecs()codecs.ThrowExceptionsOnInvalidImages = TrueDim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE2.dcm"))' Prepare the commandDim i As IntegerDim pLookupTable() As ShortReDim pLookupTable(65535)Dim LookupTableDescriptor As DicomLookupTableDescriptor = New DicomLookupTableDescriptor' set a LookupTable which reduces the intensity of each pixel to halfFor i = 0 To 65535pLookupTable(i) = CType(i / 2, Int16)Next' fill the LookupTableDescriptor objectLookupTableDescriptor.FirstStoredPixelValueMapped = 0LookupTableDescriptor.EntryBits = 16' apply the LookupTableDim command As ApplyModalityLookupTableCommand = New ApplyModalityLookupTableCommandcommand.Flags = ModalityLookupTableCommandFlags.Nonecommand.LookupTable = pLookupTablecommand.LookupTableDescriptor = LookupTableDescriptorcommand.Run(leadImage)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.Core;public void ApplyModalityLookupTableCommandExample(){// Load an imageRasterCodecs codecs = new RasterCodecs();codecs.ThrowExceptionsOnInvalidImages = true;RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE2.dcm"));// Prepare the commandint i;short[] pLookupTable = new short[0x10000];DicomLookupTableDescriptor LookupTableDescriptor = new DicomLookupTableDescriptor();// set a LookupTable which reduces the intensity of each pixel to halffor(i = 0; i <= 0xFFFF; i++)pLookupTable[i] = (short)(i / 2);// fill the LookupTableDescriptor objectLookupTableDescriptor.FirstStoredPixelValueMapped = 0;LookupTableDescriptor.EntryBits = 16;// apply the LookupTableApplyModalityLookupTableCommand command = new ApplyModalityLookupTableCommand();command.Flags = ModalityLookupTableCommandFlags.None;command.LookupTable = pLookupTable;command.LookupTableDescriptor = LookupTableDescriptor;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 ApplyModalityLookupTableCommandExample(){// 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 i;short[] pLookupTable = new short[0x10000];DicomLookupTableDescriptor LookupTableDescriptor = new DicomLookupTableDescriptor();// set a LookupTable which reduces the intensity of each pixel to halffor(i = 0; i <= 0xFFFF; i++)pLookupTable[i] = (short)(i / 2);// fill the LookupTableDescriptor objectLookupTableDescriptor.FirstStoredPixelValueMapped = 0;LookupTableDescriptor.EntryBits = 16;// apply the LookupTableApplyModalityLookupTableCommand command = new ApplyModalityLookupTableCommand();command.Flags = ModalityLookupTableCommandFlags.None;command.LookupTable = pLookupTable;command.LookupTableDescriptor = LookupTableDescriptor;command.Run(image);}
using Leadtools;using Leadtools.Examples;using Leadtools.Codecs;using Leadtools.ImageProcessing.Core;public void ApplyModalityLookupTableCommandExample(RasterImage image, Stream outStream){// Prepare the commandint i;short[] pLookupTable = new short[0x10000];DicomLookupTableDescriptor LookupTableDescriptor = new DicomLookupTableDescriptor();// set a LookupTable which reduces the intensity of each pixel to halffor (i = 0; i <= 0xFFFF; i++)pLookupTable[i] = (short)(i / 2);// fill the LookupTableDescriptor objectLookupTableDescriptor.FirstStoredPixelValueMapped = 0;LookupTableDescriptor.EntryBits = 16;// apply the LookupTableApplyModalityLookupTableCommand command = new ApplyModalityLookupTableCommand();command.Flags = ModalityLookupTableCommandFlags.None;command.LookupTable = pLookupTable;command.LookupTableDescriptor = LookupTableDescriptor;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 ApplyModalityLookupTableCommandExample(ByVal image As RasterImage, ByVal outStream As Stream)' Prepare the commandDim i As IntegerDim pLookupTable As Short() = New Short(&H10000 - 1){}Dim LookupTableDescriptor As DicomLookupTableDescriptor = New DicomLookupTableDescriptor()' set a LookupTable which reduces the intensity of each pixel to halfi = 0Do While i <= &HFFFFpLookupTable(i) = CShort(i / 2)i += 1Loop' fill the LookupTableDescriptor objectLookupTableDescriptor.FirstStoredPixelValueMapped = 0LookupTableDescriptor.EntryBits = 16' apply the LookupTableDim command As ApplyModalityLookupTableCommand = New ApplyModalityLookupTableCommand()command.Flags = ModalityLookupTableCommandFlags.Nonecommand.LookupTable = pLookupTablecommand.LookupTableDescriptor = LookupTableDescriptorcommand.Run(image)' Save result imageDim codecs As RasterCodecs = New RasterCodecs()codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24)image.Dispose()End Sub
ApplyModalityLookupTableCommand Members
Leadtools.ImageProcessing.Core Namespace
Changing Brightness and Contrast
Leadtools.ImageProcessing.Color.RemapIntensityCommand
ApplyLinearModalityLookupTableCommand Class
ApplyVoiLookupTableCommand Class
ApplyLinearVoiLookupTableCommand Class
|
Products |
Support |
Feedback: ApplyModalityLookupTableCommand 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.