←Select platform

AnisotropicDiffusionCommand Class

Summary

Performs a 2-Dimensional Anisotropic Diffusion filter on an image for reduction of varied patterned and non-patterned noise.

Syntax

C#
VB
WinRT C#
C++
public sealed class AnisotropicDiffusionCommand : Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommand
function Leadtools.ImageProcessing.Core.AnisotropicDiffusionCommand()

Remarks
  • This function is designed to reduce noise in images, more specifically, medical images. This procedure is best suited for images with a great amount of periodic noise in them.
  • The number of iterations controls the number of times the filter will be applied to the image. The lower the number of iterations, the faster the filter will perform. Higher iterations typically mean clearer results, yet ultimately clarity depends on the maximum length of vectors that can be computed from the image.
  • The higher the timestep variable, the larger the range of vectors used for the next iteration. If the timestep parameter is too high, out of range results occur because at some spots the maximum number of vectors allowed is exceeded.
  • The update parameter is very useful when using a large number of iterations on a large image, especially when the results are not known. This variable updates the image after update iterations, thus the progress of the de-noising can be witnessed.
  • If the image has a region, the function will be applied only on the region. This function 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 in the Document/Medical toolkits.
Example

Runs the AnisotropicDiffusionCommand on the Image.

C#
VB
WinRT C#
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.ImageProcessing.Core 
 
    
Public Sub AnisotropicDiffusionCommandExample() 
   Dim codecs As New RasterCodecs() 
   codecs.ThrowExceptionsOnInvalidImages = True 
   Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ImageProcessingDemo\\NaturalFruits.jpg")) 
 
   ' Prepare the command 
   Dim command As AnisotropicDiffusionCommand = New AnisotropicDiffusionCommand 
   'Apply  
   command.Iterations = 20 
   command.Smoothing = 1 
   command.TimeStep = 100.0F 
   command.MinVariation = 0.5F 
   command.MaxVariation = 0.8F 
   command.EdgeHeight = 4.0F 
   command.Update = 10 
 
 
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.Core; 
 
       
public void AnisotropicDiffusionCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\NaturalFruits.jpg")); 
 
   // Prepare the command 
   AnisotropicDiffusionCommand command = new AnisotropicDiffusionCommand(); 
   //Apply  
   command.Iterations = 20; 
   command.Smoothing = 1; 
   command.TimeStep = 100.0f; 
   command.MinVariation = 0.5f; 
   command.MaxVariation = 0.8f; 
   command.EdgeHeight = 4.0f; 
   command.Update = 10; 
   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 AnisotropicDiffusionCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
   // Load the image 
   string srcFileName = @"Assets\Image1.cmp"; 
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName); 
   RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile)); 
 
   // Prepare the command 
   AnisotropicDiffusionCommand command = new AnisotropicDiffusionCommand(); 
   //Apply  
   command.Iterations = 20; 
   command.Smoothing = 1; 
   command.TimeStep = 100.0f; 
   command.MinVariation = 0.5f; 
   command.MaxVariation = 0.8f; 
   command.EdgeHeight = 4.0f; 
   command.Update = 10; 
   command.Run(image); 
} 

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.ImageProcessing.Core Assembly
Click or drag to resize