Leadtools.Services.ImageProcessing.ServiceContracts Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
StatisticsInformation Method
See Also  Example
Leadtools.Services.ImageProcessing.ServiceContracts Namespace > IImageProcessingService Interface : StatisticsInformation Method



request
A DataContractAttribute containing the data that will be used in this StatisticsInformation operation.
request
A DataContractAttribute containing the data that will be used in this StatisticsInformation operation.
Returns statistical information about the image.

Syntax

Visual Basic (Declaration) 
<FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, 
   Action="", 
   Name="", 
   Namespace="", 
   HasProtectionLevel=False)>
<OperationContractAttribute("StatisticsInformation")>
Overridable Function StatisticsInformation( _
   ByVal request As StatisticsInformationRequest _
) As StatisticsInformationResponse
Visual Basic (Usage)Copy Code
Dim instance As IImageProcessingService
Dim request As StatisticsInformationRequest
Dim value As StatisticsInformationResponse
 
value = instance.StatisticsInformation(request)
C# 
[FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, 
   Action="", 
   Name="", 
   Namespace="", 
   HasProtectionLevel=false)]
[OperationContractAttribute("StatisticsInformation")]
virtual StatisticsInformationResponse StatisticsInformation( 
   StatisticsInformationRequest request
)
C++/CLI 
[FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, 
   Action="", 
   Name="", 
   Namespace="", 
   HasProtectionLevel=false)]
[OperationContractAttribute("StatisticsInformation")]
virtual StatisticsInformationResponse StatisticsInformation( 
   StatisticsInformationRequest request
) 

Parameters

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

Return Value

A DataContractAttribute containing the modified image resulting from the StatisticsInformation operation.

Example

Visual BasicCopy Code
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(LeadtoolsExamples.Common.ImagesPath.Path & "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
C#Copy Code
public void StatisticsInformationExample() 

   ImageProcessingServiceClient client = new ImageProcessingServiceClient(); 
   IImageProcessingService imageService = client as IImageProcessingService; 
 
   RawBinaryData sourceBinaryData = new RawBinaryData(); 
   sourceBinaryData.Data = File.ReadAllBytes(LeadtoolsExamples.Common.ImagesPath.Path + "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(); 
}

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.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

Applications developed with LEADTOOLS WCF components require runtime licenses. Server licensing is required for applications on a server. For more information, refer to: Imaging Pro/Document/Medical Features