Error processing SSI file
LEADTOOLS Image Processing (Leadtools.ImageProcessing.Core assembly)

Show in webframe

GWireCommand Class








Members 
Performs semi-automatic segmentation by creating minimal paths that follow the boundaries of the objects in the image.
Object Model
Syntax
public class GWireCommand : System.IDisposable  
'Declaration
 
Public Class GWireCommand 
   Implements System.IDisposable 
'Usage
 
Dim instance As GWireCommand
function Leadtools.ImageProcessing.Core.GWireCommand()
public ref class GWireCommand : public System.IDisposable  
Remarks
Example
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing.Core

      
Public Sub GWireCommandExample()
   Dim codecs As RasterCodecs = New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True
   'Load an image
   Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm"))

   Dim command As GWireCommand = New GWireCommand(image, 90)

   Dim SeedPoints As List(Of LeadPoint) = New List(Of LeadPoint)()

   ' Get the boundaries of the object
   SeedPoints.Add(New LeadPoint(200, 163))
   SeedPoints.Add(New LeadPoint(245, 195))
   SeedPoints.Add(New LeadPoint(289, 163))
   SeedPoints.Add(New LeadPoint(282, 188))
   SeedPoints.Add(New LeadPoint(304, 314))
   SeedPoints.Add(New LeadPoint(247, 271))
   SeedPoints.Add(New LeadPoint(201, 315))
   SeedPoints.Add(New LeadPoint(228, 199))
   SeedPoints.Add(New LeadPoint(199, 175))

   Dim pointIdx As Integer = 0
   Dim AllPaths As List(Of LeadPoint) = New List(Of LeadPoint)()

   ' Loop over the list of SeedPoints to get the minimum path between each set of two points.
   ' And add the minimum path between the two points to the AllPaths List.
   For index As Integer = 0 To 3
      ' Set the seed point.
      command.SetSeedPoint(SeedPoints(pointIdx))

      pointIdx += 1
      ' Get the minimum path from the seed point to the target point.
      Dim minPath As LeadPoint() = command.GetMinPath(SeedPoints(pointIdx))

      ' Add the minimum path to the AllPaths list to be used later to create a region.
      AllPaths.AddRange(minPath)
   Next index

   ' Use the minimum path around the object and convert it to a region.
   image.AddPolygonToRegion(Nothing, AllPaths.ToArray(), LeadFillMode.Alternate, RasterRegionCombineMode.Set)
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 GWireCommandExample()
{
    RasterCodecs codecs = new RasterCodecs();
    codecs.ThrowExceptionsOnInvalidImages = true;
    //Load an image
    RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm"));

    GWireCommand command = new GWireCommand(image, 90);

    List<LeadPoint> SeedPoints = new List<LeadPoint>();

    // Get the boundaries of the object
    SeedPoints.Add(new LeadPoint(200, 163));
    SeedPoints.Add(new LeadPoint(245, 195));
    SeedPoints.Add(new LeadPoint(289, 163));
    SeedPoints.Add(new LeadPoint(282, 188));
    SeedPoints.Add(new LeadPoint(304, 314));
    SeedPoints.Add(new LeadPoint(247, 271));
    SeedPoints.Add(new LeadPoint(201, 315));
    SeedPoints.Add(new LeadPoint(228, 199));
    SeedPoints.Add(new LeadPoint(199, 175));

    int pointIdx = 0;
    List<LeadPoint> AllPaths = new List<LeadPoint>();

    // Loop over the list of SeedPoints to get the minimum path between each set of two points.
    // And add the minimum path between the two points to the AllPaths List.
    for (int index = 0; index < 4; index++)
    {
        // Set the seed point.
        command.SetSeedPoint(SeedPoints[pointIdx]);

        pointIdx++;
        // Get the minimum path from the seed point to the target point.
        LeadPoint[] minPath = command.GetMinPath(SeedPoints[pointIdx]);

        // Add the minimum path to the AllPaths list to be used later to create a region.
        AllPaths.AddRange(minPath);
    }

    // Use the minimum path around the object and convert it to a region.
    image.AddPolygonToRegion(null, AllPaths.ToArray(), LeadFillMode.Alternate, RasterRegionCombineMode.Set);
}

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

Target Platforms

See Also

Reference

GWireCommand Members
Leadtools.ImageProcessing.Core Namespace

Error processing SSI file