Initializes a new ZeroToNegativeCommand class object with explicit parameters.
public ZeroToNegativeCommand(int shiftAmount,int minimumInput,int maximumInput,int minimumOutput,int maximumOutput)
Public Function New( _ByVal shiftAmount As Integer, _ByVal minimumInput As Integer, _ByVal maximumInput As Integer, _ByVal minimumOutput As Integer, _ByVal maximumOutput As Integer _)
- (instancetype)initWithShiftAmount:(NSInteger)shiftAmountminimumInput:(NSInteger)minimumInputmaximumInput:(NSInteger)maximumInputminimumOutput:(NSInteger)minimumOutputmaximumOutput:(NSInteger)maximumOutput
public ZeroToNegativeCommand(int shiftAmount,int minimumInput,int maximumInput,int minimumOutput,int maximumOutput)
public:ZeroToNegativeCommand(int shiftAmount,int minimumInput,int maximumInput,int minimumOutput,int maximumOutput)
shiftAmount
Value that is used to shift the image data to the negative side.
minimumInput
The image minimum value. This value can be obtained MinMaxValuesCommand
maximumInput
The image maximum value. This value can be obtained MinMaxValuesCommand
minimumOutput
The minimum allowed value, which means that the image data values after applying the command will not be less than this value.
maximumOutput
The maximum allowed value, which means that the image data values after applying the command will not exceed this value.
This command will apply MultiscaleEnhancementCommand on a signed image, but since MultiscaleEnhancementCommand doesn't support signed images, we will convert the image to unsigned image, apply the effect, and then convert it back to signed image.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing.Core;public void ZeroToNegativeConstructorExample(){// Load an imageRasterCodecs codecs = new RasterCodecs();codecs.ThrowExceptionsOnInvalidImages = true;RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Beauty16.jpg"));// 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(MinToZCommand.ShiftAmount, -32767, 32766, 0, 65535);command.Run(image);}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.CoreLeadtools.Examples.Support.SetLicense()Public Sub ZeroToNegativeConstructorExample()Dim codecs As New RasterCodecs()codecs.ThrowExceptionsOnInvalidImages = TrueDim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ImageProcessingDemo\Beauty16.jpg"))' 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 ZeroToNegativeCommand(MinToZCommand.ShiftAmount, -32767, 32766, 0, 65535)command.Run(leadImage)End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Examples;using Leadtools.Codecs;using Leadtools.ImageProcessing.Core;public void ZeroToNegativeConstructorExample(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(MinToZCommand.ShiftAmount, -32767, 32766, 0, 65535);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 ZeroToNegativeConstructorExample(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(MinToZCommand.ShiftAmount, -32767, 32766, 0, 65535)command.Run(image)' Save result imageDim codecs As RasterCodecs = New RasterCodecs()codecs.Save(image, outStream, RasterImageFormat.DicomGray, image.BitsPerPixel)image.Dispose()End Sub
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
