public DiscretizeSettingsDialog(DiscretizeSettings settings, Image originalImage)
        {
            this.settings = settings;
            this.originalImage = originalImage;

            InitializeComponent();

            switch (settings.discretizeMethod)
            {
                case DiscretizeMethod.DiscretizeForeground:
                    radioButton2.Checked = true; break;
                case DiscretizeMethod.DiscretizeIntensity:
                    radioButton1.Checked = true; break;
                case DiscretizeMethod.DiscretizeHue:
                    radioButton3.Checked = true; break;
                case DiscretizeMethod.DiscretizeSaturation:
                    radioButton4.Checked = true; break;
                case DiscretizeMethod.DiscretizeValue:
                    radioButton5.Checked = true; break;
            }

            ValueChanged(true);

            this.MaximumSize = Size;
        }
Пример #2
0
        //Constructs the document and places it in the provided state
        public NuGenDocument(DigitizeState state)
        {
            listeners = new List <NuGenImageListener>();

            pointSets     = new NuGenPointSetCollection();
            segments      = new NuGenSegmentCollection();
            transform     = new NuGenScreenTranslate(this);
            gridDisplay   = new List <GridlineScreen>();
            digitizeState = state;
            matchSet      = new NuGenMatchSet(pointMatchSettings);

            //load all of the settings
            NuGenDefaultSettings rSettings = NuGenDefaultSettings.GetInstance();

            coordSettings      = rSettings.CoordSettings;
            exportSettings     = rSettings.ExportSettings;
            segmentSettings    = rSettings.SegmentSettings;
            pointMatchSettings = rSettings.PointMatchSettings;

            gridRemovalSettings             = rSettings.GridRemovalSettings;
            gridDisplaySettings.initialized = false;
            gridDisplaySettings.gridSetX    = rSettings.GridDisplayGridSetX;
            gridDisplaySettings.gridSetY    = rSettings.GridDisplayGridSetY;

            discretizeSettings  = rSettings.DiscretizeSettings;
            backgroundSelection = rSettings.BackgroundSelection;
        }
Пример #3
0
        public DiscretizeSettingsDialog(DiscretizeSettings settings, Image originalImage)
        {
            this.settings      = settings;
            this.originalImage = originalImage;

            InitializeComponent();

            switch (settings.discretizeMethod)
            {
            case DiscretizeMethod.DiscretizeForeground:
                radioButton2.Checked = true; break;

            case DiscretizeMethod.DiscretizeIntensity:
                radioButton1.Checked = true; break;

            case DiscretizeMethod.DiscretizeHue:
                radioButton3.Checked = true; break;

            case DiscretizeMethod.DiscretizeSaturation:
                radioButton4.Checked = true; break;

            case DiscretizeMethod.DiscretizeValue:
                radioButton5.Checked = true; break;
            }

            ValueChanged(true);

            this.MaximumSize = Size;
        }
        public GridRemovalSettingsDialog(NuGenDocument doc)
        {
            this.settings = doc.GridRemovalSettings;
            this.originalImage = doc.OriginalImage;
            this.discretizeSettings = doc.DiscretizeSettings;
            this.transform = doc.Transform;
            this.bgColor = doc.BackgroundColor;
            this.coordSettings = doc.CoordSettings;

            if (doc.ValidAxes)
                this.gridRemovalMesh = doc.GridDisplaySettings;
            else
                this.gridRemovalMesh.initialized = false;

            discretizeSettings.discretizeMethod = DiscretizeMethod.DiscretizeForeground;

            InitializeComponent();
            InitializeDefaults();

            if (!(doc.ValidAxes || doc.ValidScale))
            {
                textBox1.Enabled = false;
                textBox2.Enabled = false;
                checkBox2.Enabled = false;
                checkBox2.Checked = false;
                checkBox3.Enabled = false;
                checkBox3.Checked = false;
            }

            histogram.ValueChanged = this.ValueChanged;

            ValueChanged(true);

            this.MaximumSize = Size;
        }
