-
Notifications
You must be signed in to change notification settings - Fork 1
/
SpotDtDlg.cpp
947 lines (855 loc) · 30.2 KB
/
SpotDtDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
#include "SpotDtDlg.h"
#include <math.h>
#include <wx/wx.h>
#include <wx/spinctrl.h>
#include <wx/busyinfo.h>
#include <wx/filename.h>
#include "ImagePanel.h"
#include "EffectPar.h"
#include "Graying.h"
#include "WaterShed.h"
// tools buttons
const long SpotDtDlg::ID_BMPBTN_IMG_ZOOMIN = wxNewId();
const long SpotDtDlg::ID_BMPBTN_IMG_ZOOMOUT = wxNewId();
const long SpotDtDlg::ID_BMPBTN_IMG_ZOOMRECT = wxNewId();
const long SpotDtDlg::ID_BMPBTN_IMG_ZOOMFIT = wxNewId();
const long SpotDtDlg::ID_BMPBTN_IMG_ZOOMACTUAL = wxNewId();
const long SpotDtDlg::ID_BMPBTN_IMG_MOVE = wxNewId();
// image selector
const long SpotDtDlg::ID_CI_IMAGE = wxNewId();
// detect param btn
const long SpotDtDlg::ID_BMPBTN_DT_FAINT = wxNewId();
const long SpotDtDlg::ID_BMPBTN_DT_MIN = wxNewId();
const long SpotDtDlg::ID_BMPBTN_DT_MAX = wxNewId();
const long SpotDtDlg::ID_CB_BKGCORRECT = wxNewId();
// filter param
const long SpotDtDlg::ID_CB_MEDIAN = wxNewId();
const long SpotDtDlg::ID_CB_GAUSS = wxNewId();
const long SpotDtDlg::ID_RBX_MEDIAN = wxNewId();
const long SpotDtDlg::ID_RBX_GAUSS = wxNewId();
// detect param edit
const long SpotDtDlg::ID_ED_FAINT_X = wxNewId();
const long SpotDtDlg::ID_ED_FAINT_Y = wxNewId();
const long SpotDtDlg::ID_SPD_FAINT_T = wxNewId();
const long SpotDtDlg::ID_SP_MIN = wxNewId();
const long SpotDtDlg::ID_SP_MAX = wxNewId();
const long SpotDtDlg::ID_SPD_ASPECT = wxNewId();
const long SpotDtDlg::ID_ED_SPOTNUM = wxNewId();
IMPLEMENT_CLASS(SpotDtDlg, wxDialog)
BEGIN_EVENT_TABLE(SpotDtDlg, wxDialog)
END_EVENT_TABLE()
/**< simpl construct, this func is a target construct */
SpotDtDlg::SpotDtDlg()
{
}
/**< construct and create */
SpotDtDlg::SpotDtDlg(wxWindow* parent,
wxWindowID id /*= wxID_ANY*/,
const wxString& title /*= _("Spot Detection")*/,
const wxPoint& pos /*= wxDefaultPosition*/,
const wxSize& sz /*= wxDefaultSize*/,
long style /*= wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER*/,
const wxString& name /*= wxDialogNameStr*/)
: SpotDtDlg() // delegate construct
{
Create(parent, id, title, pos, sz, style, name);
}
/**< destruct */
SpotDtDlg::~SpotDtDlg()
{
}
/**< create dialog */
bool SpotDtDlg::Create(wxWindow* parent,
wxWindowID id /*= wxID_ANY*/,
const wxString& title /*= _("Spot Detection")*/,
const wxPoint& pos /*= wxDefaultPosition*/,
const wxSize& sz /*= wxDefaultSize*/,
long style /*= wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER*/,
const wxString& name /*= wxDialogNameStr*/)
{
bool bRet = false;
// set extra styles
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
// create
bRet = wxDialog::Create(parent, id, title, pos, sz, style, name);
if (!bRet)
return bRet;
// create controls
bRet = CreateControl();
if (!bRet)
return bRet;
// event map
bRet = DyEventMap();
if (!bRet)
return bRet;
// centre dialog on the parente
Centre();
return bRet;
}
/**< Initialize member, inlcude gel images */
bool SpotDtDlg::Init(const wxArrayPtrVoid* pAryImgs)
{
// Calibration
if (pAryImgs == NULL)
{
wxASSERT_MSG(false, _T("The images' array is invalid."));
return false;
}
// image choice control
wxChoice* pCI = dynamic_cast<wxChoice*>(FindWindow(ID_CI_IMAGE));
wxASSERT_MSG(pCI != nullptr, _T("Get image choice control failed."));
pCI->Clear();
// create the new iamge array
size_t nNum = pAryImgs->Count();
wxASSERT_MSG(nNum > 0, _T("There's no image in array."));
m_pAryImgs = pAryImgs;
bool bFirst = true;
for(size_t i = 0; i < nNum; ++i)
{
wxImage* pImg = static_cast<wxImage*>(m_pAryImgs->Item(i));
if (pImg == nullptr)
{
wxASSERT_MSG(false, _T("Get a image from array failed."));
continue;
}
// fill the image choice control
if (!pImg->HasOption(wxIMAGE_OPTION_FILENAME))
{
wxASSERT_MSG(false, _T("The image has no option filename."));
continue;
}
const wxString& pathname = pImg->GetOption(wxIMAGE_OPTION_FILENAME);
wxFileName fnm(pathname);
const wxString& name = fnm.GetFullName();
pCI->Append(name, reinterpret_cast<void*>(i));
// default sel the first image
if (bFirst)
{
bFirst = false;
pCI->SetSelection(0);
// copy the first iamge to display
if (m_imgDisp.IsOk())
m_imgDisp.Destroy();
m_imgDisp = pImg->Copy();
m_pImgPanel->SetImg(m_imgDisp);
}
}
wxASSERT_MSG(!bFirst, _T("There's no valid image in array."));
return true;
}
/**< create controls and layout */
bool SpotDtDlg::CreateControl()
{
wxBoxSizer* pTopSizer = new wxBoxSizer(wxHORIZONTAL);
{
wxBoxSizer* pLeft = new wxBoxSizer(wxVERTICAL);
{
wxBoxSizer* pIT = new wxBoxSizer(wxHORIZONTAL);
{
wxBoxSizer* pTools = new wxBoxSizer(wxVERTICAL);
{
// buttons
wxBitmapButton* pBmpBtn = nullptr;
pBmpBtn = new wxBitmapButton(this, ID_BMPBTN_IMG_ZOOMIN, wxBitmap(_T("./skin/zoomin.png"), wxBITMAP_TYPE_PNG));
pBmpBtn->SetToolTip(_("ZoomIn Image"));
pTools->Add(pBmpBtn, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 2);
pBmpBtn = new wxBitmapButton(this, ID_BMPBTN_IMG_ZOOMOUT, wxBitmap(_T("./skin/zoomout.png"), wxBITMAP_TYPE_PNG));
pBmpBtn->SetToolTip(_("ZoomOut Image"));
pTools->Add(pBmpBtn, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 2);
pBmpBtn = new wxBitmapButton(this, ID_BMPBTN_IMG_ZOOMRECT, wxBitmap(_T("./skin/zoomrect.png"), wxBITMAP_TYPE_PNG));
pBmpBtn->SetToolTip(_("Zoom Sel Rect Image"));
pTools->Add(pBmpBtn, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 2);
pBmpBtn = new wxBitmapButton(this, ID_BMPBTN_IMG_ZOOMFIT, wxBitmap(_T("./skin/zoomfit.png"), wxBITMAP_TYPE_PNG));
pBmpBtn->SetToolTip(_("Fit Image"));
pTools->Add(pBmpBtn, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 2);
pBmpBtn = new wxBitmapButton(this, ID_BMPBTN_IMG_ZOOMACTUAL, wxBitmap(_T("./skin/zoomactual.png"), wxBITMAP_TYPE_PNG));
pBmpBtn->SetToolTip(_("Actual Image"));
pTools->Add(pBmpBtn, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 2);
pBmpBtn = new wxBitmapButton(this, ID_BMPBTN_IMG_MOVE, wxBitmap(_T("./skin/imgmove.png"), wxBITMAP_TYPE_PNG));
pBmpBtn->SetToolTip(_("Move Image"));
pTools->Add(pBmpBtn, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 2);
}
pIT->Add(pTools, 0, wxLEFT|wxALIGN_CENTER, 3);
// image panel
m_pImgPanel = new ImagePanel(this, wxID_ANY, wxDefaultPosition, wxSize(600, 500) );
pIT->Add(m_pImgPanel, 1, wxALL|wxALIGN_CENTER|wxEXPAND, 3);
}
pLeft->Add(pIT, 1, wxALL|wxALIGN_CENTER|wxEXPAND, 0);
// Image Selection
wxBoxSizer* pSelImg = new wxBoxSizer(wxHORIZONTAL);
{
wxStaticText* pText = new wxStaticText(this, wxID_ANY, _("Select Image:"));
pSelImg->Add(pText, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
wxChoice* pCiImg = new wxChoice(this, ID_CI_IMAGE);
pSelImg->Add(pCiImg, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5);
pSelImg->AddStretchSpacer(1);
}
pLeft->Add(pSelImg, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 0);
}
pTopSizer->Add(pLeft, 1, wxALL|wxALIGN_LEFT|wxEXPAND, 0);
wxBoxSizer* pRight = new wxBoxSizer(wxVERTICAL);
{
wxStaticBoxSizer* pStep = new wxStaticBoxSizer(wxVERTICAL, this, _("Step 1: Set Param"));
{
wxFlexGridSizer* pSels = new wxFlexGridSizer(3, 2, 0, 0);
{
wxBitmapButton* pBmpBtn = nullptr;
wxStaticText* pText = nullptr;
pBmpBtn = new wxBitmapButton(this, ID_BMPBTN_DT_FAINT, wxBitmap(_T("./skin/SelFaint.png"), wxBITMAP_TYPE_PNG));
pBmpBtn->SetToolTip(_("Select Faint Spot in Image"));
pSels->Add(pBmpBtn, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
pText = new wxStaticText(this, wxID_ANY, _("Select Faint Spot"));
pSels->Add(pText, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 2);
pBmpBtn = new wxBitmapButton(this, ID_BMPBTN_DT_MIN, wxBitmap(_T("./skin/SelMin.png"), wxBITMAP_TYPE_PNG));
pBmpBtn->SetToolTip(_("Select Minimum Spot in Image"));
pSels->Add(pBmpBtn, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
pText = new wxStaticText(this, wxID_ANY, _("Select Minimum Spot"));
pSels->Add(pText, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 2);
pBmpBtn = new wxBitmapButton(this, ID_BMPBTN_DT_MAX, wxBitmap(_T("./skin/SelMax.png"), wxBITMAP_TYPE_PNG));
pBmpBtn->SetToolTip(_("Select Maximum Spot in Image"));
pSels->Add(pBmpBtn, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
pText = new wxStaticText(this, wxID_ANY, _("Select Maximum Spot"));
pSels->Add(pText, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 2);
}
pStep->Add(pSels, 0, wxALL|wxALIGN_LEFT|wxALIGN_TOP, 0);
wxCheckBox* pCB = new wxCheckBox(this, ID_CB_BKGCORRECT, _("Background Correct"));
pStep->Add(pCB, 0, wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP, 2);
pCB = new wxCheckBox(this, ID_CB_MEDIAN, _("Median Filter"));
pCB->SetValue(true);
pStep->Add(pCB, 0, wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP, 2);
wxArrayString strs;
strs.Add(_("3X3"));
strs.Add(_("5X5"));
strs.Add(_("7X7"));
wxRadioBox* pTmpl = new wxRadioBox(this, ID_RBX_MEDIAN, _("Size"), wxDefaultPosition, wxDefaultSize,
strs, 3, wxRA_SPECIFY_COLS);
pStep->Add(pTmpl, 0, wxLEFT|wxBOTTOM|wxALIGN_LEFT|wxALIGN_TOP, 2);
pCB = new wxCheckBox(this, ID_CB_GAUSS, _("Gauss Filter"));
pCB->SetValue(true);
pStep->Add(pCB, 0, wxLEFT|wxTOP|wxALIGN_LEFT|wxALIGN_TOP, 2);
pTmpl = new wxRadioBox(this, ID_RBX_GAUSS, _("Size"), wxDefaultPosition, wxDefaultSize,
strs, 3, wxRA_SPECIFY_COLS);
pStep->Add(pTmpl, 0, wxLEFT|wxBOTTOM|wxALIGN_LEFT|wxALIGN_TOP, 2);
}
pRight->Add(pStep, 0, wxTOP|wxRIGHT|wxALIGN_TOP|wxEXPAND, 5);
pStep = new wxStaticBoxSizer(wxVERTICAL, this, _("Step 2: Modify Param"));
{
wxFlexGridSizer* pParLay = new wxFlexGridSizer(6, 2, 0, 0);
{
wxControl* pCtrl = nullptr;
// 1
pCtrl = new wxStaticText(this, wxID_ANY, _("Faint Coord:"));
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
wxBoxSizer* pCoord = new wxBoxSizer(wxHORIZONTAL);
{
pCtrl = new wxTextCtrl(this, ID_ED_FAINT_X, _T("0"), wxDefaultPosition, wxDefaultSize, wxTE_RIGHT|wxTE_READONLY, wxTextValidator(wxFILTER_DIGITS));
pCoord->Add(pCtrl, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 0);
pCtrl = new wxStaticText(this, wxID_ANY, _(","));
pCoord->Add(pCtrl, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 0);
pCtrl = new wxTextCtrl(this, ID_ED_FAINT_Y, _T("0"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY, wxTextValidator(wxFILTER_DIGITS));
pCoord->Add(pCtrl, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 0);
}
pParLay->Add(pCoord, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 2);
// 2
pCtrl = new wxStaticText(this, wxID_ANY, _("&Faint Thre:"));
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
pCtrl = new wxSpinCtrlDouble(this, ID_SPD_FAINT_T, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxALIGN_RIGHT,
0.0, 100.0, 0.00, 0.05);
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 2);
// 3
pCtrl = new wxStaticText(this, wxID_ANY, _("&Min Rad:"));
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
pCtrl = new wxSpinCtrl(this, ID_SP_MIN, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxALIGN_RIGHT,
1, 9999, 2);
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 2);
// 4
pCtrl = new wxStaticText(this, wxID_ANY, _("Max Rad:"));
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
pCtrl = new wxSpinCtrl(this, ID_SP_MAX);
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 2);
// 5
pCtrl = new wxStaticText(this, wxID_ANY, _("Min Aspect:"));
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
pCtrl = new wxSpinCtrlDouble(this, ID_SPD_ASPECT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxALIGN_RIGHT,
0.0, 100.0, 0.34, 0.01);
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 2);
// 6
pCtrl = new wxStaticText(this, wxID_ANY, _("Spot Num:"));
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 2);
pCtrl = new wxTextCtrl(this, ID_ED_SPOTNUM, _T("0"), wxDefaultPosition, wxDefaultSize, wxTE_RIGHT|wxTE_READONLY, wxTextValidator(wxFILTER_DIGITS));
pParLay->Add(pCtrl, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 2);
}
pStep->Add(pParLay, 0, wxALL|wxALIGN_LEFT|wxALIGN_TOP, 2);
}
pRight->Add(pStep, 0, wxTOP|wxRIGHT|wxALIGN_TOP|wxEXPAND, 5);
pRight->AddStretchSpacer(1);
wxBoxSizer* pBtnLay = new wxBoxSizer(wxHORIZONTAL);
{
pBtnLay->AddStretchSpacer(1);
wxButton* pBtn = new wxButton(this, wxID_APPLY, _("&Test Param"));
pBtnLay->Add(pBtn, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 3);
pBtn = new wxButton(this, wxID_OK, _("&Batch"));
pBtnLay->Add(pBtn, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 3);
pBtn = new wxButton(this, wxID_CANCEL, _("&Exit"));
pBtnLay->Add(pBtn, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 3);
}
pRight->Add(pBtnLay, 0, wxBOTTOM|wxRIGHT|wxALIGN_BOTTOM|wxEXPAND, 2);
}
pTopSizer->Add(pRight, 0, wxALL|wxALIGN_RIGHT|wxEXPAND, 0);
}
SetSizer(pTopSizer);
pTopSizer->Fit(this);
pTopSizer->SetSizeHints(this);
return true;
}
/**< dynamic event map */
bool SpotDtDlg::DyEventMap()
{
// image operate bottons
Connect(ID_BMPBTN_IMG_ZOOMIN, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnZoomIN);
Connect(ID_BMPBTN_IMG_ZOOMIN, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnsUpdate);
Connect(ID_BMPBTN_IMG_ZOOMOUT, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnZoomOut);
Connect(ID_BMPBTN_IMG_ZOOMOUT, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnsUpdate);
Connect(ID_BMPBTN_IMG_ZOOMRECT, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnZoomRect);
Connect(ID_BMPBTN_IMG_ZOOMRECT, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnsUpdate);
Connect(ID_BMPBTN_IMG_ZOOMFIT, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnZoomFit);
Connect(ID_BMPBTN_IMG_ZOOMFIT, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnsUpdate);
Connect(ID_BMPBTN_IMG_ZOOMACTUAL, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnZoomActual);
Connect(ID_BMPBTN_IMG_ZOOMACTUAL, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnsUpdate);
Connect(ID_BMPBTN_IMG_MOVE, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnImgMove);
Connect(ID_BMPBTN_IMG_MOVE, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnsUpdate);
Connect(ID_BMPBTN_DT_FAINT, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnDtFaint);
Connect(ID_BMPBTN_DT_FAINT, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnsUpdate);
Connect(ID_BMPBTN_DT_MIN, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnDtMin);
Connect(ID_BMPBTN_DT_MIN, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnsUpdate);
Connect(ID_BMPBTN_DT_MAX, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnDtMax);
Connect(ID_BMPBTN_DT_MAX, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnsUpdate);
Connect(m_pImgPanel->GetId(), wxEVT_IMGPL, (wxObjectEventFunction)&SpotDtDlg::OnImgplNtfy);
// other controls
Connect(ID_RBX_MEDIAN, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnRbxMedianUpdate);
Connect(ID_RBX_GAUSS, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnRbxGaussUpdate);
Connect(ID_SP_MAX, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnSpMaxUpdate);
Connect(ID_CI_IMAGE, wxEVT_CHOICE, (wxObjectEventFunction)&SpotDtDlg::OnCiImage);
Connect(wxID_APPLY, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnBtnTestParam);
Connect(wxID_APPLY, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnProcUpdate);
Connect(wxID_OK, wxEVT_BUTTON, (wxObjectEventFunction)&SpotDtDlg::OnBtnOK);
Connect(wxID_OK, wxEVT_UPDATE_UI, (wxObjectEventFunction)&SpotDtDlg::OnBtnProcUpdate);
return true;
}
/**< obtain detect param from ui control*/
bool SpotDtDlg::GetParam()
{
// get detect param
wxString strValue = wxEmptyString;
long lValue = 0l;
wxTextCtrl* pEdit = nullptr;
wxSpinCtrl* pSp = nullptr;
wxSpinCtrlDouble* pSpd = nullptr;
wxCheckBox* pCkb = nullptr;
wxRadioBox* pRdbx = nullptr;
// faint x
pEdit = dynamic_cast<wxTextCtrl*>(FindWindow(ID_ED_FAINT_X));
wxASSERT_MSG(pEdit != nullptr, _T("Get Fain X control failed."));
if (pEdit != nullptr)
{
strValue = pEdit->GetValue();
strValue.ToLong(&lValue);
m_stDtParam.ptFaint.x = (int)lValue;
}
// faint y
pEdit = dynamic_cast<wxTextCtrl*>(FindWindow(ID_ED_FAINT_Y));
wxASSERT_MSG(pEdit != nullptr, _T("Get Fain Y control failed."));
if (pEdit != nullptr)
{
strValue = pEdit->GetValue();
strValue.ToLong(&lValue);
m_stDtParam.ptFaint.y = (int)lValue;
}
// faint shreshold
pSpd = dynamic_cast<wxSpinCtrlDouble*>(FindWindow(ID_SPD_FAINT_T));
wxASSERT_MSG(pSpd != nullptr, _T("Get Faint Shreshold control failed."));
if (pSpd != nullptr)
m_stDtParam.dFaint = pSpd->GetValue();
// min spot radius
pSp = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SP_MIN));
wxASSERT_MSG(pSp != nullptr, _T("Get min spot radius control failed."));
if (pSp != nullptr)
m_stDtParam.iMinRad = pSp->GetValue();
// max spot radius
pCkb = dynamic_cast<wxCheckBox*>(FindWindow(ID_CB_BKGCORRECT));
wxASSERT_MSG(pCkb != nullptr, _T("Get background correct control failed."));
if (pCkb != nullptr && pCkb->IsChecked())
{
pSp = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SP_MIN));
wxASSERT_MSG(pSp != nullptr, _T("Get min spot radius control failed."));
if (pSp != nullptr)
m_stDtParam.iMaxRad = pSp->GetValue();
}
else
m_stDtParam.iMaxRad = -1;
// minimum aspect
pSpd = dynamic_cast<wxSpinCtrlDouble*>(FindWindow(ID_SPD_ASPECT));
wxASSERT_MSG(pSpd != nullptr, _T("Get aspect spin control failed."));
if (pSpd != nullptr)
m_stDtParam.dAspect = pSpd->GetValue();
// median filter
pCkb = dynamic_cast<wxCheckBox*>(FindWindow(ID_CB_MEDIAN));
wxASSERT_MSG(pCkb != nullptr, _T("Get median checkbox control failed."));
if (pCkb != nullptr && pCkb->IsChecked())
{
pRdbx = dynamic_cast<wxRadioBox*>(FindWindow(ID_RBX_MEDIAN));
wxASSERT_MSG(pRdbx != nullptr, _T("Get median radiobox control failed."));
if (pRdbx != nullptr)
m_stDtParam.iMedianFlt = pRdbx->GetSelection();
}
else
m_stDtParam.iMedianFlt = -1;
// gaussian filter
pCkb = dynamic_cast<wxCheckBox*>(FindWindow(ID_CB_GAUSS));
wxASSERT_MSG(pCkb != nullptr, _T("Get gaussian checkbox control failed."));
if (pCkb != nullptr && pCkb->IsChecked())
{
pRdbx = dynamic_cast<wxRadioBox*>(FindWindow(ID_RBX_GAUSS));
wxASSERT_MSG(pRdbx != nullptr, _T("Get gaussian radiobox control failed."));
if (pRdbx != nullptr)
m_stDtParam.iGaussFlt = pRdbx->GetSelection();
}
else
m_stDtParam.iGaussFlt = -1;
return true;
}
/**< obtain the faint spot in special circle */
bool SpotDtDlg::GetFaintSpot(const wxRect& rc)
{
if (!m_imgDisp.IsOk() || rc.width <= 0)
return false;
unsigned char* pSrc = m_imgDisp.GetData();
int iW = m_imgDisp.GetWidth();
int iH = m_imgDisp.GetHeight();
// the circle
int iBx = rc.x - rc.width, iEx = rc.x + rc.width;
int iBy = rc.y - rc.width, iEy = rc.y + rc.width;
if (iBx < 0)
iBx = 0;
if (iEx >= iW)
iEx = iW -1;
if (iBy < 0)
iBy = 0;
if (iEy <= iH)
iEy = iH -1;
// traverse the circle's pixel, find the min-intensity spot
wxPoint ptMin = {0, 0};
unsigned char pixMin = 255;
unsigned char* pLine = pSrc + iBy*iW*3;
for (int y = iBy; y <= iEy; ++y)
{
unsigned char* pPix = pLine + iBx*3;
for (int x = iBx; x <= iEx; ++x)
{
// if in the circle
if((y-rc.y)*(y - rc.y) + (x-rc.x)*(x-rc.x) <= rc.width*rc.width)
{
if (pPix[0] < pixMin)
{
pixMin = pPix[0];
ptMin.y = y;
ptMin.x = x;
}
}
pPix += 3;
}
pLine += iW*3;
}
// the faint spot, dispaly the coord
wxString str = wxEmptyString;
wxTextCtrl* pEdit = dynamic_cast<wxTextCtrl*>(FindWindow(ID_ED_FAINT_X));
wxASSERT_MSG(pEdit != nullptr, _T("Get the faint spot x control failed."));
if (pEdit != nullptr)
{
str.Printf(_T("%d"), ptMin.x);
pEdit->SetValue(str);
}
pEdit = dynamic_cast<wxTextCtrl*>(FindWindow(ID_ED_FAINT_Y));
wxASSERT_MSG(pEdit != nullptr, _T("Get the faint spot x control failed."));
if (pEdit != nullptr)
{
str.Printf(_T("%d"), ptMin.y);
pEdit->SetValue(str);
}
return true;
}
/**< zoom in image */
void SpotDtDlg::OnZoomIN(wxCommandEvent& event)
{
m_pImgPanel->ImgZoomIn();
}
/**< zoom out image */
void SpotDtDlg::OnZoomOut(wxCommandEvent& event)
{
m_pImgPanel->ImgZoomOut();
}
/**< zoom image depend sel rect */
void SpotDtDlg::OnZoomRect(wxCommandEvent& event)
{
m_pImgPanel->ImgZoomRect();
if (m_lMouseFunc != ID_BMPBTN_IMG_ZOOMRECT)
m_lMouseFunc = ID_BMPBTN_IMG_ZOOMRECT;
else
m_lMouseFunc = 0;
}
/**< zoom image fit the wnd */
void SpotDtDlg::OnZoomFit(wxCommandEvent& event)
{
m_pImgPanel->ImgZoomFit();
}
/**< display image in it's actual size */
void SpotDtDlg::OnZoomActual(wxCommandEvent& event)
{
m_pImgPanel->ImgZoomActual();
}
/**< move iamge to diaplay different region */
void SpotDtDlg::OnImgMove(wxCommandEvent& event)
{
m_pImgPanel->ImgMove();
if (m_lMouseFunc != ID_BMPBTN_IMG_MOVE)
m_lMouseFunc = ID_BMPBTN_IMG_MOVE;
else
m_lMouseFunc = 0;
}
/**< select faint spot */
void SpotDtDlg::OnDtFaint(wxCommandEvent& event)
{
if (m_lMouseFunc != ID_BMPBTN_DT_FAINT)
{
m_lMouseFunc = ID_BMPBTN_DT_FAINT;
m_pImgPanel->SelTools(IMGPL_CMD::SEL_CIRCLE,
_T("./skin/SelFaint.png"), 7, 7);
}
else
{
m_lMouseFunc = 0;
m_pImgPanel->SelTools(IMGPL_CMD::NONE);
}
}
/**< select min radius spot */
void SpotDtDlg::OnDtMin(wxCommandEvent& event)
{
if (m_lMouseFunc != ID_BMPBTN_DT_MIN)
{
m_lMouseFunc = ID_BMPBTN_DT_MIN;
m_pImgPanel->SelTools(IMGPL_CMD::SEL_CIRCLE,
_T("./skin/SelMin.png"), 7, 7);
}
else
{
m_lMouseFunc = 0;
m_pImgPanel->SelTools(IMGPL_CMD::NONE);
}
}
/**< select max radius spot */
void SpotDtDlg::OnDtMax(wxCommandEvent& event)
{
if (m_lMouseFunc != ID_BMPBTN_DT_MAX)
{
m_lMouseFunc = ID_BMPBTN_DT_MAX;
m_pImgPanel->SelTools(IMGPL_CMD::SEL_CIRCLE,
_T("./skin/SelMax.png"), 7, 7);
}
else
{
m_lMouseFunc = 0;
m_pImgPanel->SelTools(IMGPL_CMD::NONE);
}
}
/**< update tool btns' state */
void SpotDtDlg::OnBtnsUpdate(wxUpdateUIEvent& event)
{
if (m_pAryImgs == nullptr)
{
event.Enable(false);
return;
}
long id = event.GetId();
if (id == ID_BMPBTN_IMG_ZOOMIN)
m_pImgPanel->UpdateUI(IMGPL_CMD::IMG_ZIN, event);
else if (id == ID_BMPBTN_IMG_ZOOMOUT)
m_pImgPanel->UpdateUI(IMGPL_CMD::IMG_ZOUT, event);
else if (id == ID_BMPBTN_IMG_ZOOMRECT)
m_pImgPanel->UpdateUI(IMGPL_CMD::IMG_ZRECT, event);
else if (id == ID_BMPBTN_IMG_ZOOMFIT)
m_pImgPanel->UpdateUI(IMGPL_CMD::IMG_ZFIT, event);
else if (id == ID_BMPBTN_IMG_ZOOMACTUAL)
m_pImgPanel->UpdateUI(IMGPL_CMD::IMG_ZACTUAL, event);
else if (id == ID_BMPBTN_IMG_MOVE)
m_pImgPanel->UpdateUI(IMGPL_CMD::IMG_MOVE, event);
else if (id == ID_BMPBTN_DT_FAINT)
{
m_pImgPanel->UpdateUI(IMGPL_CMD::SEL_CIRCLE, event);
event.Check(event.GetChecked()&&(m_lMouseFunc == ID_BMPBTN_DT_FAINT));
}
else if (id == ID_BMPBTN_DT_MIN)
{
m_pImgPanel->UpdateUI(IMGPL_CMD::SEL_CIRCLE, event);
event.Check(event.GetChecked()&&(m_lMouseFunc == ID_BMPBTN_DT_MIN));
}
else if (id == ID_BMPBTN_DT_MAX)
{
wxCheckBox* pCbx = dynamic_cast<wxCheckBox*>(FindWindow(ID_CB_BKGCORRECT));
wxASSERT_MSG(pCbx != nullptr, _T("Get Background checkbox control failed."));
if (pCbx != nullptr && pCbx->IsChecked())
{
m_pImgPanel->UpdateUI(IMGPL_CMD::SEL_CIRCLE, event);
event.Check(event.GetChecked()&&(m_lMouseFunc == ID_BMPBTN_DT_MAX));
}
else
event.Enable(false);
}
}
/**< invoke when these iamge panels notify */
void SpotDtDlg::OnImgplNtfy(wxImgplEvent& event)
{
IMGPL_CMD cmd = event.GetCMD();
void* pParam = event.GetParam();
// execu notify
switch(cmd)
{
case IMGPL_CMD::IMG_ZRECT:
break;
case IMGPL_CMD::IMG_MOVE:
break;
case IMGPL_CMD::SEL_CIRCLE:
{
wxRect* prcSel = static_cast<wxRect*>(pParam);
wxASSERT_MSG(prcSel != nullptr, _T("EVT_IMGPL get SEL_CIRCLE event param failed."));
if (prcSel == nullptr)
break;
if (m_lMouseFunc == ID_BMPBTN_DT_FAINT)
{
GetFaintSpot(*prcSel);
}
else if (m_lMouseFunc == ID_BMPBTN_DT_MAX)
{
wxSpinCtrl* pSp = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SP_MAX));
wxASSERT_MSG(pSp != nullptr, _T("Get max spot radius control failed."));
if (pSp != nullptr)
pSp->SetValue(prcSel->width);
}
else if(m_lMouseFunc == ID_BMPBTN_DT_MIN)
{
wxSpinCtrl* pSp = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SP_MIN));
wxASSERT_MSG(pSp != nullptr, _T("Get min spot radius control failed."));
if (pSp != nullptr)
pSp->SetValue(prcSel->width);
}
}
break;
case IMGPL_CMD::SEL_ELLIPSE:
break;
case IMGPL_CMD::SEL_SQUARE:
break;
case IMGPL_CMD::SEL_RECTANGLE:
break;
default:
break;
}
}
/**< median template size can be modify only when it is checked */
void SpotDtDlg::OnRbxMedianUpdate(wxUpdateUIEvent& event)
{
wxCheckBox* pCB = dynamic_cast<wxCheckBox*>(FindWindow(ID_CB_MEDIAN));
wxRadioBox* pRbx = dynamic_cast<wxRadioBox*>(FindWindow(ID_RBX_MEDIAN));
if (pCB != nullptr && pRbx != nullptr)
pRbx->Enable(pCB->IsChecked());
}
/**< gauss template size can be modify only when it is checked */
void SpotDtDlg::OnRbxGaussUpdate(wxUpdateUIEvent& event)
{
wxCheckBox* pCB = dynamic_cast<wxCheckBox*>(FindWindow(ID_CB_GAUSS));
wxRadioBox* pRbx = dynamic_cast<wxRadioBox*>(FindWindow(ID_RBX_GAUSS));
if (pCB != nullptr && pRbx != nullptr)
pRbx->Enable(pCB->IsChecked());
}
/**< max radius only needed when background correct */
void SpotDtDlg::OnSpMaxUpdate(wxUpdateUIEvent& event)
{
wxCheckBox* pCB = dynamic_cast<wxCheckBox*>(FindWindow(ID_CB_BKGCORRECT));
wxSpinCtrl* pSp = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SP_MAX));
if (pCB != nullptr && pSp != nullptr)
pSp->Enable(pCB->IsChecked());
}
/**< change image selection */
void SpotDtDlg::OnCiImage(wxCommandEvent& event)
{
size_t nNum = m_pAryImgs->Count();
int iSel = event.GetSelection();
if (iSel < 0 || iSel >= (long)nNum)
{
wxASSERT_MSG(false, _T("Change image selection error."));
return;
}
wxImage* pImg = static_cast<wxImage*>(m_pAryImgs->Item(iSel));
if (m_imgDisp.IsOk())
m_imgDisp.Destroy();
m_imgDisp = pImg->Copy();
m_pImgPanel->SetImg(m_imgDisp);
}
/**< Test Param */
void SpotDtDlg::OnBtnTestParam(wxCommandEvent& event)
{
wxBusyInfo wait(_("Please wait, working..."), this);
// get param from ui
GetParam();
// get current image and cache
int iW = 0; // image width
int iWb = 0; // bytes per line
int iH = 0; // image height
int iN = 0; // image pisel number
EffectPar parEft;
unsigned char* pIn = nullptr;
unsigned char* pOut = nullptr;
{
size_t nNum = m_pAryImgs->Count();
wxChoice* pCi = dynamic_cast<wxChoice*>(FindWindow(ID_CI_IMAGE));
wxASSERT_MSG(pCi != nullptr, _T("Get Image Switch control failed."));
if (pCi == nullptr)
return;
int iSel = pCi->GetSelection();
if (iSel < 0 || iSel >= (long)nNum)
{
wxASSERT_MSG(false, _T("Get current image selection error."));
return;
}
wxImage* pImgCur = nullptr;
pImgCur = static_cast<wxImage*>(m_pAryImgs->Item(iSel));
wxASSERT_MSG(pImgCur != nullptr, _T("Get current select image error."));
if (pImgCur == nullptr)
return;
// init effect data
parEft.SetImage(pImgCur);
iW = parEft.Width(); // image width
iWb = iW*3; // bytes per line
iH = parEft.Height(); // image height
iN = parEft.PixNum(); // image pisel number
// copy out the input image
pIn = parEft.GetCache();
memcpy(pIn, pImgCur->GetData(), iN*3);
parEft.Input(pIn, true);
}
LS_SPOTS lsSpots; // spots list
int iSpotN = 0; // the result spot num
unsigned char* pDes = nullptr; // dest iamge
unsigned char* pWS = nullptr; // the spot edge
// Graying switch
Graying::Gray(parEft);
// clp detect
WaterShed* pws = new WaterShed;
parEft.Modify(false);
if (!pws->WSTmain(&parEft, &m_stDtParam, &lsSpots))
goto OnBtnTestParam_end;
if (lsSpots.empty())
{
wxMessageBox(_("Detect failed!"), _("Information"), wxOK|wxICON_INFORMATION|wxCENTER, this);
goto OnBtnTestParam_end;
}
pOut = parEft.Output();
iSpotN = (int)lsSpots.size();
// draw the spot center
for (auto it = lsSpots.begin(); it != lsSpots.end(); ++it)
{
ST_SPOT_NODE& spot = *it;
// 绘制蛋白点+
int x = spot.x;
int y = spot.y;
unsigned char* pPix = pIn + (y*iW + x)*3;
// -
for (int i = -3; i <= 3; ++i)
{
if (x+i < 0 || x+i >= iW)
continue;
unsigned char* pT = pPix + i*3;
pT[0] = 255;
pT[1] = 0;
pT[2] = 0;
}
// |
for (int i = -3; i <= 3; ++i)
{
if (y+i < 0 || y+i >= iH)
continue;
unsigned char* pT = pPix + i*iWb;
pT[0] = 255;
pT[1] = 0;
pT[2] = 0;
}
}
// draw the spot edge
pDes = pIn;
pWS = pOut;
for (int i = 0; i < iN; ++i)
{
if(pWS[1] > 0)
{
pDes[0] = 0u;
pDes[1] = 255u;
pDes[2] = 0u;
}
pDes += 3;
pWS += 3;
}
// alter the detect parameter
{
wxSpinCtrlDouble* pSpd = nullptr; // the faint Shreshold Control
wxTextCtrl* pEdit = nullptr; // the Spot Number Control
pSpd = dynamic_cast<wxSpinCtrlDouble*>(FindWindow(ID_SPD_FAINT_T));
wxASSERT_MSG(pSpd != nullptr, _T("Get Faint Shreshold control failed."));
if (pSpd != nullptr)
pSpd->SetValue(m_stDtParam.dFaint);
pEdit = dynamic_cast<wxTextCtrl*>(FindWindow(ID_ED_SPOTNUM));
wxASSERT_MSG(pEdit != nullptr, _T("Get Spot Number control failed."));
if (pEdit != nullptr)
{
wxString str;
str.Printf(_T("%d"), iSpotN);
pEdit->SetValue(str);
}
}
// copy the resualt to the disp image
pDes = m_imgDisp.GetData();
memcpy(pDes, pIn, iN*3);
OnBtnTestParam_end:
if (pws != nullptr)
{
delete pws;
pws = nullptr;
}
WaterShed::ClearSpots(&lsSpots);
parEft.Recycle(pIn);
parEft.Recycle(pOut);
// update ui
m_pImgPanel->Refresh();
}
/**< determine the detectiong pearameter, and close dialog*/
void SpotDtDlg::OnBtnOK(wxCommandEvent& event)
{
// get the detection parameter
GetParam();
// terminate the dialog
if (IsModal())
EndModal(wxID_OK);
else
{
SetReturnCode(wxID_OK);
Show(false);
}
}
/**< update "Test Param" and "Batch" button's state*/
void SpotDtDlg::OnBtnProcUpdate(wxUpdateUIEvent& event)
{
if (m_pAryImgs == nullptr)
event.Enable(false);
else
{
size_t nNum = m_pAryImgs->Count();
event.Enable(nNum > 0);
}
}