public override object GetStretcher(int bandNo) { object stratcher = RgbStretcherFactory.GetStretcher("MWRIX.SWE"); if (stratcher == null) { stratcher = RgbStretcherFactory.CreateStretcher(enumDataType.Byte, 0, 255); } return(stratcher); }
public override object GetStretcher(int bandNo) { if (bandNo == 5) { return(RgbStretcherFactory.CreateStretcher(enumDataType.Float, 0, 4)); } else { return(base.GetStretcher(bandNo)); } }
private object TryGetDefaultStretcher(IRasterBand band) { double minValue, maxValue; if (_dataType == enumDataType.Byte) { minValue = 0; maxValue = 255; } else { band.ComputeMinMax(out minValue, out maxValue, true, null); } return(RgbStretcherFactory.CreateStretcher(_dataType, minValue, maxValue)); }
private object[] GetStretcher(enumDataType dataType, RasterQuickStatResult[] resutls, float percent) { int bandCount = resutls.Length; //x%像元临界个数 int criticalCount = (int)(percent * resutls[0].HistogramResult.PixelCount); object[] sts = new object[bandCount]; //low for (int i = 0; i < bandCount; i++) { //边界DN值 double lowValue = 0, heightValue = 0; //累计个数 double accCount = 0; int bucks = resutls[i].HistogramResult.ActualBuckets; //lowValue for (int k = 0; k < bucks; k++) { if (accCount > criticalCount) { break; } accCount += resutls[i].HistogramResult.Items[k]; lowValue = resutls[i].HistogramResult.MinDN + k * resutls[i].HistogramResult.Bin; } //HighValue accCount = 0; for (int k = bucks - 1; k >= 0; k--) { if (accCount > criticalCount) { break; } accCount += resutls[i].HistogramResult.Items[k]; heightValue = resutls[i].HistogramResult.MinDN + k * resutls[i].HistogramResult.Bin; } // sts[i] = RgbStretcherFactory.CreateStretcher(dataType, lowValue, heightValue); } return(sts); }
public MosaicProjectItem(IRasterDataProvider mainFile) { try { MainFile = mainFile; string dir = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, ".prjChche", Path.GetFileName(mainFile.fileName)); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } _prjFilename = Path.Combine(dir, Path.GetFileNameWithoutExtension(mainFile.fileName) + ".OVERVIEW.LDF"); // DataIdentify dataIdentify = mainFile.DataIdentify; bool isDay = dataIdentify.DayOrNight == enumDayOrNight.Day || dataIdentify.DayOrNight == enumDayOrNight.Null; int[] bandNos = RgbStretcherFactory.GetDefaultBands(dataIdentify.Satellite, dataIdentify.Sensor, false, isDay); CreateOverviewBmp(null, bandNos); } catch (Exception ex) { _errorMsg = "获取范围或者生成缩略图失败:" + ex.Message; throw new Exception(_errorMsg, ex); } }