RunSegmentation(String) Method
                In This Topic
            
            Runs the segmentation process on the image previously set by the 
GdPictureSegmenter.SetImage method within the current GdPictureSegmenter object. You are allowed to set the custom result identifier you prefer using this method. The result of this process, identifiable by this custom ID, is internally attached to the current GdPictureSegmenter object as well.
Syntax
            
            
            
            
            'Declaration
 
Public Overloads Function RunSegmentation( _
   ByVal  As String _
) As String
             
        
            
            public string RunSegmentation( 
   string 
)
             
        
            
            public function RunSegmentation( 
    : String
): String; 
             
        
            
            public function RunSegmentation( 
    : String
) : String;
             
        
            
            public: string* RunSegmentation( 
   string* 
) 
             
        
            
            public:
String^ RunSegmentation( 
   String^ 
) 
             
        
             
        
            Parameters
- SegmentationResuldID
- A unique result identifier of the executed segmentation process, that is used to identify the segmentation result.
            You can define your preferable value. If you leave this parameter null or empty, a new identifier is automatically generated.
Return Value
A unique result identifier of the executed segmentation process. If the method has been successfully followed, then the custom identifier passed as a parameter is returned, if it is properly defined. 
The GdPictureSegmenter.GetStat method can be subsequently used to determine if this method has been successful.
 
            
            
            
            
            
            Example
How to use the custom result identifier when running more segmentation processes.
            
             
    
	
		Dim caption As String = "Example: RunSegmentation"
Using gdpictureSegmenter As GdPictureSegmenter = New GdPictureSegmenter()
    'Set up the image you want to process.
    Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
        'The standard open file dialog displays to allow you to select the file.
        Dim image As Integer = gdpictureImaging.CreateGdPictureImageFromFile("")
        If (gdpictureImaging.GetStat() = GdPictureStatus.OK) AndAlso
           (gdpictureSegmenter.SetImage(image) = GdPictureStatus.OK) Then
 
            'Set the segmentation mode.
            gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents4
            'Run the segmentation process.
            Dim resultIDComp4 As String = "ConnectedComponents4"
            gdpictureSegmenter.RunSegmentation(resultIDComp4)
            If gdpictureSegmenter.GetStat() = GdPictureStatus.OK Then
                'Check the results ...
                Dim blockCount As Integer = gdpictureSegmenter.GetBlockCount(resultIDComp4)
                'Continue ...
            Else
                MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption)
            End If
 
            'Set the segmentation mode.
            gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents8
            'Run the segmentation process.
            Dim resultIDComp8 As String = "ConnectedComponents8"
            gdpictureSegmenter.RunSegmentation(resultIDComp8)
            If gdpictureSegmenter.GetStat() = GdPictureStatus.OK Then
                'Check the results ...
                Dim blockCount As Integer = gdpictureSegmenter.GetBlockCount(resultIDComp8)
                'Continue ...
            Else
                MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption)
            End If
 
            'Release the used image.
            gdpictureImaging.ReleaseGdPictureImage(image)
 
            'Release resources.
            gdpictureSegmenter.ReleaseSegmentationResult(resultIDComp4)
            gdpictureSegmenter.ReleaseSegmentationResult(resultIDComp8)
        Else
            MessageBox.Show("The error occurred when setting up the image: " + gdpictureImaging.GetStat().ToString() + " or " + gdpictureSegmenter.GetStat().ToString(), caption)
        End If
    End Using
End Using
	 
	
		string caption = "Example: RunSegmentation";
using (GdPictureSegmenter gdpictureSegmenter = new GdPictureSegmenter())
{
    //Set up the image you want to process.
    using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
    {
        //The standard open file dialog displays to allow you to select the file.
        int image = gdpictureImaging.CreateGdPictureImageFromFile("");
        if ((gdpictureImaging.GetStat() == GdPictureStatus.OK) &&
            (gdpictureSegmenter.SetImage(image) == GdPictureStatus.OK))
        {
            //Set the segmentation mode.
            gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents4;
 
            //Run the segmentation process.
            string resultIDComp4 = "ConnectedComponents4";
            gdpictureSegmenter.RunSegmentation(resultIDComp4);
            if (gdpictureSegmenter.GetStat() == GdPictureStatus.OK)
            {
                //Check the results ...
                int blockCount = gdpictureSegmenter.GetBlockCount(resultIDComp4);
                //Continue ...
            }
            else
            {
                MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption);
            }
 
            //Set the segmentation mode.
            gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents8;
 
            //Run the segmentation process.
            string resultIDComp8 = "ConnectedComponents8";
            gdpictureSegmenter.RunSegmentation(resultIDComp8);
            if (gdpictureSegmenter.GetStat() == GdPictureStatus.OK)
            {
                //Check the results ...
                int blockCount = gdpictureSegmenter.GetBlockCount(resultIDComp8);
                //Continue ...
            }
            else
            {
                MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption);
            }
 
            //Release the used image.
            gdpictureImaging.ReleaseGdPictureImage(image);
 
            //Release resources.
            gdpictureSegmenter.ReleaseSegmentationResult(resultIDComp4);
            gdpictureSegmenter.ReleaseSegmentationResult(resultIDComp8);
        }
        else
            MessageBox.Show("The error occurred when setting up the image: " + gdpictureImaging.GetStat().ToString() + " or " + gdpictureSegmenter.GetStat().ToString(), caption);
    }
}
	 
	
 
