//IHS融合 private void IHSToolStripMenuItem_Click(object sender, EventArgs e) { try { //选择全色影像 FrmImgSelect FIS1 = new FrmImgSelect(Images, "IHS融合 - 选择全色影像..."); if (FIS1.ShowDialog(this) == DialogResult.OK) { if (FIS1.SelectedImg.BandNum != 1) { throw new ArgumentException("全色影像光谱数不为1。"); } //选择多光谱影像 FrmImgSelect FIS2 = new FrmImgSelect(Images, "IHS融合 - 选择多光谱影像..."); if (FIS2.ShowDialog(this) == DialogResult.OK) { //选择多光谱影像波段组合 FrmBandSelector FBS = new FrmBandSelector(FIS2.SelectedImg); if (FBS.ShowDialog(this) == DialogResult.OK) { //选择导出位置 FrmExport E = new FrmExport(); if (E.ShowDialog(this) == DialogResult.OK) { if (Tools.ImageFusion.IHSFusion(FIS1.SelectedImg.GDALDataset, FIS2.SelectedImg.GDALDataset, FIS1.SelectedImg.CumulativeProbability, FIS2.SelectedImg.CumulativeProbability, FBS.BandList, E.OutDataType, E.OutPath)) { CheckFile(E.OutPath); ManageTreeView(); } E.Dispose(); } FBS.Dispose(); } FIS2.Dispose(); } FIS1.Dispose(); } } catch (Exception err) { MessageBox.Show(err.ToString()); } }
//更改波段组合 private void ChangeBandToolStripMenuItem_Click(object sender, EventArgs e) { try { FrmBandSelector BS = new FrmBandSelector(Images[DisplayImageIndex]); if (BS.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { //若更改后的波段和原先不一样则刷新位图缓存。 if (Images[DisplayImageIndex].SetBandList(BS.BandList)) { RedrawBitmap(null, null); } ImageShow(); EditBand(); } BS.Dispose(); } catch (Exception err) { MessageBox.Show(err.Message); } }