-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainFrame.cpp
2051 lines (1614 loc) · 76.1 KB
/
MainFrame.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
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* ----------------------------------------------------------------------------
MainFrame.cpp
MIView - Medical Image Viewer
Copyright (C) 2009-2011 Gregory Book
MIView is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------- */
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "MainFrame.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
//#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
////@begin includes
////@end includes
#include "MainFrame.h"
#include "BugReport.h"
//#include "LogWindow.h"
#include "MainFrameVariables.h"
#include "ImageCanvas.h"
#include "AboutDialog.h"
#include "AnonymizeDialog.h"
#include "OptionsDialog.h"
#include "FileOpenDialog.h"
#include "ConvertDialog.h"
#include "SaveScreenshot.h"
#include "ColorMapDialog.h"
#include "MIViewBrowser.h"
#include "wx/colordlg.h"
#include "wx/file.h"
////@begin XPM images
#include "xpm/openfile.xpm"
#include "xpm/close32.xpm"
#include "xpm/normalview.xpm"
#include "xpm/brain3view.xpm"
#include "xpm/multisliceview2.xpm"
#include "xpm/mip.xpm"
#include "xpm/ssd.xpm"
#include "xpm/volume-rend.xpm"
#include "xpm/show-info-overlay.xpm"
#include "xpm/showlines.xpm"
#include "xpm/hi-res.xpm"
#include "xpm/image-info.xpm"
////@end XPM images
#include "xpm/openfile-16.xpm"
#include "xpm/close16.xpm"
#include "xpm/help.xpm"
#include "xpm/brain.xpm"
void *logWindow;
//void *openFileDialog;
MainFrame *frame;
wxString msg;
/* for the debugging of memory leaks */
//#include <crtdbg.h>
//#define new new(_NORMAL_BLOCK,__FILE__, __LINE__)
/*!
* MainFrame type definition
*/
IMPLEMENT_CLASS( MainFrame, wxFrame )
BEGIN_EVENT_TABLE( MainFrame, wxFrame )
////@begin MainFrame event table entries
EVT_CLOSE( MainFrame::OnCloseWindow )
EVT_SIZE( MainFrame::OnSize )
EVT_PAINT( MainFrame::OnPaint )
EVT_MOUSEWHEEL( MainFrame::OnMouseWheel )
EVT_KEY_DOWN( MainFrame::OnKeyDown )
EVT_KEY_UP( MainFrame::OnKeyUp )
EVT_MENU( ID_FILE_OPEN, MainFrame::OnFileOpen )
EVT_MENU( ID_FILE_CLOSE, MainFrame::OnFileClose )
EVT_MENU( ID_FILE_BROWSER, MainFrame::OnFileBrowserClick )
EVT_MENU( ID_FILE_SAVE_SCREENGRAB, MainFrame::OnFileSaveScreengrabClick )
EVT_MENU( ID_FILE_EXIT, MainFrame::OnFileExit )
EVT_MENU( ID_EDIT_OPTIONS, MainFrame::OnEditOptions )
EVT_MENU( ID_OPTIONS_FUNCTION_EDITOR, MainFrame::OnOptionsFunctionEditorClick )
EVT_MENU( ID_VIEW_NORMAL, MainFrame::OnViewNormal )
EVT_MENU( ID_VIEW_ORTHOGONAL, MainFrame::OnViewOrthogonal )
EVT_MENU( ID_VIEW_MIP, MainFrame::OnViewMIP )
EVT_MENU( ID_VIEW_SSD, MainFrame::OnViewSSD )
EVT_MENU( ID_VIEW_VOL_REND, MainFrame::OnViewVolumeRendering )
EVT_MENU( ID_VIEW_IMAGE_OVERLAY, MainFrame::OnShowOverlay )
EVT_MENU( ID_IMAGE_INFORMATION, MainFrame::OnShowImageInformation )
EVT_MENU( ID_FILE_ANONYMIZE, MainFrame::OnAnonymize )
EVT_MENU( ID_FILE_CONVERT, MainFrame::OnFileConvertClick )
EVT_MENU( ID_HELP_HELP, MainFrame::OnHelpHelp )
EVT_MENU( ID_HELP_REPORTBUG, MainFrame::OnHelpReportbugClick )
EVT_MENU( ID_HELP_ABOUT, MainFrame::OnHelpAbout )
EVT_MENU( ID_MAIN_TOOLBAR_OPEN_FILES, MainFrame::OnFileOpen )
EVT_MENU( ID_MAIN_TOOLBAR_CLOSE_FILE, MainFrame::OnFileClose )
EVT_MENU( ID_MAIN_TOOLBAR_VIEW_NORMAL, MainFrame::OnViewNormal )
EVT_MENU( ID_MAIN_TOOLBAR_VIEW_ORTHOGONAL, MainFrame::OnViewOrthogonal )
EVT_MENU( ID_MAIN_TOOLBAR_VIEW_MULTISLICE, MainFrame::OnViewMultislice )
EVT_MENU( ID_MAIN_TOOLBAR_VIEW_MIP, MainFrame::OnViewMIP )
EVT_MENU( ID_MAIN_TOOLBAR_VIEW_SSD, MainFrame::OnViewSSD )
EVT_MENU( ID_MAIN_TOOLBAR_VIEW_VOL_REND, MainFrame::OnViewVolumeRendering )
EVT_MENU( ID_MAIN_TOOLBAR_SHOW_OVERLAY, MainFrame::OnShowOverlay )
EVT_MENU( ID_MAIN_TOOLBAR_SHOW_LINES, MainFrame::OnMainToolbarShowLinesClick )
EVT_MENU( ID_IMAGE_TOOLBAR_HIRES, MainFrame::OnViewHiRes )
EVT_MENU( ID_MAIN_TOOLBAR_INFO, MainFrame::OnShowImageInformation )
EVT_COMMAND_SCROLL( ID_SCROLLBAR, MainFrame::OnScrollSliceScroll )
EVT_CHECKBOX( ID_BESTFIT_ZOOM, MainFrame::OnBestfitZoomClick )
EVT_SLIDER( ID_ZOOM_SLIDER, MainFrame::OnZoomSliderUpdated )
EVT_SPINCTRL( ID_SPIN_ZOOM, MainFrame::OnSpinZoomUpdated )
EVT_TEXT( ID_SPIN_ZOOM, MainFrame::OnSpinZoomTextUpdated )
EVT_RADIOBUTTON( ID_RADIO_USE_PLANE0, MainFrame::OnRadioUsePlaneSelected )
EVT_RADIOBUTTON( ID_RADIO_USE_PLANE1, MainFrame::OnRadioUsePlaneSelected )
EVT_RADIOBUTTON( ID_RADIO_USE_PLANE2, MainFrame::OnRadioUsePlaneSelected )
EVT_SPINCTRL( ID_VOLUME_NUM, MainFrame::OnVolumeNumUpdated )
EVT_RADIOBUTTON( ID_RENDERMETHOD_RAY_TRACE, MainFrame::OnRenderMethodSelected )
EVT_RADIOBUTTON( ID_RENDERMETHOD_3D_TEXTURE, MainFrame::OnRenderMethodSelected )
EVT_SPINCTRL( ID_NUM_STEPS, MainFrame::OnNumStepsUpdated )
EVT_CHECKBOX( ID_USE_SSD, MainFrame::OnUseSSDClick )
EVT_TEXT( ID_TEXT_SSD_CUTOFF, MainFrame::OnTextSSDCutoffTextUpdated )
EVT_SPIN( ID_SPIN_SSD_CUTOFF, MainFrame::OnSpinSSDCutoffUpdated )
EVT_TEXT( ID_TEXT_INTENSITY, MainFrame::OnTextIntensityUpdated )
EVT_SPIN( ID_SPIN_INTENSITY, MainFrame::OnSpinIntensityUpdated )
EVT_SPINCTRL( ID_SPIN_NUM_VOLUME_SLICES, MainFrame::OnSpinNumVolumeSlicesUpdated )
EVT_TEXT( ID_SPIN_NUM_VOLUME_SLICES, MainFrame::OnSpinNumVolumeSlicesTextUpdated )
EVT_TEXT( ID_TEXT_DENSITY, MainFrame::OnTextDensityUpdated )
EVT_SPIN( ID_SPIN_DENSITY, MainFrame::OnSpinDensityUpdated )
EVT_SLIDER( ID_SLIDER_X_ROTATE, MainFrame::OnSliderXRotateUpdated )
EVT_SPINCTRL( ID_SPIN_X, MainFrame::OnSpinXUpdated )
EVT_TEXT( ID_SPIN_X, MainFrame::OnSpinXTextUpdated )
EVT_SLIDER( ID_SLIDER_Y_ROTATE, MainFrame::OnSliderYRotateUpdated )
EVT_SPINCTRL( ID_SPIN_Y, MainFrame::OnSpinYUpdated )
EVT_TEXT( ID_SPIN_Y, MainFrame::OnSpinYTextUpdated )
EVT_SLIDER( ID_SLIDER_Z_ROTATE, MainFrame::OnSliderZRotateUpdated )
EVT_SPINCTRL( ID_SPIN_Z, MainFrame::OnSpinZUpdated )
EVT_TEXT( ID_SPIN_Z, MainFrame::OnSpinZTextUpdated )
EVT_SLIDER( ID_SLIDER_ANGLE, MainFrame::OnSliderAngleUpdated )
EVT_SPINCTRL( ID_SPIN_ANGLE, MainFrame::OnSpinAngleUpdated )
EVT_TEXT( ID_SPIN_ANGLE, MainFrame::OnSpinAngleTextUpdated )
EVT_BUTTON( ID_RESET_ROTATION, MainFrame::OnResetRotation )
EVT_CHECKBOX( ID_COLORMAP_USE_WINDOW, MainFrame::OnColormapUseWindowClick )
EVT_CHECKBOX( ID_COLORIZE, MainFrame::OnUseColorMapClick )
EVT_COMBOBOX( ID_COLORMAP_COMBO, MainFrame::OnColormapComboSelected )
////@end MainFrame event table entries
END_EVENT_TABLE()
MainFrame::MainFrame( )
{
}
MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
/* memory leak debugging... */
int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // Get current flag
flag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit
_CrtSetDbgFlag(flag); // Set flag to the new value
controlsAreReady = false;
Create( parent, id, caption, pos, size, style );
if (wxGetApp().argc > 1) {
wxArrayString filepaths;
filepaths.Add(wxGetApp().argv[1]);
OpenFiles(filepaths);
}
}
// --------------------------------------------------------
// ---------- Create --------------------------------------
// --------------------------------------------------------
bool MainFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin MainFrame member initialisation
mainToolbar = NULL;
panelCanvas = NULL;
sizerCanvas = NULL;
scrollSlice = NULL;
imgCanvas = NULL;
panelImage = NULL;
chkBestFitZoom = NULL;
sldZoom = NULL;
spinZoom = NULL;
radUsePlane0 = NULL;
radUsePlane1 = NULL;
radUsePlane2 = NULL;
spinVolumeNum = NULL;
panelMultislice = NULL;
radByRows = NULL;
radByCols = NULL;
chkBestFitMultislice = NULL;
spinNumRows = NULL;
spinNumCols = NULL;
panelVolumeRendering = NULL;
radRenderRayTrace = NULL;
radRender3DTexture = NULL;
spinNumSteps = NULL;
chkUseShading = NULL;
txtSSDCutoff = NULL;
spinSSDCutoff = NULL;
txtIntensity = NULL;
spinIntensity = NULL;
spinNumVolSlices = NULL;
txtDensity = NULL;
spinDensity = NULL;
panelRotations = NULL;
sldXRotate = NULL;
spinX = NULL;
sldYRotate = NULL;
spinY = NULL;
sldZRotate = NULL;
spinZ = NULL;
sldAngleRotate = NULL;
spinAngle = NULL;
btnResetRotation = NULL;
panelColorMap = NULL;
chkUseWindow = NULL;
chkColorize = NULL;
cmbColorMap = NULL;
statusbar = NULL;
////@end MainFrame member initialisation
////@begin MainFrame creation
wxFrame::Create( parent, id, caption, pos, size, style );
this->SetBackgroundColour(wxColour(236, 233, 216));
CreateControls();
SetIcon(GetIconResource(wxT("../xpm/brain.xpm")));
Centre();
////@end MainFrame creation
this->Maximize(true);
return true;
}
// --------------------------------------------------------
// ---------- CreateControls ------------------------------
// --------------------------------------------------------
void MainFrame::CreateControls()
{
WriteLog("CreateControls() called...");
/* setup the OpenGL canvas */
int glAttributes[6] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 32, 0, 0};
/* setup the log window */
frame = this;
//logWindow = new LogWindow();
mainVars = new MainFrameVariables();
////@begin MainFrame content construction
MainFrame* itemFrame1 = this;
GetAuiManager().SetManagedWindow(this);
wxMenuBar* menuBar = new wxMenuBar;
wxMenu* itemMenu3 = new wxMenu;
{
wxMenuItem* menuItem = new wxMenuItem(itemMenu3, ID_FILE_OPEN, _("&Open File(s)..."), wxEmptyString, wxITEM_NORMAL);
wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("../xpm/openfile-16.xpm")));
menuItem->SetBitmap(bitmap);
itemMenu3->Append(menuItem);
}
{
wxMenuItem* menuItem = new wxMenuItem(itemMenu3, ID_FILE_CLOSE, _("Close Current File(s)"), wxEmptyString, wxITEM_NORMAL);
wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("../xpm/close16.xpm")));
menuItem->SetBitmap(bitmap);
itemMenu3->Append(menuItem);
}
itemMenu3->AppendSeparator();
itemMenu3->Append(ID_FILE_BROWSER, _("DICOM Browser..."), wxEmptyString, wxITEM_NORMAL);
itemMenu3->AppendSeparator();
itemMenu3->Append(ID_FILE_SAVE_SCREENGRAB, _("Save screenshot..."), wxEmptyString, wxITEM_NORMAL);
itemMenu3->AppendSeparator();
itemMenu3->Append(ID_FILE_EXIT, _("E&xit"), wxEmptyString, wxITEM_NORMAL);
menuBar->Append(itemMenu3, _("&File"));
wxMenu* itemMenu12 = new wxMenu;
itemMenu12->Append(ID_EDIT_OPTIONS, _("&Options..."), wxEmptyString, wxITEM_NORMAL);
itemMenu12->AppendSeparator();
itemMenu12->Append(ID_OPTIONS_FUNCTION_EDITOR, _("Transfer Function Editor (Color-mapping)..."), wxEmptyString, wxITEM_NORMAL);
menuBar->Append(itemMenu12, _("&Edit"));
wxMenu* itemMenu16 = new wxMenu;
itemMenu16->Append(ID_VIEW_NORMAL, _("Normal"), wxEmptyString, wxITEM_NORMAL);
itemMenu16->Append(ID_VIEW_ORTHOGONAL, _("Orthogonal"), wxEmptyString, wxITEM_NORMAL);
itemMenu16->Append(ID_VIEW_MULTISLICE, _("Multislice"), wxEmptyString, wxITEM_NORMAL);
itemMenu16->Append(ID_VIEW_MIP, _("Maximum Intensity Projection"), wxEmptyString, wxITEM_NORMAL);
itemMenu16->Append(ID_VIEW_SSD, _("Surface Shaded Display"), wxEmptyString, wxITEM_NORMAL);
itemMenu16->Append(ID_VIEW_VOL_REND, _("Volume Rendering"), wxEmptyString, wxITEM_NORMAL);
itemMenu16->AppendSeparator();
itemMenu16->Append(ID_VIEW_IMAGE_OVERLAY, _("Image Overlay"), wxEmptyString, wxITEM_CHECK);
itemMenu16->Check(ID_VIEW_IMAGE_OVERLAY, true);
menuBar->Append(itemMenu16, _("View"));
wxMenu* itemMenu25 = new wxMenu;
itemMenu25->Append(ID_IMAGE_INFORMATION, _("Information..."), wxEmptyString, wxITEM_NORMAL);
menuBar->Append(itemMenu25, _("&Image"));
wxMenu* itemMenu27 = new wxMenu;
itemMenu27->Append(ID_FILE_ANONYMIZE, _("Anonymize..."), wxEmptyString, wxITEM_NORMAL);
itemMenu27->Append(ID_FILE_CONVERT, _("Convert Files..."), wxEmptyString, wxITEM_NORMAL);
menuBar->Append(itemMenu27, _("Tools"));
wxMenu* itemMenu30 = new wxMenu;
{
wxMenuItem* menuItem = new wxMenuItem(itemMenu30, ID_HELP_HELP, _("&Help"), wxEmptyString, wxITEM_NORMAL);
wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("../xpm/help.xpm")));
menuItem->SetBitmap(bitmap);
itemMenu30->Append(menuItem);
}
itemMenu30->AppendSeparator();
itemMenu30->Append(ID_HELP_REPORTBUG, _("Report a Bug..."), wxEmptyString, wxITEM_NORMAL);
itemMenu30->Append(ID_HELP_ABOUT, _("&About"), wxEmptyString, wxITEM_NORMAL);
menuBar->Append(itemMenu30, _("&Help"));
itemFrame1->SetMenuBar(menuBar);
mainToolbar = new wxToolBar( itemFrame1, ID_MAIN_TOOLBAR, wxDefaultPosition, wxDefaultSize, wxTB_FLAT|wxTB_HORIZONTAL|wxTB_NODIVIDER );
mainToolbar->SetToolBitmapSize(wxSize(32, 32));
wxBitmap itemtool36Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/openfile.xpm")));
wxBitmap itemtool36BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_OPEN_FILES, _("Open File(s)..."), itemtool36Bitmap, itemtool36BitmapDisabled, wxITEM_NORMAL, _("Open File(s)..."), wxEmptyString);
wxBitmap itemtool37Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/close32.xpm")));
wxBitmap itemtool37BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_CLOSE_FILE, _("Close Current File(s)..."), itemtool37Bitmap, itemtool37BitmapDisabled, wxITEM_NORMAL, _("Close Current File(s)..."), wxEmptyString);
mainToolbar->AddSeparator();
wxBitmap itemtool39Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/normalview.xpm")));
wxBitmap itemtool39BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_VIEW_NORMAL, _("Normal View"), itemtool39Bitmap, itemtool39BitmapDisabled, wxITEM_RADIO, _("Normal View"), wxEmptyString);
wxBitmap itemtool40Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/brain3view.xpm")));
wxBitmap itemtool40BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_VIEW_ORTHOGONAL, _("Orthogonal View"), itemtool40Bitmap, itemtool40BitmapDisabled, wxITEM_RADIO, _("Orthogonal View"), wxEmptyString);
wxBitmap itemtool41Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/multisliceview2.xpm")));
wxBitmap itemtool41BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_VIEW_MULTISLICE, _("Multislice View"), itemtool41Bitmap, itemtool41BitmapDisabled, wxITEM_RADIO, _("Multislice View"), wxEmptyString);
wxBitmap itemtool42Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/mip.xpm")));
wxBitmap itemtool42BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_VIEW_MIP, _("Maximum Intensity Projection"), itemtool42Bitmap, itemtool42BitmapDisabled, wxITEM_RADIO, _("Maximum Intensity Projection"), wxEmptyString);
wxBitmap itemtool43Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/ssd.xpm")));
wxBitmap itemtool43BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_VIEW_SSD, _("Surface Shaded Display"), itemtool43Bitmap, itemtool43BitmapDisabled, wxITEM_RADIO, _("Surface Shaded Display"), wxEmptyString);
mainToolbar->EnableTool(ID_MAIN_TOOLBAR_VIEW_SSD, false);
wxBitmap itemtool44Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/volume-rend.xpm")));
wxBitmap itemtool44BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_VIEW_VOL_REND, _("Volume Rendering View"), itemtool44Bitmap, itemtool44BitmapDisabled, wxITEM_RADIO, _("Volume Rendering View"), wxEmptyString);
mainToolbar->AddSeparator();
wxBitmap itemtool46Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/show-info-overlay.xpm")));
wxBitmap itemtool46BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_SHOW_OVERLAY, _("Show/Hide Image Overlay"), itemtool46Bitmap, itemtool46BitmapDisabled, wxITEM_CHECK, _("Show/Hide Image Overlay"), wxEmptyString);
wxBitmap itemtool47Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/showlines.xpm")));
wxBitmap itemtool47BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_SHOW_LINES, _("Show/Hide slice lines"), itemtool47Bitmap, itemtool47BitmapDisabled, wxITEM_CHECK, _("Show/Hide Slice Lines"), wxEmptyString);
wxBitmap itemtool48Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/hi-res.xpm")));
wxBitmap itemtool48BitmapDisabled;
mainToolbar->AddTool(ID_IMAGE_TOOLBAR_HIRES, _("View Hi/Lo Resolution"), itemtool48Bitmap, itemtool48BitmapDisabled, wxITEM_CHECK, _("View Hi/Lo Resolution"), wxEmptyString);
mainToolbar->AddSeparator();
wxBitmap itemtool50Bitmap(itemFrame1->GetBitmapResource(wxT("xpm/image-info.xpm")));
wxBitmap itemtool50BitmapDisabled;
mainToolbar->AddTool(ID_MAIN_TOOLBAR_INFO, _("Show Image Information"), itemtool50Bitmap, itemtool50BitmapDisabled, wxITEM_NORMAL, _("Show Image Information"), wxEmptyString);
mainToolbar->Realize();
itemFrame1->GetAuiManager().AddPane(mainToolbar, wxAuiPaneInfo()
.ToolbarPane().Name(_T("Pane1")).Top().Layer(10).CaptionVisible(false).CloseButton(false).DestroyOnClose(false).Resizable(false).Floatable(false).Movable(false));
panelCanvas = new wxPanel( itemFrame1, ID_GLCANVAS_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
itemFrame1->GetAuiManager().AddPane(panelCanvas, wxAuiPaneInfo()
.Name(_T("panelGLCanvas")).Caption(_("No File Loaded")).Centre().CloseButton(false).DestroyOnClose(false).Resizable(true).Floatable(false));
sizerCanvas = new wxBoxSizer(wxHORIZONTAL);
panelCanvas->SetSizer(sizerCanvas);
scrollSlice = new wxScrollBar( panelCanvas, ID_SCROLLBAR, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL );
scrollSlice->SetScrollbar(0, 1, 100, 1);
sizerCanvas->Add(scrollSlice, 0, wxGROW|wxALL, 0);
imgCanvas = new ImageCanvas( panelCanvas, ID_GLCANVAS, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER, wxT("GLCanvas"), glAttributes );
sizerCanvas->Add(imgCanvas, 1, wxGROW|wxALL, 0);
// Fit to content
itemFrame1->GetAuiManager().GetPane(_T("panelGLCanvas")).BestSize(panelCanvas->GetSizer()->Fit(panelCanvas)).MinSize(panelCanvas->GetSizer()->GetMinSize());
panelImage = new wxPanel( itemFrame1, ID_IMAGE_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
itemFrame1->GetAuiManager().AddPane(panelImage, wxAuiPaneInfo()
.Name(_T("panelImage")).Caption(_("Image")).MinSize(wxSize(175, 50)).MaxSize(wxSize(-1, 50)).BestSize(wxSize(-1, 50)).CloseButton(false).DestroyOnClose(false).Resizable(true).FloatingSize(wxSize(175, 75)));
wxBoxSizer* itemBoxSizer56 = new wxBoxSizer(wxVERTICAL);
panelImage->SetSizer(itemBoxSizer56);
wxBoxSizer* itemBoxSizer57 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer56->Add(itemBoxSizer57, 0, wxGROW|wxALL, 0);
wxStaticText* itemStaticText58 = new wxStaticText( panelImage, wxID_STATIC, _("Zoom %"), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticText58->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxBOLD, false, wxT("Tahoma")));
itemBoxSizer57->Add(itemStaticText58, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
chkBestFitZoom = new wxCheckBox( panelImage, ID_BESTFIT_ZOOM, _("Best Fit"), wxDefaultPosition, wxDefaultSize, 0 );
chkBestFitZoom->SetValue(true);
itemBoxSizer57->Add(chkBestFitZoom, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer60 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer56->Add(itemBoxSizer60, 0, wxGROW|wxALL, 0);
sldZoom = new wxSlider( panelImage, ID_ZOOM_SLIDER, 100, 5, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
if (MainFrame::ShowToolTips())
sldZoom->SetToolTip(_("Zoom (5-1000%)"));
itemBoxSizer60->Add(sldZoom, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2);
spinZoom = new wxSpinCtrl( panelImage, ID_SPIN_ZOOM, _T("100"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 5, 1000, 100 );
if (MainFrame::ShowToolTips())
spinZoom->SetToolTip(_("Zoom (5-1000%)"));
itemBoxSizer60->Add(spinZoom, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
wxBoxSizer* itemBoxSizer63 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer56->Add(itemBoxSizer63, 0, wxALIGN_LEFT|wxALL, 2);
wxBoxSizer* itemBoxSizer64 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer63->Add(itemBoxSizer64, 0, wxGROW|wxALL, 2);
wxStaticText* itemStaticText65 = new wxStaticText( panelImage, wxID_STATIC, _("Viewing Plane"), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticText65->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxBOLD, false, wxT("Tahoma")));
itemBoxSizer64->Add(itemStaticText65, 0, wxALIGN_LEFT|wxALL, 1);
radUsePlane0 = new wxRadioButton( panelImage, ID_RADIO_USE_PLANE0, _("Plane 0"), wxDefaultPosition, wxDefaultSize, 0 );
radUsePlane0->SetValue(true);
itemBoxSizer64->Add(radUsePlane0, 0, wxALIGN_LEFT|wxALL, 1);
radUsePlane1 = new wxRadioButton( panelImage, ID_RADIO_USE_PLANE1, _("Plane 1"), wxDefaultPosition, wxDefaultSize, 0 );
radUsePlane1->SetValue(false);
itemBoxSizer64->Add(radUsePlane1, 0, wxALIGN_LEFT|wxALL, 1);
radUsePlane2 = new wxRadioButton( panelImage, ID_RADIO_USE_PLANE2, _("Plane 2"), wxDefaultPosition, wxDefaultSize, 0 );
radUsePlane2->SetValue(false);
itemBoxSizer64->Add(radUsePlane2, 0, wxALIGN_LEFT|wxALL, 1);
wxBoxSizer* itemBoxSizer69 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer63->Add(itemBoxSizer69, 0, wxGROW|wxALL, 2);
wxStaticText* itemStaticText70 = new wxStaticText( panelImage, wxID_STATIC, _("Volume"), wxDefaultPosition, wxDefaultSize, 0 );
itemStaticText70->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxBOLD, false, wxT("Tahoma")));
itemBoxSizer69->Add(itemStaticText70, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 1);
spinVolumeNum = new wxSpinCtrl( panelImage, ID_VOLUME_NUM, _T("0"), wxDefaultPosition, wxSize(80, -1), wxSP_ARROW_KEYS, 0, 1000, 0 );
itemBoxSizer69->Add(spinVolumeNum, 0, wxALIGN_LEFT|wxALL, 1);
panelMultislice = new wxPanel( itemFrame1, ID_MULTISLICE_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
itemFrame1->GetAuiManager().AddPane(panelMultislice, wxAuiPaneInfo()
.Name(_T("panelMultislice")).Caption(_("Multislice")).MinSize(wxSize(-1, 100)).MaxSize(wxSize(-1, 100)).BestSize(wxSize(-1, 100)).Position(1).CloseButton(false).DestroyOnClose(false).Resizable(true));
wxBoxSizer* itemBoxSizer73 = new wxBoxSizer(wxVERTICAL);
panelMultislice->SetSizer(itemBoxSizer73);
wxBoxSizer* itemBoxSizer74 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer73->Add(itemBoxSizer74, 0, wxGROW|wxALL, 0);
wxStaticText* itemStaticText75 = new wxStaticText( panelMultislice, wxID_STATIC, _("Order images by"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer74->Add(itemStaticText75, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
wxBoxSizer* itemBoxSizer76 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer74->Add(itemBoxSizer76, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
radByRows = new wxRadioButton( panelMultislice, ID_ORDER_BY_ROWS, _("Rows"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
radByRows->SetValue(true);
itemBoxSizer76->Add(radByRows, 0, wxALIGN_LEFT|wxALL, 0);
radByCols = new wxRadioButton( panelMultislice, ID_ORDER_BY_COLS, _("Columns"), wxDefaultPosition, wxDefaultSize, 0 );
radByCols->SetValue(false);
itemBoxSizer76->Add(radByCols, 0, wxALIGN_LEFT|wxALL, 0);
itemBoxSizer74->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
chkBestFitMultislice = new wxCheckBox( panelMultislice, ID_CHECK_BESTFIT_MULTISLICE, _("Best Fit"), wxDefaultPosition, wxDefaultSize, 0 );
chkBestFitMultislice->SetValue(false);
itemBoxSizer74->Add(chkBestFitMultislice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
itemBoxSizer73->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
wxBoxSizer* itemBoxSizer82 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer73->Add(itemBoxSizer82, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxFlexGridSizer* itemFlexGridSizer83 = new wxFlexGridSizer(2, 3, 0, 0);
itemBoxSizer82->Add(itemFlexGridSizer83, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
wxStaticText* itemStaticText84 = new wxStaticText( panelMultislice, wxID_STATIC, _("Rows"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer83->Add(itemStaticText84, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 0);
wxStaticText* itemStaticText85 = new wxStaticText( panelMultislice, wxID_STATIC, _("x"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer83->Add(itemStaticText85, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 0);
wxStaticText* itemStaticText86 = new wxStaticText( panelMultislice, wxID_STATIC, _("Columns"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer83->Add(itemStaticText86, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 0);
spinNumRows = new wxSpinCtrl( panelMultislice, ID_NUM_ROWS, _T("1"), wxDefaultPosition, wxSize(45, -1), wxSP_ARROW_KEYS, 1, 100, 1 );
itemFlexGridSizer83->Add(spinNumRows, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 0);
wxStaticText* itemStaticText88 = new wxStaticText( panelMultislice, wxID_STATIC, _("x"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer83->Add(itemStaticText88, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 2);
spinNumCols = new wxSpinCtrl( panelMultislice, ID_NUM_COLS, _T("1"), wxDefaultPosition, wxSize(45, -1), wxSP_ARROW_KEYS, 1, 100, 1 );
itemFlexGridSizer83->Add(spinNumCols, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 0);
panelVolumeRendering = new wxPanel( itemFrame1, ID_VOLUME_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
itemFrame1->GetAuiManager().AddPane(panelVolumeRendering, wxAuiPaneInfo()
.Name(_T("panelVolumeRendering")).Caption(_("Volume Rendering")).MinSize(wxSize(-1, 200)).MaxSize(wxSize(-1, 200)).BestSize(wxSize(-1, 200)).CloseButton(false).DestroyOnClose(false).Resizable(true));
wxBoxSizer* itemBoxSizer91 = new wxBoxSizer(wxVERTICAL);
panelVolumeRendering->SetSizer(itemBoxSizer91);
wxBoxSizer* itemBoxSizer92 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer91->Add(itemBoxSizer92, 0, wxGROW|wxALL, 1);
wxStaticText* itemStaticText93 = new wxStaticText( panelVolumeRendering, wxID_STATIC, _("Rendering Method"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer92->Add(itemStaticText93, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer94 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer92->Add(itemBoxSizer94, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
radRenderRayTrace = new wxRadioButton( panelVolumeRendering, ID_RENDERMETHOD_RAY_TRACE, _("Ray Tracing"), wxDefaultPosition, wxDefaultSize, 0 );
radRenderRayTrace->SetValue(true);
itemBoxSizer94->Add(radRenderRayTrace, 0, wxALIGN_LEFT|wxALL, 1);
radRender3DTexture = new wxRadioButton( panelVolumeRendering, ID_RENDERMETHOD_3D_TEXTURE, _("3D Texture Slicing"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
radRender3DTexture->SetValue(false);
itemBoxSizer94->Add(radRender3DTexture, 0, wxALIGN_LEFT|wxALL, 1);
wxBoxSizer* itemBoxSizer97 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer91->Add(itemBoxSizer97, 0, wxGROW|wxALL, 1);
wxStaticBox* itemStaticBoxSizer98Static = new wxStaticBox(panelVolumeRendering, wxID_ANY, _("Ray Casting"));
wxStaticBoxSizer* itemStaticBoxSizer98 = new wxStaticBoxSizer(itemStaticBoxSizer98Static, wxVERTICAL);
itemBoxSizer97->Add(itemStaticBoxSizer98, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer99 = new wxBoxSizer(wxVERTICAL);
itemStaticBoxSizer98->Add(itemBoxSizer99, 0, wxGROW|wxALL, 1);
wxBoxSizer* itemBoxSizer100 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer99->Add(itemBoxSizer100, 0, wxGROW|wxALL, 1);
wxStaticText* itemStaticText101 = new wxStaticText( panelVolumeRendering, wxID_STATIC, _("# Steps"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer100->Add(itemStaticText101, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
spinNumSteps = new wxSpinCtrl( panelVolumeRendering, ID_NUM_STEPS, _T("80"), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 10, 500, 80 );
itemBoxSizer100->Add(spinNumSteps, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
chkUseShading = new wxCheckBox( panelVolumeRendering, ID_USE_SSD, _("Surface shading"), wxDefaultPosition, wxDefaultSize, 0 );
chkUseShading->SetValue(false);
itemBoxSizer99->Add(chkUseShading, 0, wxALIGN_LEFT|wxALL, 2);
wxBoxSizer* itemBoxSizer104 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer99->Add(itemBoxSizer104, 0, wxGROW|wxALL, 1);
wxStaticText* itemStaticText105 = new wxStaticText( panelVolumeRendering, wxID_STATIC, _("SSD cutoff"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer104->Add(itemStaticText105, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
txtSSDCutoff = new wxTextCtrl( panelVolumeRendering, ID_TEXT_SSD_CUTOFF, _("0.000"), wxDefaultPosition, wxSize(40, -1), 0 );
itemBoxSizer104->Add(txtSSDCutoff, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
spinSSDCutoff = new wxSpinButton( panelVolumeRendering, ID_SPIN_SSD_CUTOFF, wxDefaultPosition, wxSize(-1, 22), wxSP_VERTICAL );
spinSSDCutoff->SetRange(0, 100);
spinSSDCutoff->SetValue(0);
itemBoxSizer104->Add(spinSSDCutoff, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
wxStaticBox* itemStaticBoxSizer108Static = new wxStaticBox(panelVolumeRendering, wxID_ANY, _("Texture Slicing"));
wxStaticBoxSizer* itemStaticBoxSizer108 = new wxStaticBoxSizer(itemStaticBoxSizer108Static, wxVERTICAL);
itemBoxSizer97->Add(itemStaticBoxSizer108, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer109 = new wxBoxSizer(wxHORIZONTAL);
itemStaticBoxSizer108->Add(itemBoxSizer109, 0, wxGROW|wxALL, 1);
wxStaticText* itemStaticText110 = new wxStaticText( panelVolumeRendering, wxID_STATIC, _("Intensity"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer109->Add(itemStaticText110, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
txtIntensity = new wxTextCtrl( panelVolumeRendering, ID_TEXT_INTENSITY, _("0.5"), wxDefaultPosition, wxSize(40, -1), 0 );
txtIntensity->SetMaxLength(4);
itemBoxSizer109->Add(txtIntensity, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
spinIntensity = new wxSpinButton( panelVolumeRendering, ID_SPIN_INTENSITY, wxDefaultPosition, wxSize(-1, 22), wxSP_VERTICAL );
spinIntensity->SetRange(0, 100);
spinIntensity->SetValue(50);
itemBoxSizer109->Add(spinIntensity, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
wxBoxSizer* itemBoxSizer113 = new wxBoxSizer(wxHORIZONTAL);
itemStaticBoxSizer108->Add(itemBoxSizer113, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxStaticText* itemStaticText114 = new wxStaticText( panelVolumeRendering, wxID_STATIC, _("# slices"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer113->Add(itemStaticText114, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
spinNumVolSlices = new wxSpinCtrl( panelVolumeRendering, ID_SPIN_NUM_VOLUME_SLICES, _T("50"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 0, 1000, 50 );
itemBoxSizer113->Add(spinNumVolSlices, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
wxBoxSizer* itemBoxSizer116 = new wxBoxSizer(wxHORIZONTAL);
itemStaticBoxSizer108->Add(itemBoxSizer116, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxStaticText* itemStaticText117 = new wxStaticText( panelVolumeRendering, wxID_STATIC, _("Density"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer116->Add(itemStaticText117, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
txtDensity = new wxTextCtrl( panelVolumeRendering, ID_TEXT_DENSITY, _("0.5"), wxDefaultPosition, wxSize(40, -1), 0 );
txtDensity->SetMaxLength(4);
itemBoxSizer116->Add(txtDensity, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
spinDensity = new wxSpinButton( panelVolumeRendering, ID_SPIN_DENSITY, wxDefaultPosition, wxSize(-1, 22), wxSP_VERTICAL );
spinDensity->SetRange(0, 100);
spinDensity->SetValue(50);
itemBoxSizer116->Add(spinDensity, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
// Fit to content
itemFrame1->GetAuiManager().GetPane(_T("panelVolumeRendering")).BestSize(panelVolumeRendering->GetSizer()->Fit(panelVolumeRendering)).MinSize(panelVolumeRendering->GetSizer()->GetMinSize());
panelRotations = new wxPanel( itemFrame1, ID_ROTATIONS_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
itemFrame1->GetAuiManager().AddPane(panelRotations, wxAuiPaneInfo()
.Name(_T("panelRotations")).Caption(_("Rotations")).MinSize(wxSize(-1, 250)).MaxSize(wxSize(-1, 250)).BestSize(wxSize(-1, 250)).Position(3).CloseButton(false).DestroyOnClose(false).Resizable(true));
wxBoxSizer* itemBoxSizer121 = new wxBoxSizer(wxHORIZONTAL);
panelRotations->SetSizer(itemBoxSizer121);
wxBoxSizer* itemBoxSizer122 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer121->Add(itemBoxSizer122, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
wxBoxSizer* itemBoxSizer123 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer122->Add(itemBoxSizer123, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
wxBoxSizer* itemBoxSizer124 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer123->Add(itemBoxSizer124, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxStaticText* itemStaticText125 = new wxStaticText( panelRotations, wxID_STATIC, _("X"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer123->Add(itemStaticText125, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE, 2);
sldXRotate = new wxSlider( panelRotations, ID_SLIDER_X_ROTATE, 0, 0, 360, wxDefaultPosition, wxSize(20, 50), wxSL_VERTICAL );
itemBoxSizer123->Add(sldXRotate, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
spinX = new wxSpinCtrl( panelRotations, ID_SPIN_X, _T("0"), wxDefaultPosition, wxSize(40, 15), wxSP_ARROW_KEYS, -1, 360, 0 );
spinX->SetFont(wxFont(7, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Tahoma")));
itemBoxSizer123->Add(spinX, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxBoxSizer* itemBoxSizer128 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer122->Add(itemBoxSizer128, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
wxBoxSizer* itemBoxSizer129 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer128->Add(itemBoxSizer129, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxStaticText* itemStaticText130 = new wxStaticText( panelRotations, wxID_STATIC, _("Y"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer128->Add(itemStaticText130, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE, 2);
sldYRotate = new wxSlider( panelRotations, ID_SLIDER_Y_ROTATE, 0, 0, 360, wxDefaultPosition, wxSize(20, 50), wxSL_VERTICAL );
itemBoxSizer128->Add(sldYRotate, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
spinY = new wxSpinCtrl( panelRotations, ID_SPIN_Y, _T("0"), wxDefaultPosition, wxSize(40, 15), wxSP_ARROW_KEYS, -1, 360, 0 );
spinY->SetFont(wxFont(7, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Tahoma")));
itemBoxSizer128->Add(spinY, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxBoxSizer* itemBoxSizer133 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer122->Add(itemBoxSizer133, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
wxBoxSizer* itemBoxSizer134 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer133->Add(itemBoxSizer134, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxStaticText* itemStaticText135 = new wxStaticText( panelRotations, wxID_STATIC, _("Z"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer133->Add(itemStaticText135, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE, 2);
sldZRotate = new wxSlider( panelRotations, ID_SLIDER_Z_ROTATE, 0, 0, 360, wxDefaultPosition, wxSize(20, 50), wxSL_VERTICAL );
itemBoxSizer133->Add(sldZRotate, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
spinZ = new wxSpinCtrl( panelRotations, ID_SPIN_Z, _T("0"), wxDefaultPosition, wxSize(40, 15), wxSP_ARROW_KEYS, -1, 360, 0 );
spinZ->SetFont(wxFont(7, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Tahoma")));
itemBoxSizer133->Add(spinZ, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxBoxSizer* itemBoxSizer138 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer122->Add(itemBoxSizer138, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
wxBoxSizer* itemBoxSizer139 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer138->Add(itemBoxSizer139, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxStaticText* itemStaticText140 = new wxStaticText( panelRotations, wxID_STATIC, _("angle"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer138->Add(itemStaticText140, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE, 2);
sldAngleRotate = new wxSlider( panelRotations, ID_SLIDER_ANGLE, 0, 0, 360, wxDefaultPosition, wxSize(20, 50), wxSL_VERTICAL );
itemBoxSizer138->Add(sldAngleRotate, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
spinAngle = new wxSpinCtrl( panelRotations, ID_SPIN_ANGLE, _T("0"), wxDefaultPosition, wxSize(40, 15), wxSP_ARROW_KEYS, -1, 360, 0 );
spinAngle->SetFont(wxFont(7, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Tahoma")));
itemBoxSizer138->Add(spinAngle, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
btnResetRotation = new wxButton( panelRotations, ID_RESET_ROTATION, _("Reset"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
if (MainFrame::ShowToolTips())
btnResetRotation->SetToolTip(_("Reset all rotations to zero"));
itemBoxSizer121->Add(btnResetRotation, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
// Fit to content
itemFrame1->GetAuiManager().GetPane(_T("panelRotations")).BestSize(panelRotations->GetSizer()->Fit(panelRotations)).MinSize(panelRotations->GetSizer()->GetMinSize());
panelColorMap = new wxPanel( itemFrame1, ID_COLOR_MAP_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
itemFrame1->GetAuiManager().AddPane(panelColorMap, wxAuiPaneInfo()
.Name(_T("panelColorMap")).Caption(_("Color Map")).MinSize(wxSize(-1, 75)).MaxSize(wxSize(-1, 75)).BestSize(wxSize(-1, 75)).CloseButton(false).DestroyOnClose(false).Resizable(true).Floatable(false));
wxBoxSizer* itemBoxSizer145 = new wxBoxSizer(wxVERTICAL);
panelColorMap->SetSizer(itemBoxSizer145);
chkUseWindow = new wxCheckBox( panelColorMap, ID_COLORMAP_USE_WINDOW, _("Use window levels"), wxDefaultPosition, wxDefaultSize, 0 );
chkUseWindow->SetValue(true);
itemBoxSizer145->Add(chkUseWindow, 0, wxALIGN_LEFT|wxALL, 5);
wxStaticLine* itemStaticLine147 = new wxStaticLine( panelColorMap, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
itemBoxSizer145->Add(itemStaticLine147, 0, wxGROW|wxALL, 0);
chkColorize = new wxCheckBox( panelColorMap, ID_COLORIZE, _("Use Colormap"), wxDefaultPosition, wxDefaultSize, 0 );
chkColorize->SetValue(false);
itemBoxSizer145->Add(chkColorize, 0, wxALIGN_LEFT|wxALL, 5);
wxBoxSizer* itemBoxSizer149 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer145->Add(itemBoxSizer149, 0, wxGROW|wxALL, 0);
itemBoxSizer149->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxArrayString cmbColorMapStrings;
cmbColorMap = new wxBitmapComboBox( panelColorMap, ID_COLORMAP_COMBO, wxEmptyString, wxDefaultPosition, wxDefaultSize, cmbColorMapStrings, wxCB_READONLY );
itemBoxSizer149->Add(cmbColorMap, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
// Fit to content
itemFrame1->GetAuiManager().GetPane(_T("panelColorMap")).BestSize(panelColorMap->GetSizer()->Fit(panelColorMap)).MinSize(panelColorMap->GetSizer()->GetMinSize());
statusbar = new wxStatusBar( itemFrame1, ID_STATUSBAR, wxST_SIZEGRIP );
statusbar->SetFieldsCount(1);
statusbar->SetStatusText(_("Ready"), 0);
itemFrame1->SetStatusBar(statusbar);
GetAuiManager().Update();
////@end MainFrame content construction
itemFrame1->imgCanvasIsReady = true;
imgCanvas->SetObjectPointers(frame,mainVars);
/* set the default toolbar button selection */
frame->mainToolbar->ToggleTool(ID_MAIN_TOOLBAR_SHOW_OVERLAY, true);
frame->mainToolbar->ToggleTool(ID_MAIN_TOOLBAR_SHOW_LINES, true);
frame->mainToolbar->ToggleTool(ID_IMAGE_TOOLBAR_HIRES, true);
frame->GetAuiManager().GetPane("panelVolumeRendering").Hide();
frame->GetAuiManager().GetPane("panelMultislice").Hide();
frame->GetAuiManager().Update();
/* hide the slice scroll bar by default */
frame->scrollSlice->Hide();
frame->sizerCanvas->Layout();
/* get the maximum texture size for the colormap LUT */
int texSize = imgCanvas->GetMaxTextureSize();
colorMaps = new ColorMapList(texSize);
displayPoints = new DisplayPoints();
/* setup the color mapping combo box */
PopulateColorMapBox();
/* now the controls have been created... */
controlsAreReady = true;
}
// --------------------------------------------------------
// ---------- ShowToolTips --------------------------------
// --------------------------------------------------------
bool MainFrame::ShowToolTips()
{
return true;
}
// --------------------------------------------------------
// ---------- GetBitmapResource ---------------------------
// --------------------------------------------------------
wxBitmap MainFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin MainFrame bitmap retrieval
wxUnusedVar(name);
if (name == _T("xpm/openfile-16.xpm"))
{
wxBitmap bitmap(openfile_16_xpm);
return bitmap;
}
else if (name == _T("xpm/close16.xpm"))
{
wxBitmap bitmap(close16_xpm);
return bitmap;
}
else if (name == _T("xpm/help.xpm"))
{
wxBitmap bitmap(help_xpm);
return bitmap;
}
else if (name == _T("xpm/openfile.xpm"))
{
wxBitmap bitmap(openfile_xpm);
return bitmap;
}
else if (name == _T("xpm/close32.xpm"))
{
wxBitmap bitmap(close32_xpm);
return bitmap;
}
else if (name == _T("xpm/normalview.xpm"))
{
wxBitmap bitmap(normalview_xpm);
return bitmap;
}
else if (name == _T("xpm/brain3view.xpm"))
{
wxBitmap bitmap(brain3view_xpm);
return bitmap;
}
else if (name == _T("xpm/multisliceview2.xpm"))
{
wxBitmap bitmap(multisliceview2_xpm);
return bitmap;
}
else if (name == _T("xpm/mip.xpm"))
{
wxBitmap bitmap(mip_xpm);
return bitmap;
}
else if (name == _T("xpm/ssd.xpm"))
{
wxBitmap bitmap(ssd_xpm);
return bitmap;
}
else if (name == _T("xpm/volume-rend.xpm"))
{
wxBitmap bitmap(volume_rend_xpm);
return bitmap;
}
else if (name == _T("xpm/show-info-overlay.xpm"))
{
wxBitmap bitmap(show_info_overlay_xpm);
return bitmap;
}
else if (name == _T("xpm/showlines.xpm"))
{
wxBitmap bitmap(showlines_xpm);
return bitmap;
}
else if (name == _T("xpm/hi-res.xpm"))
{
wxBitmap bitmap(hi_res_xpm);
return bitmap;
}
else if (name == _T("xpm/image-info.xpm"))
{
wxBitmap bitmap(image_info_xpm);
return bitmap;
}
return wxNullBitmap;
////@end MainFrame bitmap retrieval
}
// --------------------------------------------------------
// ---------- GetIconResources ----------------------------
// --------------------------------------------------------
wxIcon MainFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin MainFrame icon retrieval
wxUnusedVar(name);
if (name == _T("xpm/brain.xpm"))
{
wxIcon icon(brain_xpm);
return icon;
}
return wxNullIcon;
////@end MainFrame icon retrieval
}
// --------------------------------------------------------
// ---------- SetZoom -------------------------------------
// --------------------------------------------------------
/* sets the zoom on the GUI */
void MainFrame::SetZoom(int zoom)
{
frame->sldZoom->SetValue(zoom);
frame->spinZoom->SetValue(zoom);
mainVars->Image_zoomPercent(spinZoom->GetValue());
}
// --------------------------------------------------------
// ---------- SetCurrentRotation --------------------------
// --------------------------------------------------------
void MainFrame::SetCurrentRotation(float angle, float x, float y, float z)
{
frame->spinAngle->SetValue(int(360.0*angle));
frame->spinX->SetValue(int(360.0*x));
frame->spinY->SetValue(int(360.0*y));
frame->spinZ->SetValue(int(360.0*z));
frame->sldAngleRotate->SetValue(int(360.0*angle));
frame->sldXRotate->SetValue(int(360.0*x));
frame->sldYRotate->SetValue(int(360.0*y));
frame->sldZRotate->SetValue(int(360.0*z));
}
// --------------------------------------------------------
// ---------- SetCurrentSlice -----------------------------
// --------------------------------------------------------
/* sets the slice scroll bar to the correct position */
void MainFrame::SetCurrentSlice(int startSlice, int endSlice, int slice)
{
int w,h;
frame->GetClientSize(&w, &h);
if ((frame->imgCanvas->IsCurrentVolumeMultiFrame()) && (frame->scrollSlice != NULL)) {
frame->scrollSlice->SetScrollbar(slice, 1, endSlice+1, 1, true);
frame->scrollSlice->SetThumbPosition(slice);
}