Пример #5
0
        public ImageHistogram(Image image, DiscretizeSettings settings)
        {
            this.image = new Bitmap(image.Clone() as Image);
            this.settings = settings;

            discretize = new NuGenDiscretize(new Bitmap(image), settings);

            switch (settings.discretizeMethod)
            {
                case DiscretizeMethod.DiscretizeForeground :
                    histogramData = new int[101]; displayData = new int[101]; break;
                case DiscretizeMethod.DiscretizeHue :
                    histogramData = new int[361]; displayData = new int[361]; break;
                case DiscretizeMethod.DiscretizeIntensity:
                    histogramData = new int[101]; displayData = new int[101]; break;
                case DiscretizeMethod.DiscretizeSaturation:
                    histogramData = new int[101]; displayData = new int[101]; break;
                case DiscretizeMethod.DiscretizeValue:
                    histogramData = new int[101]; displayData = new int[101]; break;
            }

            innerPanel = new Panel();
            innerPanel.Size = new Size(Width - pad, Height - pad - slidersSize);
            innerPanel.Location = new Point(pad / 2, pad / 2);
            innerPanel.Paint += new PaintEventHandler(innerPanel_Paint);

            lowBar = new TrackBar();
            lowBar.Location = new Point(0, innerPanel.Location.Y + innerPanel.Height + 5);
            lowBar.Size = new Size(Width, 25);
            lowBar.TickStyle = TickStyle.None;
            lowBar.Minimum = 0;
            lowBar.Maximum = 100;
            lowBar.AutoSize = false;
            lowBar.ValueChanged += new EventHandler(lowBar_ValueChanged);
            lowBar.MouseUp += new MouseEventHandler(lowBar_MouseUp);

            highBar = new TrackBar();
            highBar.Location = new Point(lowBar.Location.X, lowBar.Location.Y + lowBar.Height + 5);
            highBar.Size = new Size(Width, 25);
            highBar.TickStyle = TickStyle.None;
            highBar.AutoSize = false;
            highBar.Minimum = 0;
            highBar.Maximum = 100;
            highBar.ValueChanged += new EventHandler(highBar_ValueChanged);
            highBar.MouseUp += new MouseEventHandler(highBar_MouseUp);
            
            this.DoubleBuffered = true;            

            Controls.Add(innerPanel);
            Controls.Add(lowBar);
            Controls.Add(highBar);

            this.BorderStyle = BorderStyle.Fixed3D;

            lowBar.Value = GetLowThreshold();
            highBar.Value = GetHighThreshold();
        }
Пример #6
0
        void ValueChanged(bool ignoreThread)
        {
            discretizeSettings = histogram.Settings;
            settings.foregroundThresholdLow  = histogram.Settings.foregroundThresholdLow;
            settings.foregroundThresholdHigh = histogram.Settings.foregroundThresholdHigh;

            if (ignoreThread && discretizeThread != null)
            {
                discretizeThread.Abort();
                discretizeThread = null;
            }

            if (discretizeThread == null)
            {
                discretizeThread = new Thread(new ThreadStart(this.DiscretizeGo));
                discretizeThread.Start();
            }
        }
Пример #7
0
        public GridRemovalSettingsDialog(NuGenDocument doc)
        {
            this.settings           = doc.GridRemovalSettings;
            this.originalImage      = doc.OriginalImage;
            this.discretizeSettings = doc.DiscretizeSettings;
            this.transform          = doc.Transform;
            this.bgColor            = doc.BackgroundColor;
            this.coordSettings      = doc.CoordSettings;

            if (doc.ValidAxes)
            {
                this.gridRemovalMesh = doc.GridDisplaySettings;
            }
            else
            {
                this.gridRemovalMesh.initialized = false;
            }

            discretizeSettings.discretizeMethod = DiscretizeMethod.DiscretizeForeground;

            InitializeComponent();
            InitializeDefaults();

            if (!(doc.ValidAxes || doc.ValidScale))
            {
                textBox1.Enabled  = false;
                textBox2.Enabled  = false;
                checkBox2.Enabled = false;
                checkBox2.Checked = false;
                checkBox3.Enabled = false;
                checkBox3.Checked = false;
            }

            histogram.ValueChanged = this.ValueChanged;

            ValueChanged(true);

            this.MaximumSize = Size;
        }
