Sets a Kaufmann region based on the color value of the specified point in the enhanced image (KaufmannProcessedImage).
public class KaufmannRegionCommand : RasterCommand
Public Class KaufmannRegionCommand
Inherits RasterCommand
public ref class KaufmannRegionCommand : public RasterCommand
This command is available in the Document/Medical Toolkits.
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:
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:
Call the command a second time to make a region around the brain sphere after adjusting the properties appropriately, and save the PixelsCount value.
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.
Apply KaufmannRegionCommand testing on the passed image. We assumed here that the passed image is "Image3.dic".
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Core;
public void KaufmannRegionCommandExample()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image3.dcm"));
// Prepare the command
LeadPoint startPoint = new LeadPoint((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 = 110;
KaufmannCommandInner.MinimumInput = 54;
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());
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing.Core
Public Sub KaufmannRegionCommandExample()
Dim codecs As New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm"))
' Prepare the command
Dim startPoint As LeadPoint = New LeadPoint((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 = 110
KaufmannCommandInner.MinimumInput = 54
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())
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
Leadtools.ImageProcessing.Core Namespace
Leadtools.ImageProcessing.Color.ChangeIntensityCommand
Leadtools.ImageProcessing.Color.GammaCorrectCommand
Leadtools.ImageProcessing.Color.ChangeContrastCommand
Leadtools.ImageProcessing.Color.StretchIntensityCommand
Leadtools.ImageProcessing.Color.RemapIntensityCommand
Leadtools.ImageProcessing.Color.ChangeHueCommand
Leadtools.ImageProcessing.Color.ChangeSaturationCommand
Leadtools.ImageProcessing.Color.HistogramEqualizeCommand
Leadtools.ImageProcessing.Color.HistogramContrastCommand
Leadtools.ImageProcessing.Color.ColorLevelCommand
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document