123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325 |
- using Metis.ParameterSet;
- using OpenCvSharp;
- using PaintDotNet.Base;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.CustomControl;
- using PaintDotNet.Data.Param;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.IO;
- using System.Windows.Forms;
- namespace PaintDotNet.Binarization
- {
- /// <summary>
- /// 二值提取
- /// </summary>
- internal class BinaryExtractDialog : PdnBaseForm
- {
- #region 控件
- private GroupBox groupBox1;
- private GroupBox groupBox2;
- private CheckBox checkBox1;
- private Button button2;
- private Button button1;
- private GroupBox groupBox3;
- private GroupBox groupBox4;
- private ListView listView1;
- private ImageList imageList1;
- private IContainer components;
- private GroupBox groupBox5;
- private GroupBox groupBox6;
- private GroupBox groupBox7;
- private Label label1;
- private ComboBox comboBox1;
- private Button button3;
- private Button button4;
- private Button button5;
- private CheckBox checkBox2;
- private CheckBox checkBox3;
- private CheckBox checkBox4;
- private NumericUpDown numericUpDown2;
- private NumericUpDown numericUpDown1;
- private RadioButton radioButton2;
- private RadioButton radioButton1;
- private Panel panel2;
- private Label label2;
- private Button button6;
- private Button button7;
- private CheckBox checkBox5;
- private CustomControl.DecimalScopeControl numberScopeControl3;
- private CustomControl.DecimalScopeControl numberScopeControl2;
- private CustomControl.DecimalScopeControl numberScopeControl1;
- private RadioButton radioButton5;
- private RadioButton radioButton4;
- private RadioButton radioButton3;
- private CustomControl.HistogramControl histogramControl1;
- private Button button8;
- private Button button9;
- private Button button10;
- #endregion
- /// <summary>
- /// 主控件
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 公共按钮
- /// </summary>
- private CommonControlButtons commonControlButtons;
- /// <summary>
- /// 图像面板
- /// </summary>
- private DocumentWorkspaceWindow documentWorkspace;
- /// <summary>
- /// 处理程序
- /// </summary>
- private ParamObject action = new Data.Action.Action901();
- /// <summary>
- /// 步长 初始值1,依次增加
- /// </summary>
- private string stepLength = "00" + Startup.instance.step_length;
- /// <summary>
- /// 调色板
- /// </summary>
- private ColorsForm colorsFormGrid;
- /// <summary>
- /// 选中图片的mat
- /// </summary>
- private Mat imageMat;
- /// <summary>
- /// 参数下拉的集合
- /// </summary>
- private List<string> files = new List<string>();
- /// <summary>
- /// 初始系统参数配置值
- /// </summary>
- private BinaryExtractionModel binaryExtractionModel;
- /// <summary>
- /// 选中的左侧list的下标
- /// </summary>
- private int index = 0;
- /// <summary>
- /// 单位标尺
- /// </summary>
- private double unitLength = 1;
- /// <summary>
- /// 另存为弹出框显示
- /// </summary>
- private CreateNameDialog dialog;
- private int menuId;
- private string menuName;
- /// <summary>
- /// 各个图片对应数据
- /// </summary>
- private GrainSizeAnalysisModel analysisModel;
- private const string ParamKey_Paramlist = "paramlist";//参数列表
- private const string ParamKey_NewPic = "newPic";//创建新图
- public BinaryExtractDialog(AppWorkspace appWorkspace, string dialogText, PdnMenuItem menuItem)
- {
- this.menuId = menuItem.MenuId;
- this.menuName = menuItem.Text;
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryActionSaving\\ParameterSaving.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
- foreach (var item in this.analysisModel.ListParam)
- item.setValue();
- InitializeComponent();
- InitializeLanguageText();
- //
- // 设置Dialog属性
- //
- this.appWorkspace = appWorkspace;
- this.Text = dialogText;
- this.Icon = PdnInfo.AppIcon;
- //
- // 初始化目标选择的背景图
- //
- this.InitButtonBackgroundImage();
- //
- //初始化色板
- //
- this.colorsFormGrid = new ColorsForm();
- this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
- //
- //初始化图像控件
- //
- this.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
- this.documentWorkspace.Dock = DockStyle.Fill;
- this.documentWorkspace.HookMouseEvents();
- this.documentWorkspace.AuxiliaryLineEnabled = false;
- this.documentWorkspace.Visible = false;
- this.groupBox1.Controls.Add(documentWorkspace);
- //
- //初始化操作按钮
- //
- this.commonControlButtons = new CommonControlButtons();
- this.commonControlButtons.Dock = DockStyle.Top;
- this.commonControlButtons.Height = 30;
- this.commonControlButtons.HideZoomToWindowAndActualSize();
- this.groupBox1.Controls.Add(commonControlButtons);
- //
- //初始化相
- //
- PhaseModel model = new PhaseModel();
- model.choise = true;
- model.mat = null;
- model.color = panel2.BackColor.ToArgb();
- model.position = this.documentWorkspace.PhaseModels.Count + 1;
- model.name = PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text");
- this.documentWorkspace.PhaseModels.Add(model);
- //
- // 设置listview事件
- //
- this.listView1.SelectedIndexChanged += new EventHandler(this.ListViewSelectedIndexChanged);
- InitParameterList();
- //如果是脚本执行,将参数带入(AppWorkspace.ScriptRunning && AppWorkspace.ScriptCurrentParam != null && AppWorkspace.ScriptCurrentParam.MenuId == action.MenuId);
- if (this.appWorkspace.ScriptRunning && this.appWorkspace.ScriptCurrentParam != null && this.appWorkspace.ScriptCurrentParam.MenuId == action.MenuId)
- {
- foreach (Args arg in action.Lists)
- {
- Args param1 = this.appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
- if (param1.value != null)
- arg.Value = param1.value;
- }
- foreach (Args args in action.Lists)
- {
- if (args.Key == "colorInterval")
- {
- this.binaryExtractionModel.ColorInterval = (Boolean)args.Value ? 2 : 1;
- }
- else if (args.Key == "scope1")
- {
- List<double> twoL = (List<double>)args.Value;
- this.binaryExtractionModel.ColorOneStart = (int)twoL[0];
- this.binaryExtractionModel.ColorOneEnd = (int)twoL[1];
- }
- else if (args.Key == "scope2")
- {
- List<double> twoL = (List<double>)args.Value;
- this.binaryExtractionModel.ColorTwoStart = (int)twoL[0];
- this.binaryExtractionModel.ColorTwoEnd = (int)twoL[1];
- }
- else if (args.Key == "scope3")
- {
- List<double> twoL = (List<double>)args.Value;
- this.binaryExtractionModel.ColorThreeStart = (int)twoL[0];
- this.binaryExtractionModel.ColorThreeEnd = (int)twoL[1];
- }
- else if (args.Key == "deleteBoundaryObject")
- {
- this.binaryExtractionModel.DeleteBoundaryObject = (bool)args.Value;
- }
- else if (args.Key == "holeFilling")
- {
- this.binaryExtractionModel.HoleFilling = (bool)args.Value;
- }
- else if (args.Key == "debrisRemoval")
- {
- this.binaryExtractionModel.DebrisRemoval = (bool)args.Value;
- }
- else if (args.Key == "scope4")
- {
- this.binaryExtractionModel.DebrisAreaStart = (int)((List<double>)args.Value)[0];
- this.binaryExtractionModel.DebrisAreaEnd = (int)((List<double>)args.Value)[1];
- }
- else if (args.Key == "binaryStyle")
- {
- this.binaryExtractionModel.BinaryStyle = (int)args.Value;
- }
- else if (args.Key == "phaseColor")
- {
- this.binaryExtractionModel.PhaseColor = (int)args.Value;
- }
- else if (args.Key == "targetSelection")
- {
- this.binaryExtractionModel.TargetSelection = (int)args.Value - 1;
- }
- else if (args.Key == "createNewImg")
- {
- checkBox1.Checked = (int)args.Value == 0 ? true : false;
- }
- }
- this.appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
- }
- InitPicList();
- InitHistogramDragEvent();
- InitCommonButtonEvent();
- this.Shown += new EventHandler(this.ShownChoiseItemAndInitData);
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing);
- }
- private void formClosing(object sender, EventArgs e)
- {
- #region [开启脚本录制]
- if (appWorkspace.startScriptRecording)
- {
- getScriptRecording();
- }
- #endregion
- }
- private void ShownChoiseItemAndInitData(object sender, EventArgs e)
- {
- //滚动到指定的行位置
- this.listView1.EnsureVisible(index);
- // 初始化数据
- this.imageMat = this.appWorkspace.DocumentWorkspaces[index].CompositionSurface.CreatedAliasedMat();
- Document document = Document.FromImageMat(imageMat.Clone());
- this.documentWorkspace.Document = document;
- this.documentWorkspace.Visible = true;
- this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[index].GraphicsList;
- //this.applyButtonImpl(null, null);
- //显示直方图
- this.histogramControl1.CreateHistogram(this.imageMat, true, 339, 130, 0);
- GetListParamModel();
- InitParameterToControl();
- }
- private void InitButtonBackgroundImage()
- {
- this.button8.FlatStyle = FlatStyle.Flat;
- this.button8.FlatAppearance.BorderSize = 0;
- this.button8.BackgroundImageLayout = ImageLayout.Zoom;
- this.button8.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray1.png").Reference;
- this.button8.Click += new EventHandler(this.button8_click);
- this.button9.FlatStyle = FlatStyle.Flat;
- this.button9.FlatAppearance.BorderSize = 0;
- this.button9.BackgroundImageLayout = ImageLayout.Zoom;
- this.button9.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyle2.png").Reference;
- this.button9.Click += new EventHandler(this.button9_click);
- this.button10.FlatStyle = FlatStyle.Flat;
- this.button10.FlatAppearance.BorderSize = 0;
- this.button10.BackgroundImageLayout = ImageLayout.Zoom;
- this.button10.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray3.png").Reference;
- this.button10.Click += new EventHandler(this.button10_click);
- }
- private void button8_click(object sender, EventArgs e)
- {
- this.binaryExtractionModel.TargetSelection = 1;
- this.radioButton3.Checked = true;
- this.button8.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyle1.png").Reference;
- this.button9.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray2.png").Reference;
- this.button10.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray3.png").Reference;
- }
- private void button9_click(object sender, EventArgs e)
- {
- this.binaryExtractionModel.TargetSelection = 2;
- this.radioButton4.Checked = true;
- this.button9.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyle2.png").Reference;
- this.button8.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray1.png").Reference;
- this.button10.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray3.png").Reference;
- }
- private void button10_click(object sender, EventArgs e)
- {
- this.binaryExtractionModel.TargetSelection = 3;
- this.radioButton5.Checked = true;
- this.button10.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyle3.png").Reference;
- this.button8.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray1.png").Reference;
- this.button9.BackgroundImage = PdnResources.GetImageResource("Images.BinaryExtractChoiseStyleGray2.png").Reference;
- }
- private void InitCommonButtonEvent()
- {
- this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
- this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
- this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
- this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
- this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
- this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
- }
- private void zoomInButton_Click(object sender, EventArgs e)
- {
- if (this.imageMat != null)
- this.documentWorkspace.ZoomIn();
- }
- private void zoomOutButton_Click(object sender, EventArgs e)
- {
- if (this.imageMat != null)
- this.documentWorkspace.ZoomOut();
- }
- private void zoomToWindowButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
- }
- private void actualSizeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
- this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
- }
- private void pointerButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
- }
- private void mobileModeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
- }
- private void InitHistogramDragEvent()
- {
- this.histogramControl1.DragOneEventActionFinish += new EventHandler<EventArgs<int>>(this.DragOneEvent);
- this.histogramControl1.DragTwoEventActionFinish += new EventHandler<EventArgs<int>>(this.DragTwoEvent);
- this.histogramControl1.DragThreeEventActionFinish += new EventHandler<EventArgs<int>>(this.DragThreeEvent);
- this.histogramControl1.DragFourEventActionFinish += new EventHandler<EventArgs<int>>(this.DragFourEvent);
- this.histogramControl1.DragFiveEventActionFinish += new EventHandler<EventArgs<int[]>>(this.DragFiveEvent);
- this.histogramControl1.DragSixEventActionFinish += new EventHandler<EventArgs<int[]>>(this.DragSixEvent);
- }
- /// <summary>
- /// 颜色区间2 截止值变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void DragFourEvent(object sender, EventArgs<int> e)
- {
- this.numberScopeControl2.maxValue = e.Data;
- this.SetArgsValue();
- }
- /// <summary>
- /// 颜色区间2 起始值变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void DragThreeEvent(object sender, EventArgs<int> e)
- {
- this.numberScopeControl2.minValue = e.Data;
- this.SetArgsValue();
- }
- /// <summary>
- /// 颜色区间1 截止值变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void DragTwoEvent(object sender, EventArgs<int> e)
- {
- if (this.binaryExtractionModel.ColorInterval == 1)
- {
- this.numberScopeControl1.maxValue = e.Data;
- }
- else if (this.binaryExtractionModel.ColorInterval == 2)
- {
- this.numberScopeControl3.maxValue = e.Data;
- }
- this.SetArgsValue();
- }
- /// <summary>
- /// 颜色区间1 起始值变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void DragOneEvent(object sender, EventArgs<int> e)
- {
- if (this.binaryExtractionModel.ColorInterval == 1)
- {
- this.numberScopeControl1.minValue = e.Data;
- }
- else if (this.binaryExtractionModel.ColorInterval == 2)
- {
- this.numberScopeControl3.minValue = e.Data;
- }
- this.SetArgsValue();
- }
- private void DragFiveEvent(object sender, EventArgs<int[]> e)
- {
- this.DeleteEventHandler();
- if (this.binaryExtractionModel.ColorInterval == 1)
- {
- this.numberScopeControl1.minValue = e.Data[1];
- this.numberScopeControl1.maxValue = e.Data[0];
- }
- else if (this.binaryExtractionModel.ColorInterval == 2)
- {
- this.numberScopeControl3.minValue = e.Data[1];
- this.numberScopeControl3.maxValue = e.Data[0];
- }
- this.AddEventHandler();
- this.SetArgsValue();
- this.applyButtonImpl(null, null);
- }
- private void DragSixEvent(object sender, EventArgs<int[]> e)
- {
- this.DeleteEventHandler();
- /*if (this.binaryExtractionModel.ColorInterval == 1)
- {*/
- this.numberScopeControl2.minValue = e.Data[1];
- this.numberScopeControl2.maxValue = e.Data[0];
- /*}
- else if (this.binaryExtractionModel.ColorInterval == 2)
- {
- this.numberScopeControl3.minValue = e.Data[1];
- this.numberScopeControl3.maxValue = e.Data[0];
- }*/
- this.AddEventHandler();
- this.SetArgsValue();
- this.applyButtonImpl(null, null);
- }
- /// <summary>
- /// 初始化参数配置下拉
- /// </summary>
- public void InitParameterList(int index = 0, bool reInit = true)
- {
- List<string> fileNames = FileOperationHelper.GetFileList(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\");
- files.Clear();
- foreach (string fileName in fileNames)
- {
- string name = fileName.Substring(0, fileName.LastIndexOf("."));
- files.Add(name);
- }
- this.comboBox1.SelectedIndexChanged -= this.comboBox1_SelectedIndexChanged;
- this.comboBox1.DataSource = null;
- this.comboBox1.DataSource = files;
- string nowModelName = Startup.instance.configModel.BinaryParameter.Substring(0, Startup.instance.configModel.Watermark.LastIndexOf("."));
- if (index != 0)
- {
- if (this.files.Count > index)
- {
- this.comboBox1.SelectedIndex = index;
- }
- else
- {
- this.comboBox1.SelectedIndex = 0;
- }
- }
- else
- {
- this.comboBox1.SelectedIndex = files.FindIndex(a => a.Equals(nowModelName));
- }
- if (reInit)
- {
- this.binaryExtractionModel = XmlSerializeHelper.DESerializer<BinaryExtractionModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open));
- }
- this.panel2.BackColor = Color.FromArgb(this.binaryExtractionModel.PhaseColor);
- this.comboBox1.SelectedIndexChanged += new EventHandler(this.comboBox1_SelectedIndexChanged);
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.binaryExtractionModel = XmlSerializeHelper.DESerializer<BinaryExtractionModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open));
- this.InitParameterToControl();
- this.applyButtonImpl(null, null);
- }
- /// <summary>
- /// 把参数的值设置到控件上
- /// </summary>
- public void InitParameterToControl()
- {
- if (this.binaryExtractionModel != null)
- {
- //阈值相关
- //1个颜色区间还是2个
- if (this.binaryExtractionModel.ColorInterval == 1)
- {
- this.numberScopeControl2.Visible = false;
- this.numberScopeControl3.Visible = false;
- this.button6.Text = PdnResources.GetString("Menu.inverse.text");
- }
- else
- {
- this.numberScopeControl2.Visible = true;
- this.numberScopeControl3.Visible = true;
- this.button6.Text = PdnResources.GetString("Menu.Uncheck.text");
- }
- //删除事件
- this.DeleteEventHandler();
- this.numberScopeControl1.maxValue = this.binaryExtractionModel.ColorOneEnd;
- this.numberScopeControl1.minValue = this.binaryExtractionModel.ColorOneStart;
- this.numberScopeControl2.maxValue = this.binaryExtractionModel.ColorTwoEnd;
- this.numberScopeControl2.minValue = this.binaryExtractionModel.ColorTwoStart;
- this.numberScopeControl3.maxValue = this.binaryExtractionModel.ColorThreeEnd;
- this.numberScopeControl3.minValue = this.binaryExtractionModel.ColorThreeStart;
- this.checkBox2.Checked = this.binaryExtractionModel.DeleteBoundaryObject;
- this.checkBox3.Checked = this.binaryExtractionModel.HoleFilling;
- this.checkBox4.Checked = this.binaryExtractionModel.DebrisRemoval;
- this.numericUpDown1.Value = this.binaryExtractionModel.DebrisAreaStart;
- this.numericUpDown2.Value = this.binaryExtractionModel.DebrisAreaEnd;
- if (this.binaryExtractionModel.BinaryStyle == 1) this.radioButton1.Checked = true;
- if (this.binaryExtractionModel.BinaryStyle == 2) this.radioButton2.Checked = true;
- this.panel2.BackColor = Color.FromArgb(this.binaryExtractionModel.PhaseColor);
- if (this.binaryExtractionModel.TargetSelection == 1)
- {
- this.button8_click(null, null);
- }
- if (this.binaryExtractionModel.TargetSelection == 2)
- {
- this.button9_click(null, null);
- }
- if (this.binaryExtractionModel.TargetSelection == 3)
- {
- this.button10_click(null, null);
- }
- this.SetArgsValue();
- foreach (Args args in action.Lists)
- {
- if (args.Key == "targetSelection")
- {
- args.Value = this.binaryExtractionModel.TargetSelection;
- }
- else if (args.Key == "phaseColor")
- {
- args.Value = this.binaryExtractionModel.PhaseColor;
- }
- else if (args.Key == "binaryStyle")
- {
- args.Value = this.binaryExtractionModel.BinaryStyle;
- }
- }
- //添加事件
- this.AddEventHandler();
- //处理直方图
- if (this.binaryExtractionModel.ColorInterval == 1)
- {
- this.histogramControl1.UpdateVerticalBarWithOneScope((int)(this.numberScopeControl1.minValue), (int)(this.numberScopeControl1.maxValue));
- }
- else
- {
- this.histogramControl1.UpdateVerticalBarWithTwoScope(
- (int)(this.numberScopeControl3.minValue),
- (int)(this.numberScopeControl3.maxValue),
- (int)(this.numberScopeControl2.minValue),
- (int)(this.numberScopeControl2.maxValue)
- );
- }
- }
- }
- /// <summary>
- /// 删除事件
- /// </summary>
- private void DeleteEventHandler()
- {
- this.numberScopeControl1.ValueChanged -= this.numberScope1_ValueChanged;
- this.numberScopeControl1.numericUpDown1.KeyUp -= this.numberScope1_ValueChanged;
- this.numberScopeControl1.numericUpDown2.KeyUp -= this.numberScope1_ValueChanged;
- this.numberScopeControl3.numericUpDown2.KeyUp -= this.applyButtonImpl;
- this.numberScopeControl2.ValueChanged -= this.numberScope2_ValueChanged;
- this.numberScopeControl2.numericUpDown1.KeyUp -= this.numberScope2_ValueChanged;
- this.numberScopeControl2.numericUpDown2.KeyUp -= this.numberScope2_ValueChanged;
- this.numberScopeControl3.ValueChanged -= this.numberScope3_ValueChanged;
- this.numberScopeControl3.numericUpDown1.KeyUp -= this.numberScope3_ValueChanged;
- this.numberScopeControl3.numericUpDown2.KeyUp -= this.numberScope3_ValueChanged;
- //this.numberScopeControl1.ValueChanged -= this.applyButtonImpl;
- //this.numberScopeControl2.ValueChanged -= this.applyButtonImpl;
- //this.numberScopeControl3.ValueChanged -= this.applyButtonImpl;
- this.radioButton1.CheckedChanged -= this.radioButton1Or2_ValueChanged;
- this.radioButton2.CheckedChanged -= this.radioButton1Or2_ValueChanged;
- this.checkBox2.CheckedChanged -= this.applyButtonImpl;
- this.panel2.BackColorChanged -= this.applyButtonImpl;
- this.checkBox3.CheckedChanged -= this.applyButtonImpl;
- this.checkBox4.CheckedChanged -= this.applyButtonImpl;
- this.numericUpDown1.KeyUp -= this.Detritus_ValueChanged;
- this.numericUpDown1.ValueChanged -= new System.EventHandler(this.Detritus_ValueChanged);
- this.numericUpDown2.KeyUp -= this.Detritus_ValueChanged;
- this.numericUpDown2.ValueChanged -= new System.EventHandler(this.Detritus_ValueChanged);
- this.radioButton5.CheckedChanged -= this.radioButton5_CheckedChanged;
- this.radioButton4.CheckedChanged -= this.radioButton5_CheckedChanged;
- this.radioButton3.CheckedChanged -= this.radioButton5_CheckedChanged;
- }
- /// <summary>
- /// 添加事件
- /// </summary>
- private void AddEventHandler()
- {
- this.numberScopeControl1.ValueChanged += this.numberScope1_ValueChanged;
- this.numberScopeControl1.numericUpDown1.KeyUp += this.numberScope1_ValueChanged;
- this.numberScopeControl1.numericUpDown2.KeyUp += this.numberScope1_ValueChanged;
- this.numberScopeControl3.numericUpDown2.KeyUp += this.applyButtonImpl;
- this.numberScopeControl2.ValueChanged += this.numberScope2_ValueChanged;
- this.numberScopeControl2.numericUpDown1.KeyUp += this.numberScope2_ValueChanged;
- this.numberScopeControl2.numericUpDown2.KeyUp += this.numberScope2_ValueChanged;
- this.numberScopeControl3.ValueChanged += this.numberScope3_ValueChanged;
- this.numberScopeControl3.numericUpDown1.KeyUp += this.numberScope3_ValueChanged;
- this.numberScopeControl3.numericUpDown2.KeyUp += this.numberScope3_ValueChanged;
- //this.numberScopeControl1.ValueChanged += this.applyButtonImpl;
- //this.numberScopeControl2.ValueChanged += this.applyButtonImpl;
- //this.numberScopeControl3.ValueChanged += this.applyButtonImpl;
- this.radioButton1.CheckedChanged += this.radioButton1Or2_ValueChanged;
- this.radioButton2.CheckedChanged += this.radioButton1Or2_ValueChanged;
- this.checkBox2.CheckedChanged += this.applyButtonImpl;
- this.panel2.BackColorChanged += this.applyButtonImpl;
- this.checkBox3.CheckedChanged += this.applyButtonImpl;
- this.checkBox4.CheckedChanged += this.applyButtonImpl;
- this.numericUpDown1.KeyUp += this.Detritus_ValueChanged;
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.Detritus_ValueChanged);
- this.numericUpDown2.KeyUp += this.Detritus_ValueChanged;
- this.numericUpDown2.ValueChanged += new System.EventHandler(this.Detritus_ValueChanged);
- this.radioButton5.CheckedChanged += this.radioButton5_CheckedChanged;
- this.radioButton4.CheckedChanged += this.radioButton5_CheckedChanged;
- this.radioButton3.CheckedChanged += this.radioButton5_CheckedChanged;
- }
- /// <summary>
- /// 初始化图片列表数据
- /// </summary>
- public void InitPicList()
- {
- //初始化图片列表
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.Thumbnail);//.CreateAliasedBitmap()
- this.listView1.Items.Add("", i);
- this.listView1.Items[i].ImageIndex = i;
- this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
- {
- index = i;
- }
- }
- //
- // 初始化选中的数据
- //
- this.listView1.Items[index].Selected = true; //选中行
- }
- /// <summary>
- /// ListView图片选择改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ListViewSelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.listView1.SelectedItems != null && this.listView1.SelectedItems.Count > 0)
- {
- //获取标尺-微米
- unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.SelectedItems[0].Index].GetRuler(MeasurementUnit.Micron);
- this.appWorkspace.ActiveDocumentWorkspace = this.appWorkspace.DocumentWorkspaces[this.listView1.SelectedItems[0].Index];
- this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.SelectedItems[0].Index].CompositionSurface.CreatedAliasedMat();
- Document document = Document.FromImageMat(imageMat.Clone());
- this.documentWorkspace.Document = document;
- this.documentWorkspace.Visible = true;
- this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.SelectedItems[0].Index].GraphicsList;
- if (this.checkBox4.Checked)
- {
- //参数改变
- foreach (Args args in action.Lists)
- {
- if (args.Key == "scope4")
- {
- ((List<double>)args.Value)[0] = (double)numericUpDown1.Value / unitLength / unitLength;
- ((List<double>)args.Value)[1] = (double)numericUpDown2.Value / unitLength / unitLength;
- break;
- }
- }
- this.binaryExtractionModel.DebrisAreaStart = (int)((double)numericUpDown1.Value / unitLength / unitLength);
- this.binaryExtractionModel.DebrisAreaEnd = (int)((double)numericUpDown2.Value / unitLength / unitLength);
- }
- this.applyButtonImpl(sender, e);
- //显示直方图
- this.histogramControl1.CreateHistogram(this.imageMat, true, 339, 130, 0);
-
- }
- }
- /// <summary>
- /// 添加参数改变的监听
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BinaryExtractionDialog_Load(object sender, EventArgs e)
- {
- System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
- foreach (Args args in action.Lists)
- {
- switch (args.Key)
- {
- case "phaseColor":
- args.Value = this.binaryExtractionModel.PhaseColor;
- break;
- default:
- break;
- }
- }
- this.applyButtonImpl(null, null);
- }
- #region 参数事件
- #region 阈值相关
- /// <summary>
- /// 反选/取消反选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- this.DeleteEventHandler();
- if (numberScopeControl2.Visible)
- {
- this.numberScopeControl1.minValue = this.numberScopeControl3.maxValue;
- this.numberScopeControl1.maxValue = this.numberScopeControl2.minValue;
- this.numberScopeControl2.Visible = false;
- this.numberScopeControl3.Visible = false;
- this.button6.Text = PdnResources.GetString("Menu.inverse.text");
- this.binaryExtractionModel.ColorInterval = 1;
- this.histogramControl1.Flag = 1;
- //处理直方图
- this.histogramControl1.UpdateVerticalBarWithOneScope((int)(this.numberScopeControl1.minValue), (int)(this.numberScopeControl1.maxValue));
- }
- else
- {
- this.numberScopeControl3.minValue = 0;
- this.numberScopeControl3.maxValue = this.numberScopeControl1.minValue;
- this.numberScopeControl2.minValue = this.numberScopeControl1.maxValue;
- this.numberScopeControl2.maxValue = 255;
- this.numberScopeControl2.Visible = true;
- this.numberScopeControl3.Visible = true;
- this.button6.Text = PdnResources.GetString("Menu.Uncheck.text");
- this.binaryExtractionModel.ColorInterval = 2;
- this.histogramControl1.Flag = 2;
- //处理直方图
- this.histogramControl1.UpdateVerticalBarWithTwoScope(
- (int)(this.numberScopeControl3.minValue),
- (int)(this.numberScopeControl3.maxValue),
- (int)(this.numberScopeControl2.minValue),
- (int)(this.numberScopeControl2.maxValue)
- );
- }
- this.AddEventHandler();
- this.SetArgsValue();
- this.applyButtonImpl(null, null);
- }
- /// <summary>
- /// 一个颜色区间时
- /// 区间值变化的事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numberScope1_ValueChanged(object sender, EventArgs e)
- {
- this.SetArgsValue();
- this.binaryExtractionModel.ColorOneStart = (int)(this.numberScopeControl1.numericUpDown1.Value);
- this.binaryExtractionModel.ColorOneEnd = (int)(this.numberScopeControl1.numericUpDown2.Value);
- //处理直方图
- this.histogramControl1.UpdateVerticalBarWithOneScope((int)(this.numberScopeControl1.minValue), (int)(this.numberScopeControl1.maxValue));
- this.applyButtonImpl(null, null);
- }
- /// <summary>
- /// 二个颜色区间时
- /// 区间1值变化的事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numberScope2_ValueChanged(object sender, EventArgs e)
- {
- this.SetArgsValue();
- this.binaryExtractionModel.ColorTwoStart = (int)(this.numberScopeControl2.minValue);
- this.binaryExtractionModel.ColorTwoEnd = (int)(this.numberScopeControl2.maxValue);
- //处理直方图
- this.histogramControl1.UpdateVerticalBarWithTwoScope(
- (int)(this.numberScopeControl3.minValue),
- (int)(this.numberScopeControl3.maxValue),
- (int)(this.numberScopeControl2.minValue),
- (int)(this.numberScopeControl2.maxValue)
- );
- this.applyButtonImpl(null, null);
- }
- /// <summary>
- /// 二个颜色区间时
- /// 区间2值变化的事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numberScope3_ValueChanged(object sender, EventArgs e)
- {
- this.SetArgsValue();
- this.binaryExtractionModel.ColorThreeStart = (int)(this.numberScopeControl3.minValue);
- this.binaryExtractionModel.ColorThreeEnd = (int)(this.numberScopeControl3.maxValue);
- //处理直方图
- this.histogramControl1.UpdateVerticalBarWithTwoScope(
- (int)(this.numberScopeControl3.minValue),
- (int)(this.numberScopeControl3.maxValue),
- (int)(this.numberScopeControl2.minValue),
- (int)(this.numberScopeControl2.maxValue)
- );
- this.applyButtonImpl(null, null);
- }
- /// <summary>
- /// 自动阈值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_Click(object sender, EventArgs e)
- {
- this.DeleteEventHandler();
- if (imageMat != null)
- {
- //先计算阈值
- Mat mat = imageMat.Clone();// PaintDotNet.Camera.Tools.ToMat(bitmap);
- Mat gray = mat.CvtColor(ColorConversionCodes.BGR2GRAY);
- double otsu = Cv2.Threshold(gray, gray, 0, 255, ThresholdTypes.Triangle);
- if (otsu <= 10 || otsu >= 245)
- {
- otsu = Cv2.Threshold(mat.CvtColor(ColorConversionCodes.BGR2GRAY), gray, 0, 255, ThresholdTypes.Otsu);//.Triangle
- }
- {
- //隐藏控件
- this.numberScopeControl1.minValue = this.numberScopeControl3.maxValue;
- this.numberScopeControl1.maxValue = this.numberScopeControl2.minValue;
- this.numberScopeControl2.Visible = false;
- this.numberScopeControl3.Visible = false;
- this.button6.Text = PdnResources.GetString("Menu.inverse.text");
- this.binaryExtractionModel.ColorInterval = 1;
- this.histogramControl1.Flag = 1;
- //给控件赋值
- this.numberScopeControl1.minValue = 0;
- this.numberScopeControl1.maxValue = otsu;
- this.binaryExtractionModel.ColorOneStart = Convert.ToInt32(this.numberScopeControl1.minValue);
- this.binaryExtractionModel.ColorOneEnd = Convert.ToInt32(otsu);
- this.SetArgsValue();
- }
- //处理直方图
- this.histogramControl1.UpdateVerticalBarWithOneScope(0, Convert.ToInt32(this.numberScopeControl1.maxValue));
- mat.Dispose();
- GC.Collect();
- this.applyButtonImpl(sender, e);
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicturefirst.text"));
- }
- this.AddEventHandler();
- }
- #endregion
- #region 处理细节
- /// <summary>
- /// 删除边界对象
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- //参数改变
- foreach (Args args in action.Lists)
- {
- if (args.Key == "deleteBoundaryObject")
- {
- args.Value = this.checkBox2.Checked;
- break;
- }
- }
- this.binaryExtractionModel.DeleteBoundaryObject = this.checkBox2.Checked;
- }
- /// <summary>
- /// 孔洞填充
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox3_CheckedChanged(object sender, EventArgs e)
- {
- //参数改变
- foreach (Args args in action.Lists)
- {
- if (args.Key == "holeFilling")
- {
- args.Value = this.checkBox3.Checked;
- break;
- }
- }
- this.binaryExtractionModel.HoleFilling = this.checkBox3.Checked;
- }
- /// <summary>
- /// 碎屑删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- //参数改变
- foreach (Args args in action.Lists)
- {
- if (args.Key == "debrisRemoval")
- {
- args.Value = this.checkBox4.Checked;
- break;
- }
- }
- this.binaryExtractionModel.DebrisRemoval = this.checkBox4.Checked;
- }
- /// <summary>
- /// 碎屑面积变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Detritus_ValueChanged(object sender, EventArgs e)
- {
- if (this.checkBox4.Checked)
- {
- DeleteEventHandler();
- if (((NumericUpDown)sender).Name.Equals("numericUpDown1"))
- numericUpDown2.Value = Math.Max(numericUpDown2.Value, numericUpDown1.Value);
- else if (((NumericUpDown)sender).Name.Equals("numericUpDown2"))
- numericUpDown1.Value = Math.Min(numericUpDown1.Value, numericUpDown2.Value);
- foreach (Args args in action.Lists)
- {
- if (args.Key == "scope4")
- {
- ((List<double>)args.Value)[0] = (double)numericUpDown1.Value / unitLength / unitLength;
- ((List<double>)args.Value)[1] = (double)numericUpDown2.Value / unitLength / unitLength;
- break;
- }
- }
- this.binaryExtractionModel.DebrisAreaStart = (int)((double)numericUpDown1.Value / unitLength / unitLength);
- this.binaryExtractionModel.DebrisAreaEnd = (int)((double)numericUpDown2.Value / unitLength / unitLength);
- this.applyButtonImpl(null, null);
- AddEventHandler();
- }
- }
- #endregion
- #region 二值样式
- /// <summary>
- /// 实心和边线
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void radioButton1Or2_ValueChanged(object sender, EventArgs e)
- {
- if (((RadioButton)sender).Checked)
- {
- //参数改变
- foreach (Args args in action.Lists)
- {
- if (args.Key == "binaryStyle")
- {
- if (radioButton1.Checked)
- {
- args.Value = 1;
- }
- else
- {
- args.Value = 2;
- }
- break;
- }
- }
- this.binaryExtractionModel.BinaryStyle = radioButton1.Checked ? 1 : 2;
- this.applyButtonImpl(sender, e);
- }
- }
- /// <summary>
- /// 相颜色点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel2_Click(object sender, EventArgs e)
- {
- this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
- this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
- this.colorsFormGrid.ShowDialog();
- }
- /// <summary>
- /// Panel2的调色板颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void gridColorChanged(object sender, EventArgs e)
- {
- Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
- //先修改参数
- foreach (Args args in action.Lists)
- {
- if (args.Key == "phaseColor")
- {
- args.Value = color.ToArgb();
- break;
- }
- }
- //更改背景色,触发事件
- this.panel2.BackColor = color;
- //改变配置文件里面的相颜色
- this.binaryExtractionModel.PhaseColor = color.ToArgb();
- //关闭色板
- this.colorsFormGrid.Close();
- }
- #endregion
- #region 目标选择
- /// <summary>
- /// 目标选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void radioButton5_CheckedChanged(object sender, EventArgs e)
- {
- //参数改变
- foreach (Args args in action.Lists)
- {
- if (args.Key == "targetSelection")
- {
- if (radioButton3.Checked)
- {
- args.Value = 1;
- this.binaryExtractionModel.TargetSelection = 1;
- }
- else if (radioButton4.Checked)
- {
- args.Value = 2;
- this.binaryExtractionModel.TargetSelection = 2;
- }
- else
- {
- args.Value = 3;
- this.binaryExtractionModel.TargetSelection = 3;
- }
- break;
- }
- }
- if (((RadioButton)sender).Checked)
- {
- this.applyButtonImpl(null, null);
- }
- }
- #endregion
- #endregion
- /// <summary>
- /// 生成新图
- /// </summary>
- /// <param name="mat"></param>
- private void OpenFileImpl()
- {
- if (imageMat != null)
- {
- DocumentWorkspace dw = this.appWorkspace.AddNewDocumentWorkspace();
- Document document = Document.FromImageMat(imageMat.Clone());
- dw.Document = document;
- dw.fileText = this.Text + "-" + stepLength;
- dw.rules = this.appWorkspace.DocumentWorkspaces[this.listView1.SelectedItems[0].Index].rules;
- dw.xmlSaveModel = this.appWorkspace.DocumentWorkspaces[this.listView1.SelectedItems[0].Index].xmlSaveModel;
- this.appWorkspace.ActiveDocumentWorkspace = dw;
- this.appWorkspace.ActiveDocumentWorkspace.PhaseModels = this.documentWorkspace.PhaseModelsForCopy;
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- Startup.instance.step_length += 1;
- stepLength = "00" + Startup.instance.step_length;
- }
- }
- /// <summary>
- /// 应用到全部
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- ProgressThreadProcClass procClass = new ProgressThreadProcClass();
- int itemCount = 100;
- ProgressThreadProcClass.IFileTransferProgressEvents progressEvents = new ProgressThreadProcClass.IFileTransferProgressEvents();
- System.Threading.ThreadStart copyThreadProc =
- delegate ()
- {
- try
- {
- int num = this.appWorkspace.DocumentWorkspaces.Length;
- for (int i = 0; i < num; i++)
- {
- List<PhaseModel> list = new List<PhaseModel>();
- PhaseModel model = new PhaseModel();
- model.name = PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text");
- model.choise = true;
- if (this.appWorkspace.DocumentWorkspaces[i].GraphicsList.IsExsitView())
- {
- model.mat = action.PerformProcess(
- PaintDotNet.Camera.Tools.ToMat(this.appWorkspace.DocumentWorkspaces[i].GetFullSizeWithRegion()),
- this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreatedAliasedMat().Clone(), true);
- model.color = this.panel2.BackColor.ToArgb();
- }
- else
- {
- model.mat = action.PerformProcess(this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreatedAliasedMat().Clone(), true);
- model.color = this.panel2.BackColor.ToArgb();
- }
- list.Add(model);
- this.Invoke(new EventHandler(delegate
- {
- if (checkBox1.Checked)
- {
- DocumentWorkspace dw = this.appWorkspace.AddNewDocumentWorkspace();//return mat/*.Clone()*/;//待测试
- Document document = Document.FromImageMat(this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreatedAliasedMat().Clone());
- dw.Document = document;
- dw.rules = this.appWorkspace.DocumentWorkspaces[i].rules;
- dw.xmlSaveModel = this.appWorkspace.DocumentWorkspaces[i].xmlSaveModel;
- dw.fileText = this.Text + "-" + stepLength;
- dw.PhaseModels = list;
- this.appWorkspace.ActiveDocumentWorkspace = dw;
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- Startup.instance.step_length += 1;
- stepLength = "00" + Startup.instance.step_length;
- }
- else
- {
- this.appWorkspace.DocumentWorkspaces[i].PhaseModels = list;
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- }
- }));
- }
- this.Invoke(new EventHandler(delegate
- {
- this.Close();
- }));
- }
- catch (Exception)
- {
- }
- finally
- {
- progressEvents.EndOperation(OperationResult.Finished);
- }
- };
- procClass.StartProgressAction(this, itemCount, copyThreadProc, progressEvents, null);
- }
- /// <summary>
- /// 显示原图/原图+二值图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ShowOrHideOriginPic(object sender, EventArgs e)
- {
- if (!checkBox5.Checked)
- {
- this.documentWorkspace.PhaseModels[0].choise = true;
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 参数改变时,重新处理图像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void applyButtonImpl(object sender, EventArgs e)
- {
- ProgressThreadProcClass procClass = new ProgressThreadProcClass();
- int itemCount = 100;
- ProgressThreadProcClass.IFileTransferProgressEvents progressEvents = new ProgressThreadProcClass.IFileTransferProgressEvents();
- System.Threading.ThreadStart copyThreadProc =
- delegate ()
- {
- try
- {
- long start = Cv2.GetTickCount();
- if (this.listView1.SelectedItems != null && this.listView1.SelectedItems.Count > 0)
- {
- //判断是否存在视场,如果存在视场,则把视场提取出来,进行处理
- if (this.documentWorkspace.GraphicsList.IsExsitView())
- {
- this.documentWorkspace.PhaseModels.Clear();
- PhaseModel model = new PhaseModel();
- model.choise = true;
- model.mat = action.PerformProcess(
- PaintDotNet.Camera.Tools.ToMat(this.documentWorkspace.GetFullSizeWithRegion()),
- this.imageMat.Clone(), true);
- model.color = this.panel2.BackColor.ToArgb();
- model.position = this.documentWorkspace.PhaseModels.Count + 1;
- model.name = PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text");
- this.documentWorkspace.PhaseModels.Add(model);
- }
- else
- {
- this.documentWorkspace.PhaseModels.Clear();
- PhaseModel model = new PhaseModel();
- model.choise = true;
- model.mat = action.PerformProcess(this.imageMat.Clone(), true);
- model.color = this.panel2.BackColor.ToArgb();
- model.position = this.documentWorkspace.PhaseModels.Count + 1;
- model.name = PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text");
- this.documentWorkspace.PhaseModels.Add(model);
- }
- ShowOrHideOriginPic(null, null);
- }
- double time = (Cv2.GetTickCount() - start) / Cv2.GetTickFrequency();
- System.Console.WriteLine(PdnResources.GetString("Menu.executiontime.Text") + ":" + time);
- }
- catch (Exception)
- {
- }
- finally
- {
- progressEvents.EndOperation(OperationResult.Finished);
- }
- };
- procClass.StartProgressAction(this, itemCount, copyThreadProc, progressEvents, this.Text);//#21198
- }
- /// <summary>
- /// 应用
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void applyButton_Click(object sender, EventArgs e)
- {
- if (this.listView1.SelectedItems != null && this.listView1.SelectedItems.Count > 0)
- {
- if (checkBox1.Checked)
- {
- this.OpenFileImpl();
- }
- else
- {
- if (this.documentWorkspace.PhaseModels.Count > 0)
- {
- List<PhaseModel> models = new List<PhaseModel>();
- foreach (PhaseModel temp in this.documentWorkspace.PhaseModels)
- {
- if (temp.mat == null)
- { return; }
- PhaseModel model = new PhaseModel();
- model.choise = temp.choise;
- model.color = temp.color;
- model.mat = temp.mat.Clone();
- model.name = temp.name;
- model.position = temp.position;
- models.Add(model);
- }
- this.appWorkspace.DocumentWorkspaces[this.listView1.SelectedItems[0].Index].PhaseModels = models;
- this.appWorkspace.DocumentWorkspaces[this.listView1.SelectedItems[0].Index].Refresh();
- }
- }
- }
- this.Close();
- }
- /// <summary>
- /// 删除按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- if ("Default".Equals(this.comboBox1.Text))
- {
- MessageBox.Show(PdnResources.GetString("Menu.Defaultparamscannotbedeleted.text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeleteparams.text") + "?", PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- if (dr == DialogResult.OK)
- {
- //删除xml文件
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\" + this.comboBox1.Text + ".xml";
- FileInfo fileInfo = new FileInfo(filePath);
- fileInfo.Delete();
- //初始化xml文件列表
- InitParameterList(this.comboBox1.SelectedIndex);
- this.binaryExtractionModel = XmlSerializeHelper.DESerializer<BinaryExtractionModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\" + this.comboBox1.SelectedItem.ToString() + ".xml", FileMode.Open));
- InitParameterToControl();
- }
- }
- /// <summary>
- /// 保存参数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- foreach (Args args in action.Lists)
- {
- if (args.Key == "colorInterval")
- {
- this.binaryExtractionModel.ColorInterval = int.Parse(args.Value.ToString());
- }
- else if (args.Key == "scope1")
- {
- List<double> twoL = (List<double>)args.Value;
- this.binaryExtractionModel.ColorOneStart = (int)twoL[0];
- this.binaryExtractionModel.ColorOneEnd = (int)twoL[1];
- }
- else if (args.Key == "scope3")
- {
- List<double> twoL = (List<double>)args.Value;
- this.binaryExtractionModel.ColorTwoStart = (int)twoL[0];
- this.binaryExtractionModel.ColorTwoEnd = (int)twoL[1];
- }
- else if (args.Key == "scope2")
- {
- List<double> twoL = (List<double>)args.Value;
- this.binaryExtractionModel.ColorThreeStart = (int)twoL[0];
- this.binaryExtractionModel.ColorThreeEnd = (int)twoL[1];
- }
- else if (args.Key == "deleteBoundaryObject")
- {
- this.binaryExtractionModel.DeleteBoundaryObject = (bool)args.Value;
- }
- else if (args.Key == "holeFilling")
- {
- this.binaryExtractionModel.HoleFilling = (bool)args.Value;
- }
- else if (args.Key == "debrisRemoval")
- {
- this.binaryExtractionModel.DebrisRemoval = (bool)args.Value;
- }
- else if (args.Key == "scope4")
- {
- this.binaryExtractionModel.DebrisAreaStart = (int)((List<double>)args.Value)[0];
- this.binaryExtractionModel.DebrisAreaEnd = (int)((List<double>)args.Value)[1];
- }
- else if (args.Key == "binaryStyle")
- {
- this.binaryExtractionModel.BinaryStyle = (int)args.Value;
- }
- else if (args.Key == "phaseColor")
- {
- this.binaryExtractionModel.PhaseColor = (int)args.Value;
- }
- else if (args.Key == "targetSelection")
- {
- this.binaryExtractionModel.TargetSelection = (int)args.Value;
- }
- }
- string stageModelXml = XmlSerializeHelper.XmlSerialize<BinaryExtractionModel>(this.binaryExtractionModel);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\" + this.comboBox1.Text + ".xml";
- FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
- }
- /// <summary>
- /// 另存为
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- dialog = new CreateNameDialog(this);
- dialog.Text = PdnResources.GetString("Menu.File.SaveAs.Text");
- dialog.StartPosition = FormStartPosition.CenterParent;
- dialog.ShowDialog();
- }
- /// <summary>
- /// 另存为弹窗 确定保存
- /// </summary>
- /// <param name="name"></param>
- public override void GetCreateName(string name)
- {
- string currentcomboBox = this.comboBox1.Text;
- if (files.Contains(name))
- {
- MessageBox.Show(PdnResources.GetString("Menu.Stylenamecannotberepeated.text"), PdnResources.GetString("Menu.ensure.text"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- BinaryExtractionModel newModel = this.binaryExtractionModel;
- foreach (Args args in action.Lists)
- {
- if (args.Key == "colorInterval")
- {
- this.binaryExtractionModel.ColorInterval = int.Parse(args.Value.ToString());
- }
- else if (args.Key == "scope1")
- {
- List<double> twoL = (List<double>)args.Value;
- this.binaryExtractionModel.ColorOneStart = (int)twoL[0];
- this.binaryExtractionModel.ColorOneEnd = (int)twoL[1];
- }
- else if (args.Key == "scope3")
- {
- List<double> twoL = (List<double>)args.Value;
- this.binaryExtractionModel.ColorTwoStart = (int)twoL[0];
- this.binaryExtractionModel.ColorTwoEnd = (int)twoL[1];
- }
- else if (args.Key == "scope2")
- {
- List<double> twoL = (List<double>)args.Value;
- this.binaryExtractionModel.ColorThreeStart = (int)twoL[0];
- this.binaryExtractionModel.ColorThreeEnd = (int)twoL[1];
- }
- else if (args.Key == "deleteBoundaryObject")
- {
- this.binaryExtractionModel.DeleteBoundaryObject = (bool)args.Value;
- }
- else if (args.Key == "holeFilling")
- {
- this.binaryExtractionModel.HoleFilling = (bool)args.Value;
- }
- else if (args.Key == "debrisRemoval")
- {
- this.binaryExtractionModel.DebrisRemoval = (bool)args.Value;
- }
- else if (args.Key == "scope4")
- {
- this.binaryExtractionModel.DebrisAreaStart = (int)((List<double>)args.Value)[0];
- this.binaryExtractionModel.DebrisAreaEnd = (int)((List<double>)args.Value)[1];
- }
- else if (args.Key == "binaryStyle")
- {
- this.binaryExtractionModel.BinaryStyle = (int)args.Value;
- }
- else if (args.Key == "phaseColor")
- {
- this.binaryExtractionModel.PhaseColor = (int)args.Value;
- }
- else if (args.Key == "targetSelection")
- {
- this.binaryExtractionModel.TargetSelection = (int)args.Value;
- }
- }
- //另存为
- string stageModelXml = XmlSerializeHelper.XmlSerialize<BinaryExtractionModel>(newModel);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\" + name + ".xml";
- FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
- InitParameterList(0, false);
- this.comboBox1.Text = currentcomboBox;
- dialog.Close();
- }
- public void SetArgsValue()
- {
- foreach (Args args in action.Lists)
- {
- if (args.Key == "colorInterval")
- {
- args.Value = this.binaryExtractionModel.ColorInterval;
- }
- else if (args.Key == "scope1")
- {
- List<double> twoL = new List<double>();
- twoL.Add(this.numberScopeControl1.minValue);
- twoL.Add(this.numberScopeControl1.maxValue);
- args.Value = twoL;
- }
- else if (args.Key == "scope2")
- {
- List<double> twoL = new List<double>();
- twoL.Add(this.numberScopeControl3.minValue);
- twoL.Add(this.numberScopeControl3.maxValue);
- args.Value = twoL;
- }
- else if (args.Key == "scope3")
- {
- List<double> twoL = new List<double>();
- twoL.Add(this.numberScopeControl2.minValue);
- twoL.Add(this.numberScopeControl2.maxValue);
- args.Value = twoL;
- }
- }
- }
- private void InitializeLanguageText()
- {
- this.groupBox1.Text = PdnResources.GetString("Menu.Preview.text");
- this.groupBox2.Text = PdnResources.GetString("Menu.operation.text");
- this.button5.Text = PdnResources.GetString("Menu.File.Save.Text");
- this.button4.Text = PdnResources.GetString("Menu.File.SaveAs.Text");
- this.button3.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.label1.Text = PdnResources.GetString("Menu.Binaryoperation.Binaryextraction.paramslist.text") + ":";
- this.checkBox1.Text = PdnResources.GetString("Menu.Createnewgraph.text");
- this.button2.Text = PdnResources.GetString("Menu.Binaryoperation.Binaryextraction.Applytoall.text");
- this.button1.Text = PdnResources.GetString("Menu.application.text");
- this.groupBox3.Text = PdnResources.GetString("Menu.Tools.Histogram.Text");
- this.checkBox5.Text = PdnResources.GetString("Menu.Theoriginalcolor.text");
- this.button7.Text = PdnResources.GetString("Menu.Automaticthreshold.text");
- this.button6.Text = PdnResources.GetString("Menu.inverse.text");
- this.groupBox4.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
- this.groupBox5.Text = PdnResources.GetString("Menu.Processingdetails.text");
- this.checkBox4.Text = PdnResources.GetString("Menu.Clasticdelete.text");
- this.checkBox3.Text = PdnResources.GetString("Menu.BinaryAction.HoleFilling.Text");
- this.checkBox2.Text = PdnResources.GetString("Menu.Binaryoperation.Binaryextraction.Deleteboundaryobject.text");
- this.groupBox6.Text = PdnResources.GetString("Menu.Binarystyle.text");
- this.label2.Text = PdnResources.GetString("Menu.Phasecolor.text") + ":";
- this.radioButton2.Text = PdnResources.GetString("Menu.Sideline.text");
- this.radioButton1.Text = PdnResources.GetString("Menu.solid.text");
- this.groupBox7.Text = PdnResources.GetString("Menu.Targetselection.text");
- this.radioButton5.Text = PdnResources.GetString("Menu.style.text") + "3";
- this.radioButton4.Text = PdnResources.GetString("Menu.style.text") + "2";
- this.radioButton3.Text = PdnResources.GetString("Menu.style.text") + "1";
- }
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.button5 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.comboBox1 = new System.Windows.Forms.ComboBox();
- this.label1 = new System.Windows.Forms.Label();
- this.checkBox1 = new System.Windows.Forms.CheckBox();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.histogramControl1 = new PaintDotNet.CustomControl.HistogramControl();
- this.numberScopeControl3 = new PaintDotNet.CustomControl.DecimalScopeControl();
- this.numberScopeControl2 = new PaintDotNet.CustomControl.DecimalScopeControl();
- this.numberScopeControl1 = new PaintDotNet.CustomControl.DecimalScopeControl();
- this.checkBox5 = new System.Windows.Forms.CheckBox();
- this.button7 = new System.Windows.Forms.Button();
- this.button6 = new System.Windows.Forms.Button();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.listView1 = new System.Windows.Forms.ListView();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.checkBox3 = new System.Windows.Forms.CheckBox();
- this.checkBox2 = new System.Windows.Forms.CheckBox();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.label2 = new System.Windows.Forms.Label();
- this.panel2 = new System.Windows.Forms.Panel();
- this.radioButton2 = new System.Windows.Forms.RadioButton();
- this.radioButton1 = new System.Windows.Forms.RadioButton();
- this.groupBox7 = new System.Windows.Forms.GroupBox();
- this.button10 = new System.Windows.Forms.Button();
- this.button9 = new System.Windows.Forms.Button();
- this.button8 = new System.Windows.Forms.Button();
- this.radioButton5 = new System.Windows.Forms.RadioButton();
- this.radioButton4 = new System.Windows.Forms.RadioButton();
- this.radioButton3 = new System.Windows.Forms.RadioButton();
- this.groupBox2.SuspendLayout();
- this.groupBox3.SuspendLayout();
- this.groupBox4.SuspendLayout();
- this.groupBox5.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- this.groupBox6.SuspendLayout();
- this.groupBox7.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Location = new System.Drawing.Point(532, 70);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(398, 447);
- this.groupBox1.TabIndex = 5;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "预览";
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox2.Controls.Add(this.button5);
- this.groupBox2.Controls.Add(this.button4);
- this.groupBox2.Controls.Add(this.button3);
- this.groupBox2.Controls.Add(this.comboBox1);
- this.groupBox2.Controls.Add(this.label1);
- this.groupBox2.Controls.Add(this.checkBox1);
- this.groupBox2.Controls.Add(this.button2);
- this.groupBox2.Controls.Add(this.button1);
- this.groupBox2.Location = new System.Drawing.Point(13, 12);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(917, 52);
- this.groupBox2.TabIndex = 6;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "操作";
- //
- // button5
- //
- this.button5.Location = new System.Drawing.Point(354, 21);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(75, 23);
- this.button5.TabIndex = 10;
- this.button5.Text = "保存";
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // button4
- //
- this.button4.Location = new System.Drawing.Point(272, 21);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(75, 23);
- this.button4.TabIndex = 9;
- this.button4.Text = "另存为";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(190, 21);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(75, 23);
- this.button3.TabIndex = 8;
- this.button3.Text = "删除";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // comboBox1
- //
- this.comboBox1.FormattingEnabled = true;
- this.comboBox1.Location = new System.Drawing.Point(82, 22);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(101, 20);
- this.comboBox1.TabIndex = 7;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(7, 26);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(65, 12);
- this.label1.TabIndex = 6;
- this.label1.Text = "参数列表:";
- //
- // checkBox1
- //
- this.checkBox1.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.checkBox1.AutoSize = true;
- this.checkBox1.Location = new System.Drawing.Point(680, 24);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(72, 16);
- this.checkBox1.TabIndex = 5;
- this.checkBox1.Text = "创建新图";
- this.checkBox1.UseVisualStyleBackColor = true;
- //
- // button2
- //
- this.button2.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.button2.Location = new System.Drawing.Point(757, 20);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 4;
- this.button2.Text = "应用到全部一个";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button1
- //
- this.button1.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.button1.Location = new System.Drawing.Point(838, 20);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 3;
- this.button1.Text = "应用";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.applyButton_Click);
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.histogramControl1);
- this.groupBox3.Controls.Add(this.numberScopeControl3);
- this.groupBox3.Controls.Add(this.numberScopeControl2);
- this.groupBox3.Controls.Add(this.numberScopeControl1);
- this.groupBox3.Controls.Add(this.checkBox5);
- this.groupBox3.Controls.Add(this.button7);
- this.groupBox3.Controls.Add(this.button6);
- this.groupBox3.Location = new System.Drawing.Point(159, 70);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(367, 221);
- this.groupBox3.TabIndex = 7;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "直方图";
- //
- // histogramControl1
- //
- this.histogramControl1.Flag = 1;
- this.histogramControl1.Location = new System.Drawing.Point(8, 22);
- this.histogramControl1.Name = "histogramControl1";
- this.histogramControl1.Size = new System.Drawing.Size(340, 130);
- this.histogramControl1.TabIndex = 16;
- //
- // numberScopeControl3
- //
- this.numberScopeControl3.DecimalPlaces = 0;
- this.numberScopeControl3.Location = new System.Drawing.Point(8, 158);
- this.numberScopeControl3.Maximum = 255D;
- this.numberScopeControl3.maxValue = 0D;
- this.numberScopeControl3.Minimum = 0D;
- this.numberScopeControl3.minValue = 0D;
- this.numberScopeControl3.Name = "numberScopeControl3";
- this.numberScopeControl3.Size = new System.Drawing.Size(150, 22);
- this.numberScopeControl3.TabIndex = 15;
- this.numberScopeControl3.Visible = false;
- //
- // numberScopeControl2
- //
- this.numberScopeControl2.DecimalPlaces = 0;
- this.numberScopeControl2.Location = new System.Drawing.Point(186, 158);
- this.numberScopeControl2.Maximum = 255D;
- this.numberScopeControl2.maxValue = 0D;
- this.numberScopeControl2.Minimum = 0D;
- this.numberScopeControl2.minValue = 0D;
- this.numberScopeControl2.Name = "numberScopeControl2";
- this.numberScopeControl2.Size = new System.Drawing.Size(150, 22);
- this.numberScopeControl2.TabIndex = 14;
- this.numberScopeControl2.Visible = false;
- //
- // numberScopeControl1
- //
- this.numberScopeControl1.DecimalPlaces = 0;
- this.numberScopeControl1.Location = new System.Drawing.Point(8, 158);
- this.numberScopeControl1.Maximum = 255D;
- this.numberScopeControl1.maxValue = 0D;
- this.numberScopeControl1.Minimum = 0D;
- this.numberScopeControl1.minValue = 0D;
- this.numberScopeControl1.Name = "numberScopeControl1";
- this.numberScopeControl1.Size = new System.Drawing.Size(150, 22);
- this.numberScopeControl1.TabIndex = 13;
- this.numberScopeControl1.Tag = "numberScopeControl1";
- //
- // checkBox5
- //
- this.checkBox5.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.checkBox5.AutoSize = true;
- this.checkBox5.Location = new System.Drawing.Point(311, 196);
- this.checkBox5.Name = "checkBox5";
- this.checkBox5.Size = new System.Drawing.Size(48, 16);
- this.checkBox5.TabIndex = 11;
- this.checkBox5.Text = "原图";
- this.checkBox5.UseVisualStyleBackColor = true;
- this.checkBox5.CheckedChanged += new System.EventHandler(this.ShowOrHideOriginPic);
- //
- // button7
- //
- this.button7.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.button7.Location = new System.Drawing.Point(197, 192);
- this.button7.Name = "button7";
- this.button7.Size = new System.Drawing.Size(75, 23);
- this.button7.TabIndex = 12;
- this.button7.Text = "自动阈值";
- this.button7.UseVisualStyleBackColor = true;
- this.button7.Click += new System.EventHandler(this.button7_Click);
- //
- // button6
- //
- this.button6.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.button6.Location = new System.Drawing.Point(19, 192);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(75, 23);
- this.button6.TabIndex = 11;
- this.button6.Text = "反选";
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // groupBox4
- //
- this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox4.Controls.Add(this.listView1);
- this.groupBox4.Location = new System.Drawing.Point(13, 71);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(140, 446);
- this.groupBox4.TabIndex = 8;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "图像索引";
- //
- // listView1
- //
- this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.listView1.HideSelection = false;
- this.listView1.LargeImageList = this.imageList1;
- this.listView1.Location = new System.Drawing.Point(7, 21);
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(127, 419);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- //
- // imageList1
- //
- this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // groupBox5
- //
- this.groupBox5.Controls.Add(this.numericUpDown2);
- this.groupBox5.Controls.Add(this.numericUpDown1);
- this.groupBox5.Controls.Add(this.checkBox4);
- this.groupBox5.Controls.Add(this.checkBox3);
- this.groupBox5.Controls.Add(this.checkBox2);
- this.groupBox5.Location = new System.Drawing.Point(160, 298);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(366, 64);
- this.groupBox5.TabIndex = 9;
- this.groupBox5.TabStop = false;
- this.groupBox5.Text = "处理细节";
- //
- // numericUpDown2
- //
- this.numericUpDown2.Location = new System.Drawing.Point(317, 26);
- this.numericUpDown2.Maximum = new decimal(new int[] {
- 2147483647,
- 0,
- 0,
- 0});
- this.numericUpDown2.Name = "numericUpDown2";
- this.numericUpDown2.Size = new System.Drawing.Size(40, 21);
- this.numericUpDown2.TabIndex = 6;
- //
- // numericUpDown1
- //
- this.numericUpDown1.Location = new System.Drawing.Point(272, 26);
- this.numericUpDown1.Maximum = new decimal(new int[] {
- 2147483647,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(40, 21);
- this.numericUpDown1.TabIndex = 5;
- //
- // checkBox4
- //
- this.checkBox4.AutoSize = true;
- this.checkBox4.Location = new System.Drawing.Point(197, 29);
- this.checkBox4.Name = "checkBox4";
- this.checkBox4.Size = new System.Drawing.Size(72, 16);
- this.checkBox4.TabIndex = 2;
- this.checkBox4.Text = "碎屑删除";
- this.checkBox4.UseVisualStyleBackColor = true;
- this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
- //
- // checkBox3
- //
- this.checkBox3.AutoSize = true;
- this.checkBox3.Location = new System.Drawing.Point(117, 29);
- this.checkBox3.Name = "checkBox3";
- this.checkBox3.Size = new System.Drawing.Size(72, 16);
- this.checkBox3.TabIndex = 1;
- this.checkBox3.Text = "孔洞填充";
- this.checkBox3.UseVisualStyleBackColor = true;
- this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
- //
- // checkBox2
- //
- this.checkBox2.AutoSize = true;
- this.checkBox2.Location = new System.Drawing.Point(7, 29);
- this.checkBox2.Name = "checkBox2";
- this.checkBox2.Size = new System.Drawing.Size(96, 16);
- this.checkBox2.TabIndex = 0;
- this.checkBox2.Text = "删除边界对象";
- this.checkBox2.UseVisualStyleBackColor = true;
- this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
- //
- // groupBox6
- //
- this.groupBox6.Controls.Add(this.label2);
- this.groupBox6.Controls.Add(this.panel2);
- this.groupBox6.Controls.Add(this.radioButton2);
- this.groupBox6.Controls.Add(this.radioButton1);
- this.groupBox6.Location = new System.Drawing.Point(159, 369);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(367, 64);
- this.groupBox6.TabIndex = 10;
- this.groupBox6.TabStop = false;
- this.groupBox6.Text = "二值样式";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(105, 34);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(41, 12);
- this.label2.TabIndex = 20;
- this.label2.Text = "相颜色";
- //
- // panel2
- //
- this.panel2.BackColor = System.Drawing.Color.Blue;
- this.panel2.Location = new System.Drawing.Point(160, 29);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(72, 21);
- this.panel2.TabIndex = 19;
- this.panel2.Click += new System.EventHandler(this.panel2_Click);
- //
- // radioButton2
- //
- this.radioButton2.AutoSize = true;
- this.radioButton2.Location = new System.Drawing.Point(56, 32);
- this.radioButton2.Name = "radioButton2";
- this.radioButton2.Size = new System.Drawing.Size(47, 16);
- this.radioButton2.TabIndex = 1;
- this.radioButton2.Text = "边线";
- this.radioButton2.UseVisualStyleBackColor = true;
- //
- // radioButton1
- //
- this.radioButton1.AutoSize = true;
- this.radioButton1.Checked = true;
- this.radioButton1.Location = new System.Drawing.Point(7, 32);
- this.radioButton1.Name = "radioButton1";
- this.radioButton1.Size = new System.Drawing.Size(47, 16);
- this.radioButton1.TabIndex = 0;
- this.radioButton1.TabStop = true;
- this.radioButton1.Text = "实心";
- this.radioButton1.UseVisualStyleBackColor = true;
- //
- // groupBox7
- //
- this.groupBox7.Controls.Add(this.button10);
- this.groupBox7.Controls.Add(this.button9);
- this.groupBox7.Controls.Add(this.button8);
- this.groupBox7.Controls.Add(this.radioButton5);
- this.groupBox7.Controls.Add(this.radioButton4);
- this.groupBox7.Controls.Add(this.radioButton3);
- this.groupBox7.Location = new System.Drawing.Point(159, 440);
- this.groupBox7.Name = "groupBox7";
- this.groupBox7.Size = new System.Drawing.Size(367, 77);
- this.groupBox7.TabIndex = 11;
- this.groupBox7.TabStop = false;
- this.groupBox7.Text = "目标选择";
- //
- // button10
- //
- this.button10.Location = new System.Drawing.Point(106, 21);
- this.button10.Name = "button10";
- this.button10.Size = new System.Drawing.Size(40, 40);
- this.button10.TabIndex = 5;
- this.button10.UseVisualStyleBackColor = true;
- //
- // button9
- //
- this.button9.Location = new System.Drawing.Point(60, 21);
- this.button9.Name = "button9";
- this.button9.Size = new System.Drawing.Size(40, 40);
- this.button9.TabIndex = 4;
- this.button9.UseVisualStyleBackColor = true;
- //
- // button8
- //
- this.button8.Location = new System.Drawing.Point(14, 21);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(40, 40);
- this.button8.TabIndex = 3;
- this.button8.UseVisualStyleBackColor = true;
- //
- // radioButton5
- //
- this.radioButton5.AutoSize = true;
- this.radioButton5.Location = new System.Drawing.Point(238, 55);
- this.radioButton5.Name = "radioButton5";
- this.radioButton5.Size = new System.Drawing.Size(14, 13);
- this.radioButton5.TabIndex = 2;
- this.radioButton5.UseVisualStyleBackColor = true;
- this.radioButton5.Visible = false;
- //
- // radioButton4
- //
- this.radioButton4.AutoSize = true;
- this.radioButton4.Checked = true;
- this.radioButton4.Location = new System.Drawing.Point(297, 44);
- this.radioButton4.Name = "radioButton4";
- this.radioButton4.Size = new System.Drawing.Size(14, 13);
- this.radioButton4.TabIndex = 1;
- this.radioButton4.TabStop = true;
- this.radioButton4.UseVisualStyleBackColor = true;
- this.radioButton4.Visible = false;
- //
- // radioButton3
- //
- this.radioButton3.AutoSize = true;
- this.radioButton3.Location = new System.Drawing.Point(279, 21);
- this.radioButton3.Name = "radioButton3";
- this.radioButton3.Size = new System.Drawing.Size(14, 13);
- this.radioButton3.TabIndex = 0;
- this.radioButton3.UseVisualStyleBackColor = true;
- this.radioButton3.Visible = false;
- //
- // BinaryExtractDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(942, 529);
- this.Controls.Add(this.groupBox7);
- this.Controls.Add(this.groupBox6);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Name = "BinaryExtractDialog";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "二值提取";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BinaryExtractDialog_FormClosing);
- this.Load += new System.EventHandler(this.BinaryExtractionDialog_Load);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox6, 0);
- this.Controls.SetChildIndex(this.groupBox7, 0);
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- this.groupBox4.ResumeLayout(false);
- this.groupBox5.ResumeLayout(false);
- this.groupBox5.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- this.groupBox6.ResumeLayout(false);
- this.groupBox6.PerformLayout();
- this.groupBox7.ResumeLayout(false);
- this.groupBox7.PerformLayout();
- this.ResumeLayout(false);
- }
- #region 参数保存及提取
- /// <summary>
- /// 保存参数的key,value和type
- /// </summary>
- /// <param name="param_key"></param>
- /// <param name="param_value"></param>
- /// <param name="param_type"></param>
- private void saveParamValue(string param_key, string param_value, int param_type)
- {
- bool foundItem = false;
- foreach (var item in this.analysisModel.ListParam)
- {
- if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
- {
- item.param_value = param_value;
- item.setValue();
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- {
- GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
- analysisItem.menuId = this.menuId;
- analysisItem.param_key = param_key;
- analysisItem.param_type = param_type;
- analysisItem.param_value = param_value;
- analysisItem.setValue();
- this.analysisModel.ListParam.Add(analysisItem);
- }
- }
- /// <summary>
- /// 保存界面中的参数到model
- /// </summary>
- private void saveDialogParamValues()
- {
- saveParamValue(ParamKey_Paramlist, comboBox1.Text, (int)Base.Dtryt.ItemString);//参数列表
- saveParamValue(ParamKey_NewPic, checkBox1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//是否创建新图
- }
- /// <summary>
- /// 获取保存的参数
- /// </summary>
- private void GetListParamModel()
- {
- if (this.analysisModel != null)
- {
- for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
- {
- switch (this.analysisModel.ListParam[i].param_key)
- {
- case ParamKey_Paramlist:
- comboBox1.Text = (string)this.analysisModel.ListParam[i].value;
- //comboBox1_SelectedIndexChanged(null, null);
- break;
- case ParamKey_NewPic:
- checkBox1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- }
- }
- }
- }
- private void BinaryExtractDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- this.saveDialogParamValues();
- //xml保存路径
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryActionSaving\\ParameterSaving.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- foreach (var analysisItem in this.analysisModel.ListParam)
- {
- bool foundItem = false;
- foreach (var item in analysisModelXml.ListParam)
- {
- if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
- {
- item.param_value = analysisItem.param_value;
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- analysisModelXml.ListParam.Add(analysisItem.cloneModel());
- }
- //按路径和名称保存xml文件
- string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
- //保存xml
- FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
- }
- #endregion
- #region [脚本录制]
- private void getScriptRecording()
- {
- List<Args> args = action.Lists;
- foreach (var item in args)
- {
- item.value = setScriptRecording(item.key);
- }
- appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
- }
- private object setScriptRecording(string key)
- {
- object value = null;
- if (key == "colorInterval")
- {
- value = this.binaryExtractionModel.ColorInterval == 2 ? true : false;
- }
- else if (key == "scope1")
- {
- value = new List<double>() { this.binaryExtractionModel.ColorOneStart, this.binaryExtractionModel.ColorOneEnd };
- }
- else if (key == "scope2")
- {
- value = new List<double>() { this.binaryExtractionModel.ColorTwoStart, this.binaryExtractionModel.ColorTwoEnd };
- }
- else if (key == "scope3")
- {
- value = new List<double>() { this.binaryExtractionModel.ColorThreeStart, this.binaryExtractionModel.ColorThreeEnd };
- }
- else if (key == "deleteBoundaryObject")
- {
- value = this.binaryExtractionModel.DeleteBoundaryObject;
- }
- else if (key == "holeFilling")
- {
- value = this.binaryExtractionModel.HoleFilling;
- }
- else if (key == "debrisRemoval")
- {
- value = this.binaryExtractionModel.DebrisRemoval;
- }
- else if (key == "scope4")
- {
- value = new List<double>() { this.binaryExtractionModel.DebrisAreaStart, this.binaryExtractionModel.DebrisAreaEnd };
- }
- else if (key == "binaryStyle")
- {
- value = this.binaryExtractionModel.BinaryStyle;
- }
- else if (key == "phaseColor")
- {
- value = this.binaryExtractionModel.PhaseColor;
- }
- else if (key == "targetSelection")
- {
- value = this.binaryExtractionModel.TargetSelection + 1;
- }
- else if (key == "createNewImg")
- {
- value = checkBox1.Checked ? 0 : 1;
- }
- return value;
- }
- #endregion
- }
- }
|