Exemplo n.º 1
0
        public void WriteCsv(IEnumerable <CoralPatch> collection)
        {
            var saveFileDialog1 = new SaveFileDialog
            {
                Filter           = "csv files (*.csv)|*.csv",
                FilterIndex      = 2,
                RestoreDirectory = true
            };

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Stream myStream = saveFileDialog1.OpenFile();

                if (myStream.CanWrite)
                {
                    var file = new StreamWriter(myStream);

                    file.Write(CoralPatch.CsvHeader() + "\n");

                    foreach (var coralPatch in collection)
                    {
                        file.Write(coralPatch.ToCsvFormat() + "\n");
                    }

                    file.Close();
                }
            }
        }
Exemplo n.º 2
0
        private void CoralPatchLabelListboxSelectedIndexChanged(object sender, EventArgs e)
        {
            //try
            //{
            // update image and patch
            _selectedPatch = _coralPatches.ElementAt(coralPatchLabelListbox.SelectedIndex);
            var img = _imageReader.GetImage(coralPatchLabelListbox.SelectedIndex);

            CoralPictureBox.Image = img;
            _segmentor.CacheImage(img);
            _segmentor.UpdatePatch(_selectedPatch);

            // update coords if needed
            if (_selectedPatch.IsRelativePosition)
            {
                _selectedPatch.ToAbsolute(img.Width, img.Height);
            }

            /*}
             * catch(Exception x)
             * {
             *  MessageBox.Show("The associated image file was not found! make sure the relative path is correct. The error was : " + x.Message);
             * }*/

            // update display
            classDisplayLabel.Text = _selectedPatch.ClassLabel;
            DrawPatch();
        }
 public override void UpdatePatch(CoralPatch newPatch)
 {
     base.UpdatePatch(newPatch);
     // apply default parameters if needed
     if (!SelectedPatch.x0.HasValue)
     {
         SelectedPatch.x0 = (int)SelectedPatch.PatchCenterX;
     }
     if (!SelectedPatch.y0.HasValue)
     {
         SelectedPatch.y0 = (int)SelectedPatch.PatchCenterY;
     }
     if (!SelectedPatch.x1.HasValue)
     {
         SetPatchScale(1.00d);
     }
 }
Exemplo n.º 4
0
 public virtual void UpdatePatch(CoralPatch newPatch)
 {
     SelectedPatch = newPatch;
 }