public GetBandStatStdDev ( int bandIndex ) : string | ||
bandIndex | int | Index of the band for which to get the value. |
리턴 | string |
/// <summary> /// Sets band properties on a given dataset including stats, band names and wavelengths. /// </summary> /// <param name="dataset">The dataset to set properties on.</param> /// <param name="dimParser">Dimap parser to read properties from.</param> private void SetBandProperties(IDataset dataset, DiMapParser dimParser) { try { // Set band band props. IRasterKeyProperties rasterKeyProps = (IRasterKeyProperties)dataset; IRasterBandCollection rasterBandColl = (IRasterBandCollection)dataset; int imageNumBands = ((IFunctionRasterDataset)dataset).RasterInfo.BandCount; int dinNumBands = dimParser.NumBands; int[] bandIndexes = new int[dinNumBands]; IStringArray bandNames = new StrArrayClass(); for (int i = 0; i < dinNumBands; ++i) { // Get band index for the first band. bandIndexes[i] = Convert.ToInt16(dimParser.GetBandIndex(i)); // Validate band index. if (bandIndexes[i] > 0 && bandIndexes[i] <= imageNumBands) { // Get Band Name for the index. bandNames.Add(dimParser.GetBandDesc(bandIndexes[i])); // Get Band stats for the index. IRasterStatistics bandStats = new RasterStatisticsClass(); bandStats.Minimum = Convert.ToDouble(dimParser.GetBandStatMin(bandIndexes[i])); bandStats.Maximum = Convert.ToDouble(dimParser.GetBandStatMax(bandIndexes[i])); bandStats.Mean = Convert.ToDouble(dimParser.GetBandStatMean(bandIndexes[i])); bandStats.StandardDeviation = Convert.ToDouble(dimParser.GetBandStatStdDev(bandIndexes[i])); // Set stats on the dataset. ((IRasterBandEdit2)rasterBandColl.Item(bandIndexes[i] - 1)).AlterStatistics(bandStats); // Set Band Name and wavelengths according to the name. rasterKeyProps.SetBandProperty("BandName", (bandIndexes[i] - 1), bandNames.get_Element(i)); SetBandWavelengths(dataset, (bandIndexes[i] - 1)); // Refresh dataset so changes are saved. ((IRasterDataset3)dataset).Refresh(); } } } catch (Exception exc) { string error = exc.Message; } }