-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathdev_panelfig.tex
More file actions
1277 lines (1081 loc) · 45.2 KB
/
Copy pathdev_panelfig.tex
File metadata and controls
1277 lines (1081 loc) · 45.2 KB
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
\documentclass{tufte-handout}
\usepackage{../braph2_dev}
\usepackage{graphicx, booktabs, array}
%\geometry{showframe} % display margins for debugging page layout
\title{Implement a New Figure Panel}
\begin{document}
\maketitle
\begin{abstract}
\noindent
This is the developer tutorial for implementing a new figure panel.
In this tutorial, you will learn how to create the generator file \fn{*.gen.m} for a new figure panel, which can then be compiled by \code{braph2genesis}.
All figure panels are (direct or indirect) extensions of the element \code{PanelFig}.
You will use the figure panels \code{BrainSurfacePF} and \code{BrainAtlasPF} as an examples.
\end{abstract}
\tableofcontents
\clearpage
\section{Implementation of figure panel (\code{BrainSurfacePF})}
To understand the general concepts of a figure panel, you will start by implementing in detail the figure panel \code{BrainSurfacePF}, which is a direct extension of the element \code{PanelFig}.
\begin{lstlisting}[
label=cd:pf:brainsurfacepf:header,
caption={
{\bf BrainSurfacePF element header.}
The \code{header} section of the generator code in \fn{\_BrainSurfacePF.gen.m} provides the general information about the \code{BrainSurfacePF} element.
}
]
%% ¡header!
BrainSurfacePF < PanelFig (pf, panel figure brain surface) is a plot of a brain surfce. ¥\circled{1}\circlednote{1}{ The element \code{BrainSurfacePF} is defined as a subclass of \code{PabelFig}. The moniker will be \code{pf}.}¥
%%% ¡description!
BrainSurfacePF manages the plot of the brain surface choosen by the user.
A collection of brain surfaces in NV format can be found in the folder
./braph2/brainsurfs/.
This class provides the common methods needed to manage the plot of
the surface. In particular, the user can change lighting, material,
camlight, shadning, colormap, facecolor, brain color, face color,
edge color, and background color.
%%% ¡seealso!
BrainSurface
%%% ¡build!
1
\end{lstlisting}
\begin{lstlisting}[
label=cd:pf:brainsurfacepf:constants,
caption={
{\bf BrainSurfacePF element constants.}
The \code{constants} section of the generator code in \fn{\_BrainSurfacePF.gen.m} introductes some element constants. These will simplify the management of the visualization of the brain surface.
}
]
%% ¡constants!
% fixed 3d view
VIEW_3D = 1 % 3D view numeric code
VIEW_3D_CMD = '3D' % 3D view name
VIEW_3D_AZEL = [-37.5 30] % 3D view azimutal and polar angles
% sagittal left view
VIEW_SL = 2 % sagittal left view numeric code
VIEW_SL_CMD = 'Sagittal left' % sagittal left view name
VIEW_SL_AZEL = [-90 0] % sagittal left view azimutal and polar angles
% sagittal right view
VIEW_SR = 3 % sagittal right view numeric code
VIEW_SR_CMD = 'Sagittal right' % sagittal right view name
VIEW_SR_AZEL = [90 0] % sagittal right view azimutal and polar angles
% axial dorsal view
VIEW_AD = 4 % axial dorsal view numeric code
VIEW_AD_CMD = 'Axial dorsal' % axial dorsal view name
VIEW_AD_AZEL = [0 90] % axial dorsal view azimutal and polar angles
% axial ventral view
VIEW_AV = 5 % axial ventral view numeric code
VIEW_AV_CMD = 'Axial ventral' % axial ventral view name
VIEW_AV_AZEL = [0 -90] % axial ventral view azimutal and polar angles
% coronal anterior view
VIEW_CA = 6 % coronal anterior view numeric code
VIEW_CA_CMD = 'Coronal anterior' % coronal anterior view name
VIEW_CA_AZEL = [180 0] % coronal anterior view azimutal and polar angles
% coronal posterior view
VIEW_CP = 7 % coronal posterior view numeric code
VIEW_CP_CMD = 'Coronal posterior' % coronal posterior view name
VIEW_CP_AZEL = [0 0] % coronal posterior view azimutal and polar angles
VIEW_CMD = { ... % vector of view names
BrainSurfacePF.VIEW_3D_CMD ...
BrainSurfacePF.VIEW_SL_CMD ...
BrainSurfacePF.VIEW_SR_CMD ...
BrainSurfacePF.VIEW_AD_CMD ...
BrainSurfacePF.VIEW_AV_CMD ...
BrainSurfacePF.VIEW_CA_CMD ...
BrainSurfacePF.VIEW_CP_CMD ...
}
VIEW_AZEL = { ... % vector of view azimutal and polar angle
BrainSurfacePF.VIEW_3D_AZEL ...
BrainSurfacePF.VIEW_SL_AZEL ...
BrainSurfacePF.VIEW_SR_AZEL ...
BrainSurfacePF.VIEW_AD_AZEL ...
BrainSurfacePF.VIEW_AV_AZEL ...
BrainSurfacePF.VIEW_CA_AZEL ...
BrainSurfacePF.VIEW_CP_AZEL ...
}
\end{lstlisting}
\begin{lstlisting}[
label=cd:pf:brainsurfacepf:props,
caption={
{\bf BrainSurfacePF element new props.}
The \code{props} section of the generator code in \fn{\_BrainSurfacePF.gen.m} defines the necessary user interface objects and their callbacks.
}
]
%% ¡props!
%%% ¡prop!
H_AXES (evanescent, handle) is the handle for the axes. ¥\circled{1}\circlednote{1}{ defines the evanescent handle of the axes where the brain surface will be plotted. It also defines its general properties.}¥
%%%% ¡calculate!
h_axes = uiaxes( ...
'Parent', pf.memorize('H'), ... ¥\circled{2}\circlednote{2}{ ensures that the parent panel is memorized.}¥
'Tag', 'H_AXES', ...
'Units', 'normalized', ...
'OuterPosition', [0 0 1 1] ...
);
h_axes.Toolbar.Visible = 'off';
h_axes.Interactions = [];
value = h_axes;
%%% ¡prop!
VIEW (figure, rvector) sets the desired view as the line-of-sight azimuth and elevation angles. ¥\circled{3}\circlednote{3}{ determines the view of the brain surface.}¥
%%%% ¡check_prop!
check = length(value) == 2;
%%%% ¡default!
BrainSurfacePF.VIEW_SL_AZEL
%%%% ¡postset! ¥\circled{4}\circlednote{4}{ is executed only when the \code{VIEW} property is set. It takes care of adjusting the view and resetting the lightning.}¥
if pf.get('DRAWN')
view(pf.get('H_AXES'), pf.get('VIEW'))
% reset the ambient lighting
pf.memorize('ST_AMBIENT').set('PANEL', pf, 'PROP', pf.H_AXES).get('SETUP')
end
%%%% ¡gui!
pr = PanelPropRVectorView('EL', pf, 'PROP', BrainSurfacePF.VIEW, varargin{:});
%%% ¡prop!
ST_AXIS (figure, item) determines the axis settings. ¥\circled{5}\circlednote{5}{ determines the axis setting through the container property \code{SettingsAxis}, which derives from \code{Settings}.}¥
%%%% ¡settings!
'SettingsAxis'
%%%% ¡default!
SettingsAxis('GRID', false, 'AXIS', false) ¥\circled{6}\circlednote{6}{ defines the default values by instantiating a default instance of \code{SettingsAxis}.}¥
%%%% ¡gui! ¥\circled{7}\circlednote{7}{ employs the property panel \code{SettingsAxisPP}, which is specialized for \code{SettingsAxis} and derives from \code{SettingsPP}.}¥
pr = SettingsAxisPP('EL', pf, 'PROP', BrainSurfacePF.ST_AXIS, varargin{:});
%%% ¡prop!
SURFFILE (figure, option) is the name of the file of the brain surface to be plotted. ¥\circled{8}\circlednote{8}{ contains the file from which the brain surface is plotted.}¥
%%%% ¡settings!
{dir([fileparts(which('braph2')) filesep() 'brainsurfs' filesep() '*.nv']).name}
%%%% ¡default!
'human_ICBM152.nv'
%%%% ¡postset! ¥\circled{9}\circlednote{9}{ is executed only when the \code{SURFILE} property is set. It updates the property \code{SURF} loading the data from the file. It the figure panel is already drawn, it refreshes the brain handle and redraws it.}¥
bs = ImporterBrainSurfaceNV('FILE', pf.get('SURFFILE')).get('SURF');
pf.set('SURF', bs)
if pf.get('DRAWN')
delete(pf.get('H_BRAIN'))
pf.set('H_BRAIN', Element.getNoValue())
pf.memorize('H_BRAIN')
pf.set('BRAIN', pf.get('BRAIN'))
pf.memorize('ST_SURFACE').set('PANEL', pf, 'PROP', pf.H_BRAIN).get('SETUP')
pf.memorize('ST_AMBIENT').set('PANEL', pf, 'PROP', pf.H_AXES).get('SETUP')
end
%%% ¡prop!
SURF (metadata, item) is the brain surface to be plotted. ¥\circled{10}\circlednote{10}{ contains the \code{BrainSurface} element.}¥
%%%% ¡settings!
'BrainSurface'
%%%% ¡default!
ImporterBrainSurfaceNV('FILE', BrainSurfacePF.getPropDefault('SURFFILE')).get('SURF')
%%% ¡prop!
H_BRAIN (evanescent, handle) is the handle for brain surface. ¥\circled{11}\circlednote{11}{ is the evanescent handle for the brain surface. This is calculated by \circled{12}.}¥
%%%% ¡calculate! ¥\circled{12}¥
triangles = pf.get('SURF').get('TRIANGLES');
coordinates = pf.get('SURF').get('COORDINATES');
h_brain = trisurf( ...
triangles, ...
coordinates(:, 1), ...
coordinates(:, 2), ...
coordinates(:, 3), ...
'Parent', pf.memorize('H_AXES'), ...
'Tag', 'H_BRAIN' ...
);
xlabel(pf.get('H_AXES'), 'Sagittal')
ylabel(pf.get('H_AXES'), 'Axial')
zlabel(pf.get('H_AXES'), 'Coronal')
value = h_brain;
%%% ¡prop!
BRAIN (figure, logical) determines whether the brain surface is shown. ¥\circled{13}\circlednote{13}{ determines whether the brain surface is shown.}¥
%%%% ¡default!
true
%%%% ¡postset! ¥\circled{14}\circlednote{14}{ is executed whenever \code{BRAIN} is set in order to show or hide the brain surface.}¥
if pf.get('DRAWN')
if pf.get('BRAIN')
set(pf.get('H_BRAIN'), 'Visible', 'on')
else % ~pf.get('BRAIN')
set(pf.get('H_BRAIN'), 'Visible', 'off')
end
end
%%% ¡prop!
ST_SURFACE (figure, item) determines the surface settings. ¥\circled{15}\circlednote{15}{ determines the brain surface settings throught the container property \code{SettingsSurface}, which derives from \code{Settings}.}¥
%%%% ¡settings!
'SettingsSurface'
%%%% ¡gui!
pr = SettingsSurfacePP('EL', pf, 'PROP', BrainSurfacePF.ST_SURFACE, varargin{:}); ¥\circled{16}\circlednote{16}{ employs the property panel \code{SettingsSurfacePP}, which is specialized for \code{SettingsSurface} and derives from \code{SettingsPP}.}¥
%%% ¡prop!
ST_AMBIENT (figure, item) determines the ambient settings. ¥\circled{17}\circlednote{17}{ determines the ambient lighting settings throught the container property \code{SettingsAmbient}, which is derived from \code{Settings}.}¥
%%%% ¡settings!
'SettingsAmbient'
%%%% ¡default!
SettingsAmbient('LIGHTING', 'gouraud', 'MATERIAL', 'dull', 'CAMLIGHT', 'headlight (x2)', 'SHADING', 'none', 'COLORMAP', 'none') ¥\circled{18}\circlednote{18}{ defines the default values by instantiating a default instance of \code{SettingsAmbient}.}¥
%%%% ¡gui!
pr = SettingsAmbientPP('EL', pf, 'PROP', BrainSurfacePF.ST_AMBIENT, varargin{:}); ¥\circled{19}\circlednote{19}{ employs the property panel \code{SettingsAmbientPP}, which is specialized for \code{SettingsAmbient} and derives from \code{SettingsPP}.}¥
\end{lstlisting}
\begin{lstlisting}[
label=cd:pf:brainsurfacepf:props_update,
caption={
{\bf BrainSurfacePF element props update.}
The \code{props\_update} section of the generator code in \fn{\_BrainSurfacePF.gen.m} updates the properties of the \code{PanelFig} element. This defines the core properties of the figure panel.
}
]
%% ¡props_update!
¤...¤
%%% ¡prop!
DRAW (query, logical) draws the figure brain surface. ¥\circled{1}\circlednote{1}{ initializes the figure panel by drawing its graphical elements.}¥
%%%% ¡calculate!
value = calculateValue@PanelFig(pf, PanelFig.DRAW, varargin{:}); ¥\circled{2}\circlednote{2}{ calls the constructor of the parent. It returns \code{value = true} if the panel is drawn correctly. It gives a warning if the panel is not drawn correctly.}¥
if value
pf.memorize('H_AXES') ¥\circled{3}\circlednote{3}{ ensures that the axes are memorized.}¥
pf.memorize('ST_AXIS').set('PANEL', pf, 'PROP', BrainSurfacePF.H_AXES).get('SETUP') ¥\circled{4}\circlednote{4}{ creates, memorizes, and sets up the property \code{ST\_AXES} containing the axes settings.}¥
pf.memorize('H_BRAIN') ¥\circled{5}\circlednote{5}{ memorizes the property \code{H\_BRAIN}.}¥
pf.memorize('ST_SURFACE').set('PANEL', pf, 'PROP', BrainSurfacePF.H_BRAIN).get('SETUP') ¥\circled{6}\circlednote{6}{ creates, memorizes, and sets up the property \code{ST\_SURFACE} containing the brain surface settings.}¥
pf.memorize('ST_AMBIENT').set('PANEL', pf, 'PROP', BrainSurfacePF.H_AXES).get('SETUP') ¥\circled{7}\circlednote{7}{ creates, memorizes, and sets up the property \code{ST\_AMBIENT} containing the lightning settings.}¥
end
%%% ¡prop!
DELETE (query, logical) resets the handles when the panel figure brain surface is deleted. ¥\circled{8}\circlednote{8}{ deletes all evanescent handles when the figure containing the panel is deleted.}¥
%%%% ¡calculate!
value = calculateValue@PanelFig(pf, PanelFig.DELETE, varargin{:}); % also warning
if value
pf.set('H_AXES', Element.getNoValue())
pf.set('H_BRAIN', Element.getNoValue())
end
\end{lstlisting}
\begin{lstlisting}[
label=cd:pf:brainsurfacepf:tests,
caption={
{\bf BrainSurfacePF element tests.}
The \code{tests} section of the generator code in \fn{\_BrainSurfacePF.gen.m} determines how the unit tests are performed.
}
]
%% ¡tests!
%%% ¡excluded_props! ¥\circled{1}\circlednote{1}{ some properties need to be excluded from the tests, mainly because they are initialized by other proprties and therefore could give some spurious errors when unit tested.}¥
[BrainSurfacePF.PARENT BrainSurfacePF.H BrainSurfacePF.ST_POSITION BrainSurfacePF.ST_AXIS BrainSurfacePF.ST_SURFACE BrainSurfacePF.ST_AMBIENT]
%%% ¡warning_off!
true
%%% ¡test!
%%%% ¡name!
Remove Figures
%%%% ¡code!
warning('off', [BRAPH2.STR ':BrainSurfacePF'])
assert(length(findall(0, 'type', 'figure')) == 1) ¥\circled{2}\circlednote{2}{ throws an error if there remains a different number of figures than expected.}¥
delete(findall(0, 'type', 'figure')) ¥\circled{3}\circlednote{3}{ removes the figures remaining from the testing.}¥
warning('on', [BRAPH2.STR ':BrainSurfacePF'])
\end{lstlisting}
\subsection{Addition of toolbar buttons}
You will now see how to add the pushbuttons in the toolbar of the figure, opportunely altering the code so far implemented.
\begin{lstlisting}[
label=cd:pf:brainsurfacepf:props_update_tools,
caption={
{\bf BrainSurfacePF element props update.}
The \code{props\_update} section of the generator code in \fn{\_BrainSurfacePF.gen.m} with the additions needed to have the toolbar pushbuttons.
\expand{cd:pf:brainsurfacepf:props_update}
}
]
¤%% ¡props_update!¤
¤...¤
%%% ¡prop!
H_TOOLS (evanescent, handlelist) is the list of panel-specific tools from the first. ¥\circled{1}\circlednote{1}{ provides a list of evanescent handles to toolbar pushbuttons.}¥
%%%% ¡calculate!
toolbar = pf.memorize('H_TOOLBAR'); ¥\circled{2}\circlednote{2}{ retrieves the toolbar, ensuring that the handle is memorized, and \circled{3} checks that it is actually drawn.}¥
if check_graphics(toolbar, 'uitoolbar') ¥\circled{3}¥
value = calculateValue@PanelFig(pf, PanelFig.H_TOOLS);
tool_separator_1 = uipushtool(toolbar, 'Separator', 'on', 'Visible', 'off');
% Brain
tool_brain = uitoggletool(toolbar, ...
'Tag', 'TOOL.Brain', ...
'Separator', 'on', ...
'State', pf.get('BRAIN'), ...
'Tooltip', 'Show Brain', ...
'CData', imread('icon_brain.png'), ...
'OnCallback', {@cb_brain, true}, ...
'OffCallback', {@cb_brain, false});
% Axis
tool_axis = uitoggletool(toolbar, ...
'Tag', 'TOOL.Axis', ...
'State', pf.get('ST_AXIS').get('AXIS'), ...
'Tooltip', 'Show axis', ...
'CData', imread('icon_axis.png'), ...
'OnCallback', {@cb_axis, true}, ...
'OffCallback', {@cb_axis, false});
% Grid
tool_grid = uitoggletool(toolbar, ...
'Tag', 'TOOL.Grid', ...
'State', pf.get('ST_AXIS').get('GRID'), ...
'Tooltip', 'Show grid', ...
'CData', imread('icon_grid.png'), ...
'OnCallback', {@cb_grid, true}, ...
'OffCallback', {@cb_grid, false});
tool_separator_2 = uipushtool(toolbar, 'Separator', 'on', 'Visible', 'off');
% View 3D
tool_view3D = uitoggletool(toolbar, ...
'Tag', 'TOOL.View3D', ...
'Separator', 'on', ...
'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_3D_AZEL), ...
'Tooltip', BrainSurfacePF.VIEW_3D_CMD, ...
'CData', imread('icon_view_3d.png'), ...
'ClickedCallback', {@cb_view, BrainSurfacePF.VIEW_3D_AZEL});
% View SL
tool_viewSL = uitoggletool(toolbar, ...
'Tag', 'TOOL.ViewSL', ...
'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_SL_AZEL), ...
'Tooltip', BrainSurfacePF.VIEW_SL_CMD, ...
'CData', imread('icon_view_sl.png'), ...
'ClickedCallback', {@cb_view, BrainSurfacePF.VIEW_SL_AZEL});
% View SR
tool_viewSR = uitoggletool(toolbar, ...
'Tag', 'TOOL.ViewSR', ...
'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_SR_AZEL), ...
'Tooltip', BrainSurfacePF.VIEW_SR_CMD, ...
'CData', imread('icon_view_sr.png'), ...
'ClickedCallback', {@cb_view, BrainSurfacePF.VIEW_SR_AZEL});
% View AD
tool_viewAD = uitoggletool(toolbar, ...
'Tag', 'TOOL.ViewAD', ...
'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_AD_AZEL), ...
'Tooltip', BrainSurfacePF.VIEW_AD_CMD, ...
'CData', imread('icon_view_ad.png'), ...
'ClickedCallback', {@cb_view, BrainSurfacePF.VIEW_AD_AZEL});
% View AV
tool_viewAV = uitoggletool(toolbar, ...
'Tag', 'TOOL.ViewAV', ...
'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_AV_AZEL), ...
'Tooltip', BrainSurfacePF.VIEW_AV_CMD, ...
'CData', imread('icon_view_av.png'), ...
'ClickedCallback', {@cb_view, BrainSurfacePF.VIEW_AV_AZEL});
% View CA
tool_viewCA = uitoggletool(toolbar, ...
'Tag', 'TOOL.ViewCA', ...
'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_CA_AZEL), ...
'Tooltip', BrainSurfacePF.VIEW_CA_CMD, ...
'CData', imread('icon_view_ca.png'), ...
'ClickedCallback', {@cb_view, BrainSurfacePF.VIEW_CA_AZEL});
% View CP
tool_viewCP = uitoggletool(toolbar, ...
'Tag', 'TOOL.ViewCP', ...
'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_CP_AZEL), ...
'Tooltip', BrainSurfacePF.VIEW_CP_CMD, ...
'CData', imread('icon_view_cp.png'), ...
'ClickedCallback', {@cb_view, BrainSurfacePF.VIEW_CP_AZEL});
value = {value{:}, ... ¥\circled{4}\circlednote{4}{ reorders the pushbuttons.}¥
tool_separator_1, ...
tool_brain, tool_axis, tool_grid, ...
tool_separator_2, ...
tool_view3D, tool_viewSL, tool_viewSL, tool_viewSR, tool_viewAD, tool_viewAV, tool_viewCA, tool_viewCP ...
};
else
value = {};
end
%%%% ¡calculate_callbacks! ¥\circled{5}\circlednote{5}{ provides the callback functions for the pushbuttons.}¥
function cb_brain(~, ~, brain) % (src, event)
pf.set('BRAIN', brain)
end
function cb_axis(~, ~, axis) % (src, event)
pf.get('ST_AXIS').set('AXIS', axis);
% triggers the update of ST_AXIS
pf.set('ST_AXIS', pf.get('ST_AXIS'))
end
function cb_grid(~, ~, grid) % (src, event)
pf.get('ST_AXIS').set('GRID', grid);
% triggers the update of ST_AXIS
pf.set('ST_AXIS', pf.get('ST_AXIS'))
end
function cb_view(~, ~, azel) % (src, event)
pf.set('VIEW', azel)
end
¤%%% ¡prop!
DRAW (query, logical) draws the figure brain surface.
%%%% ¡calculate!
value = calculateValue@PanelFig(pf, PanelFig.DRAW, varargin{:});
if value
pf.memorize('H_AXES')¤
pf.set('VIEW', pf.get('VIEW')) ¥\circled{1}\circlednote{1}{ ensures that the \code{postset} code is executed by resetting \code{VIEW} to its current value. This is needed to update the toolbar pushbuttons when the figure panel is first drawn.}¥
¤pf.memorize('ST_AXIS').set('PANEL', pf, 'PROP', BrainSurfacePF.H_AXES).get('SETUP')¤
pf.memorize('LISTENER_ST_AXIS'); ¥\circled{2}\circlednote{2}{ memorizes also the listener to the changes in \code{ST\_AXIS}. This is needed to ensure that the toolbar pushbuttons are synchronized with the content of \code{ST\_AXIS}.}¥
¤pf.memorize('H_BRAIN')¤
pf.set('BRAIN', pf.get('BRAIN')) ¥\circled{3}\circlednote{3}{ ensures that the \code{postset} code is executed by resetting \code{BRAIN} to its current value. This is needed to update the toolbar pushbuttons when the figure panel is first drawn.}¥
¤pf.memorize('ST_SURFACE').set('PANEL', pf, 'PROP', BrainSurfacePF.H_BRAIN).get('SETUP')
pf.memorize('ST_AMBIENT').set('PANEL', pf, 'PROP', BrainSurfacePF.H_AXES).get('SETUP')
end
%%% ¡prop!
DELETE (query, logical) resets the handles when the panel figure brain surface is deleted.
%%%% ¡calculate!
value = calculateValue@PanelFig(pf, PanelFig.DELETE, varargin{:});
if value
pf.set('H_AXES', Element.getNoValue())
pf.set('H_BRAIN', Element.getNoValue())¤
pf.set('LISTENER_ST_AXIS', Element.getNoValue()) ¥\circled{4}\circlednote{4}{ deletes also the evanescent handle for the \code{LISTENER\_ST\_AXIS} when the figure panel is deleted.}¥
¤end¤
\end{lstlisting}
\begin{lstlisting}[
label=cd:pf:brainsurfacepf:props_tools,
caption={
{\bf BrainSurfacePF element new props with toolbar pushbuttons.}
The \code{props} section of the generator code in \fn{\_BrainSurfacePF.gen.m} with the additions needed to have the toolbar pushbuttons for the brain surface.
\expand{cd:pf:brainsurfacepf:props}
}
]
¤%% ¡props!¤
¤...¤
¤%%% ¡prop!
VIEW (figure, rvector) sets the desired view as the line-of-sight azimuth and elevation angles.
%%%% ¡check_prop!
check = length(value) == 2;
%%%% ¡default!
BrainSurfacePF.VIEW_SL_AZEL
%%%% ¡postset!
if pf.get('DRAWN')
view(pf.get('H_AXES'), pf.get('VIEW'))
% reset the ambient lighting
pf.memorize('ST_AMBIENT').set('PANEL', pf, 'PROP', pf.H_AXES).get('SETUP')¤
% update state of toggle tools ¥\circled{1}\circlednote{1}{ ensures that toolbar pushbuttons are updated with the current view.}¥
toolbar = pf.get('H_TOOLBAR');
if check_graphics(toolbar, 'uitoolbar')
set(findobj(toolbar, 'Tag', 'TOOL.View3D'), 'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_3D_AZEL))
set(findobj(toolbar, 'Tag', 'TOOL.ViewSL'), 'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_SL_AZEL))
set(findobj(toolbar, 'Tag', 'TOOL.ViewSR'), 'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_SR_AZEL))
set(findobj(toolbar, 'Tag', 'TOOL.ViewAD'), 'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_AD_AZEL))
set(findobj(toolbar, 'Tag', 'TOOL.ViewAV'), 'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_AV_AZEL))
set(findobj(toolbar, 'Tag', 'TOOL.ViewCA'), 'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_CA_AZEL))
set(findobj(toolbar, 'Tag', 'TOOL.ViewCP'), 'State', isequal(pf.get('VIEW'), BrainSurfacePF.VIEW_CP_AZEL))
end
¤end
%%%% ¡gui!
pr = PanelPropRVectorView('EL', pf, 'PROP', BrainSurfacePF.VIEW, varargin{:});
%%% ¡prop!
ST_AXIS (figure, item) determines the axis settings.
%%%% ¡settings!
'SettingsAxis'
%%%% ¡default!
SettingsAxis('GRID', false, 'AXIS', false)¤
%%%% ¡postset! ¥\circled{2}\circlednote{2}{ ensures that the toolbar pushbuttons are updated whenever the \code{ST\_AXIS} property is updated.}¥
if pf.get('DRAWN')
toolbar = pf.get('H_TOOLBAR');
if check_graphics(toolbar, 'uitoolbar')
set(findobj(toolbar, 'Tag', 'TOOL.Grid'), 'State', pf.get('ST_AXIS').get('GRID'))
set(findobj(toolbar, 'Tag', 'TOOL.Axis'), 'State', pf.get('ST_AXIS').get('AXIS'))
end
end
¤%%%% ¡gui!
pr = SettingsAxisPP('EL', pf, 'PROP', BrainSurfacePF.ST_AXIS, varargin{:});¤
%%% ¡prop! ¥\circled{3}\circlednote{3}{ ensures that the toolbar pushbuttons are updated whenever the \code{ST\_AXIS} property is updated.}¥
LISTENER_ST_AXIS (evanescent, handle) contains the listener to the axis settings to update the pushbuttons.
%%%% ¡calculate!
value = listener(pf.get('ST_AXIS'), 'PropSet', @cb_listener_st_axis);
%%%% ¡calculate_callbacks!
function cb_listener_st_axis(~, ~)
if pf.get('DRAWN')
toolbar = pf.get('H_TOOLBAR');
if check_graphics(toolbar, 'uitoolbar')
set(findobj(toolbar, 'Tag', 'TOOL.Grid'), 'State', pf.get('ST_AXIS').get('GRID'))
set(findobj(toolbar, 'Tag', 'TOOL.Axis'), 'State', pf.get('ST_AXIS').get('AXIS'))
end
end
end
¤...¤
¤%%% ¡prop!
BRAIN (figure, logical) determines whether the brain surface is shown.
%%%% ¡default!
true
%%%% ¡postset!
if pf.get('DRAWN')
if pf.get('BRAIN')
set(pf.get('H_BRAIN'), 'Visible', 'on')
else % ~pf.get('BRAIN')
set(pf.get('H_BRAIN'), 'Visible', 'off')
end¤
toolbar = pf.get('H_TOOLBAR'); ¥\circled{4}\circlednote{4}{ ensures that the toolbar pushbuttons are updated whenever the \code{BRAIN} property is updated.}¥
if check_graphics(toolbar, 'uitoolbar')
set(findobj(toolbar, 'Tag', 'TOOL.Brain'), 'State', pf.get('BRAIN'))
end
¤end¤
¤...¤
\end{lstlisting}
\begin{lstlisting}[
label=cd:pf:brainsurfacepf:tests_tools,
caption={
{\bf BrainSurfacePF element tests with toolbar pushbuttons.}
The \code{tests} section of the generator code in \fn{\_BrainSurfacePF.gen.m} with the additions needed to have the tool- bar pushbuttons for the brain surface.
\expand{cd:pf:brainsurfacepf:tests}
}
]
¤%% ¡tests!
%%% ¡excluded_props!
[BrainSurfacePF.PARENT BrainSurfacePF.H BrainSurfacePF.ST_POSITION BrainSurfacePF.ST_AXIS BrainSurfacePF.ST_SURFACE BrainSurfacePF.ST_AMBIENT¤ BrainSurfacePF.LISTENER_ST_AXIS¤]¤ ¥\circled{1}\circlednote{1}{ excludes from testing also \code{LISTENER\_ST\_AXIS}.}¥
¤...¤
\end{lstlisting}
\clearpage
\section{Extension of figure panel (\code{BrainAtlasPF})}
You will now learn how to extend \code{BrainSurfacePF} to plot also brain regions. You will therefore implement \code{BrainAtlasPF}.
\begin{lstlisting}[
label=cd:pf:brainatlaspf:header,
caption={
{\bf BrainAtlasPF element header.}
The \code{header} section of the generator code in \fn{\_BrainAtlasPF.gen.m} provides the general information about the \code{BrainAtlasPF} element.
}
]
%% ¡header!
BrainAtlasPF < BrainSurfacePF (pf, panel figure brain atlas) is a plot of a brain atlas. ¥\circled{1}\circlednote{1}{ \code{BrainAtlasPF} is a child of \code{BrainSurfacePF}.}¥
%%% ¡description!
BrainAtlasPF manages the plot of the brain regions symbols,
spheres, ids and labels. BrainAtlasPF utilizes the surface created
from PFBrainSurface to integrate the regions to a brain surface.
%%% ¡seealso!
BrainAtlas, BrainSurface
%%% ¡build!
1
\end{lstlisting}
\begin{lstlisting}[
label=cd:pf:brainatlaspf:sphs,
caption={
{\bf BrainAtlasPF spheres.}
This code demonstrates how to add the spheres to the \code{BrainAtlasPF}.
}
]
%% ¡props!
%%% ¡prop! ¥\circled{1}\circlednote{1}{ contains the brain atlas to be visualized.}¥
BA (metadata, item) is the brain atlas with the brain regions.
%%%% ¡settings!
'BrainAtlas'
%%% ¡prop! ¥\circled{2}\circlednote{2}{ contains the evanescent handles for the spheres to represent the brain regions.}¥
H_SPHS (evanescent, handlelist) is the set of handles for the spheres.
%%%% ¡calculate! ¥\circled{3}\circlednote{3}{ draws the spheres and creates the handles.}¥
L = pf.memorize('BA').get('BR_DICT').get('LENGTH');
h_sphs = cell(1, L);
for i = 1:1:L
h_sphs{i} = surf([], [], [], ...
'Parent', pf.memorize('H_AXES'), ...
'Tag', ['H_SPHS{' int2str(i) '}'], ...
'Visible', false ...
);
end
value = h_sphs;
%%% ¡prop! ¥\circled{4}\circlednote{4}{ determines whether the shperes are shown. When it is set to \code{FALSE}, \circled{5} sets all spheres already drawn to invisible. When it is set to \code{TRUE}, \circled{6} triggers the update of the sphere dictionary containing the elements corresponding to each sphere.}¥
SPHS (figure, logical) determines whether the spheres are shown.
%%%% ¡default!
true
%%%% ¡postset!
if ~pf.get('SPHS') % false ¥\circled{5}¥
h_sphs = pf.get('H_SPHS');
for i = 1:1:length(h_sphs)
set(h_sphs{i}, 'Visible', false)
end
else % true ¥\circled{6}¥
% triggers the update of SPH_DICT
pf.set('SPH_DICT', pf.get('SPH_DICT'))
end
%%% ¡prop!
SPH_DICT (figure, idict) contains the spheres of the brain regions. ¥\circled{7}\circlednote{7}{ provides the dictionary with all sphere elements, which is only executed if \circled{8} the brain atlas is set.}¥
%%%% ¡settings!
'SettingsSphere'
%%%% ¡postset!
if pf.get('SPHS') && ~isa(pf.getr('BA'), 'NoValue') ¥\circled{8}¥
br_dict = pf.get('BA').get('BR_DICT');
if pf.get('SPH_DICT').get('LENGTH') == 0 && br_dict.get('LENGTH') ¥\circled{9}\circlednote{9}{ creates the sphere elements if they do not already exist. Each sphere element is a \code{SettingsSphere} with all properties necessary to set the sphere.}¥
for i = 1:1:br_dict.get('LENGTH')
br = br_dict.get('IT', i);
sphs{i} = SettingsSphere( ...
'PANEL', pf, ...
'PROP', BrainAtlasPF.H_SPHS, ...
'I', i, ...
'VISIBLE', true, ...
'ID', br.get('ID'), ...
'X', br.get('X'), ...
'Y', br.get('Y'), ...
'Z', br.get('Z'), ...
'FACECOLOR', BRAPH2.COL, ...
'FACEALPHA', 1 ...
);
end
pf.get('SPH_DICT').set('IT_LIST', sphs)
end
for i = 1:1:br_dict.get('LENGTH') ¥\circled{10}\circlednote{10}{ setups the sphere objects by calling the property \code{SETUP} on each of them.}¥
pf.get('SPH_DICT').get('IT', i).get('SETUP')
end
% reset the ambient lighting
pf.get('ST_AMBIENT').get('SETUP')
end
%%%% ¡gui! ¥\circled{11}\circlednote{11}{ uses \code{PanelPropIDictTable} to provide a table where the sphere settings can be managed.}¥
pr = PanelPropIDictTable('EL', pf, 'PROP', BrainAtlasPF.SPH_DICT, ...
'COLS', [PanelPropIDictTable.SELECTOR SettingsSphere.VISIBLE SettingsSphere.X SettingsSphere.Y SettingsSphere.Z SettingsSphere.SPHERESIZE SettingsSphere.FACECOLOR SettingsSphere.FACEALPHA SettingsSphere.EDGECOLOR SettingsSphere.EDGEALPHA], ...
varargin{:});
%% ¡props_update!
¤...¤
¤%%% ¡prop!
DRAW (query, logical) draws the figure brain atlas.
%%%% ¡calculate!
value = calculateValue@BrainSurfacePF(pf, BrainSurfacePF.DRAW, varargin{:}); % also warning
if value¤
pf.memorize('H_SPHS') ¥\circled{12}\circlednote{12}{ memorizes the sphere handles.}¥
pf.set('SPHS', pf.get('SPHS')) ¥\circled{13}\circlednote{13}{ sets the sphere elements \code{SettingsSphere} by triggering the \code{postset} of \code{SPHS}.}¥
% reset the ambient lighting
pf.get('ST_AMBIENT').get('SETUP')
¤end¤
¤%%% ¡prop!
DELETE (query, logical) resets the handles when the panel figure brain surface is deleted.
%%%% ¡calculate!
value = calculateValue@BrainSurfacePF(pf, BrainSurfacePF.DELETE, varargin{:}); % also warning
if value¤
pf.set('H_SPHS', Element.getNoValue()) ¥\circled{14}\circlednote{14}{ deletes the sphere handles when the figure panel is deleted.}¥
¤end¤
%% ¡tests!
%%% ¡excluded_props!
[BrainAtlasPF.PARENT BrainAtlasPF.H BrainAtlasPF.ST_POSITION BrainAtlasPF.ST_AXIS BrainAtlasPF.ST_SURFACE BrainAtlasPF.ST_AMBIENT]
¤...¤
\end{lstlisting}
\begin{lstlisting}[
label=cd:pf:brainatlaspf:syms,
caption={
{\bf BrainAtlasPF symbols.}
This code demonstrates how to add the symbols to the \code{BrainAtlasPF}.
\expand{cd:pf:brainatlaspf:sphs}
}
]
¤%% ¡props!¤
¤...¤
%%% ¡prop!
H_SYMS (evanescent, handlelist) is the set of handles for the symbols.
%%%% ¡calculate!
L = pf.memorize('BA').get('BR_DICT').get('LENGTH');
h_syms = cell(1, L);
for i = 1:1:L
h_syms{i} = plot3(0, 0, 0, ...
'Parent', pf.get('H_AXES'), ...
'Tag', ['H_SYMS{' int2str(i) '}'], ...
'Visible', false ...
);
end
value = h_syms;
%%% ¡prop!
SYMS (figure, logical) determines whether the symbols are shown.
%%%% ¡default!
false
%%%% ¡postset!
if ~pf.get('SYMS') % false
h_syms = pf.get('H_SYMS');
for i = 1:1:length(h_syms)
set(h_syms{i}, 'Visible', false)
end
else % true
% triggers the update of SYM_DICT
pf.set('SYM_DICT', pf.get('SYM_DICT'))
end
%%% ¡prop!
SYM_DICT (figure, idict) contains the symbols of the brain regions.
%%%% ¡settings!
'SettingsSymbol'
%%%% ¡postset!
if pf.get('SYMS') && ~isa(pf.getr('BA'), 'NoValue')
br_dict = pf.get('BA').get('BR_DICT');
if pf.get('SYM_DICT').get('LENGTH') == 0 && br_dict.get('LENGTH')
for i = 1:1:br_dict.get('LENGTH')
br = br_dict.get('IT', i);
syms{i} = SettingsSymbol( ...
'PANEL', pf, ...
'PROP', BrainAtlasPF.H_SYMS, ...
'I', i, ...
'VISIBLE', true, ...
'ID', br.get('ID'), ... % Callback('EL', br, 'TAG', 'ID'), ...
'X', br.get('X'), ... % Callback('EL', br, 'TAG', 'X'), ...
'Y', br.get('Y'), ... % Callback('EL', br, 'TAG', 'Y'), ...
'Z', br.get('Z') ... % Callback('EL', br, 'TAG', 'Z') ...
);
end
pf.get('SYM_DICT').set('IT_LIST', syms)
end
for i = 1:1:br_dict.get('LENGTH')
pf.get('SYM_DICT').get('IT', i).get('SETUP')
end
end
%%%% ¡gui!
pr = PanelPropIDictTable('EL', pf, 'PROP', BrainAtlasPF.SYM_DICT, ...
'COLS', [PanelPropIDictTable.SELECTOR SettingsSymbol.VISIBLE SettingsSymbol.X SettingsSymbol.Y SettingsSymbol.Z SettingsSymbol.SYMBOL SettingsSymbol.SYMBOLSIZE SettingsSymbol.EDGECOLOR SettingsSymbol.FACECOLOR], ...
varargin{:});
¤%% ¡props_update!¤
¤...¤
¤%%% ¡prop!
DRAW (query, logical) draws the figure brain atlas.
%%%% ¡calculate!
value = calculateValue@BrainSurfacePF(pf, BrainSurfacePF.DRAW, varargin{:}); % also warning
if value
pf.memorize('H_SPHS')
pf.set('SPHS', pf.get('SPHS'))¤
pf.memorize('H_SYMS')
pf.set('SYMS', pf.get('SYMS'))
¤% reset the ambient lighting
pf.get('ST_AMBIENT').get('SETUP')
end
%%% ¡prop!
DELETE (query, logical) resets the handles when the panel figure brain surface is deleted.
%%%% ¡calculate!
value = calculateValue@BrainSurfacePF(pf, BrainSurfacePF.DELETE, varargin{:}); % also warning
if value
pf.set('H_SPHS', Element.getNoValue())¤
pf.set('H_SYMS', Element.getNoValue())
¤end¤
¤...¤
\end{lstlisting}
\begin{lstlisting}[
label=cd:pf:brainatlaspf:ids,
caption={
{\bf BrainAtlasPF ids.}
This code demonstrates how to add the ids to the \code{BrainAtlasPF}.
\expand{cd:pf:brainatlaspf:syms}
}
]
¤%% ¡props!¤
¤...¤
%%% ¡prop!
H_IDS (evanescent, handlelist) is the set of handles for the ids.
%%%% ¡calculate!
L = pf.memorize('BA').get('BR_DICT').get('LENGTH');
h_ids = cell(1, L);
for i = 1:1:L
h_ids{i} = text(0, 0, 0, '', ...
'Parent', pf.get('H_AXES'), ...
'Tag', ['H_IDS{' int2str(i) '}'], ...
'Visible', false ...
);
end
value = h_ids;
%%% ¡prop!
IDS (figure, logical) determines whether the ids are shown.
%%%% ¡default!
false
%%%% ¡postset!
if ~pf.get('IDS') % false
h_ids = pf.get('H_IDS');
for i = 1:1:length(h_ids)
set(h_ids{i}, 'Visible', false)
end
else % true
% triggers the update of ID_DICT
pf.set('ID_DICT', pf.get('ID_DICT'))
end
%%% ¡prop!
ID_DICT (figure, idict) contains the ids of the brain regions.
%%%% ¡settings!
'SettingsText'
%%%% ¡postset!
if pf.get('IDS') && ~isa(pf.getr('BA'), 'NoValue')
br_dict = pf.get('BA').get('BR_DICT');
if pf.get('ID_DICT').get('LENGTH') == 0 && br_dict.get('LENGTH')
for i = 1:1:br_dict.get('LENGTH')
br = br_dict.get('IT', i);
ids{i} = SettingsText( ...
'PANEL', pf, ...
'PROP', BrainAtlasPF.H_IDS, ...
'I', i, ...
'VISIBLE', true, ...
'ID', br.get('ID'), ... % Callback('EL', br, 'TAG', 'ID'), ...
'X', br.get('X'), ... % Callback('EL', br, 'TAG', 'X'), ...
'Y', br.get('Y'), ... % Callback('EL', br, 'TAG', 'Y'), ...
'Z', br.get('Z'), ... % Callback('EL', br, 'TAG', 'Z'), ...
'TXT', br.get('ID') ... % Callback('EL', br, 'TAG', 'ID') ...
);
end
pf.get('ID_DICT').set('IT_LIST', ids)
end
for i = 1:1:br_dict.get('LENGTH')
pf.get('ID_DICT').get('IT', i).get('SETUP')
end
end
%%%% ¡gui!
pr = PanelPropIDictTable('EL', pf, 'PROP', BrainAtlasPF.ID_DICT, ...
'COLS', [PanelPropIDictTable.SELECTOR SettingsText.VISIBLE SettingsText.X SettingsText.Y SettingsText.Z SettingsText.ROTATION SettingsText.TXT SettingsText.FONTNAME SettingsText.FONTSIZE SettingsText.FONTCOLOR SettingsText.INTERPRETER], ...
varargin{:});
¤%% ¡props_update!¤
¤...¤
¤%%% ¡prop!
DRAW (query, logical) draws the figure brain atlas.
%%%% ¡calculate!
value = calculateValue@BrainSurfacePF(pf, BrainSurfacePF.DRAW, varargin{:}); % also warning
if value
pf.memorize('H_SPHS')
pf.set('SPHS', pf.get('SPHS'))
pf.memorize('H_SYMS')
pf.set('SYMS', pf.get('SYMS'))¤
pf.memorize('H_IDS')
pf.set('SPHS', pf.get('SPHS'))
¤% reset the ambient lighting
pf.get('ST_AMBIENT').get('SETUP')
end
%%% ¡prop!
DELETE (query, logical) resets the handles when the panel figure brain surface is deleted.
%%%% ¡calculate!
value = calculateValue@BrainSurfacePF(pf, BrainSurfacePF.DELETE, varargin{:}); % also warning
if value
pf.set('H_SPHS', Element.getNoValue())
pf.set('H_SYMS', Element.getNoValue())¤
pf.set('H_IDS', Element.getNoValue())
¤end¤
¤...¤
\end{lstlisting}
\begin{lstlisting}[
label=cd:pf:brainatlaspf:labs,
caption={
{\bf BrainAtlasPF labels.}
This code demonstrates how to add the labels to the \code{BrainAtlasPF}.
\expand{cd:pf:brainatlaspf:ids}
}
]
¤%% ¡props!¤
¤...¤
¤%%% ¡prop!
H_LABS (evanescent, handlelist) is the set of handles for the labels.
%%%% ¡calculate!
L = pf.memorize('BA').get('BR_DICT').get('LENGTH');
h_labs = cell(1, L);
for i = 1:1:L
h_labs{i} = text(0, 0, 0, '', ...
'Parent', pf.get('H_AXES'), ...
'Tag', ['H_LABS{' int2str(i) '}'], ...
'Visible', false ...
);
end
value = h_labs;
%%% ¡prop!
LABS (figure, logical) determines whether the labels are shown.
%%%% ¡default!
false
%%%% ¡postset!
if ~pf.get('LABS') % false
h_labs = pf.get('H_LABS');
for i = 1:1:length(h_labs)
set(h_labs{i}, 'Visible', false)
end
else % true
% triggers the update of LAB_DICT
pf.set('LAB_DICT', pf.get('LAB_DICT'))
end
%%% ¡prop!
LAB_DICT (figure, idict) contains the labels of the brain regions.
%%%% ¡settings!
'SettingsText'
%%%% ¡postset!
if pf.get('LABS') && ~isa(pf.getr('BA'), 'NoValue')