public GWireCommand()
public:
GWireCommand();
__init__() # Default constructor
By default, the External Energy is set at 90 and the Internal Energy at 10. External energy represents the image forces while calculating the minimum path, (i.e., the boundaries of the object of interest). Higher external energies are used for complex objects. Internal energy represents the internal curve energy due to bending or a discontinuity. Higher internal energy minimizes curve bending and results in smoother curves. Internal energy reduces the effect of image noise by reducing the effect of image forces. In the code, set only the external energy. The internal energy is calculated as percentage 100 – ExternalEnergy.
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:\LEADTOOLS22\Resources\Images";
}
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.