-
Notifications
You must be signed in to change notification settings - Fork 3
/
ptrDsGrid.m
118 lines (102 loc) · 4.24 KB
/
ptrDsGrid.m
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
function ptrDsGrid (hMainWin)
ptrData = guidata (hMainWin);
pnPos = [0, ptrData.params.statusBarHeight, ...
ptrData.params.mainWinSize(1), ...
ptrData.params.mainWinSize(2) - ptrData.params.statusBarHeight];
buttonsBarHeight = 50;
% Deletes the panel if already exists
if isfield(ptrData.handles,'mainPanel') && ...
isfield(ptrData.handles.mainPanel,'hPanel') && ...
ishandle(ptrData.handles.mainPanel.hPanel)
delete(ptrData.handles.mainPanel.hPanel);
end
% Creates main panel
h.hPanel = uipanel('Parent', hMainWin, ...
'Units','pixels', ...
'Position', pnPos, ...
'BorderType','none');
% Create grid panel
h.gridPanel = uipanel('Parent', h.hPanel, ...
'Units','pixels', ...
'Position', [0 buttonsBarHeight ...
pnPos(3) pnPos(4) - buttonsBarHeight], ...
'BackgroundColor', ptrData.params.colormap(1,:), ...
'BorderType','none');
% Create buttons panel
h.btnPanel = uipanel('Parent', h.hPanel, ...
'Units','pixels', ...
'Position', [0 0 pnPos(3) buttonsBarHeight], ...
'BorderType','none');
% Create axes
h.axes = axes('Parent', h.gridPanel, ...
'Units', 'normalized', ...
'Position', [0 0 1 1], ...
'XTick',[], 'YTick', [], ...
'Box', 'off');
axes(h.axes); % Set as current axes
% Popupmenu for selecting the view
h.buttonsBar.txtSliceView = uicontrol ('Parent', h.btnPanel, ...
'String', [ptrLgGetString('secuUI_SliceView') ':'], ...
'Style','text', ...
'Units','pixels', ...
'Position',[10 35 100 12], ...
'FontUnits','pixels', ...
'FontName', 'Helvetica', ...
'FontSize', 10, ...
'FontWeight', 'normal', ...
'HorizontalAlignment','left');
views = {ptrLgGetString('secuUI_ViewAxial'); ...
ptrLgGetString('secuUI_ViewCoronal'); ...
ptrLgGetString('secuUI_ViewSagital')};
h.buttonsBar.cbSliceView = uicontrol ('Parent', h.btnPanel, ...
'String', views, ...
'Style','popupmenu', ...
'Units','pixels', ...
'Position',[10 15 100 15], ...
'FontUnits','pixels', ...
'FontName', 'Helvetica', ...
'FontSize', 10, ...
'FontWeight', 'normal', ...
'Value', ptrData.current.view,...
'Callback', {'ptrCbGrid', 'changeView'}, ...
'HorizontalAlignment','left');
% Slider for selecting the slice
h.buttonsBar.txtSliceTxt = uicontrol ('Parent', h.btnPanel, ...
'String', [ptrLgGetString('secuUI_SliceTxt') ':'], ...
'Style','text', ...
'Units','pixels', ...
'Position',[pnPos(3)-110 35 70 12], ...
'FontUnits','pixels', ...
'FontName', 'Helvetica', ...
'FontSize', 10, ...
'FontWeight', 'normal', ...
'HorizontalAlignment','left');
h.buttonsBar.txtSliceIdx = uicontrol ('Parent', h.btnPanel, ...
'String', '/ ', ...
'Style','text', ...
'Units','pixels', ...
'Position',[pnPos(3)-40 35 30 12], ...
'FontUnits','pixels', ...
'FontName', 'Helvetica', ...
'FontSize', 10, ...
'FontWeight', 'normal', ...
'HorizontalAlignment','right');
h.buttonsBar.sliderSlice = uicontrol(...
'Parent', h.btnPanel,...
'Style', 'slider', ...
'Units','pixels', ...
'Position', [pnPos(3)-110 15, 100, 15], ...
'Callback', {'ptrCbGrid','changeSlice'}, ...
'Enable', 'on', ...
'Min', 0, ...
'Max', 1, ...
'SliderStep', [0.1 0.1], ...
'Value', ptrData.current.slice);
ptrData.handles.mainPanel = h;
guidata (hMainWin, ptrData);
% Enable image tools (tool bar)
ptrPlotTools (ptrData.handles.toolbar.toolbar, [], 'enable', 'on');
% Disable scroll
set (ptrData.handles.win, 'WindowScrollWheelFcn', '');
ptrCbGrid(hMainWin, [], 'refreshImage');
end