Leadtools.ImageProcessing.Core Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.10
KaufmannRegionCommand Class
See Also  Members   Example 
Leadtools.ImageProcessing.Core Namespace : KaufmannRegionCommand Class




Sets a Kaufmann region based on the color value of the specified point in the enhanced image (KaufmannProcessedImage). This command is available in the Raster Pro and above toolkits.

Syntax

Visual Basic (Declaration) 
Public Class KaufmannRegionCommand 
   Inherits RasterCommand
   Implements IRasterCommand 
Visual Basic (Usage)Copy Code
Dim instance As KaufmannRegionCommand
C# 
public class KaufmannRegionCommand : RasterCommand, IRasterCommand  
Managed Extensions for C++ 
public __gc class KaufmannRegionCommand : public RasterCommand, IRasterCommand  
C++/CLI 
public ref class KaufmannRegionCommand : public RasterCommand, IRasterCommand  

Example

Visual BasicCopy Code
ImageProcessing.Core.KaufmannRegionCommand
   Public Sub KaufmannRegionCommandExample()
      RasterCodecs.Startup()
      Dim codecs As New RasterCodecs()
      codecs.ThrowExceptionsOnInvalidImages = True

      Dim leadImage As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image3.dic")

      ' Prepare the command
      Dim startPoint As Point = New Point((leadImage.Width \ 2), (leadImage.Height \ 2))

      ' apply the command in order to get the pixels count of the first region.
      Dim KaufmannCommandInner As KaufmannRegionCommand = New KaufmannRegionCommand
      KaufmannCommandInner.CombineMode = RasterRegionCombineMode.Set
      KaufmannCommandInner.MaximumInput = 54
      KaufmannCommandInner.MinimumInput = 110
      KaufmannCommandInner.Radius = 21
      KaufmannCommandInner.RegionStart = startPoint
      KaufmannCommandInner.RegionThreshold = 13
      KaufmannCommandInner.RemoveHoles = True
      KaufmannCommandInner.Run(leadImage)

      Dim firstPixelCount As Integer = KaufmannCommandInner.PixelsCount

      ' apply the command once more.
      Dim KaufmannCommandOuter As KaufmannRegionCommand = New KaufmannRegionCommand(29, 51, 229, 207, startPoint, True, RasterRegionCombineMode.Set)
      KaufmannCommandOuter.Run(leadImage)

      Dim secondPixelCount As Integer = KaufmannCommandOuter.PixelsCount

      ' print the ratio between the first and the second region.
      Dim result As Double = (firstPixelCount * 1.0 / secondPixelCount)
      MessageBox.Show(result.ToString())

      RasterCodecs.Shutdown()
   End Sub
C#Copy Code
ImageProcessing.Core.KaufmannRegionCommand 
      public void KaufmannRegionCommandExample() 
      { 
         // Load an image 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
         codecs.ThrowExceptionsOnInvalidImages = true; 
 
         RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image3.dic"); 
 
         // Prepare the command 
         Point startPoint = new Point((image.Width / 2), (image.Height / 2)); 
 
         // apply the command in order to get the pixels count of the first region. 
         KaufmannRegionCommand KaufmannCommandInner = new KaufmannRegionCommand(); 
         KaufmannCommandInner.CombineMode = RasterRegionCombineMode.Set; 
         KaufmannCommandInner.MaximumInput = 54; 
         KaufmannCommandInner.MinimumInput = 110; 
         KaufmannCommandInner.Radius = 21; 
         KaufmannCommandInner.RegionStart = startPoint; 
         KaufmannCommandInner.RegionThreshold = 13; 
         KaufmannCommandInner.RemoveHoles = true; 
         KaufmannCommandInner.Run(image); 
 
         int firstPixelCount = KaufmannCommandInner.PixelsCount; 
 
         // apply the command once more. 
         KaufmannRegionCommand KaufmannCommandOuter = new KaufmannRegionCommand(29, 51, 229, 207, startPoint, true, RasterRegionCombineMode.Set); 
         KaufmannCommandOuter.Run(image); 
 
         int secondPixelCount = KaufmannCommandOuter.PixelsCount; 
 
         // print the ratio between the first and the second region. 
         double result = (firstPixelCount * 1.0 / secondPixelCount); 
         MessageBox.Show(result.ToString()); 
 
         RasterCodecs.Shutdown(); 
      }

Remarks

This class is used to calculate the Kaufmann ratio (size of the corpus callosum / size of the brain sphere). The corpus callosum is a white matter structure that consists of nerve fibers that connect the left and right hemispheres of the brain.
Prior to creating the Kaufmann region, this command performs noise reduction on an image using enhancement procedures such as the Gaussian blur. Then this command class (using a magic wand technique) creates a Kaufmann region that starts with the color value of the point specified in RegionStart and ends at the value specified in RegionThreshold. The region is placed in KaufmannProcessedImage. The KaufmannProcessedImage contains the data from Image, (enhanced using the internal enhancing procedures) and the resulting region. The Image itself is not changed. The area of the resulting region can be used to calculate the Kaufmann ratio.
To calculate the Kaufmann ratio do the following steps:
  1. Call the command to make a region around the corpus callosum, adjusting the following properties in order to make the region around the area you want, and then save the PixelsCount value:
    • CombineMode property - a RasterRegionCombineMode value that specifies how the area being added is to be combined.
    • KaufmannProcessedImage property - the RasterImage that contains the region.
    • MaximumInput property - an integer which specifies which values are to be considered to be highlights. This value is used internally to brighten the highlights to make region selection easier.
    • MinimumInput property - an integer which specifies which values are to be considered to be shadows. This value is used internally to darken the shadows to make region selection easier.
    • Radius property - the size of the neighborhood used in the internal blurring process.
    • RegionStart property - the starting point for the created region.
    • RegionThreshold property - the stopping point for the magic wand region expansion. If the difference between the color of the new pixel which is about to be included in the region and the pixel color which is pointed by Region exceeds the difference between the RegionThreshold and the pixel color which is pointed to by RegionStart, the pixel will not be included.
    • RemoveHoles property - value that specifies whether to remove all holes from the created region.
  2. Call the command a second time to make a region around the brain sphere after adjusting the properties appropriately, and save the PixelsCount value.
  3. Now calculate the ratio.
  4. This command does not support 32-bit grayscale images.
For more information on how to calculate the brain ratio refer to the example below.
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.

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.Core.KaufmannRegionCommand

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also