Mercurial > hg > orthanc-stone
comparison Applications/StoneWebViewer/WebApplication/app.js @ 1859:58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 20 Sep 2021 17:08:23 +0200 |
parents | 023cce3d7844 |
children | 9290d2916150 |
comparison
equal
deleted
inserted
replaced
1858:be88206f8d78 | 1859:58681a5c727b |
---|---|
148 cineTimeoutId: null, | 148 cineTimeoutId: null, |
149 cineLoadingFrame: false, | 149 cineLoadingFrame: false, |
150 videoUri: '', | 150 videoUri: '', |
151 windowingCenter: 0, | 151 windowingCenter: 0, |
152 windowingWidth: 0, | 152 windowingWidth: 0, |
153 instanceNumber: 0 | 153 instanceNumber: 0, |
154 contentDate: '', | |
155 contentTime: '', | |
154 } | 156 } |
155 }, | 157 }, |
156 watch: { | 158 watch: { |
157 currentFrame: function(newVal, oldVal) { | 159 currentFrame: function(newVal, oldVal) { |
158 /** | 160 /** |
169 this.cineLoadingFrame = false; | 171 this.cineLoadingFrame = false; |
170 this.cineRate = 30; // Default value | 172 this.cineRate = 30; // Default value |
171 this.windowingCenter = 0; | 173 this.windowingCenter = 0; |
172 this.windowingWidth = 0; | 174 this.windowingWidth = 0; |
173 this.instanceNumber = 0; | 175 this.instanceNumber = 0; |
174 | 176 this.contentDate = ''; |
177 this.contentTime = '' | |
178 | |
175 if (this.cineTimeoutId !== null) { | 179 if (this.cineTimeoutId !== null) { |
176 clearTimeout(this.cineTimeoutId); | 180 clearTimeout(this.cineTimeoutId); |
177 this.cineTimeoutId = null; | 181 this.cineTimeoutId = null; |
178 } | 182 } |
179 | 183 |
253 if (args.detail.canvasId == that.canvasId) { | 257 if (args.detail.canvasId == that.canvasId) { |
254 that.currentFrame = (args.detail.currentFrame + 1); | 258 that.currentFrame = (args.detail.currentFrame + 1); |
255 that.numberOfFrames = args.detail.numberOfFrames; | 259 that.numberOfFrames = args.detail.numberOfFrames; |
256 that.quality = args.detail.quality; | 260 that.quality = args.detail.quality; |
257 that.instanceNumber = args.detail.instanceNumber; | 261 that.instanceNumber = args.detail.instanceNumber; |
262 that.contentDate = args.detail.contentDate; | |
263 that.contentTime = args.detail.contentTime; | |
258 } | 264 } |
259 }); | 265 }); |
260 | 266 |
261 window.addEventListener('SeriesDetailsReady', function(args) { | 267 window.addEventListener('SeriesDetailsReady', function(args) { |
262 if (args.detail.canvasId == that.canvasId) { | 268 if (args.detail.canvasId == that.canvasId) { |
936 return format.replace(/YYYY/g, year).replace(/MM/g, month).replace(/DD/g, day); | 942 return format.replace(/YYYY/g, year).replace(/MM/g, month).replace(/DD/g, day); |
937 } | 943 } |
938 } | 944 } |
939 }, | 945 }, |
940 | 946 |
947 FormatTime: function(time) | |
948 { | |
949 if (time === undefined || | |
950 time.length == 0) { | |
951 return ''; | |
952 } | |
953 else { | |
954 var format = this.globalConfiguration['TimeFormat']; | |
955 if (format === undefined) { | |
956 // No configuration for the date format, use the DICOM tag as such | |
957 return time; | |
958 } | |
959 else { | |
960 var timeRegexHMS = /([0-9]{2})([0-9]{2})([0-9]{2})/; | |
961 var timeRegexHMSms = /([0-9]{2})([0-9]{2})([0-9]{2}).([0-9]*)/ | |
962 var m = time.match(timeRegexHMSms); | |
963 if (m) { | |
964 format = format.replace(/hh/g, m[1]).replace(/mm/g, m[2]).replace(/ss/g, m[3]); | |
965 if (format.indexOf('f') != -1) { // format expects ms | |
966 return format.replace(/f/g, m[4]) | |
967 } else { | |
968 return format; | |
969 } | |
970 } | |
971 var m = time.match(timeRegexHMS); | |
972 if (m) { | |
973 format = format.replace(/hh/g, m[1]).replace(/mm/g, m[2]).replace(/ss/g, m[3]); | |
974 if (format.indexOf('f') != -1) { // format expects ms but we could not capture one | |
975 return format.replace(/.f/g, '') | |
976 } | |
977 } | |
978 | |
979 return time; | |
980 } | |
981 } | |
982 }, | |
983 | |
941 DownloadJpeg: function() | 984 DownloadJpeg: function() |
942 { | 985 { |
943 var canvas = document.getElementById(this.GetActiveCanvas()); | 986 var canvas = document.getElementById(this.GetActiveCanvas()); |
944 SaveDataUriScheme('StoneWebViewerScreenshot.jpg', canvas.toDataURL('image/jpeg')); | 987 SaveDataUriScheme('StoneWebViewerScreenshot.jpg', canvas.toDataURL('image/jpeg')); |
945 }, | 988 }, |