GenerateHistogram
The GenerateHistogram ISCommand is used for generating histograms from an area of interest in an image service definition. Histogram statistics are extracted based on the image size. For some image service definitons (primarily those which do not contain service overviews), the generation of histograms may fail; however, this failure does not affect the image service definition and you can continue to use it.
The command line is:
ISCommand GenerateHistogram --ImageService=<Path To an ImageService> --XMin=<XMin> --YMin=<YMin> --XMax=<XMax> --YMax=<YMax> --NCols=<number of columns> --NRows=<number of rows> -- Nbins=<Nbins> --MinBin=<MinBin> --MaxBin=<MaxBin> --NoData=<NoData> --StatsType=<Level of statistics> --ActualValues=[True|False] --FileName=<OutputFilePath>
The table below defines the variables that are required to use this script. Most variables are defined within the script. You can either make an edit to the script or enter the variable at the command line as shown below.
Variable |
Description/Options |
Default |
Required |
ImageService |
Path and name of the service for which you want to generate histograms. |
User specified |
Yes |
XMin |
Leftmost X coordinate of the set extent. |
User specified |
Yes |
YMin |
Bottommost Y coordinate of the set extent |
User specified |
Yes |
XMax |
Rightmost X coordinate of the set extent. |
User specified |
Yes |
YMax |
Topmost Y coordinate of the set extent. |
User specified |
Yes |
NCols |
Number of Columns |
1000 |
Yes |
NRows |
Number of Rows |
1000 |
Yes |
NBins |
Number of Bin Values used in Histogram. By default, it is 255. It may be a smaller or larger value to gain more detail. |
255 |
Yes |
MinBin |
Value for the Minimum Bin and for scaling histogram values which are always normalized between 0 and 255. This is usually 0. For terrain it should be the Min value. |
User specified |
Yes |
MaxBin |
Value for the Maximum Bin. This is usually 255 for an 8-bit image. The default is 2^N-bits. For terrain it is the max value. For example, for a 12-bit image it is 4096. |
User specified |
Yes |
NoData |
Specifies the values representing NoData. It may be a semicolon delimited list. If as part of a list or there are commas then they are assumed to be R,G,B values. If only one color value is given then it is assumed to be that same value for all bands of a multispectral image. For example, 255 represents white not 255,0,0. The values are not scaled by MinBin and MaxBin Value. For example, -999 represents -999 irrespective of values of MinBin and MaxBin. The default for are 0;2^N-bits. For Elevation the defaults are values <-998 and >35000. |
0;255 |
Yes |
StatsType |
Defines the level of statistics |
Basic |
Yes |
ActualValues |
Define this property as True to get pixel values in the generated histogram. When set as false, all values are normalized from 0 to 255 between MinBin and MaxBin. In this case the actual value = MinBin+ ( (histogramValue/255)*(MaxBin-MinBin) ) |
False |
Yes |
FileName |
The output file name and path for saving the service info |
Histogram.xml |
Yes |
Example:
ISCommand GenerateHistogram --ImageService=ISDef://d:\test\LandsatWorld.ISDef\ImageService.ISDef --XMin=0 --YMin=7500 --XMax=11500 --YMax=0 --NCols=1000 --NRows=1000 -- Nbins=255 --MinBin=0 --MaxBin=255 --NoData=0;255 --StatsType=Basic --ActualValues=False --FileName=C:\Test\Histogram.xml