/// <summary> /// 初始化影像基本信息。 /// </summary> private void InitBaseInfo() { BandNum = GDALDataset.RasterCount; Width = GDALDataset.RasterXSize; Height = GDALDataset.RasterYSize; PixelCount = Width * Height; GDALDataType = GDALDataset.GetRasterBand(1).DataType; ColorInterpretation = GDALDataset.GetRasterBand(1).GetColorInterpretation(); GDALColorTable = GDALDataset.GetRasterBand(1).GetColorTable(); InitNoData(); CheckGrayscale(); }
private IRasterBand[] ReadBandsFromGDAL(Dataset ds, IRasterDataProvider provider) { if (ds == null || ds.RasterCount == 0) { return(null); } IRasterBand[] bands = new IRasterBand[ds.RasterCount]; GDALDataset gdalDs = new GDALDataset(ds); for (int i = 1; i <= ds.RasterCount; i++) { Band band = ds.GetRasterBand(i); bands[i - 1] = new GDALRasterBand(provider, band, gdalDs); } return(bands); }