Mercurial > hg > orthanc
annotate OrthancServer/OrthancRestApi/OrthancRestSystem.cpp @ 3333:2a38e00a0638
Size of the Orthanc static binaries are reduced by compressing ICU data
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 27 Mar 2019 15:25:18 +0100 |
parents | fca730c267d7 |
children | 962e5f00744b |
rev | line source |
---|---|
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1233
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3060
4e43e67f8ecf
preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2976
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU General Public License as |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * published by the Free Software Foundation, either version 3 of the |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * License, or (at your option) any later version. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * In addition, as a special exception, the copyright holders of this |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * program give permission to link the code of its release with the |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * that use the same license as the "OpenSSL" library), and distribute |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * the linked executables. You must obey the GNU General Public License |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * in all respects for all of the code used other than "OpenSSL". If you |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * modify file(s) with this exception, you may extend this exception to |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * your version of the file(s), but you are not obligated to do so. If |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * you do not wish to do so, delete this exception statement from your |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * version. If you delete this exception statement from all source files |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * in the program, then also delete it here. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * This program is distributed in the hope that it will be useful, but |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * WITHOUT ANY WARRANTY; without even the implied warranty of |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * General Public License for more details. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * You should have received a copy of the GNU General Public License |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 **/ |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
831
84513f2ee1f3
pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
34 #include "../PrecompiledHeadersServer.h" |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #include "OrthancRestApi.h" |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
3097 | 37 #include "../../Core/DicomParsing/FromDcmtkBridge.h" |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
38 #include "../../Core/MetricsRegistry.h" |
3097 | 39 #include "../../Plugins/Engine/OrthancPlugins.h" |
40 #include "../../Plugins/Engine/PluginsManager.h" | |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
41 #include "../OrthancConfiguration.h" |
1437
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
42 #include "../ServerContext.h" |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 namespace Orthanc |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 // System information ------------------------------------------------------- |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
974 | 49 static void ServeRoot(RestApiGetCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 call.GetOutput().Redirect("app/explorer.html"); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
974 | 54 static void GetSystemInformation(RestApiGetCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 Json::Value result = Json::objectValue; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 |
2444
d9e3781d2023
"/system" URI returns the version of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2382
diff
changeset
|
58 result["ApiVersion"] = ORTHANC_API_VERSION; |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
59 result["Version"] = ORTHANC_VERSION; |
1668
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
60 result["DatabaseVersion"] = OrthancRestApi::GetIndex(call).GetDatabaseVersion(); |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
61 |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
62 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
63 OrthancConfiguration::ReaderLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
64 result["DicomAet"] = lock.GetConfiguration().GetStringParameter("DicomAet", "ORTHANC"); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
65 result["DicomPort"] = lock.GetConfiguration().GetUnsignedIntegerParameter("DicomPort", 4242); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
66 result["HttpPort"] = lock.GetConfiguration().GetUnsignedIntegerParameter("HttpPort", 8042); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
67 result["Name"] = lock.GetConfiguration().GetStringParameter("Name", ""); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
68 } |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
70 result["StorageAreaPlugin"] = Json::nullValue; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
71 result["DatabaseBackendPlugin"] = Json::nullValue; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
72 |
2136
dd609a99d39a
uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2069
diff
changeset
|
73 #if ORTHANC_ENABLE_PLUGINS == 1 |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1631
diff
changeset
|
74 result["PluginsEnabled"] = true; |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
75 const OrthancPlugins& plugins = OrthancRestApi::GetContext(call).GetPlugins(); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
76 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
77 if (plugins.HasStorageArea()) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
78 { |
1631 | 79 std::string p = plugins.GetStorageAreaLibrary().GetPath(); |
80 result["StorageAreaPlugin"] = boost::filesystem::canonical(p).string(); | |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
81 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
82 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
83 if (plugins.HasDatabaseBackend()) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
84 { |
1631 | 85 std::string p = plugins.GetDatabaseBackendLibrary().GetPath(); |
86 result["DatabaseBackendPlugin"] = boost::filesystem::canonical(p).string(); | |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
87 } |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1631
diff
changeset
|
88 #else |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1631
diff
changeset
|
89 result["PluginsEnabled"] = false; |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1631
diff
changeset
|
90 #endif |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
91 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 call.GetOutput().AnswerJson(result); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 |
974 | 95 static void GetStatistics(RestApiGetCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 { |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
97 static const uint64_t MEGA_BYTES = 1024 * 1024; |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
98 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
99 uint64_t diskSize, uncompressedSize, countPatients, countStudies, countSeries, countInstances; |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
100 OrthancRestApi::GetIndex(call).GetGlobalStatistics(diskSize, uncompressedSize, countPatients, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
101 countStudies, countSeries, countInstances); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
102 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 Json::Value result = Json::objectValue; |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
104 result["TotalDiskSize"] = boost::lexical_cast<std::string>(diskSize); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
105 result["TotalUncompressedSize"] = boost::lexical_cast<std::string>(uncompressedSize); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
106 result["TotalDiskSizeMB"] = static_cast<unsigned int>(diskSize / MEGA_BYTES); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
107 result["TotalUncompressedSizeMB"] = static_cast<unsigned int>(uncompressedSize / MEGA_BYTES); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
108 result["CountPatients"] = static_cast<unsigned int>(countPatients); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
109 result["CountStudies"] = static_cast<unsigned int>(countStudies); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
110 result["CountSeries"] = static_cast<unsigned int>(countSeries); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
111 result["CountInstances"] = static_cast<unsigned int>(countInstances); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
112 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 call.GetOutput().AnswerJson(result); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 |
974 | 116 static void GenerateUid(RestApiGetCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 std::string level = call.GetArgument("level", ""); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 if (level == "patient") |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 { |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
121 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient), MimeType_PlainText); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 else if (level == "study") |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 { |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
125 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Study), MimeType_PlainText); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 else if (level == "series") |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 { |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
129 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series), MimeType_PlainText); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 else if (level == "instance") |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 { |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
133 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Instance), MimeType_PlainText); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 |
974 | 137 static void ExecuteScript(RestApiPostCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 std::string result; |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 ServerContext& context = OrthancRestApi::GetContext(call); |
996
cf52f3bcb2b3
clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
974
diff
changeset
|
141 |
1446
8dc80ba768aa
refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
142 std::string command; |
8dc80ba768aa
refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
143 call.BodyToString(command); |
8dc80ba768aa
refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
144 |
996
cf52f3bcb2b3
clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
974
diff
changeset
|
145 { |
2617
912a767911b0
back to a single Lua context
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2616
diff
changeset
|
146 LuaScripting::Lock lock(context.GetLuaScripting()); |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2612
diff
changeset
|
147 lock.GetLua().Execute(result, command); |
996
cf52f3bcb2b3
clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
974
diff
changeset
|
148 } |
cf52f3bcb2b3
clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
974
diff
changeset
|
149 |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
150 call.GetOutput().AnswerBuffer(result, MimeType_PlainText); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 |
2475
8cc3ca64a534
Orthanc now uses UTC (universal time) instead of local time in its database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
153 template <bool UTC> |
974 | 154 static void GetNowIsoString(RestApiGetCall& call) |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 { |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
156 call.GetOutput().AnswerBuffer(SystemToolbox::GetNowIsoString(UTC), MimeType_PlainText); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
996
diff
changeset
|
159 |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
996
diff
changeset
|
160 static void GetDicomConformanceStatement(RestApiGetCall& call) |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
996
diff
changeset
|
161 { |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
996
diff
changeset
|
162 std::string statement; |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
996
diff
changeset
|
163 GetFileResource(statement, EmbeddedResources::DICOM_CONFORMANCE_STATEMENT); |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
164 call.GetOutput().AnswerBuffer(statement, MimeType_PlainText); |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
996
diff
changeset
|
165 } |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
996
diff
changeset
|
166 |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
996
diff
changeset
|
167 |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
168 static void GetDefaultEncoding(RestApiGetCall& call) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
169 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
170 Encoding encoding = GetDefaultDicomEncoding(); |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
171 call.GetOutput().AnswerBuffer(EnumerationToString(encoding), MimeType_PlainText); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
172 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
173 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
174 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
175 static void SetDefaultEncoding(RestApiPutCall& call) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
176 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
177 Encoding encoding = StringToEncoding(call.GetBodyData()); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
178 |
2940
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
179 { |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
180 OrthancConfiguration::WriterLock lock; |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
181 lock.GetConfiguration().SetDefaultEncoding(encoding); |
4767d36679ed
refactoring access to Orthanc configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
182 } |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
183 |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
184 call.GetOutput().AnswerBuffer(EnumerationToString(encoding), MimeType_PlainText); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
185 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
186 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
187 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
188 |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
189 // Plugins information ------------------------------------------------------ |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
190 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
191 static void ListPlugins(RestApiGetCall& call) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
192 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
193 Json::Value v = Json::arrayValue; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
194 |
1233 | 195 v.append("explorer.js"); |
196 | |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
197 if (OrthancRestApi::GetContext(call).HasPlugins()) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
198 { |
2136
dd609a99d39a
uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2069
diff
changeset
|
199 #if ORTHANC_ENABLE_PLUGINS == 1 |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
200 std::list<std::string> plugins; |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
201 OrthancRestApi::GetContext(call).GetPlugins().GetManager().ListPlugins(plugins); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
202 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
203 for (std::list<std::string>::const_iterator |
1303 | 204 it = plugins.begin(); it != plugins.end(); ++it) |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
205 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
206 v.append(*it); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
207 } |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1631
diff
changeset
|
208 #endif |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
209 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
210 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
211 call.GetOutput().AnswerJson(v); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
212 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
213 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
214 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
215 static void GetPlugin(RestApiGetCall& call) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
216 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
217 if (!OrthancRestApi::GetContext(call).HasPlugins()) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
218 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
219 return; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
220 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
221 |
2136
dd609a99d39a
uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2069
diff
changeset
|
222 #if ORTHANC_ENABLE_PLUGINS == 1 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
223 const PluginsManager& manager = OrthancRestApi::GetContext(call).GetPlugins().GetManager(); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
224 std::string id = call.GetUriComponent("id", ""); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
225 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
226 if (manager.HasPlugin(id)) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
227 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
228 Json::Value v = Json::objectValue; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
229 v["ID"] = id; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
230 v["Version"] = manager.GetPluginVersion(id); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
231 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
232 const OrthancPlugins& plugins = OrthancRestApi::GetContext(call).GetPlugins(); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
233 const char *c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_RootUri); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
234 if (c != NULL) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
235 { |
1597
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
236 std::string root = c; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
237 if (!root.empty()) |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
238 { |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
239 // Turn the root URI into a URI relative to "/app/explorer.js" |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
240 if (root[0] == '/') |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
241 { |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
242 root = ".." + root; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
243 } |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
244 |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
245 v["RootUri"] = root; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
246 } |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
247 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
248 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
249 c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_Description); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
250 if (c != NULL) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
251 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
252 v["Description"] = c; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
253 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
254 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
255 c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_OrthancExplorer); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
256 v["ExtendsOrthancExplorer"] = (c != NULL); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
257 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
258 call.GetOutput().AnswerJson(v); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
259 } |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1631
diff
changeset
|
260 #endif |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
261 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
262 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
263 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
264 static void GetOrthancExplorerPlugins(RestApiGetCall& call) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
265 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
266 std::string s = "// Extensions to Orthanc Explorer by the registered plugins\n\n"; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
267 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
268 if (OrthancRestApi::GetContext(call).HasPlugins()) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
269 { |
2136
dd609a99d39a
uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2069
diff
changeset
|
270 #if ORTHANC_ENABLE_PLUGINS == 1 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
271 const OrthancPlugins& plugins = OrthancRestApi::GetContext(call).GetPlugins(); |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
272 const PluginsManager& manager = plugins.GetManager(); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
273 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
274 std::list<std::string> lst; |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
275 manager.ListPlugins(lst); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
276 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
277 for (std::list<std::string>::const_iterator |
1303 | 278 it = lst.begin(); it != lst.end(); ++it) |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
279 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
280 const char* tmp = plugins.GetProperty(it->c_str(), _OrthancPluginProperty_OrthancExplorer); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
281 if (tmp != NULL) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
282 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
283 s += "/**\n * From plugin: " + *it + " (version " + manager.GetPluginVersion(*it) + ")\n **/\n\n"; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
284 s += std::string(tmp) + "\n\n"; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
285 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
286 } |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1631
diff
changeset
|
287 #endif |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
288 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
289 |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
290 call.GetOutput().AnswerBuffer(s, MimeType_JavaScript); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
291 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
292 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
293 |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2140
diff
changeset
|
294 |
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2140
diff
changeset
|
295 |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
296 // Jobs information ------------------------------------------------------ |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
297 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
298 static void ListJobs(RestApiGetCall& call) |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2140
diff
changeset
|
299 { |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
300 bool expand = call.HasArgument("expand"); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
301 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
302 Json::Value v = Json::arrayValue; |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
303 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
304 std::set<std::string> jobs; |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
305 OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().ListJobs(jobs); |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2140
diff
changeset
|
306 |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
307 for (std::set<std::string>::const_iterator it = jobs.begin(); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
308 it != jobs.end(); ++it) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
309 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
310 if (expand) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
311 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
312 JobInfo info; |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
313 if (OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().GetJobInfo(info, *it)) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
314 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
315 Json::Value tmp; |
2647
73d7d95dd75e
removal of internal job information
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
316 info.Format(tmp); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
317 v.append(tmp); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
318 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
319 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
320 else |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
321 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
322 v.append(*it); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
323 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
324 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
325 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
326 call.GetOutput().AnswerJson(v); |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2140
diff
changeset
|
327 } |
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2140
diff
changeset
|
328 |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
329 static void GetJobInfo(RestApiGetCall& call) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
330 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
331 std::string id = call.GetUriComponent("id", ""); |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2140
diff
changeset
|
332 |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
333 JobInfo info; |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
334 if (OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().GetJobInfo(info, id)) |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
335 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
336 Json::Value json; |
2647
73d7d95dd75e
removal of internal job information
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2617
diff
changeset
|
337 info.Format(json); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
338 call.GetOutput().AnswerJson(json); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
339 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
340 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
341 |
2582
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
342 |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
343 static void GetJobOutput(RestApiGetCall& call) |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
344 { |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
345 std::string job = call.GetUriComponent("id", ""); |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
346 std::string key = call.GetUriComponent("key", ""); |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
347 |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
348 std::string value; |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
349 MimeType mime; |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
350 |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
351 if (OrthancRestApi::GetContext(call).GetJobsEngine(). |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
352 GetRegistry().GetJobOutput(value, mime, job, key)) |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
353 { |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
354 call.GetOutput().AnswerBuffer(value, mime); |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
355 } |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
356 else |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
357 { |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
358 throw OrthancException(ErrorCode_InexistentItem, |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
359 "Job has no such output: " + key); |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
360 } |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
361 } |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
362 |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
363 |
2582
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
364 enum JobAction |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
365 { |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
366 JobAction_Cancel, |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
367 JobAction_Pause, |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
368 JobAction_Resubmit, |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
369 JobAction_Resume |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
370 }; |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
371 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
372 template <JobAction action> |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
373 static void ApplyJobAction(RestApiPostCall& call) |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
374 { |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
375 std::string id = call.GetUriComponent("id", ""); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
376 |
2582
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
377 bool ok = false; |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
378 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
379 switch (action) |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
380 { |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
381 case JobAction_Cancel: |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
382 ok = OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().Cancel(id); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
383 break; |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
384 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
385 case JobAction_Pause: |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
386 ok = OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().Pause(id); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
387 break; |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
388 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
389 case JobAction_Resubmit: |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
390 ok = OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().Resubmit(id); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
391 break; |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
392 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
393 case JobAction_Resume: |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
394 ok = OrthancRestApi::GetContext(call).GetJobsEngine().GetRegistry().Resume(id); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
395 break; |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
396 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
397 default: |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
398 throw OrthancException(ErrorCode_InternalError); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
399 } |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
400 |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
401 if (ok) |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
402 { |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
403 call.GetOutput().AnswerBuffer("{}", MimeType_Json); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
404 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
405 } |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
406 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
407 |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
408 static void GetMetricsPrometheus(RestApiGetCall& call) |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
409 { |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3177
diff
changeset
|
410 #if ORTHANC_ENABLE_PLUGINS == 1 |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3177
diff
changeset
|
411 OrthancRestApi::GetContext(call).GetPlugins().RefreshMetrics(); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3177
diff
changeset
|
412 #endif |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3177
diff
changeset
|
413 |
3177
053e72ff9fc5
new metrics: orthanc_jobs_[pending|running|completed]
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
414 static const float MEGA_BYTES = 1024 * 1024; |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
415 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
416 ServerContext& context = OrthancRestApi::GetContext(call); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
417 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
418 uint64_t diskSize, uncompressedSize, countPatients, countStudies, countSeries, countInstances; |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
419 context.GetIndex().GetGlobalStatistics(diskSize, uncompressedSize, countPatients, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
420 countStudies, countSeries, countInstances); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
421 |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3177
diff
changeset
|
422 unsigned int jobsPending, jobsRunning, jobsSuccess, jobsFailed; |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3177
diff
changeset
|
423 context.GetJobsEngine().GetRegistry().GetStatistics(jobsPending, jobsRunning, jobsSuccess, jobsFailed); |
3177
053e72ff9fc5
new metrics: orthanc_jobs_[pending|running|completed]
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
424 |
053e72ff9fc5
new metrics: orthanc_jobs_[pending|running|completed]
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
425 MetricsRegistry& registry = context.GetMetricsRegistry(); |
053e72ff9fc5
new metrics: orthanc_jobs_[pending|running|completed]
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
426 registry.SetValue("orthanc_disk_size_mb", static_cast<float>(diskSize) / MEGA_BYTES); |
053e72ff9fc5
new metrics: orthanc_jobs_[pending|running|completed]
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
427 registry.SetValue("orthanc_uncompressed_size_mb", static_cast<float>(diskSize) / MEGA_BYTES); |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
428 registry.SetValue("orthanc_count_patients", static_cast<unsigned int>(countPatients)); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
429 registry.SetValue("orthanc_count_studies", static_cast<unsigned int>(countStudies)); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
430 registry.SetValue("orthanc_count_series", static_cast<unsigned int>(countSeries)); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
431 registry.SetValue("orthanc_count_instances", static_cast<unsigned int>(countInstances)); |
3177
053e72ff9fc5
new metrics: orthanc_jobs_[pending|running|completed]
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
432 registry.SetValue("orthanc_jobs_pending", jobsPending); |
053e72ff9fc5
new metrics: orthanc_jobs_[pending|running|completed]
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3174
diff
changeset
|
433 registry.SetValue("orthanc_jobs_running", jobsRunning); |
3179
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3177
diff
changeset
|
434 registry.SetValue("orthanc_jobs_completed", jobsSuccess + jobsFailed); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3177
diff
changeset
|
435 registry.SetValue("orthanc_jobs_success", jobsSuccess); |
fca730c267d7
New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3177
diff
changeset
|
436 registry.SetValue("orthanc_jobs_failed", jobsFailed); |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
437 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
438 std::string s; |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
439 registry.ExportPrometheusText(s); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
440 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
441 call.GetOutput().AnswerBuffer(s, MimeType_PrometheusText); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
442 } |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
443 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
444 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
445 static void GetMetricsEnabled(RestApiGetCall& call) |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
446 { |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
447 bool enabled = OrthancRestApi::GetContext(call).GetMetricsRegistry().IsEnabled(); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
448 call.GetOutput().AnswerBuffer(enabled ? "1" : "0", MimeType_PlainText); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
449 } |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
450 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
451 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
452 static void PutMetricsEnabled(RestApiPutCall& call) |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
453 { |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
454 bool enabled; |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
455 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
456 std::string body(call.GetBodyData()); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
457 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
458 if (body == "1") |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
459 { |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
460 enabled = true; |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
461 } |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
462 else if (body == "0") |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
463 { |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
464 enabled = false; |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
465 } |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
466 else |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
467 { |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
468 throw OrthancException(ErrorCode_ParameterOutOfRange, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
469 "The HTTP body must be 0 or 1, but found: " + body); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
470 } |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
471 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
472 // Success |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
473 OrthancRestApi::GetContext(call).GetMetricsRegistry().SetEnabled(enabled); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
474 call.GetOutput().AnswerBuffer("", MimeType_PlainText); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
475 } |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
476 |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
477 |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
478 void OrthancRestApi::RegisterSystem() |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
479 { |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
480 Register("/", ServeRoot); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
481 Register("/system", GetSystemInformation); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
482 Register("/statistics", GetStatistics); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
483 Register("/tools/generate-uid", GenerateUid); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
484 Register("/tools/execute-script", ExecuteScript); |
2475
8cc3ca64a534
Orthanc now uses UTC (universal time) instead of local time in its database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
485 Register("/tools/now", GetNowIsoString<true>); |
8cc3ca64a534
Orthanc now uses UTC (universal time) instead of local time in its database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
486 Register("/tools/now-local", GetNowIsoString<false>); |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
996
diff
changeset
|
487 Register("/tools/dicom-conformance", GetDicomConformanceStatement); |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2140
diff
changeset
|
488 Register("/tools/default-encoding", GetDefaultEncoding); |
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2140
diff
changeset
|
489 Register("/tools/default-encoding", SetDefaultEncoding); |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
490 Register("/tools/metrics", GetMetricsEnabled); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
491 Register("/tools/metrics", PutMetricsEnabled); |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3097
diff
changeset
|
492 Register("/tools/metrics-prometheus", GetMetricsPrometheus); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
493 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
494 Register("/plugins", ListPlugins); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
495 Register("/plugins/{id}", GetPlugin); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1218
diff
changeset
|
496 Register("/plugins/explorer.js", GetOrthancExplorerPlugins); |
2573
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
497 |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
498 Register("/jobs", ListJobs); |
3372c5255333
StoreScuJob, Orthanc Explorer for jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2475
diff
changeset
|
499 Register("/jobs/{id}", GetJobInfo); |
2582
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
500 Register("/jobs/{id}/cancel", ApplyJobAction<JobAction_Cancel>); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
501 Register("/jobs/{id}/pause", ApplyJobAction<JobAction_Pause>); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
502 Register("/jobs/{id}/resubmit", ApplyJobAction<JobAction_Resubmit>); |
b3da733d984c
job actions in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2573
diff
changeset
|
503 Register("/jobs/{id}/resume", ApplyJobAction<JobAction_Resume>); |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2940
diff
changeset
|
504 Register("/jobs/{id}/{key}", GetJobOutput); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
505 } |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
506 } |