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