Mercurial > hg > orthanc-stone
comparison Applications/StoneWebViewer/WebApplication/app.js @ 1709:2931f5e15320
download study from Stone Web viewer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 30 Nov 2020 15:36:40 +0100 |
parents | ee2b5990dfff |
children | 673c163e1b3e |
comparison
equal
deleted
inserted
replaced
1708:eb59fbee071e | 1709:2931f5e15320 |
---|---|
25 var COLORS = [ 'blue', 'red', 'green', 'yellow', 'violet' ]; | 25 var COLORS = [ 'blue', 'red', 'green', 'yellow', 'violet' ]; |
26 var SERIES_INSTANCE_UID = '0020,000e'; | 26 var SERIES_INSTANCE_UID = '0020,000e'; |
27 var STUDY_INSTANCE_UID = '0020,000d'; | 27 var STUDY_INSTANCE_UID = '0020,000d'; |
28 var STUDY_DESCRIPTION = '0008,1030'; | 28 var STUDY_DESCRIPTION = '0008,1030'; |
29 var STUDY_DATE = '0008,0020'; | 29 var STUDY_DATE = '0008,0020'; |
30 var PATIENT_ID = '0010,0020'; | |
31 var PATIENT_NAME = '0010,0010'; | |
32 var SERIES_NUMBER = '0020,0011'; | |
33 var SERIES_DESCRIPTION = '0008,103e'; | |
34 var MODALITY = '0008,0060'; | |
30 | 35 |
31 // Registry of the PDF series for which the instance metadata is still waiting | 36 // Registry of the PDF series for which the instance metadata is still waiting |
32 var pendingSeriesPdf_ = {}; | 37 var pendingSeriesPdf_ = {}; |
33 | 38 |
34 | 39 |
95 } | 100 } |
96 else { | 101 else { |
97 alert('Unsupported mouse action in the configuration file: ' + config); | 102 alert('Unsupported mouse action in the configuration file: ' + config); |
98 return stone.WebViewerAction.PAN; | 103 return stone.WebViewerAction.PAN; |
99 } | 104 } |
105 } | |
106 | |
107 | |
108 /** | |
109 * Enable support for tooltips in Bootstrap. This function must be | |
110 * called after each modification to the DOM that introduces new | |
111 * tooltips (e.g. after loading studies). | |
112 **/ | |
113 function RefreshTooltips() | |
114 { | |
115 $('[data-toggle="tooltip"]').tooltip({ | |
116 placement: 'bottom', | |
117 container: 'body', | |
118 trigger: 'hover' | |
119 }); | |
100 } | 120 } |
101 | 121 |
102 | 122 |
103 | 123 |
104 Vue.component('viewport', { | 124 Vue.component('viewport', { |
327 activeViewport: 0, | 347 activeViewport: 0, |
328 showInfo: true, | 348 showInfo: true, |
329 showReferenceLines: true, | 349 showReferenceLines: true, |
330 synchronizedBrowsing: false, | 350 synchronizedBrowsing: false, |
331 globalConfiguration: {}, | 351 globalConfiguration: {}, |
352 creatingArchive: false, | |
353 archiveJob: '', | |
332 | 354 |
333 modalWarning: false, | 355 modalWarning: false, |
334 modalNotDiagnostic: false, | 356 modalNotDiagnostic: false, |
335 modalPreferences: false, | 357 modalPreferences: false, |
336 | 358 |
537 | 559 |
538 this.studies = studies; | 560 this.studies = studies; |
539 this.series = series; | 561 this.series = series; |
540 this.seriesIndex = seriesIndex; | 562 this.seriesIndex = seriesIndex; |
541 this.ready = true; | 563 this.ready = true; |
564 | |
565 Vue.nextTick(function() { | |
566 RefreshTooltips(); | |
567 }); | |
542 }, | 568 }, |
543 | 569 |
544 SeriesDragStart: function(event, seriesIndex) { | 570 SeriesDragStart: function(event, seriesIndex) { |
545 // It is necessary to use ".toString()" for Microsoft Edge Legacy (*) | 571 // It is necessary to use ".toString()" for Microsoft Edge Legacy (*) |
546 event.dataTransfer.setData('seriesIndex', seriesIndex.toString()); | 572 event.dataTransfer.setData('seriesIndex', seriesIndex.toString()); |
870 middle = ConvertMouseAction(behaviour['MiddleMouseButton'], middle); | 896 middle = ConvertMouseAction(behaviour['MiddleMouseButton'], middle); |
871 right = ConvertMouseAction(behaviour['RightMouseButton'], right); | 897 right = ConvertMouseAction(behaviour['RightMouseButton'], right); |
872 } | 898 } |
873 | 899 |
874 this.SetMouseButtonActions(left, middle, right); | 900 this.SetMouseButtonActions(left, middle, right); |
901 }, | |
902 | |
903 CheckIsDownloadComplete: function() | |
904 { | |
905 if (this.creatingArchive && | |
906 this.archiveJob.length > 0) { | |
907 | |
908 var that = this; | |
909 axios.get(that.globalConfiguration.OrthancApiRoot + '/jobs/' + that.archiveJob) | |
910 .then(function(response) { | |
911 console.log('Progress of archive job ' + that.archiveJob + ': ' + response.data['Progress'] + '%'); | |
912 var state = response.data['State']; | |
913 if (state == 'Success') { | |
914 that.creatingArchive = false; | |
915 window.open(that.globalConfiguration.OrthancApiRoot + '/jobs/' + that.archiveJob + '/archive'); | |
916 } | |
917 else if (state == 'Running') { | |
918 setTimeout(that.CheckIsDownloadComplete, 1000); | |
919 } | |
920 else { | |
921 alert('Error while creating the archive in Orthanc: ' + response.data['ErrorDescription']); | |
922 that.creatingArchive = false; | |
923 } | |
924 }) | |
925 .catch(function(error) { | |
926 alert('The archive job is not available anymore in Orthanc'); | |
927 that.creatingArchive = false; | |
928 }); | |
929 } | |
930 }, | |
931 | |
932 DownloadStudy: function(studyInstanceUid) | |
933 { | |
934 console.log('Creating archive for study: ' + studyInstanceUid); | |
935 | |
936 var that = this; | |
937 axios.post(this.globalConfiguration.OrthancApiRoot + '/tools/lookup', studyInstanceUid) | |
938 .then(function(response) { | |
939 if (response.data.length != 1) { | |
940 throw(''); | |
941 } | |
942 else { | |
943 var orthancId = response.data[0]['ID']; | |
944 axios.post(that.globalConfiguration.OrthancApiRoot + '/studies/' + orthancId + '/archive', | |
945 { | |
946 'Asynchronous' : true | |
947 }) | |
948 .then(function(response) { | |
949 that.creatingArchive = true; | |
950 that.archiveJob = response.data.ID; | |
951 setTimeout(that.CheckIsDownloadComplete, 1000); | |
952 }); | |
953 } | |
954 }) | |
955 .catch(function (error) { | |
956 alert('Cannot find the study in Orthanc'); | |
957 }); | |
875 } | 958 } |
876 }, | 959 }, |
877 | 960 |
878 mounted: function() { | 961 mounted: function() { |
879 this.SetViewportLayout('1x1'); | 962 this.SetViewportLayout('1x1'); |
1011 } | 1094 } |
1012 } | 1095 } |
1013 | 1096 |
1014 | 1097 |
1015 $(document).ready(function() { | 1098 $(document).ready(function() { |
1016 // Enable support for tooltips in Bootstrap | 1099 RefreshTooltips(); |
1017 $('[data-toggle="tooltip"]').tooltip({ | |
1018 placement: 'bottom', | |
1019 container: 'body', | |
1020 trigger: 'hover' | |
1021 }); | |
1022 | 1100 |
1023 //app.modalWarning = true; | 1101 //app.modalWarning = true; |
1024 | 1102 |
1025 axios.get(CONFIGURATION_SOURCE) | 1103 axios.get(CONFIGURATION_SOURCE) |
1026 .then(function(response) { | 1104 .then(function(response) { |