LEADTOOLS MRC (Leadtools.Mrc assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.30
CombineSegments Method
See Also 
Leadtools.Mrc Namespace > MrcSegmenter Class : CombineSegments Method



id1
ID of the first segment to be combined.
id2
ID of the second segment to be combined.
flags
Flag that indicates how segments will be combined. For the MrcCombineSegmentFlags.ForeSimilar value, the following types are considered similar and could therefore be combined: OneColor, Background, Text1BitBw, Text2BitBw, Text1BitColor, Text2BitColor, Grayscale2Bit. These types are considered similar and therefore could be combined: Grayscale2Bit, Grayscale8Bit. These types are considered similar and therefore could be combined: Grayscale8Bit, Picture. refer to MrcCombineSegmentFlags
factor
A percentage value that represents the acceptable difference between the two segments being combined. This is valid only when flags is set to TryFactor. Possible values are between 0 and 100. A value of 0 indicates that only segments that are an exact match can be combined. A value of 100 indicates that any two segments of the same type can be combined. Large values cause very different segments to be joined, which causes considerable quality loss.

The CombineSegments Method is available in LEADTOOLS Document and Medical Imaging toolkits.

id1
ID of the first segment to be combined.
id2
ID of the second segment to be combined.
flags
Flag that indicates how segments will be combined. For the MrcCombineSegmentFlags.ForeSimilar value, the following types are considered similar and could therefore be combined: OneColor, Background, Text1BitBw, Text2BitBw, Text1BitColor, Text2BitColor, Grayscale2Bit. These types are considered similar and therefore could be combined: Grayscale2Bit, Grayscale8Bit. These types are considered similar and therefore could be combined: Grayscale8Bit, Picture. refer to MrcCombineSegmentFlags
factor
A percentage value that represents the acceptable difference between the two segments being combined. This is valid only when flags is set to TryFactor. Possible values are between 0 and 100. A value of 0 indicates that only segments that are an exact match can be combined. A value of 100 indicates that any two segments of the same type can be combined. Large values cause very different segments to be joined, which causes considerable quality loss.
Combines two segments.

Syntax

Visual Basic (Declaration) 
Public Sub CombineSegments( _
   ByVal id1 As Integer, _
   ByVal id2 As Integer, _
   ByVal flags As MrcCombineSegmentFlags, _
   ByVal factor As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As MrcSegmenter
Dim id1 As Integer
Dim id2 As Integer
Dim flags As MrcCombineSegmentFlags
Dim factor As Integer
 
instance.CombineSegments(id1, id2, flags, factor)
C# 
public void CombineSegments( 
   int id1,
   int id2,
   MrcCombineSegmentFlags flags,
   int factor
)
C++/CLI 
public:
void CombineSegments( 
   int id1,
   int id2,
   MrcCombineSegmentFlags flags,
   int factor
) 

Parameters

id1
ID of the first segment to be combined.
id2
ID of the second segment to be combined.
flags
Flag that indicates how segments will be combined. For the MrcCombineSegmentFlags.ForeSimilar value, the following types are considered similar and could therefore be combined: OneColor, Background, Text1BitBw, Text2BitBw, Text1BitColor, Text2BitColor, Grayscale2Bit. These types are considered similar and therefore could be combined: Grayscale2Bit, Grayscale8Bit. These types are considered similar and therefore could be combined: Grayscale8Bit, Picture. refer to MrcCombineSegmentFlags
factor
A percentage value that represents the acceptable difference between the two segments being combined. This is valid only when flags is set to TryFactor. Possible values are between 0 and 100. A value of 0 indicates that only segments that are an exact match can be combined. A value of 100 indicates that any two segments of the same type can be combined. Large values cause very different segments to be joined, which causes considerable quality loss.

Example

Visual BasicCopy Code
Public Sub CombineSegmentsExample()
      ' Load an image
      Dim codecs As RasterCodecs = New RasterCodecs()
      codecs.ThrowExceptionsOnInvalidImages = True

      Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "MRCSegmentation.mrc"))

      Dim segmenter As MrcSegmenter = New MrcSegmenter(image, Path.Combine(LEAD_VARS.ImagesDir, "MRCSegmentation.sgm"))

      segmenter.CombineSegments(0, 1, MrcCombineSegmentFlags.CombineForce, 20)
   End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
C#Copy Code
public void CombineSegmentsExample()
   {
      // Load an image
      RasterCodecs codecs = new RasterCodecs();
      codecs.ThrowExceptionsOnInvalidImages = true;

      RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir,"MRCSegmentation.mrc"));

      MrcSegmenter segmenter = new MrcSegmenter(image,Path.Combine(LEAD_VARS.ImagesDir,"MRCSegmentation.sgm"));

      segmenter.CombineSegments(0, 1, MrcCombineSegmentFlags.CombineForce, 20);
   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}

Remarks

This method is used to combine two specific segments from the segmentation handle. The two segments must be in the same row or column to be combined.

This method can be used when performing automatic or manual segmentation. For more information, refer to Programming with LEADTOOLS MRC.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

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