@@ -32,7 +32,6 @@ function init() {
3232 // render
3333 controls . update ( ) ;
3434 renderer . render ( scene , camera ) ;
35- statsyay . update ( ) ;
3635
3736 // request new frame
3837 requestAnimationFrame ( function ( ) {
@@ -46,17 +45,10 @@ function init() {
4645 antialias : true
4746 } ) ;
4847 renderer . setSize ( threeD . clientWidth , threeD . clientHeight ) ;
49- renderer . setClearColor ( 0x607D8B , 1 ) ;
50-
51- //let maxTextureSize = renderer.context.getParameter(renderer.context.MAX_TEXTURE_SIZE);
52- //let maxTextureImageUnits = renderer.context.getParameter(renderer.context.MAX_TEXTURE_IMAGE_UNITS);
48+ renderer . setClearColor ( 0x212121 , 1 ) ;
5349
5450 threeD . appendChild ( renderer . domElement ) ;
5551
56- // stats
57- statsyay = new Stats ( ) ;
58- threeD . appendChild ( statsyay . domElement ) ;
59-
6052 // scene
6153 scene = new THREE . Scene ( ) ;
6254 // camera
@@ -81,6 +73,29 @@ window.onload = function() {
8173 // init threeJS...
8274 init ( ) ;
8375
76+ function updateLabels ( labels , modality ) {
77+
78+ if ( modality === 'CR' ||
79+ modality === 'DX' ) {
80+
81+ return ;
82+
83+ }
84+
85+ var top = document . getElementById ( 'top' ) ;
86+ top . innerHTML = labels [ 0 ] ;
87+
88+ var bottom = document . getElementById ( 'bottom' ) ;
89+ bottom . innerHTML = labels [ 1 ] ;
90+
91+ var right = document . getElementById ( 'right' ) ;
92+ right . innerHTML = labels [ 2 ] ;
93+
94+ var left = document . getElementById ( 'left' ) ;
95+ left . innerHTML = labels [ 3 ] ;
96+
97+ }
98+
8499 function buildGUI ( stackHelper ) {
85100 let stack = stackHelper . _stack ;
86101
@@ -126,18 +141,24 @@ window.onload = function() {
126141 let invertRows = cameraFolder . add ( camUtils , 'invertRows' ) ;
127142 invertRows . onChange ( function ( ) {
128143 camera . invertRows ( ) ;
144+ updateLabels ( camera . directionsLabel , stack . modality ) ;
129145 } ) ;
130146
131147 let invertColumns = cameraFolder . add ( camUtils , 'invertColumns' ) ;
132148 invertColumns . onChange ( function ( ) {
133149 camera . invertColumns ( ) ;
150+ updateLabels ( camera . directionsLabel , stack . modality ) ;
134151 } ) ;
135152
136153 let angle = cameraFolder . add ( camera , 'angle' , 0 , 360 ) . step ( 1 ) . listen ( ) ;
154+ angle . onChange ( function ( ) {
155+ updateLabels ( camera . directionsLabel , stack . modality ) ;
156+ } ) ;
137157
138158 let rotate = cameraFolder . add ( camUtils , 'rotate' ) ;
139159 rotate . onChange ( function ( ) {
140160 camera . rotate ( ) ;
161+ updateLabels ( camera . directionsLabel , stack . modality ) ;
141162 } ) ;
142163
143164 let orientationUpdate = cameraFolder . add ( camUtils , 'orientation' , [ 'default' , 'axial' , 'coronal' , 'sagittal' ] ) ;
@@ -146,16 +167,18 @@ window.onload = function() {
146167 camera . update ( ) ;
147168 camera . fitBox ( 2 ) ;
148169 stackHelper . orientation = camera . stackOrientation ;
170+ updateLabels ( camera . directionsLabel , stack . modality ) ;
149171 } ) ;
150172
151173 let conventionUpdate = cameraFolder . add ( camUtils , 'convention' , [ 'radio' , 'neuro' ] ) ;
152174 conventionUpdate . onChange ( function ( value ) {
153175 camera . convention = value ;
154176 camera . update ( ) ;
155177 camera . fitBox ( 2 ) ;
178+ updateLabels ( camera . directionsLabel , stack . modality ) ;
156179 } ) ;
157180
158- cameraFolder . open ( ) ;
181+ // cameraFolder.open();
159182 }
160183
161184 function hookCallbacks ( stackHelper ) {
@@ -239,7 +262,7 @@ window.onload = function() {
239262
240263 let stackHelper = new HelpersStack ( stack ) ;
241264 stackHelper . bbox . visible = false ;
242- stackHelper . border . color = 0x9996F3 ;
265+ stackHelper . border . visible = false ;
243266 scene . add ( stackHelper ) ;
244267
245268 // set camera
@@ -268,6 +291,7 @@ window.onload = function() {
268291 camera . update ( ) ;
269292 camera . fitBox ( 2 ) ;
270293
294+ updateLabels ( camera . directionsLabel , stack . modality ) ;
271295 buildGUI ( stackHelper ) ;
272296 hookCallbacks ( stackHelper ) ;
273297 }
0 commit comments