mirror of
				https://github.com/leaders-of-digital-9-task/dicom-viewer.git
				synced 2025-10-31 16:07:26 +03:00 
			
		
		
		
	change settings
This commit is contained in:
		
							parent
							
								
									3c9975499e
								
							
						
					
					
						commit
						efab9e1fd0
					
				
							
								
								
									
										69
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										69
									
								
								index.js
									
									
									
									
									
								
							|  | @ -18,8 +18,12 @@ app.init({ | ||||||
|   dataViewConfigs: {'*': [{divId: 'layerGroup0'}]}, |   dataViewConfigs: {'*': [{divId: 'layerGroup0'}]}, | ||||||
|   tools: tools |   tools: tools | ||||||
| }); | }); | ||||||
|  | 
 | ||||||
|  | parent.postMessage({'type': 'getDicom', data: ""}, "*") | ||||||
|  | 
 | ||||||
| app.addEventListener('load', function () { | app.addEventListener('load', function () { | ||||||
|   app.setTool('Scroll'); |   app.setTool('Scroll'); | ||||||
|  | 
 | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| function createCircle(circleData) { | function createCircle(circleData) { | ||||||
|  | @ -111,7 +115,6 @@ function postRois() { | ||||||
|     })) |     })) | ||||||
|     return roisAttrs.flat().map((e) => { |     return roisAttrs.flat().map((e) => { | ||||||
|         var points = []; |         var points = []; | ||||||
|         console.log(e.points) |  | ||||||
|         for (var i = 0; i < e.points.length; i+=2) { |         for (var i = 0; i < e.points.length; i+=2) { | ||||||
|             points.push({x: e.points[i], y: e.points[i+1]}) |             points.push({x: e.points[i], y: e.points[i+1]}) | ||||||
|         } |         } | ||||||
|  | @ -130,7 +133,6 @@ function postDraws() { | ||||||
| 
 | 
 | ||||||
| function receiveMessage(event) | function receiveMessage(event) | ||||||
| { | { | ||||||
|       console.log(event.data, "FFFFFFFFF") |  | ||||||
|       let data = undefined; |       let data = undefined; | ||||||
|       try{ |       try{ | ||||||
|         data = event.data |         data = event.data | ||||||
|  | @ -158,6 +160,8 @@ function receiveMessage(event) | ||||||
|         app.getActiveLayerGroup().getActiveDrawLayer().getKonvaStage().find('#'+findActive())[0].destroy() |         app.getActiveLayerGroup().getActiveDrawLayer().getKonvaStage().find('#'+findActive())[0].destroy() | ||||||
|       } |       } | ||||||
| } | } | ||||||
|  | window.addEventListener("message", receiveMessage, false); | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| function findActive() { | function findActive() { | ||||||
|     activeCandidates = app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().getChildren().map( |     activeCandidates = app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().getChildren().map( | ||||||
|  | @ -178,14 +182,9 @@ function findActive() { | ||||||
|     return [...active][0] |     return [...active][0] | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| window.addEventListener("message", receiveMessage, false); |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| app.addEventListener("drawchange", function (){ |  | ||||||
|   console.log("DRAWWWWWW") |  | ||||||
| }) |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| var range = document.getElementById('sliceRange'); | var range = document.getElementById('sliceRange'); | ||||||
| range.min = 0; | range.min = 0; | ||||||
|  | @ -193,34 +192,36 @@ app.addEventListener('loadend', function () { | ||||||
|   range.max = app.getImage(0).getGeometry().getSize().get(2) - 1; |   range.max = app.getImage(0).getGeometry().getSize().get(2) - 1; | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| app.loadURLs(['https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm']) | // app.loadURLs(['https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'])
 | ||||||
| 
 | 
 | ||||||
| app.addEventListener('load', () => { | // app.addEventListener('load', () => {
 | ||||||
|     app.setTool('Draw') | //     app.setTool('Scroll')
 | ||||||
|     createCircle({ | 
 | ||||||
|         type: 'Circle', | //     // app.setTool('Draw')
 | ||||||
|         center: { | //     // createCircle({
 | ||||||
|             x: 10, y: 100 | //     //     type: 'Circle',
 | ||||||
|         }, | //     //     center: {
 | ||||||
|         radius: 100 | //     //         x: 10, y: 100
 | ||||||
|     }) | //     //     },
 | ||||||
|     createRoi({ | //     //     radius: 100
 | ||||||
|         type: 'Roi', | //     // })
 | ||||||
|         points: [ | //     // createRoi({
 | ||||||
|             { | //     //     type: 'Roi',
 | ||||||
|                 x: 100, y: 100 | //     //     points: [
 | ||||||
|             }, | //     //         {
 | ||||||
|             { | //     //             x: 100, y: 100
 | ||||||
|                 x: 10, y: 100 | //     //         },
 | ||||||
|             } | //     //         {
 | ||||||
|         ] | //     //             x: 10, y: 100
 | ||||||
|     }) | //     //         }
 | ||||||
|     app.setDrawShape('Roi') | //     //     ]
 | ||||||
|     setTimeout(() => { | //     // })
 | ||||||
|     }, 3000) | //     // app.setDrawShape('Roi')
 | ||||||
|     setTimeout(() => { | //     // setTimeout(() => {
 | ||||||
|     }, 5000) | //     // }, 3000)
 | ||||||
| }) | //     // setTimeout(() => {
 | ||||||
|  | //     // }, 5000)
 | ||||||
|  | // })
 | ||||||
| 
 | 
 | ||||||
| app.addEventListener('slicechange', function () { | app.addEventListener('slicechange', function () { | ||||||
|   // update slider on slice change (for ex via mouse wheel)
 |   // update slider on slice change (for ex via mouse wheel)
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user