Example #1
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.TextBox_AssImg.Text.Equals(""))
            {
                MessageBox.Show("请选择输入待评价影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.TextBox_RefImg.Text.Equals(""))
            {
                MessageBox.Show("请选择输入参考影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.TextBox_OutputPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.listView_Ass.Items.Count != this.listView_Ref.Items.Count)
            {
                MessageBox.Show("输入的待评价影像和参考影像文件数不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (!this.cbx_SpecAve_1.Checked && !this.cbx_SpecStd_2.Checked && !this.cbx_SpecERGAS_3.Checked && !this.cbx_SpecD_4.Checked
                && !this.cbx_SpecAngMap_5.Checked && !this.cbx_CCSpec_6.Checked && !this.cbx_SpatAve_7.Checked && !this.cbx_SpatStd_8.Checked
                && !this.cbx_AveGra_9.Checked && !this.cbx_CCSpat_10.Checked && !this.cbx_SpatERGAS_11.Checked)
            {
                MessageBox.Show("请至少选择一项评价指标!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_OK.Enabled = false;
            #region 界面参数获取
            //待评价影像
            List<string> list_Ass = new List<string>();
            foreach (ListViewItem item in this.listView_Ass.Items)
            {
                string s = this.TextBox_AssImg.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Ass.Add(s);
            }
            string[] sFilename_Ass = (string[])list_Ass.ToArray();
            sGlobal_Filename_Ass = sFilename_Ass;
            //参考影像
            List<string> list_Ref = new List<string>();
            foreach (ListViewItem item in this.listView_Ref.Items)
            {
                string s = this.TextBox_RefImg.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Ref.Add(s);
            }
            string[] sFilename_Ref = (string[])list_Ref.ToArray();
            //输出路径
            string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
            sGlobal_OutDir = sFilename_Output;
            //何种质量
            string sQuaKind = this.combx_Qua.SelectedValue.ToString();
            string sQuaKindEn;
            if (sQuaKind == "光谱质量")
            {
                sQuaKindEn = "SpecQua";
            }
            else
            {
                sQuaKindEn = "SpatQua";
            }
            sGlobal_QuaKindEn = sQuaKindEn;
            //评价指标
            string[] sQuaArr = new string[] { "", "", "", "", "", "", "", "", "", "", "" };
            if (this.cbx_SpecAve_1.Checked)
            {
                sQuaArr[0] = "TRUE";
            }
            if (this.cbx_SpecStd_2.Checked)
            {
                sQuaArr[1] = "TRUE";
            }
            if (this.cbx_SpecERGAS_3.Checked)
            {
                sQuaArr[2] = "TRUE";
            }
            if (this.cbx_SpecD_4.Checked)
            {
                sQuaArr[3] = "TRUE";
            }
            if (this.cbx_SpecAngMap_5.Checked)
            {
                sQuaArr[4] = "TRUE";
            }
            if (this.cbx_CCSpec_6.Checked)
            {
                sQuaArr[5] = "TRUE";
            }
            if (this.cbx_SpatAve_7.Checked)
            {
                sQuaArr[6] = "TRUE";
            }
            if (this.cbx_SpatStd_8.Checked)
            {
                sQuaArr[7] = "TRUE";
            }
            if (this.cbx_AveGra_9.Checked)
            {
                sQuaArr[8] = "TRUE";
            }
            if (this.cbx_CCSpat_10.Checked)
            {
                sQuaArr[9] = "TRUE";
            }
            if (this.cbx_SpatERGAS_11.Checked)
            {
                sQuaArr[10] = "TRUE";
            }
            #endregion
            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\SpecFusionAss.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置

                oCom.SetIDLVariable("FilenameAss", sFilename_Ass);
                oCom.SetIDLVariable("FilenameRef", sFilename_Ref);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);
                oCom.SetIDLVariable("QuaKind", sQuaKindEn);
                oCom.SetIDLVariable("QuaArr", sQuaArr);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
                oCom.ExecuteString("SpecFusionAss,FilenameAss,FilenameRef,OutputPath,QuaKind,QuaArr,Message=Message");
                object objArr = oCom.GetIDLVariable("Message");
                //返回错误消息
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    oCom.DestroyObject();
                    this.btn_OK.Enabled = true;
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("光谱融合质量评价完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_OK.Enabled = true;
                this.btn_OpenOutputPath.Visible = true;
                QuaAssShowForm vSpecQuaAssShowForm = new QuaAssShowForm(this);
                vSpecQuaAssShowForm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
            this.btn_OK.Enabled = true;
        }
Example #2
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            #region 输入与输出路径条件判断
            if (this.TextBox_AssImg.Text.Equals(""))
            {
                MessageBox.Show("请选择输入待评价影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.TextBox_RefImg.Text.Equals(""))
            {
                MessageBox.Show("请选择输入参考影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.TextBox_OutputPath.Text.Equals(""))
            {
                MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (this.listView_Ass.Items.Count != this.listView_Ref.Items.Count)
            {
                MessageBox.Show("输入的待评价影像和参考影像文件数不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (!this.cbx_SpecAve_1.Checked && !this.cbx_SpecStd_2.Checked && !this.cbx_SpecERGAS_3.Checked && !this.cbx_SpecD_4.Checked &&
                !this.cbx_SpecAngMap_5.Checked && !this.cbx_CCSpec_6.Checked && !this.cbx_SpatAve_7.Checked && !this.cbx_SpatStd_8.Checked &&
                !this.cbx_AveGra_9.Checked && !this.cbx_CCSpat_10.Checked && !this.cbx_SpatERGAS_11.Checked)
            {
                MessageBox.Show("请至少选择一项评价指标!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion
            this.btn_OK.Enabled = false;
            #region 界面参数获取
            //待评价影像
            List <string> list_Ass = new List <string>();
            foreach (ListViewItem item in this.listView_Ass.Items)
            {
                string s = this.TextBox_AssImg.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Ass.Add(s);
            }
            string[] sFilename_Ass = (string[])list_Ass.ToArray();
            sGlobal_Filename_Ass = sFilename_Ass;
            //参考影像
            List <string> list_Ref = new List <string>();
            foreach (ListViewItem item in this.listView_Ref.Items)
            {
                string s = this.TextBox_RefImg.Text + "\\" + item.SubItems[0].Text.Trim();
                list_Ref.Add(s);
            }
            string[] sFilename_Ref = (string[])list_Ref.ToArray();
            //输出路径
            string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
            sGlobal_OutDir = sFilename_Output;
            //何种质量
            string sQuaKind = this.combx_Qua.SelectedValue.ToString();
            string sQuaKindEn;
            if (sQuaKind == "光谱质量")
            {
                sQuaKindEn = "SpecQua";
            }
            else
            {
                sQuaKindEn = "SpatQua";
            }
            sGlobal_QuaKindEn = sQuaKindEn;
            //评价指标
            string[] sQuaArr = new string[] { "", "", "", "", "", "", "", "", "", "", "" };
            if (this.cbx_SpecAve_1.Checked)
            {
                sQuaArr[0] = "TRUE";
            }
            if (this.cbx_SpecStd_2.Checked)
            {
                sQuaArr[1] = "TRUE";
            }
            if (this.cbx_SpecERGAS_3.Checked)
            {
                sQuaArr[2] = "TRUE";
            }
            if (this.cbx_SpecD_4.Checked)
            {
                sQuaArr[3] = "TRUE";
            }
            if (this.cbx_SpecAngMap_5.Checked)
            {
                sQuaArr[4] = "TRUE";
            }
            if (this.cbx_CCSpec_6.Checked)
            {
                sQuaArr[5] = "TRUE";
            }
            if (this.cbx_SpatAve_7.Checked)
            {
                sQuaArr[6] = "TRUE";
            }
            if (this.cbx_SpatStd_8.Checked)
            {
                sQuaArr[7] = "TRUE";
            }
            if (this.cbx_AveGra_9.Checked)
            {
                sQuaArr[8] = "TRUE";
            }
            if (this.cbx_CCSpat_10.Checked)
            {
                sQuaArr[9] = "TRUE";
            }
            if (this.cbx_SpatERGAS_11.Checked)
            {
                sQuaArr[10] = "TRUE";
            }
            #endregion
            #region 调用IDL程序
            //IDLSav的路径
            string sIDLSavPath = FileManage.getApplicatonPath();
            sIDLSavPath = sIDLSavPath + "IDLSav\\SpecFusionAss.pro";
            COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
            try
            {
                //初始化
                oCom.CreateObject(0, 0, 0);
                //参数设置

                oCom.SetIDLVariable("FilenameAss", sFilename_Ass);
                oCom.SetIDLVariable("FilenameRef", sFilename_Ref);
                oCom.SetIDLVariable("OutputPath", sFilename_Output);
                oCom.SetIDLVariable("QuaKind", sQuaKindEn);
                oCom.SetIDLVariable("QuaArr", sQuaArr);
                //编译idl功能源码
                oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
                //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
                oCom.ExecuteString("SpecFusionAss,FilenameAss,FilenameRef,OutputPath,QuaKind,QuaArr,Message=Message");
                object objArr = oCom.GetIDLVariable("Message");
                //返回错误消息
                if (objArr != null)
                {
                    MessageBox.Show(objArr.ToString());
                    oCom.DestroyObject();
                    this.btn_OK.Enabled = true;
                    return;
                }
                oCom.DestroyObject();
                MessageBox.Show("光谱融合质量评价完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btn_OK.Enabled             = true;
                this.btn_OpenOutputPath.Visible = true;
                QuaAssShowForm vSpecQuaAssShowForm = new QuaAssShowForm(this);
                vSpecQuaAssShowForm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion
            this.btn_OK.Enabled = true;
        }
Example #3
0
 private void btn_OK_Click(object sender, EventArgs e)
 {
     #region 输入与输出路径条件判断
     if (this.TextBox_AssImg.Text.Equals(""))
     {
         MessageBox.Show("请选择输入待评价影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (this.TextBox_RefImg.Text.Equals(""))
     {
         MessageBox.Show("请选择输入参考影像!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (this.TextBox_OutputPath.Text.Equals(""))
     {
         MessageBox.Show("请选择输出影像路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (this.listView_Ass.Items.Count != this.listView_Ref.Items.Count)
     {
         MessageBox.Show("输入的待评价影像和参考影像文件数不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (!this.cbx_AbsDiffAve_1.Checked && !this.cbx_EA_2.Checked && !this.cbx_Bias_3.Checked)
     {
         MessageBox.Show("请至少选择一项评价指标!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     #endregion
     this.btn_OK.Enabled = false;
     #region 界面参数获取
     //待评价影像
     List <string> list_Ass = new List <string>();
     foreach (ListViewItem item in this.listView_Ass.Items)
     {
         string s = this.TextBox_AssImg.Text + "\\" + item.SubItems[0].Text.Trim();
         list_Ass.Add(s);
     }
     string[] sFilename_Ass = (string[])list_Ass.ToArray();
     this.sGlobal_Filename_Ass = sFilename_Ass;
     //参考影像
     List <string> list_Ref = new List <string>();
     foreach (ListViewItem item in this.listView_Ref.Items)
     {
         string s = this.TextBox_RefImg.Text + "\\" + item.SubItems[0].Text.Trim();
         list_Ref.Add(s);
     }
     string[] sFilename_Ref = (string[])list_Ref.ToArray();
     //输出路径
     string sFilename_Output = this.TextBox_OutputPath.Text.Trim();
     sGlobal_OutDir = sFilename_Output;
     //评价指标
     string[] sQuaArr = new string[] { "", "", "", "" };
     if (this.cbx_AbsDiffAve_1.Checked)
     {
         sQuaArr[0] = "TRUE";
     }
     if (this.cbx_EA_2.Checked)
     {
         sQuaArr[1] = "TRUE";
     }
     if (this.cbx_Bias_3.Checked)
     {
         sQuaArr[2] = "TRUE";
     }
     if (this.cbx_LinearFit_4.Checked)
     {
         sQuaArr[3] = "TRUE";
     }
     #endregion
     #region 调用IDL程序
     //IDLSav的路径
     string sIDLSavPath = FileManage.getApplicatonPath();
     sIDLSavPath = sIDLSavPath + "IDLSav\\TSFusionAss.pro";
     COM_IDL_connectLib.COM_IDL_connectClass oCom = new COM_IDL_connectLib.COM_IDL_connectClass();
     try
     {
         //初始化
         oCom.CreateObject(0, 0, 0);
         //参数设置
         oCom.SetIDLVariable("F_files", sFilename_Ass);
         oCom.SetIDLVariable("Ref_files", sFilename_Ref);
         oCom.SetIDLVariable("OutPutPath", sFilename_Output);
         oCom.SetIDLVariable("QuaArr", sQuaArr);
         //编译2次idl功能源码(奇怪啊,非得编译两次才能运行,无法理解)
         oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
         oCom.ExecuteString(".compile -v '" + sIDLSavPath + "'");
         //oCom.ExecuteString("restore,\'" + sIDLSavPath + "\'");
         //执行
         oCom.ExecuteString("TSFusionAss,Ref_files,F_files,OutPutPath,QuaArr,Message=Message");
         object objArr = oCom.GetIDLVariable("Message");
         //返回错误消息
         if (objArr != null)
         {
             MessageBox.Show(objArr.ToString());
             oCom.DestroyObject();
             this.btn_OK.Enabled = true;
             return;
         }
         oCom.DestroyObject();
         MessageBox.Show("时空融合质量评价完毕", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.btn_OK.Enabled             = true;
         this.btn_OpenOutputPath.Visible = true;
         QuaAssShowForm vQuaAssShowForm = new QuaAssShowForm(this);
         vQuaAssShowForm.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     #endregion
     this.btn_OK.Enabled = true;
 }