IRasterDataset2 rd2 = rastDataset as IRasterDataset2;
IRaster raster = rd2.CreateFullRaster();
IRasterBandCollection rbc = (IRasterBandCollection)raster;
for (int i = 0; i < rbc.Count; i++)
{
IRasterBand rb = rbc.Item(i);
bool tmpBool ;
rb.HasStatistics(out tmpBool);
if(!tmpBool)
rb.ComputeStatsAndHist();
IRasterHistogram rh = rb.Histogram;
IRasterStatistics rs = rb.Statistics;
}
IRaster raster = rd2.CreateFullRaster();
IRasterBandCollection rbc = (IRasterBandCollection)raster;
for (int i = 0; i < rbc.Count; i++)
{
IRasterBand rb = rbc.Item(i);
bool tmpBool ;
rb.HasStatistics(out tmpBool);
if(!tmpBool)
rb.ComputeStatsAndHist();
IRasterHistogram rh = rb.Histogram;
IRasterStatistics rs = rb.Statistics;
}
from: http://blog.csdn.net/rrrrssss00/article/details/6585211