←Select platform

StatisticsInformation Method

Summary

Returns statistical information about the image.

Syntax

C#
VB
C++
[FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault,  
   Action="",  
   Name="",  
   Namespace="",  
   ProtectionLevel=ProtectionLevel.None,  
   HasProtectionLevel=false)] 
[OperationContractAttribute("StatisticsInformation")] 
Leadtools.Services.Imageprocessing.Datacontracts.StatisticsInformationResponse StatisticsInformation(  
   Leadtools.Services.Imageprocessing.Datacontracts.StatisticsInformationRequest request 
) 
<FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault,  
   Action="",  
   Name="",  
   Namespace="",  
   ProtectionLevel=ProtectionLevel.None,  
   HasProtectionLevel=False)> 
<OperationContractAttribute("StatisticsInformation")> 
Function StatisticsInformation( _ 
   ByVal request As Leadtools.Services.Imageprocessing.Datacontracts.StatisticsInformationRequest _ 
) As Leadtools.Services.Imageprocessing.Datacontracts.StatisticsInformationResponse 
[FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault,  
   Action="",  
   Name="",  
   Namespace="",  
   ProtectionLevel=ProtectionLevel.None,  
   HasProtectionLevel=false)] 
[OperationContractAttribute("StatisticsInformation")] 
Leadtools.Services.Imageprocessing.Datacontracts.StatisticsInformationResponse^ StatisticsInformation(  
   Leadtools.Services.Imageprocessing.Datacontracts.StatisticsInformationRequest^ request 
) 

Parameters

request
A System.Runtime.Serialization.DataContractAttribute containing the data that will be used in this StatisticsInformation operation.

Return Value

A System.Runtime.Serialization.DataContractAttribute containing the modified image resulting from the StatisticsInformation operation.

Remarks
  • This operation calculates statistical information about the image.
  • The start and end values designate the range of colors that will be taken in consideration for producing the results. Only the values between Start and End are used for the calculation of the results. The range of each one depends on the bits per pixel of the image: in the case of 8 bits per component (RGB), the range is between 0 and 255; for 16 bits, the range is 0 through 65535;and from -32768 to 32767 for signed images; and for 12 bits, the range is 0 through 4095.
  • This operation supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.
  • This operation support signed data images.
  • This operation does not support 32-bit grayscale images.
Example

C#
VB
Imports Leadtools.Services 
Imports Leadtools.Services.datacontracts._2009._01 
Imports Leadtools.Services.raster.datacontracts._2009._01 
Imports Leadtools.Services.ImageProcessing.datacontracts._2009._01 
 
Public Sub StatisticsInformationExample() 
   Dim client As ImageProcessingServiceClient = New ImageProcessingServiceClient() 
   Dim imageService As IImageProcessingService = TryCast(client, IImageProcessingService) 
 
   Dim sourceBinaryData As RawBinaryData = New RawBinaryData() 
   sourceBinaryData.Data = File.ReadAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp")) 
 
   Dim convertOptions As RasterConvertOptions = New RasterConvertOptions() 
 
   convertOptions.Source = sourceBinaryData 
   convertOptions.Destination = Nothing 
   convertOptions.Format = RasterImageFormat.Bmp 
   convertOptions.FirstPage = 1 
   convertOptions.LastPage = 1 
   convertOptions.BitsPerPixel = 24 
   convertOptions.QualityFactor = 2 
 
   Dim request As StatisticsInformationRequest = New StatisticsInformationRequest() 
   request.ConvertOptions = convertOptions 
   request.Channel = RasterColorChannel.Master 
   request.Start = 0 
   request.End = 255 
 
   Dim response As StatisticsInformationResponse = imageService.StatisticsInformation(request) 
 
   Console.WriteLine(String.Format("Minimum = : {0}", response.Minimum)) 
   Console.WriteLine(String.Format("Maximum = {0}", response.Maximum)) 
   Console.WriteLine(String.Format("Mean = {0}", response.Mean)) 
   Console.WriteLine(String.Format("Median = {0}", response.Median)) 
   Console.WriteLine(String.Format("Percent = {0}", response.Percent)) 
   Console.WriteLine(String.Format("StandardDeviation = {0}", response.StandardDeviation)) 
   Console.WriteLine(String.Format("TotalPixelCount = {0}", response.TotalPixelCount)) 
 
   client.Close() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 
using Leadtools.Services; 
using leadtools.services.datacontracts._2009._01; 
using leadtools.services.raster.datacontracts._2009._01; 
using leadtools.services.imageprocessing.datacontracts._2009._01; 
 
public void StatisticsInformationExample() 
{ 
   ImageProcessingServiceClient client = new ImageProcessingServiceClient(); 
   IImageProcessingService imageService = client as IImageProcessingService; 
 
   RawBinaryData sourceBinaryData = new RawBinaryData(); 
   sourceBinaryData.Data = File.ReadAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp")); 
 
   RasterConvertOptions convertOptions = new RasterConvertOptions(); 
 
   convertOptions.Source = sourceBinaryData; 
   convertOptions.Destination = null; 
   convertOptions.Format = RasterImageFormat.Bmp; 
   convertOptions.FirstPage = 1; 
   convertOptions.LastPage = 1; 
   convertOptions.BitsPerPixel = 24; 
   convertOptions.QualityFactor = 2; 
 
   StatisticsInformationRequest request = new StatisticsInformationRequest(); 
   request.ConvertOptions = convertOptions; 
   request.Channel = RasterColorChannel.Master; 
   request.Start = 0; 
   request.End = 255; 
 
   StatisticsInformationResponse response = imageService.StatisticsInformation(request); 
 
   Console.WriteLine(string.Format("Minimum = : {0}", response.Minimum)); 
   Console.WriteLine(string.Format("Maximum = {0}", response.Maximum)); 
   Console.WriteLine(string.Format("Mean = {0}", response.Mean)); 
   Console.WriteLine(string.Format("Median = {0}", response.Median)); 
   Console.WriteLine(string.Format("Percent = {0}", response.Percent)); 
   Console.WriteLine(string.Format("StandardDeviation = {0}", response.StandardDeviation)); 
   Console.WriteLine(string.Format("TotalPixelCount = {0}", response.TotalPixelCount)); 
 
   client.Close(); 
} 
 
static class LEAD_VARS 
{ 
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
} 

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Click or drag to resize