波段合成功能主要用於將多幅圖像合併爲一個新的多波段圖像(即波段的疊加打包,構建一個新的多波段文件),從而可根據不一樣的用途選擇不一樣波長範圍內的波段合成 RGB 彩色圖像。算法
PIE支持算法功能的執行,下面對波段合成算法功能進行介紹。ide
第一步工具 |
算法參數設置測試 |
第二步編碼 |
算法執行spa |
第三步rest |
結果顯示code |
C#算法DLL視頻 |
PIE.CommonAlgo.dllblog |
|
C#算法名稱 |
PIE.CommonAlgo.BandCombinationAlgo |
|
參數結構體 |
BandCombination_Exchange_Info |
|
參數說明 |
||
m_vecFileptr |
IIList< IRasterDataset> |
輸入影像的數據集 獲取輸入柵格影像的RasterDataset |
bands |
IIList<IList<int>> |
輸入每一個波段須要合併的波段列表 |
tstrfile |
String |
輸出文件路徑 |
m_strFileTypeCode |
String |
根據輸出類型得到文件編碼類型 .tif/.tiff——GTiff .img—————HFA 其餘—————ENVI |
regioninfo |
IList<Interestregion> |
輸入影像的範圍集合 |
m_iOutRangeCrossType |
Int |
輸出範圍方式方式,0-交集,1-並集 |
Interestregion (輸入影像範圍) |
||
ULx |
Int |
左上角的列座標(從0開始) |
ULy |
Int |
左上角的行座標(從0開始) |
height |
Int |
輸入的行數 |
Width |
Int |
輸入的列數 |
項目路徑 |
百度雲盤地址下/PIE示例程序/10.算法調用/多功能工具/ FundamentalToolDemo.BandCombinationDemo |
數據路徑 |
百度雲盤地址下/ PIE示例數據/柵格數據/04.World/World.tif |
視頻路徑 |
百度雲盤地址下/PIE視頻教程/10.算法調用/多功能工具/波段合成算.avi |
示例代碼 |
|
1 /// <summary> 2 ///波段合成算法測試,本算法實現了將兩幅World.tif影像的1-3波段合併爲具備6個波段的World5.tif影像 3 /// </summary> 4 private void Test_KrigingInterpolationAlgo() 5 { 6 #region 一、參數設置 7 PIE.CommonAlgo.BandCombination_Exchange_Info info = new PIE.CommonAlgo.BandCombination_Exchange_Info(); 8 string path = @"D:\Data\World.tif"; 9 IRasterDataset rDataset = DatasetFactory.OpenDataset(path, OpenMode.ReadOnly) as IRasterDataset; 10 11 info.m_vecFileptr = new List<IRasterDataset> { rDataset, rDataset }; 12 List<int> list1 = new List<int> { 0,1,2 }; 13 info.bands = new List<List<int>> { list1,list1 }; 14 info.tstrfile = @"D:\Data\World5.tif"; 15 info.m_strFileTypeCode = "GTiff"; 16 PIE.CommonAlgo.Interestregion interestregion = new PIE.CommonAlgo.Interestregion(); 17 interestregion.SetRegion(0, 0, rDataset.GetRasterYSize(), rDataset.GetRasterXSize()); 18 info.regioninfo = new List<PIE.CommonAlgo.Interestregion> { interestregion, interestregion }; 19 info.m_iOutRangeCrossType = 0; 20 21 PIE.SystemAlgo.ISystemAlgo algo = PIE.SystemAlgo.AlgoFactory.Instance().CreateAlgo("PIE.CommonAlgo.dll", "PIE.CommonAlgo.BandCombinationAlgo"); 22 if (algo == null) return; 23 #endregion 24 25 //二、算法執行 26 PIE.SystemAlgo.ISystemAlgoEvents algoEvents = algo as PIE.SystemAlgo.ISystemAlgoEvents; 27 algo.Name = "波段合成"; 28 algo.Params = info; 29 bool result = PIE.SystemAlgo.AlgoFactory.Instance().ExecuteAlgo(algo); 30 //三、結果顯示 31 ILayer layer = PIE.Carto.LayerFactory.CreateDefaultLayer(@"D:\Data\World5.tif"); 32 m_HookHelper.ActiveView.FocusMap.AddLayer(layer); m_HookHelper.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll); 33 } |