The raster histogram is nothing

452
1
09-20-2012 07:23 AM
sailiTang
New Contributor III
Hi,

   I have code about doing statistics for my raster data. I use ComputeStatsAndHist() to do statistics and should have been able to get raster histogram and the histogram's counts. But the histogram always nothing when I run the code, so the code dblCounts = pRasterHist.Counts always sends error message. Could you tell me if it is possible and normal that raster histogram is nothing or my code has some problem? Thank you so much.

Dim pColRBands As IRasterBandCollection
            pColRBands = pRaster

            Dim pRasterBand As IRasterBand
            pRasterBand = pColRBands.Item(0)
            pRasterBand.ComputeStatsAndHist()

            Dim pRasterHist As IRasterHistogram
            pRasterHist = pRasterBand.Histogram

Saili

            Dim dblCounts() As Double
            dblCounts = pRasterHist.Counts
0 Kudos
1 Reply
sailiTang
New Contributor III
Sorry, this is my code. the lines are mess.

Dim pColRBands As IRasterBandCollection
pColRBands = pRaster

Dim pRasterBand As IRasterBand
pRasterBand = pColRBands.Item(0)
pRasterBand.ComputeStatsAndHist()

Dim pRasterHist As IRasterHistogram
pRasterHist = pRasterBand.Histogram

Dim dblCounts() As Double
dblCounts = pRasterHist.Counts
0 Kudos