Mercurial > hg > orthanc-stl
comparison Sources/OrthancExplorer.js @ 0:4e889a8e8be2
initial commit of the viewer plugin
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Jul 2023 19:15:27 +0200 |
parents | |
children | 0f03a8a0bd6f |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4e889a8e8be2 |
---|---|
1 /** | |
2 * SPDX-FileCopyrightText: 2023 Sebastien Jodogne, UCLouvain, Belgium | |
3 * SPDX-License-Identifier: GPL-3.0-or-later | |
4 */ | |
5 | |
6 /** | |
7 * STL plugin for Orthanc | |
8 * Copyright (C) 2023 Sebastien Jodogne, UCLouvain, Belgium | |
9 * | |
10 * This program is free software: you can redistribute it and/or | |
11 * modify it under the terms of the GNU General Public License as | |
12 * published by the Free Software Foundation, either version 3 of the | |
13 * License, or (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, but | |
16 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 * General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 **/ | |
23 | |
24 | |
25 $('#series').live('pagebeforeshow', function() { | |
26 var seriesId = $.mobile.pageData.uuid; | |
27 | |
28 $('#stl-button').remove(); | |
29 | |
30 // Test whether this is a whole-slide image by check the SOP Class | |
31 // UID of one instance of the series | |
32 GetResource('/series/' + seriesId, function(series) { | |
33 var instanceId = series['Instances'][0]; | |
34 | |
35 $.ajax({ | |
36 url: '/instances/' + instanceId + '/metadata/SopClassUid', | |
37 success: function(sopClassUid) { | |
38 if (sopClassUid == '1.2.840.10008.5.1.4.1.1.104.3') { | |
39 | |
40 // This is an "Encapsulated STL Storage" IOD, register the button | |
41 var b = $('<a>') | |
42 .attr('id', 'stl-button') | |
43 .attr('data-role', 'button') | |
44 .attr('href', '#') | |
45 .attr('data-icon', 'search') | |
46 .attr('data-theme', 'e') | |
47 .text('STL viewer') | |
48 .button(); | |
49 | |
50 b.insertAfter($('#series-info')); | |
51 b.click(function() { | |
52 if ($.mobile.pageData) { | |
53 window.open('../stl/viewer.html?instance=' + instanceId); | |
54 } | |
55 }); | |
56 } | |
57 } | |
58 }); | |
59 }); | |
60 }); |