Converts grayscale signed image to an unsigned one by shifting all the negative value of the image data, so the minimum negative value will be zero.
public class MinimumToZeroCommand : Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommand, Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommandPublic Class MinimumToZeroCommandInherits Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommandImplements Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommand
public sealed class MinimumToZeroCommand : Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommand@interface LTMinimumToZeroCommand : LTRasterCommandpublic class MinimumToZeroCommand extends RasterCommandfunction Leadtools.ImageProcessing.Core.MinimumToZeroCommand()public ref class MinimumToZeroCommand : public Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommand, Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommandThis command is similar to ConvertSignedToUnsignedCommand. This command automatically determines the value to be shift in order to convert the image to unsigned image. This command is used usually before the command ZeroToNegativeCommand. This command updates the Signed property of the RasterImage. This command also updates the MinValue and MaxValue properties of the RasterImage. This command does not support 8-bit images. This command supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits. This command supports signed data images. This command does not support 32-bit grayscale images. 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.
This command will apply MultiscaleEnhancementCommand on a signed image, but since the MultiscaleEnhancementCommand does not support signed images, we will convert the image to an unsigned image, apply the effect, and then convert it back to a signed image.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.CorePublic Sub MinimumToZeroCommandExample()Dim codecs As New RasterCodecs()codecs.ThrowExceptionsOnInvalidImages = TrueDim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE2.dcm"))' Prepare the command' Convert the image to unsigned image by shifting the negative values to become positive.Dim MinToZCommand As MinimumToZeroCommand = New MinimumToZeroCommandMinToZCommand.Run(leadImage)' Apply multiscale enhancementDim MultiScaleCommand As MultiscaleEnhancementCommand = New MultiscaleEnhancementCommand(2000, 4, -1, 0, 0, MultiscaleEnhancementCommandType.Gaussian, MultiscaleEnhancementCommandFlags.EdgeEnhancement)' Convert the image back to signed by shifting the same amount in the negative side.Dim command As ZeroToNegativeCommand = New ZeroToNegativeCommandcommand.MinimumInput = -32767command.MaximumInput = 32766command.MinimumOutput = 0command.MaximumOutput = 65535command.ShiftAmount = MinToZCommand.ShiftAmountcommand.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 MinimumToZeroCommandExample(){// Load an imageRasterCodecs codecs = new RasterCodecs();codecs.ThrowExceptionsOnInvalidImages = true;RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE2.dcm"));// Prepare the command// Convert the image to unsigned image by shifting the negative values to become positive.MinimumToZeroCommand MinToZCommand = new MinimumToZeroCommand();MinToZCommand.Run(image);// Apply multiscale enhancementMultiscaleEnhancementCommand MultiScaleCommand = new MultiscaleEnhancementCommand(2000, 4, -1, 0, 0, MultiscaleEnhancementCommandType.Gaussian, MultiscaleEnhancementCommandFlags.EdgeEnhancement);// Convert the image back to signed by shifting the same amount in the negative side.ZeroToNegativeCommand command = new ZeroToNegativeCommand();command.MinimumInput = -32767;command.MaximumInput = 32766;command.MinimumOutput = 0;command.MaximumOutput = 65535;command.ShiftAmount = MinToZCommand.ShiftAmount;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 MinimumToZeroCommandExample(){// 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 command// Convert the image to unsigned image by shifting the negative values to become positive.MinimumToZeroCommand MinToZCommand = new MinimumToZeroCommand();MinToZCommand.Run(image);// Apply multiscale enhancementMultiscaleEnhancementCommand MultiScaleCommand = new MultiscaleEnhancementCommand(2000, 4, -1, 0, 0, MultiscaleEnhancementCommandType.Gaussian, MultiscaleEnhancementCommandFlags.EdgeEnhancement);// Convert the image back to signed by shifting the same amount in the negative side.ZeroToNegativeCommand command = new ZeroToNegativeCommand();command.MinimumInput = -32767;command.MaximumInput = 32766;command.MinimumOutput = 0;command.MaximumOutput = 65535;command.ShiftAmount = MinToZCommand.ShiftAmount;command.Run(image);}
using Leadtools;using Leadtools.Examples;using Leadtools.Codecs;using Leadtools.ImageProcessing.Core;public void MinimumToZeroCommandExample(RasterImage image, Stream outStream){// Prepare the command// Convert the image to unsigned image by shifting the negative values to become positive.MinimumToZeroCommand MinToZCommand = new MinimumToZeroCommand();MinToZCommand.Run(image);// Apply multiscale enhancementMultiscaleEnhancementCommand MultiScaleCommand = new MultiscaleEnhancementCommand(2000, 4, -1, 0, 0, MultiscaleEnhancementCommandType.Gaussian, MultiscaleEnhancementCommandFlags.EdgeEnhancement);// Convert the image back to signed by shifting the same amount in the negative side.ZeroToNegativeCommand command = new ZeroToNegativeCommand();command.MinimumInput = -32767;command.MaximumInput = 32766;command.MinimumOutput = 0;command.MaximumOutput = 65535;command.ShiftAmount = MinToZCommand.ShiftAmount;command.Run(image);// Save result imageRasterCodecs codecs = new RasterCodecs();codecs.Save(image, outStream, RasterImageFormat.DicomGray, image.BitsPerPixel);image.Dispose();}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.CorePublic Sub MinimumToZeroCommandExample(ByVal image As RasterImage, ByVal outStream As Stream)' Prepare the command' Convert the image to unsigned image by shifting the negative values to become positive.Dim MinToZCommand As MinimumToZeroCommand = New MinimumToZeroCommand()MinToZCommand.Run(image)' Apply multiscale enhancementDim MultiScaleCommand As MultiscaleEnhancementCommand = New MultiscaleEnhancementCommand(2000, 4, -1, 0, 0, _MultiscaleEnhancementCommandType.Gaussian, _MultiscaleEnhancementCommandFlags.EdgeEnhancement)' Convert the image back to signed by shifting the same amount in the negative side.Dim command As ZeroToNegativeCommand = New ZeroToNegativeCommand()command.MinimumInput = -32767command.MaximumInput = 32766command.MinimumOutput = 0command.MaximumOutput = 65535command.ShiftAmount = MinToZCommand.ShiftAmountcommand.Run(image)' Save result imageDim codecs As RasterCodecs = New RasterCodecs()codecs.Save(image, outStream, RasterImageFormat.DicomGray, image.BitsPerPixel)image.Dispose()End Sub
Leadtools.ImageProcessing.Core Namespace
Leadtools.ImageProcessing.ClearNegativePixelsCommand
ConvertSignedToUnsignedCommand Class
|
Products |
Support |
Feedback: MinimumToZeroCommand 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.