Пример #8
0
        //Constructs this discretize using the image as the source of data
        public NuGenDiscretize(Image img, DiscretizeSettings settings)
        {
            this.settings = settings;

            this.bmp = new Bitmap(img);
        }
        void ValueChanged(bool ignoreThread)
        {
            discretizeSettings = histogram.Settings;
            settings.foregroundThresholdLow = histogram.Settings.foregroundThresholdLow;
            settings.foregroundThresholdHigh = histogram.Settings.foregroundThresholdHigh;

            if (ignoreThread && discretizeThread != null)
            {
                discretizeThread.Abort();
                discretizeThread = null;
            }

            if (discretizeThread == null)
            {
                discretizeThread = new Thread(new ThreadStart(this.DiscretizeGo));
                discretizeThread.Start();
            }

        }
Пример #10
0
        public ImageHistogram(Image image, DiscretizeSettings settings)
        {
            this.image    = new Bitmap(image.Clone() as Image);
            this.settings = settings;

            discretize = new NuGenDiscretize(new Bitmap(image), settings);

            switch (settings.discretizeMethod)
            {
            case DiscretizeMethod.DiscretizeForeground:
                histogramData = new int[101]; displayData = new int[101]; break;

            case DiscretizeMethod.DiscretizeHue:
                histogramData = new int[361]; displayData = new int[361]; break;

            case DiscretizeMethod.DiscretizeIntensity:
                histogramData = new int[101]; displayData = new int[101]; break;

            case DiscretizeMethod.DiscretizeSaturation:
                histogramData = new int[101]; displayData = new int[101]; break;

            case DiscretizeMethod.DiscretizeValue:
                histogramData = new int[101]; displayData = new int[101]; break;
            }

            innerPanel          = new Panel();
            innerPanel.Size     = new Size(Width - pad, Height - pad - slidersSize);
            innerPanel.Location = new Point(pad / 2, pad / 2);
            innerPanel.Paint   += new PaintEventHandler(innerPanel_Paint);

            lowBar               = new TrackBar();
            lowBar.Location      = new Point(0, innerPanel.Location.Y + innerPanel.Height + 5);
            lowBar.Size          = new Size(Width, 25);
            lowBar.TickStyle     = TickStyle.None;
            lowBar.Minimum       = 0;
            lowBar.Maximum       = 100;
            lowBar.AutoSize      = false;
            lowBar.ValueChanged += new EventHandler(lowBar_ValueChanged);
            lowBar.MouseUp      += new MouseEventHandler(lowBar_MouseUp);

            highBar               = new TrackBar();
            highBar.Location      = new Point(lowBar.Location.X, lowBar.Location.Y + lowBar.Height + 5);
            highBar.Size          = new Size(Width, 25);
            highBar.TickStyle     = TickStyle.None;
            highBar.AutoSize      = false;
            highBar.Minimum       = 0;
            highBar.Maximum       = 100;
            highBar.ValueChanged += new EventHandler(highBar_ValueChanged);
            highBar.MouseUp      += new MouseEventHandler(highBar_MouseUp);

            this.DoubleBuffered = true;

            Controls.Add(innerPanel);
            Controls.Add(lowBar);
            Controls.Add(highBar);

            this.BorderStyle = BorderStyle.Fixed3D;

            lowBar.Value  = GetLowThreshold();
            highBar.Value = GetHighThreshold();
        }
Пример #11
0
        //Constructs this discretize using the image as the source of data
        public NuGenDiscretize(Image img, DiscretizeSettings settings)
        {
            this.settings = settings;

            this.bmp = new Bitmap(img);            
        }