Leadtools.Mrc Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
MrcSegmenter Class
See Also  Members   Example 
Leadtools.Mrc Namespace : MrcSegmenter Class




MrcSegmenter represents the main class that contains all methods needed to perform a full segmentation process.

Syntax

Visual Basic (Declaration) 
Public Class MrcSegmenter 
Visual Basic (Usage)Copy Code
Dim instance As MrcSegmenter
C# 
public class MrcSegmenter 
Managed Extensions for C++ 
public __gc class MrcSegmenter 
C++/CLI 
public ref class MrcSegmenter 

Example

Visual BasicCopy Code
Private Function MrcEnumerateSegmentInfoCallback(ByVal segmentHandle As MrcSegmenter, ByVal data As MrcSegmentData, ByVal iD As Integer) As Boolean
  Dim segmentRectangle As Rectangle = data.ImageSegment
  If iD = 0 Then
    MessageBox.Show("Segment ID : " & iD.ToString())
    MessageBox.Show("Left : " & segmentRectangle.Left.ToString() & Constants.vbLf & "Top : " & segmentRectangle.Top.ToString() & Constants.vbLf & "Right : " & segmentRectangle.Right.ToString() & Constants.vbLf & "Bottom : " & segmentRectangle.Bottom.ToString())
  End If
  Return True
End Function
<Test> _
Public Sub MrcSegmenterExample()
  ' Load an image
  RasterCodecs.Startup()
  Dim codecs As RasterCodecs = New RasterCodecs()
  codecs.ThrowExceptionsOnInvalidImages = True

  Dim image As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg")

  Dim segmentImageOptions As MrcSegmentImageOptions = MrcSegmentImageOptions.Empty
  segmentImageOptions.CleanSize = 5
  segmentImageOptions.SegmentQuality = 50
  segmentImageOptions.ColorThreshold = 25
  segmentImageOptions.BackgroundThreshold = 10
  segmentImageOptions.CombineThreshold = 75
  segmentImageOptions.Flags = MrcSegmentImageFlags.FavorOneBit Or MrcSegmentImageFlags.SegmentWithBackground

  Dim segmenter As MrcSegmenter = New MrcSegmenter(image, Color.White, Color.Black)
  segmenter.SegmentImage(image, segmentImageOptions)

    Dim callBack As MrcEnumerateSegmentsInfo = New MrcEnumerateSegmentsInfo(AddressOf MrcEnumerateSegmentInfoCallback)
  segmenter.EnumerateSegments(callBack)

End Sub
C#Copy Code
private bool MrcEnumerateSegmentInfoCallback(MrcSegmenter segmentHandle, MrcSegmentData data, int iD) 

   Rectangle segmentRectangle = data.ImageSegment; 
   if (iD == 0) 
   { 
      MessageBox.Show("Segment ID : " + iD.ToString()); 
      MessageBox.Show("Left : " + segmentRectangle.Left.ToString() + 
         "\nTop : " + segmentRectangle.Top.ToString() + 
         "\nRight : " + segmentRectangle.Right.ToString() + 
         "\nBottom : " + segmentRectangle.Bottom.ToString()); 
   } 
   return true; 

 
public void MrcSegmenterExample() 

   // Load an image 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg"); 
 
   MrcSegmentImageOptions segmentImageOptions = MrcSegmentImageOptions.Empty; 
   segmentImageOptions.CleanSize = 5; 
   segmentImageOptions.SegmentQuality = 50; 
   segmentImageOptions.ColorThreshold = 25; 
   segmentImageOptions.BackgroundThreshold = 10; 
   segmentImageOptions.CombineThreshold = 75; 
   segmentImageOptions.Flags = MrcSegmentImageFlags.FavorOneBit | MrcSegmentImageFlags.SegmentWithBackground; 
 
   MrcSegmenter segmenter = new MrcSegmenter(image, Color.White, Color.Black); 
   segmenter.SegmentImage(image, segmentImageOptions); 
 
   MrcEnumerateSegmentsInfo callBack = new MrcEnumerateSegmentsInfo(MrcEnumerateSegmentInfoCallback); 
   segmenter.EnumerateSegments(callBack); 
 
}

Remarks

This class is available in the Document/Medical Toolkits.

Inheritance Hierarchy

System.Object
   Leadtools.Mrc.MrcSegmenter

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

Leadtools.Mrc requires a Document or Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features