Example
How to use the custom result identifier when running more segmentation processes.
            
            Dim caption As String = "Example: RunSegmentation"
            Using gdpictureSegmenter As GdPictureSegmenter = New GdPictureSegmenter()
                'Set up the image you want to process.
                Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
                    'The standard open file dialog displays to allow you to select the file.
                    Dim image As Integer = gdpictureImaging.CreateGdPictureImageFromFile("")
                    If (gdpictureImaging.GetStat() = GdPictureStatus.OK) AndAlso
                       (gdpictureSegmenter.SetImage(image) = GdPictureStatus.OK) Then
             
                        'Set the segmentation mode.
                        gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents4
                        'Run the segmentation process.
                        Dim resultIDComp4 As String = "ConnectedComponents4"
                        gdpictureSegmenter.RunSegmentation(resultIDComp4)
                        If gdpictureSegmenter.GetStat() = GdPictureStatus.OK Then
                            'Check the results ...
                            Dim blockCount As Integer = gdpictureSegmenter.GetBlockCount(resultIDComp4)
                            'Continue ...
                        Else
                            MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption)
                        End If
             
                        'Set the segmentation mode.
                        gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents8
                        'Run the segmentation process.
                        Dim resultIDComp8 As String = "ConnectedComponents8"
                        gdpictureSegmenter.RunSegmentation(resultIDComp8)
                        If gdpictureSegmenter.GetStat() = GdPictureStatus.OK Then
                            'Check the results ...
                            Dim blockCount As Integer = gdpictureSegmenter.GetBlockCount(resultIDComp8)
                            'Continue ...
                        Else
                            MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption)
                        End If
             
                        'Release the used image.
                        gdpictureImaging.ReleaseGdPictureImage(image)
             
                        'Release resources.
                        gdpictureSegmenter.ReleaseSegmentationResult(resultIDComp4)
                        gdpictureSegmenter.ReleaseSegmentationResult(resultIDComp8)
                    Else
                        MessageBox.Show("The error occurred when setting up the image: " + gdpictureImaging.GetStat().ToString() + " or " + gdpictureSegmenter.GetStat().ToString(), caption)
                    End If
                End Using
            End Using
            string caption = "Example: RunSegmentation";
            using (GdPictureSegmenter gdpictureSegmenter = new GdPictureSegmenter())
            {
                //Set up the image you want to process.
                using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
                {
                    //The standard open file dialog displays to allow you to select the file.
                    int image = gdpictureImaging.CreateGdPictureImageFromFile("");
                    if ((gdpictureImaging.GetStat() == GdPictureStatus.OK) &&
                        (gdpictureSegmenter.SetImage(image) == GdPictureStatus.OK))
                    {
                        //Set the segmentation mode.
                        gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents4;
             
                        //Run the segmentation process.
                        string resultIDComp4 = "ConnectedComponents4";
                        gdpictureSegmenter.RunSegmentation(resultIDComp4);
                        if (gdpictureSegmenter.GetStat() == GdPictureStatus.OK)
                        {
                            //Check the results ...
                            int blockCount = gdpictureSegmenter.GetBlockCount(resultIDComp4);
                            //Continue ...
                        }
                        else
                        {
                            MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption);
                        }
             
                        //Set the segmentation mode.
                        gdpictureSegmenter.SegmentationMode = SegmentationMode.ConnectedComponents8;
             
                        //Run the segmentation process.
                        string resultIDComp8 = "ConnectedComponents8";
                        gdpictureSegmenter.RunSegmentation(resultIDComp8);
                        if (gdpictureSegmenter.GetStat() == GdPictureStatus.OK)
                        {
                            //Check the results ...
                            int blockCount = gdpictureSegmenter.GetBlockCount(resultIDComp8);
                            //Continue ...
                        }
                        else
                        {
                            MessageBox.Show("The segmentation process has failed with the status: " + gdpictureSegmenter.GetStat().ToString(), caption);
                        }
             
                        //Release the used image.
                        gdpictureImaging.ReleaseGdPictureImage(image);
             
                        //Release resources.
                        gdpictureSegmenter.ReleaseSegmentationResult(resultIDComp4);
                        gdpictureSegmenter.ReleaseSegmentationResult(resultIDComp8);
                    }
                    else
                        MessageBox.Show("The error occurred when setting up the image: " + gdpictureImaging.GetStat().ToString() + " or " + gdpictureSegmenter.GetStat().ToString(), caption);
                }
            }
            
            
            See Also