Example #1
0
 public FrmBinarize(Img img)
 {
     InitializeComponent();
     if (!img.IsGrayscale)
     {
         throw new ArgumentException("输入的不是灰度图像。");
     }
     BValueSelector.Min            = img.Min[0];
     BValueSelector.Max            = img.Max[0];
     BValueSelector.Value          = (img.Min[0] + img.Max[0]) / 2;
     BValueSelector.Ratio          = 0.1;
     BFilePathSelector.Filter      = "All files|*.*|GeoTIFF|*.tif";
     BFilePathSelector.FilterIndex = 2;
     CheckMethod();
 }
Example #2
0
 public FrmRoughness(Img Image)
 {
     InitializeComponent();
     if (Image.BandNum == 1)
     {
         this.InputImg                  = Image;
         NoDataValueTextBox.Text        = InputImg.NoDataValue[0].ToString();
         NewNoDataValueTextBox.Text     = NewNoDataValue.ToString();
         RFFilePathSelector.Filter      = "All files|*.*|Geotiff|*.tif";
         RFFilePathSelector.FilterIndex = 2;
     }
     else
     {
         this.Close();
         throw new ArgumentOutOfRangeException("操作的影像不是灰度影像。");
     }
 }
Example #3
0
 private void InputFileListView_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (InputFileListView.SelectedIndices.Count > 0)
     {
         ISConfirmAbortButtons.ConfirmButton.Enabled = true;
         SelectedImg = imgs[InputFileListView.SelectedIndices[0]];
         string filePath   = "文件:" + SelectedImg.Path;
         string dims       = "维度:" + SelectedImg.Width.ToString() + " × " + SelectedImg.Height.ToString() + " × " + SelectedImg.BandNum.ToString();
         string size       = "大小:" + new FileInfo(SelectedImg.Path).Length.ToString() + "字节(Byte)。";
         string projection = "投影:" + SelectedImg.Projection;
         FileInfoRichTextBox.Clear();
         FileInfoRichTextBox.Text += filePath + "\r\n" + dims + "\r\n" + size + "\r\n" + projection;
     }
     else
     {
         ISConfirmAbortButtons.ConfirmButton.Enabled = false;
     }
 }
Example #4
0
 public FrmBandSelector(Img Image, string Title = "选择波段组合")
 {
     try
     {
         InitializeComponent();
         this.Image = Image;
         if (Image.BandNum < 2)
         {
             throw new Exception("选择了灰度影像...");
         }
         this.Text = Title + " - " + Path.GetFileName(Image.Path);
         Checked   = false;
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
         this.DialogResult = DialogResult.Cancel;
         this.Close();
     }
 }
Example #5
0
 //RGB灰度化
 private void RGB2GrayToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         Img         img = Images[DisplayImageIndex];
         FrmRGB2Gray FRG = new FrmRGB2Gray(img);
         if (FRG.ShowDialog(this) == DialogResult.OK)
         {
             if (Tools.Common.RGB2GrayScale(img, FRG.RGBValues, FRG.R2GFilePathSelector.OutDataType, FRG.R2GFilePathSelector.Path))
             {
                 CheckFile(FRG.R2GFilePathSelector.Path);
                 ManageTreeView();
             }
         }
         FRG.Dispose();
     }
     catch (Exception err)
     {
         MessageBox.Show(err.ToString());
     }
 }
Example #6
0
 //导出当前视图
 private void ExportViewToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         Img       img = Images[DisplayImageIndex];
         FrmExport EF  = new FrmExport();
         if (EF.ShowDialog(this) == DialogResult.OK)
         {
             if (Tools.Common.ExportView(img, EF.OutDataType, EF.OutPath))
             {
                 CheckFile(EF.OutPath);
                 ManageTreeView();
             }
         }
         EF.Dispose();
     }
     catch (Exception err)
     {
         MessageBox.Show(err.ToString());
     }
 }
Example #7
0
        //检查是否与已有文件重复
        private bool CheckFile(string CheckPath)
        {
            foreach (Img Image in Images)
            {
                if (Image.Path == CheckPath)
                {
                    return(false);
                }
            }
            try
            {
                Img NewImg;
                this.Cursor = Cursors.WaitCursor;
                NewImg      = new Img(CheckPath, this, this.HintLabel, this.OperationProgressBar);
                Images.Add(NewImg);
                Tools.Common.RebuildBitmap(Images[Images.Count - 1], ImageViewPictureBox.Width, ImageViewPictureBox.Height);    //添加完文件后生成Bitmap。
                this.Cursor = Cursors.Arrow;
            }
            catch (ApplicationException err)
            {
                this.Cursor = Cursors.Arrow;
                System.Diagnostics.Trace.Write(err.ToString());
                SetHint("打开失败" + CheckPath);

                return(false);
            }
            catch (Exception err)
            {
                this.Cursor = Cursors.Arrow;
                MessageBox.Show(err.ToString());
                SetHint("打开失败" + CheckPath);

                return(false);
            }
            SetHint("已添加" + CheckPath);
            return(true);
        }
Example #8
0
 public FrmCustomStretch(Img Image)
 {
     InitializeComponent();
     this.Image = Image;
 }
Example #9
0
 public FrmViewMetaData(Img img)
 {
     InitializeComponent();
     this.img  = img;
     this.Text = "影像元数据 - " + Path.GetFileName(img.Path);
 }
Example #10
0
 public FrmViewHistogram(Img Image)
 {
     InitializeComponent();
     this.Image = Image;
 }