Mercurial > hg > orthanc
annotate Plugins/Engine/OrthancPlugins.cpp @ 1916:5bcf721bde4f
IImageWriter
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Feb 2016 15:26:37 +0100 |
parents | d7c1cb559431 |
children | e8c2f993f6b3 |
rev | line source |
---|---|
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
bafc9d592632
REST callbacks are working
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:
1282
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * This program is free software: you can redistribute it and/or |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * modify it under the terms of the GNU General Public License as |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * published by the Free Software Foundation, either version 3 of the |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * License, or (at your option) any later version. |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * In addition, as a special exception, the copyright holders of this |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * program give permission to link the code of its release with the |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * that use the same license as the "OpenSSL" library), and distribute |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * the linked executables. You must obey the GNU General Public License |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * in all respects for all of the code used other than "OpenSSL". If you |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * modify file(s) with this exception, you may extend this exception to |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * your version of the file(s), but you are not obligated to do so. If |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * you do not wish to do so, delete this exception statement from your |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * version. If you delete this exception statement from all source files |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * in the program, then also delete it here. |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * This program is distributed in the hope that it will be useful, but |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * WITHOUT ANY WARRANTY; without even the implied warranty of |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * General Public License for more details. |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * You should have received a copy of the GNU General Public License |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 **/ |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
1625 | 33 #include "../../OrthancServer/PrecompiledHeadersServer.h" |
1133 | 34 #include "OrthancPlugins.h" |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
36 #if ORTHANC_PLUGINS_ENABLED != 1 |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
37 #error The plugin support is disabled |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
38 #endif |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
39 |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
40 |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
41 #include "../../Core/ChunkedBuffer.h" |
1452
b737acb13da5
refactoring of the main function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
42 #include "../../Core/HttpServer/HttpToolbox.h" |
1486
f967bdf8534e
refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1466
diff
changeset
|
43 #include "../../Core/Logging.h" |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1430
diff
changeset
|
44 #include "../../Core/OrthancException.h" |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1430
diff
changeset
|
45 #include "../../Core/Toolbox.h" |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
46 #include "../../OrthancServer/FromDcmtkBridge.h" |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
47 #include "../../OrthancServer/ToDcmtkBridge.h" |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
48 #include "../../OrthancServer/OrthancInitialization.h" |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1430
diff
changeset
|
49 #include "../../OrthancServer/ServerContext.h" |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1430
diff
changeset
|
50 #include "../../OrthancServer/ServerToolbox.h" |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
51 #include "../../OrthancServer/Search/HierarchicalMatcher.h" |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
52 #include "../../OrthancServer/Internals/DicomImageDecoder.h" |
1554
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
53 #include "../../Core/Compression/ZlibCompressor.h" |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
54 #include "../../Core/Compression/GzipCompressor.h" |
1612
96582230ddcb
Core/ImageFormats folder renamed as Core/Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
55 #include "../../Core/Images/Image.h" |
96582230ddcb
Core/ImageFormats folder renamed as Core/Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
56 #include "../../Core/Images/PngReader.h" |
96582230ddcb
Core/ImageFormats folder renamed as Core/Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
57 #include "../../Core/Images/PngWriter.h" |
96582230ddcb
Core/ImageFormats folder renamed as Core/Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
58 #include "../../Core/Images/JpegReader.h" |
96582230ddcb
Core/ImageFormats folder renamed as Core/Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
59 #include "../../Core/Images/JpegWriter.h" |
96582230ddcb
Core/ImageFormats folder renamed as Core/Images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
60 #include "../../Core/Images/ImageProcessing.h" |
1902
8b0ee8d5e6d0
Refactoring leading to speedups with custom image decoders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
61 #include "../../OrthancServer/DefaultDicomImageDecoder.h" |
1625 | 62 #include "PluginsEnumerations.h" |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 #include <boost/regex.hpp> |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
65 #include <dcmtk/dcmdata/dcdict.h> |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
66 #include <dcmtk/dcmdata/dcdicent.h> |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 namespace Orthanc |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 { |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
70 static void CopyToMemoryBuffer(OrthancPluginMemoryBuffer& target, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
71 const void* data, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
72 size_t size) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
73 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
74 target.size = size; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
75 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
76 if (size == 0) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
77 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
78 target.data = NULL; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
79 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
80 else |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
81 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
82 target.data = malloc(size); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
83 if (target.data != NULL) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
84 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
85 memcpy(target.data, data, size); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
86 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
87 else |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
88 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
89 throw OrthancException(ErrorCode_NotEnoughMemory); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
90 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
91 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
92 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
93 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
94 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
95 static void CopyToMemoryBuffer(OrthancPluginMemoryBuffer& target, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
96 const std::string& str) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
97 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
98 if (str.size() == 0) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
99 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
100 target.size = 0; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
101 target.data = NULL; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
102 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
103 else |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
104 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
105 CopyToMemoryBuffer(target, str.c_str(), str.size()); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
106 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
107 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
108 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
109 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
110 namespace |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
111 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
112 class PluginStorageArea : public IStorageArea |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
113 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
114 private: |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
115 _OrthancPluginRegisterStorageArea callbacks_; |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
116 PluginsErrorDictionary& errorDictionary_; |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
117 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
118 void Free(void* buffer) const |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
119 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
120 if (buffer != NULL) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
121 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
122 callbacks_.free(buffer); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
123 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
124 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
125 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
126 public: |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
127 PluginStorageArea(const _OrthancPluginRegisterStorageArea& callbacks, |
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
128 PluginsErrorDictionary& errorDictionary) : |
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
129 callbacks_(callbacks), |
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
130 errorDictionary_(errorDictionary) |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
131 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
132 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
133 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
134 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
135 virtual void Create(const std::string& uuid, |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
136 const void* content, |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
137 size_t size, |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
138 FileContentType type) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
139 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
140 OrthancPluginErrorCode error = callbacks_.create |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
141 (uuid.c_str(), content, size, Plugins::Convert(type)); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
142 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
143 if (error != OrthancPluginErrorCode_Success) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
144 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
145 errorDictionary_.LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
146 throw OrthancException(static_cast<ErrorCode>(error)); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
147 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
148 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
149 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
150 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
151 virtual void Read(std::string& content, |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
152 const std::string& uuid, |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
153 FileContentType type) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
154 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
155 void* buffer = NULL; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
156 int64_t size = 0; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
157 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
158 OrthancPluginErrorCode error = callbacks_.read |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
159 (&buffer, &size, uuid.c_str(), Plugins::Convert(type)); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
160 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
161 if (error != OrthancPluginErrorCode_Success) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
162 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
163 errorDictionary_.LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
164 throw OrthancException(static_cast<ErrorCode>(error)); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
165 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
166 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
167 try |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
168 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
169 content.resize(static_cast<size_t>(size)); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
170 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
171 catch (...) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
172 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
173 Free(buffer); |
1643
87c77b9b3679
provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
174 throw OrthancException(ErrorCode_NotEnoughMemory); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
175 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
176 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
177 if (size > 0) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
178 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
179 memcpy(&content[0], buffer, static_cast<size_t>(size)); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
180 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
181 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
182 Free(buffer); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
183 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
184 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
185 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
186 virtual void Remove(const std::string& uuid, |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
187 FileContentType type) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
188 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
189 OrthancPluginErrorCode error = callbacks_.remove |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
190 (uuid.c_str(), Plugins::Convert(type)); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
191 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
192 if (error != OrthancPluginErrorCode_Success) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
193 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
194 errorDictionary_.LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
195 throw OrthancException(static_cast<ErrorCode>(error)); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
196 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
197 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
198 }; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
199 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
200 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
201 class StorageAreaFactory : public boost::noncopyable |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
202 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
203 private: |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
204 SharedLibrary& sharedLibrary_; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
205 _OrthancPluginRegisterStorageArea callbacks_; |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
206 PluginsErrorDictionary& errorDictionary_; |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
207 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
208 public: |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
209 StorageAreaFactory(SharedLibrary& sharedLibrary, |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
210 const _OrthancPluginRegisterStorageArea& callbacks, |
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
211 PluginsErrorDictionary& errorDictionary) : |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
212 sharedLibrary_(sharedLibrary), |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
213 callbacks_(callbacks), |
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
214 errorDictionary_(errorDictionary) |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
215 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
216 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
217 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
218 SharedLibrary& GetSharedLibrary() |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
219 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
220 return sharedLibrary_; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
221 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
222 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
223 IStorageArea* Create() const |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
224 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
225 return new PluginStorageArea(callbacks_, errorDictionary_); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
226 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
227 }; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
228 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
229 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
230 |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
231 struct OrthancPlugins::PImpl |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
232 { |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
233 class RestCallback : public boost::noncopyable |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
234 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
235 private: |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
236 boost::regex regex_; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
237 OrthancPluginRestCallback callback_; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
238 bool lock_; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
239 |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
240 OrthancPluginErrorCode InvokeInternal(HttpOutput& output, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
241 const std::string& flatUri, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
242 const OrthancPluginHttpRequest& request) |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
243 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
244 return callback_(reinterpret_cast<OrthancPluginRestOutput*>(&output), |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
245 flatUri.c_str(), |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
246 &request); |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
247 } |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
248 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
249 public: |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
250 RestCallback(const char* regex, |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
251 OrthancPluginRestCallback callback, |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
252 bool lockRestCallbacks) : |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
253 regex_(regex), |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
254 callback_(callback), |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
255 lock_(lockRestCallbacks) |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
256 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
257 } |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
258 |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
259 const boost::regex& GetRegularExpression() const |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
260 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
261 return regex_; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
262 } |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
263 |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
264 OrthancPluginErrorCode Invoke(boost::recursive_mutex& restCallbackMutex, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
265 HttpOutput& output, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
266 const std::string& flatUri, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
267 const OrthancPluginHttpRequest& request) |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
268 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
269 if (lock_) |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
270 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
271 boost::recursive_mutex::scoped_lock lock(restCallbackMutex); |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
272 return InvokeInternal(output, flatUri, request); |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
273 } |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
274 else |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
275 { |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
276 return InvokeInternal(output, flatUri, request); |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
277 } |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
278 } |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
279 }; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
280 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
281 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
282 typedef std::pair<std::string, _OrthancPluginProperty> Property; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
283 typedef std::list<RestCallback*> RestCallbacks; |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
284 typedef std::list<OrthancPluginOnStoredInstanceCallback> OnStoredCallbacks; |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
285 typedef std::list<OrthancPluginOnChangeCallback> OnChangeCallbacks; |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
286 typedef std::map<Property, std::string> Properties; |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
287 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
288 PluginsManager manager_; |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
289 ServerContext* context_; |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
290 RestCallbacks restCallbacks_; |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
291 OnStoredCallbacks onStoredCallbacks_; |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
292 OnChangeCallbacks onChangeCallbacks_; |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
293 OrthancPluginWorklistCallback worklistCallback_; |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
294 OrthancPluginDecodeImageCallback decodeImageCallback_; |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
295 std::auto_ptr<StorageAreaFactory> storageArea_; |
1466
0cd0f2ad3599
Fix potential deadlock in the callbacks of plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1452
diff
changeset
|
296 boost::recursive_mutex restCallbackMutex_; |
0cd0f2ad3599
Fix potential deadlock in the callbacks of plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1452
diff
changeset
|
297 boost::recursive_mutex storedCallbackMutex_; |
0cd0f2ad3599
Fix potential deadlock in the callbacks of plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1452
diff
changeset
|
298 boost::recursive_mutex changeCallbackMutex_; |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
299 boost::mutex worklistCallbackMutex_; |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
300 boost::mutex decodeImageCallbackMutex_; |
1553
7c4b487b3b4a
ensure mutual exclusion in InvokeService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
301 boost::recursive_mutex invokeServiceMutex_; |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
302 Properties properties_; |
1280
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
303 int argc_; |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
304 char** argv_; |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
305 std::auto_ptr<OrthancPluginDatabase> database_; |
1644
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
306 PluginsErrorDictionary dictionary_; |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
307 |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
308 PImpl() : |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
309 context_(NULL), |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
310 worklistCallback_(NULL), |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
311 decodeImageCallback_(NULL), |
1280
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
312 argc_(1), |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
313 argv_(NULL) |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
314 { |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
315 } |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
316 }; |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
317 |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
318 |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
319 |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
320 class OrthancPlugins::WorklistHandler : public IWorklistRequestHandler |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
321 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
322 private: |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
323 OrthancPlugins& that_; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
324 std::auto_ptr<HierarchicalMatcher> matcher_; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
325 ParsedDicomFile* currentQuery_; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
326 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
327 void Reset() |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
328 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
329 matcher_.reset(NULL); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
330 currentQuery_ = NULL; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
331 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
332 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
333 public: |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
334 WorklistHandler(OrthancPlugins& that) : that_(that) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
335 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
336 Reset(); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
337 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
338 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
339 virtual void Handle(DicomFindAnswers& answers, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
340 ParsedDicomFile& query, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
341 const std::string& remoteIp, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
342 const std::string& remoteAet, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
343 const std::string& calledAet) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
344 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
345 bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
346 matcher_.reset(new HierarchicalMatcher(query, caseSensitivePN)); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
347 currentQuery_ = &query; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
348 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
349 { |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
350 boost::mutex::scoped_lock lock(that_.pimpl_->worklistCallbackMutex_); |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
351 |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
352 if (that_.pimpl_->worklistCallback_) |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
353 { |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
354 OrthancPluginErrorCode error = that_.pimpl_->worklistCallback_ |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
355 (reinterpret_cast<OrthancPluginWorklistAnswers*>(&answers), |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
356 reinterpret_cast<const OrthancPluginWorklistQuery*>(this), |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
357 remoteAet.c_str(), |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
358 calledAet.c_str()); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
359 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
360 if (error != OrthancPluginErrorCode_Success) |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
361 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
362 Reset(); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
363 that_.GetErrorDictionary().LogError(error, true); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
364 throw OrthancException(static_cast<ErrorCode>(error)); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
365 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
366 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
367 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
368 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
369 Reset(); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
370 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
371 |
1812 | 372 void GetDicomQuery(OrthancPluginMemoryBuffer& target) const |
1802
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
373 { |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
374 assert(currentQuery_ != NULL); |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
375 std::string dicom; |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
376 currentQuery_->SaveToMemoryBuffer(dicom); |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
377 CopyToMemoryBuffer(target, dicom.c_str(), dicom.size()); |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
378 } |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
379 |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
380 bool IsMatch(const void* dicom, |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
381 size_t size) const |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
382 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
383 assert(matcher_.get() != NULL); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
384 ParsedDicomFile f(dicom, size); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
385 return matcher_->Match(f); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
386 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
387 |
1802
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
388 void AddAnswer(OrthancPluginWorklistAnswers* answers, |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
389 const void* dicom, |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
390 size_t size) const |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
391 { |
1802
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
392 assert(matcher_.get() != NULL); |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
393 ParsedDicomFile f(dicom, size); |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
394 std::auto_ptr<ParsedDicomFile> summary(matcher_->Extract(f)); |
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
395 reinterpret_cast<DicomFindAnswers*>(answers)->Add(*summary); |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
396 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
397 }; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
398 |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
399 |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
400 static char* CopyString(const std::string& str) |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
401 { |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
402 char *result = reinterpret_cast<char*>(malloc(str.size() + 1)); |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
403 if (result == NULL) |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
404 { |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
405 throw OrthancException(ErrorCode_NotEnoughMemory); |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
406 } |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
407 |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
408 if (str.size() == 0) |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
409 { |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
410 result[0] = '\0'; |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
411 } |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
412 else |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
413 { |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
414 memcpy(result, &str[0], str.size() + 1); |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
415 } |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
416 |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
417 return result; |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
418 } |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
419 |
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
420 |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
421 OrthancPlugins::OrthancPlugins() |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
422 { |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
423 /* Sanity check of the compiler */ |
1579
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
424 if (sizeof(int32_t) != sizeof(OrthancPluginErrorCode) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
425 sizeof(int32_t) != sizeof(OrthancPluginHttpMethod) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
426 sizeof(int32_t) != sizeof(_OrthancPluginService) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
427 sizeof(int32_t) != sizeof(_OrthancPluginProperty) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
428 sizeof(int32_t) != sizeof(OrthancPluginPixelFormat) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
429 sizeof(int32_t) != sizeof(OrthancPluginContentType) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
430 sizeof(int32_t) != sizeof(OrthancPluginResourceType) || |
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
431 sizeof(int32_t) != sizeof(OrthancPluginChangeType) || |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
432 sizeof(int32_t) != sizeof(OrthancPluginImageFormat) || |
1579
b93c398f934d
check the size of the enumerations in the plugin engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
433 sizeof(int32_t) != sizeof(OrthancPluginCompressionType) || |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
434 sizeof(int32_t) != sizeof(OrthancPluginValueRepresentation) || |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
435 sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFlags) || |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
436 sizeof(int32_t) != sizeof(OrthancPluginDicomToJsonFormat) || |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
437 sizeof(int32_t) != sizeof(OrthancPluginCreateDicomFlags) || |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
438 sizeof(int32_t) != sizeof(_OrthancPluginDatabaseAnswerType) || |
1760
51db4a25a741
LookupIdentifier is plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1744
diff
changeset
|
439 sizeof(int32_t) != sizeof(OrthancPluginIdentifierConstraint) || |
1815
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
440 sizeof(int32_t) != sizeof(OrthancPluginInstanceOrigin) || |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
441 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludeBinary) != static_cast<int>(DicomToJsonFlags_IncludeBinary) || |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
442 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludePrivateTags) != static_cast<int>(DicomToJsonFlags_IncludePrivateTags) || |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
443 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludeUnknownTags) != static_cast<int>(DicomToJsonFlags_IncludeUnknownTags) || |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
444 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludePixelData) != static_cast<int>(DicomToJsonFlags_IncludePixelData) || |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
445 static_cast<int>(OrthancPluginDicomToJsonFlags_ConvertBinaryToNull) != static_cast<int>(DicomToJsonFlags_ConvertBinaryToNull) || |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
446 static_cast<int>(OrthancPluginDicomToJsonFlags_ConvertBinaryToAscii) != static_cast<int>(DicomToJsonFlags_ConvertBinaryToAscii) || |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
447 static_cast<int>(OrthancPluginCreateDicomFlags_DecodeDataUriScheme) != static_cast<int>(DicomFromJsonFlags_DecodeDataUriScheme) || |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
448 static_cast<int>(OrthancPluginCreateDicomFlags_GenerateIdentifiers) != static_cast<int>(DicomFromJsonFlags_GenerateIdentifiers)) |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
449 |
1578 | 450 { |
451 throw OrthancException(ErrorCode_Plugin); | |
452 } | |
453 | |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
454 pimpl_.reset(new PImpl()); |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
455 pimpl_->manager_.RegisterServiceProvider(*this); |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
456 } |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
457 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
458 |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
459 void OrthancPlugins::SetServerContext(ServerContext& context) |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
460 { |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
461 pimpl_->context_ = &context; |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
462 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
463 |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
464 |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
465 |
1133 | 466 OrthancPlugins::~OrthancPlugins() |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
467 { |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
468 for (PImpl::RestCallbacks::iterator it = pimpl_->restCallbacks_.begin(); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
469 it != pimpl_->restCallbacks_.end(); ++it) |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
470 { |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
471 delete *it; |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
472 } |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
473 } |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
474 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
475 |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
476 static void ArgumentsToPlugin(std::vector<const char*>& keys, |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
477 std::vector<const char*>& values, |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
478 const IHttpHandler::Arguments& arguments) |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
479 { |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
480 keys.resize(arguments.size()); |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
481 values.resize(arguments.size()); |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
482 |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
483 size_t pos = 0; |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
484 for (IHttpHandler::Arguments::const_iterator |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
485 it = arguments.begin(); it != arguments.end(); ++it) |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
486 { |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
487 keys[pos] = it->first.c_str(); |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
488 values[pos] = it->second.c_str(); |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
489 pos++; |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
490 } |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
491 } |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
492 |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
493 |
1363
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
494 static void ArgumentsToPlugin(std::vector<const char*>& keys, |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
495 std::vector<const char*>& values, |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
496 const IHttpHandler::GetArguments& arguments) |
1363
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
497 { |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
498 keys.resize(arguments.size()); |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
499 values.resize(arguments.size()); |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
500 |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
501 for (size_t i = 0; i < arguments.size(); i++) |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
502 { |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
503 keys[i] = arguments[i].first.c_str(); |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
504 values[i] = arguments[i].second.c_str(); |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
505 } |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
506 } |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
507 |
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
508 |
1133 | 509 bool OrthancPlugins::Handle(HttpOutput& output, |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
510 RequestOrigin /*origin*/, |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
511 const char* /*remoteIp*/, |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
512 const char* /*username*/, |
1329 | 513 HttpMethod method, |
514 const UriComponents& uri, | |
515 const Arguments& headers, | |
1363
feaf2840917c
Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1330
diff
changeset
|
516 const GetArguments& getArguments, |
1446
8dc80ba768aa
refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1445
diff
changeset
|
517 const char* bodyData, |
8dc80ba768aa
refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1445
diff
changeset
|
518 size_t bodySize) |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
519 { |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
520 std::string flatUri = Toolbox::FlattenUri(uri); |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
521 PImpl::RestCallback* callback = NULL; |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
522 |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
523 std::vector<std::string> groups; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
524 std::vector<const char*> cgroups; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
525 |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
526 // Loop over the callbacks registered by the plugins |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
527 bool found = false; |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
528 for (PImpl::RestCallbacks::const_iterator it = pimpl_->restCallbacks_.begin(); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
529 it != pimpl_->restCallbacks_.end() && !found; ++it) |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
530 { |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
531 // Check whether the regular expression associated to this |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
532 // callback matches the URI |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
533 boost::cmatch what; |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
534 if (boost::regex_match(flatUri.c_str(), what, (*it)->GetRegularExpression())) |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
535 { |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
536 callback = *it; |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
537 |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
538 // Extract the value of the free parameters of the regular expression |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
539 if (what.size() > 1) |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
540 { |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
541 groups.resize(what.size() - 1); |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
542 cgroups.resize(what.size() - 1); |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
543 for (size_t i = 1; i < what.size(); i++) |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
544 { |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
545 groups[i - 1] = what[i]; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
546 cgroups[i - 1] = groups[i - 1].c_str(); |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
547 } |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
548 } |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
549 } |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
550 } |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
551 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
552 if (callback == NULL) |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
553 { |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
554 // Callback not found |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
555 return false; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
556 } |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
557 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
558 LOG(INFO) << "Delegating HTTP request to plugin for URI: " << flatUri; |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
560 std::vector<const char*> getKeys, getValues, headersKeys, headersValues; |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
561 |
899 | 562 OrthancPluginHttpRequest request; |
563 memset(&request, 0, sizeof(OrthancPluginHttpRequest)); | |
564 | |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
565 ArgumentsToPlugin(headersKeys, headersValues, headers); |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
566 |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
567 switch (method) |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
568 { |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
569 case HttpMethod_Get: |
899 | 570 request.method = OrthancPluginHttpMethod_Get; |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
571 ArgumentsToPlugin(getKeys, getValues, getArguments); |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
572 break; |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
573 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
574 case HttpMethod_Post: |
899 | 575 request.method = OrthancPluginHttpMethod_Post; |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
576 break; |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
577 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
578 case HttpMethod_Delete: |
899 | 579 request.method = OrthancPluginHttpMethod_Delete; |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
580 break; |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
581 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
582 case HttpMethod_Put: |
899 | 583 request.method = OrthancPluginHttpMethod_Put; |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
584 break; |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
585 |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
586 default: |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
587 throw OrthancException(ErrorCode_InternalError); |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
588 } |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
589 |
899 | 590 |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
591 request.groups = (cgroups.size() ? &cgroups[0] : NULL); |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
592 request.groupsCount = cgroups.size(); |
899 | 593 request.getCount = getArguments.size(); |
1446
8dc80ba768aa
refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1445
diff
changeset
|
594 request.body = bodyData; |
8dc80ba768aa
refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1445
diff
changeset
|
595 request.bodySize = bodySize; |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
596 request.headersCount = headers.size(); |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
597 |
899 | 598 if (getArguments.size() > 0) |
599 { | |
600 request.getKeys = &getKeys[0]; | |
601 request.getValues = &getValues[0]; | |
602 } | |
1041
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
603 |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
604 if (headers.size() > 0) |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
605 { |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
606 request.headersKeys = &headersKeys[0]; |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
607 request.headersValues = &headersValues[0]; |
2c49b7dffcec
plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1037
diff
changeset
|
608 } |
899 | 609 |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
610 assert(callback != NULL); |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
611 OrthancPluginErrorCode error = callback->Invoke(pimpl_->restCallbackMutex_, output, flatUri, request); |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
612 |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
613 if (error == OrthancPluginErrorCode_Success && |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
614 output.IsWritingMultipart()) |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
615 { |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
616 output.CloseMultipart(); |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
617 } |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
618 |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
619 if (error == OrthancPluginErrorCode_Success) |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
620 { |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
621 return true; |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
622 } |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
623 else |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
624 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
625 GetErrorDictionary().LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
626 throw OrthancException(static_cast<ErrorCode>(error)); |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
627 } |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
628 } |
899 | 629 |
630 | |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1430
diff
changeset
|
631 void OrthancPlugins::SignalStoredInstance(const std::string& instanceId, |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1430
diff
changeset
|
632 DicomInstanceToStore& instance, |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1430
diff
changeset
|
633 const Json::Value& simplifiedTags) |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
634 { |
1466
0cd0f2ad3599
Fix potential deadlock in the callbacks of plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1452
diff
changeset
|
635 boost::recursive_mutex::scoped_lock lock(pimpl_->storedCallbackMutex_); |
1185
cbd1f05b4ef2
plugin callbacks are executed in mutual exclusion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1178
diff
changeset
|
636 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
637 for (PImpl::OnStoredCallbacks::const_iterator |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
638 callback = pimpl_->onStoredCallbacks_.begin(); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
639 callback != pimpl_->onStoredCallbacks_.end(); ++callback) |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
640 { |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
641 OrthancPluginErrorCode error = (*callback) |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
642 (reinterpret_cast<OrthancPluginDicomInstance*>(&instance), |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
643 instanceId.c_str()); |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
644 |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
645 if (error != OrthancPluginErrorCode_Success) |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
646 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
647 GetErrorDictionary().LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
648 throw OrthancException(static_cast<ErrorCode>(error)); |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
649 } |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
650 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
651 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
652 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
653 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
654 |
1741
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
655 void OrthancPlugins::SignalChangeInternal(OrthancPluginChangeType changeType, |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
656 OrthancPluginResourceType resourceType, |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
657 const char* resource) |
1177
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
658 { |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
659 boost::recursive_mutex::scoped_lock lock(pimpl_->changeCallbackMutex_); |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
660 |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
661 for (std::list<OrthancPluginOnChangeCallback>::const_iterator |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
662 callback = pimpl_->onChangeCallbacks_.begin(); |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
663 callback != pimpl_->onChangeCallbacks_.end(); ++callback) |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
664 { |
1741
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
665 OrthancPluginErrorCode error = (*callback) (changeType, resourceType, resource); |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
666 |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1625
diff
changeset
|
667 if (error != OrthancPluginErrorCode_Success) |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
668 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
669 GetErrorDictionary().LogError(error, true); |
1646
da799f767e5d
simplification in error casting with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
670 throw OrthancException(static_cast<ErrorCode>(error)); |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
671 } |
1178 | 672 } |
1177
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
673 } |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
674 |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
675 |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
676 |
1741
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
677 void OrthancPlugins::SignalChange(const ServerIndexChange& change) |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
678 { |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
679 SignalChangeInternal(Plugins::Convert(change.GetChangeType()), |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
680 Plugins::Convert(change.GetResourceType()), |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
681 change.GetPublicId().c_str()); |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
682 } |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
683 |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
684 |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1740
diff
changeset
|
685 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
686 void OrthancPlugins::RegisterRestCallback(const void* parameters, |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
687 bool lock) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
688 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
689 const _OrthancPluginRestCallback& p = |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
690 *reinterpret_cast<const _OrthancPluginRestCallback*>(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
691 |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
692 LOG(INFO) << "Plugin has registered a REST callback " |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
693 << (lock ? "with" : "witout") |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
694 << " mutual exclusion on: " |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
695 << p.pathRegularExpression; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
696 |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
697 pimpl_->restCallbacks_.push_back(new PImpl::RestCallback(p.pathRegularExpression, p.callback, lock)); |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
698 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
699 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
700 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
701 |
1133 | 702 void OrthancPlugins::RegisterOnStoredInstanceCallback(const void* parameters) |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
703 { |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
704 const _OrthancPluginOnStoredInstanceCallback& p = |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
705 *reinterpret_cast<const _OrthancPluginOnStoredInstanceCallback*>(parameters); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
706 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
707 LOG(INFO) << "Plugin has registered an OnStoredInstance callback"; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
708 pimpl_->onStoredCallbacks_.push_back(p.callback); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
709 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
710 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
711 |
1177
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
712 void OrthancPlugins::RegisterOnChangeCallback(const void* parameters) |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
713 { |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
714 const _OrthancPluginOnChangeCallback& p = |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
715 *reinterpret_cast<const _OrthancPluginOnChangeCallback*>(parameters); |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
716 |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
717 LOG(INFO) << "Plugin has registered an OnChange callback"; |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
718 pimpl_->onChangeCallbacks_.push_back(p.callback); |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
719 } |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
720 |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
721 |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
722 void OrthancPlugins::RegisterWorklistCallback(const void* parameters) |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
723 { |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
724 const _OrthancPluginWorklistCallback& p = |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
725 *reinterpret_cast<const _OrthancPluginWorklistCallback*>(parameters); |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
726 |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
727 boost::mutex::scoped_lock lock(pimpl_->worklistCallbackMutex_); |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
728 |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
729 if (pimpl_->worklistCallback_ != NULL) |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
730 { |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
731 LOG(ERROR) << "Can only register one plugin to handle modality worklists"; |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
732 throw OrthancException(ErrorCode_Plugin); |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
733 } |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
734 else |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
735 { |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
736 LOG(INFO) << "Plugin has registered a callback to handle modality worklists"; |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
737 pimpl_->worklistCallback_ = p.callback; |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
738 } |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
739 } |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
740 |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
741 |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
742 void OrthancPlugins::RegisterDecodeImageCallback(const void* parameters) |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
743 { |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
744 const _OrthancPluginDecodeImageCallback& p = |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
745 *reinterpret_cast<const _OrthancPluginDecodeImageCallback*>(parameters); |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
746 |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
747 boost::mutex::scoped_lock lock(pimpl_->decodeImageCallbackMutex_); |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
748 |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
749 if (pimpl_->decodeImageCallback_ != NULL) |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
750 { |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
751 LOG(ERROR) << "Can only register one plugin to handle the decompression of DICOM images"; |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
752 throw OrthancException(ErrorCode_Plugin); |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
753 } |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
754 else |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
755 { |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
756 LOG(INFO) << "Plugin has registered a callback to decode DICOM images"; |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
757 pimpl_->decodeImageCallback_ = p.callback; |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
758 } |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
759 } |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
760 |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
761 |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
762 |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
763 |
1133 | 764 void OrthancPlugins::AnswerBuffer(const void* parameters) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
765 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
766 const _OrthancPluginAnswerBuffer& p = |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
767 *reinterpret_cast<const _OrthancPluginAnswerBuffer*>(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
768 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
769 HttpOutput* translatedOutput = reinterpret_cast<HttpOutput*>(p.output); |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1069
diff
changeset
|
770 translatedOutput->SetContentType(p.mimeType); |
1521 | 771 translatedOutput->Answer(p.answer, p.answerSize); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
772 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
773 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
774 |
1133 | 775 void OrthancPlugins::Redirect(const void* parameters) |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
776 { |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
777 const _OrthancPluginOutputPlusArgument& p = |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
778 *reinterpret_cast<const _OrthancPluginOutputPlusArgument*>(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
779 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
780 HttpOutput* translatedOutput = reinterpret_cast<HttpOutput*>(p.output); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
781 translatedOutput->Redirect(p.argument); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
782 } |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
783 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
784 |
1133 | 785 void OrthancPlugins::SendHttpStatusCode(const void* parameters) |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
786 { |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
787 const _OrthancPluginSendHttpStatusCode& p = |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
788 *reinterpret_cast<const _OrthancPluginSendHttpStatusCode*>(parameters); |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
789 |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
790 HttpOutput* translatedOutput = reinterpret_cast<HttpOutput*>(p.output); |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1069
diff
changeset
|
791 translatedOutput->SendStatus(static_cast<HttpStatus>(p.status)); |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
792 } |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
793 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
794 |
1594
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
795 void OrthancPlugins::SendHttpStatus(const void* parameters) |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
796 { |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
797 const _OrthancPluginSendHttpStatus& p = |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
798 *reinterpret_cast<const _OrthancPluginSendHttpStatus*>(parameters); |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
799 |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
800 HttpOutput* translatedOutput = reinterpret_cast<HttpOutput*>(p.output); |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
801 HttpStatus status = static_cast<HttpStatus>(p.status); |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
802 |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
803 if (p.bodySize > 0 && p.body != NULL) |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
804 { |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
805 translatedOutput->SendStatus(status, p.body, p.bodySize); |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
806 } |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
807 else |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
808 { |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
809 translatedOutput->SendStatus(status); |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
810 } |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
811 } |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
812 |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
813 |
1133 | 814 void OrthancPlugins::SendUnauthorized(const void* parameters) |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
815 { |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
816 const _OrthancPluginOutputPlusArgument& p = |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
817 *reinterpret_cast<const _OrthancPluginOutputPlusArgument*>(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
818 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
819 HttpOutput* translatedOutput = reinterpret_cast<HttpOutput*>(p.output); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
820 translatedOutput->SendUnauthorized(p.argument); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
821 } |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
822 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
823 |
1133 | 824 void OrthancPlugins::SendMethodNotAllowed(const void* parameters) |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
825 { |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
826 const _OrthancPluginOutputPlusArgument& p = |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
827 *reinterpret_cast<const _OrthancPluginOutputPlusArgument*>(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
828 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
829 HttpOutput* translatedOutput = reinterpret_cast<HttpOutput*>(p.output); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
830 translatedOutput->SendMethodNotAllowed(p.argument); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
831 } |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
832 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
833 |
1133 | 834 void OrthancPlugins::SetCookie(const void* parameters) |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
835 { |
1137
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
836 const _OrthancPluginSetHttpHeader& p = |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
837 *reinterpret_cast<const _OrthancPluginSetHttpHeader*>(parameters); |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
838 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
839 HttpOutput* translatedOutput = reinterpret_cast<HttpOutput*>(p.output); |
1137
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
840 translatedOutput->SetCookie(p.key, p.value); |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
841 } |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
842 |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
843 |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
844 void OrthancPlugins::SetHttpHeader(const void* parameters) |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
845 { |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
846 const _OrthancPluginSetHttpHeader& p = |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
847 *reinterpret_cast<const _OrthancPluginSetHttpHeader*>(parameters); |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
848 |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
849 HttpOutput* translatedOutput = reinterpret_cast<HttpOutput*>(p.output); |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
850 translatedOutput->AddHeader(p.key, p.value); |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
851 } |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
852 |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
853 |
1133 | 854 void OrthancPlugins::CompressAndAnswerPngImage(const void* parameters) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
855 { |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
856 // Bridge for backward compatibility with Orthanc <= 0.9.3 |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
857 const _OrthancPluginCompressAndAnswerPngImage& p = |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
858 *reinterpret_cast<const _OrthancPluginCompressAndAnswerPngImage*>(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
859 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
860 _OrthancPluginCompressAndAnswerImage p2; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
861 p2.output = p.output; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
862 p2.imageFormat = OrthancPluginImageFormat_Png; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
863 p2.pixelFormat = p.format; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
864 p2.width = p.width; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
865 p2.height = p.height; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
866 p2.pitch = p.height; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
867 p2.buffer = p.buffer; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
868 p2.quality = 0; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
869 |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
870 CompressAndAnswerImage(&p2); |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
871 } |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
872 |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
873 |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
874 void OrthancPlugins::CompressAndAnswerImage(const void* parameters) |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
875 { |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
876 const _OrthancPluginCompressAndAnswerImage& p = |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
877 *reinterpret_cast<const _OrthancPluginCompressAndAnswerImage*>(parameters); |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
878 |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
879 HttpOutput* translatedOutput = reinterpret_cast<HttpOutput*>(p.output); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
880 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
881 ImageAccessor accessor; |
1625 | 882 accessor.AssignReadOnly(Plugins::Convert(p.pixelFormat), p.width, p.height, p.pitch, p.buffer); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
883 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
884 std::string compressed; |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
885 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
886 switch (p.imageFormat) |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
887 { |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
888 case OrthancPluginImageFormat_Png: |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
889 { |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
890 PngWriter writer; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
891 writer.WriteToMemory(compressed, accessor); |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
892 translatedOutput->SetContentType("image/png"); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
893 break; |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
894 } |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
895 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
896 case OrthancPluginImageFormat_Jpeg: |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
897 { |
1603
905b4db3092b
CompressAndAnswerJpegImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
898 JpegWriter writer; |
905b4db3092b
CompressAndAnswerJpegImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
899 writer.SetQuality(p.quality); |
905b4db3092b
CompressAndAnswerJpegImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
900 writer.WriteToMemory(compressed, accessor); |
905b4db3092b
CompressAndAnswerJpegImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
901 translatedOutput->SetContentType("image/jpeg"); |
905b4db3092b
CompressAndAnswerJpegImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
902 break; |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
903 } |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
904 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
905 default: |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
906 throw OrthancException(ErrorCode_ParameterOutOfRange); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
907 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
908 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
909 translatedOutput->Answer(compressed); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
910 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
911 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
912 |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
913 void OrthancPlugins::CheckContextAvailable() |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
914 { |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
915 if (!pimpl_->context_) |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
916 { |
1643
87c77b9b3679
provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
917 throw OrthancException(ErrorCode_DatabaseNotInitialized); |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
918 } |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
919 } |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
920 |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
921 |
1133 | 922 void OrthancPlugins::GetDicomForInstance(const void* parameters) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
923 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
924 const _OrthancPluginGetDicomForInstance& p = |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
925 *reinterpret_cast<const _OrthancPluginGetDicomForInstance*>(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
926 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
927 std::string dicom; |
1452
b737acb13da5
refactoring of the main function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
928 |
b737acb13da5
refactoring of the main function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
929 CheckContextAvailable(); |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
930 pimpl_->context_->ReadFile(dicom, p.instanceId, FileContentType_Dicom); |
1452
b737acb13da5
refactoring of the main function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
931 |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
932 CopyToMemoryBuffer(*p.target, dicom); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
933 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
934 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
935 |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
936 void OrthancPlugins::RestApiGet(const void* parameters, |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
937 bool afterPlugins) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
938 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
939 const _OrthancPluginRestApiGet& p = |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
940 *reinterpret_cast<const _OrthancPluginRestApiGet*>(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
941 |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
942 LOG(INFO) << "Plugin making REST GET call on URI " << p.uri |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
943 << (afterPlugins ? " (after plugins)" : " (built-in API)"); |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
944 |
1445
d26c8a93d05a
refactoring: SimpleGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
945 CheckContextAvailable(); |
d26c8a93d05a
refactoring: SimpleGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
946 IHttpHandler& handler = pimpl_->context_->GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
947 |
1445
d26c8a93d05a
refactoring: SimpleGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
948 std::string result; |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
949 if (HttpToolbox::SimpleGet(result, handler, RequestOrigin_Plugins, p.uri)) |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
950 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
951 CopyToMemoryBuffer(*p.target, result); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
952 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
953 else |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
954 { |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
955 throw OrthancException(ErrorCode_BadRequest); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
956 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
957 } |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
958 |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
959 |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
960 void OrthancPlugins::RestApiGet2(const void* parameters) |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
961 { |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
962 const _OrthancPluginRestApiGet2& p = |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
963 *reinterpret_cast<const _OrthancPluginRestApiGet2*>(parameters); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
964 |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
965 LOG(INFO) << "Plugin making REST GET call on URI " << p.uri |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
966 << (p.afterPlugins ? " (after plugins)" : " (built-in API)"); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
967 |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
968 IHttpHandler::Arguments headers; |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
969 |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
970 for (uint32_t i = 0; i < p.headersCount; i++) |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
971 { |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
972 headers[p.headersKeys[i]] = p.headersValues[i]; |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
973 } |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
974 |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
975 CheckContextAvailable(); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
976 IHttpHandler& handler = pimpl_->context_->GetHttpHandler().RestrictToOrthancRestApi(!p.afterPlugins); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
977 |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
978 std::string result; |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
979 if (HttpToolbox::SimpleGet(result, handler, RequestOrigin_Plugins, p.uri, headers)) |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
980 { |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
981 CopyToMemoryBuffer(*p.target, result); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
982 } |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
983 else |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
984 { |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
985 throw OrthancException(ErrorCode_BadRequest); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
986 } |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
987 } |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
988 |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
989 |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
990 void OrthancPlugins::RestApiPostPut(bool isPost, |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
991 const void* parameters, |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
992 bool afterPlugins) |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
993 { |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
994 const _OrthancPluginRestApiPostPut& p = |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
995 *reinterpret_cast<const _OrthancPluginRestApiPostPut*>(parameters); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
996 |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
997 LOG(INFO) << "Plugin making REST " << EnumerationToString(isPost ? HttpMethod_Post : HttpMethod_Put) |
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
998 << " call on URI " << p.uri << (afterPlugins ? " (after plugins)" : " (built-in API)"); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
999 |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
1000 CheckContextAvailable(); |
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
1001 IHttpHandler& handler = pimpl_->context_->GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1002 |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1003 std::string result; |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
1004 if (isPost ? |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
1005 HttpToolbox::SimplePost(result, handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize) : |
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
1006 HttpToolbox::SimplePut (result, handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize)) |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1007 { |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1008 CopyToMemoryBuffer(*p.target, result); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1009 } |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1010 else |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1011 { |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1012 throw OrthancException(ErrorCode_BadRequest); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1013 } |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1014 } |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1015 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1016 |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1017 void OrthancPlugins::RestApiDelete(const void* parameters, |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1018 bool afterPlugins) |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1019 { |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
1020 const char* uri = reinterpret_cast<const char*>(parameters); |
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
1021 LOG(INFO) << "Plugin making REST DELETE call on URI " << uri |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1022 << (afterPlugins ? " (after plugins)" : " (built-in API)"); |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1023 |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
1024 CheckContextAvailable(); |
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1446
diff
changeset
|
1025 IHttpHandler& handler = pimpl_->context_->GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1026 |
1571
3232f1c995a5
provide the origin of the requests to HTTP handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
1027 if (!HttpToolbox::SimpleDelete(handler, RequestOrigin_Plugins, uri)) |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1028 { |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1029 throw OrthancException(ErrorCode_BadRequest); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1030 } |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1031 } |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1032 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1033 |
1133 | 1034 void OrthancPlugins::LookupResource(_OrthancPluginService service, |
1199
a843ee8bb903
separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1198
diff
changeset
|
1035 const void* parameters) |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1036 { |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1037 const _OrthancPluginRetrieveDynamicString& p = |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1038 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters); |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1039 |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1040 /** |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1041 * The enumeration below only uses the tags that are indexed in |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1042 * the Orthanc database. It reflects the |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1043 * "CandidateResources::ApplyFilter()" method of the |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1044 * "OrthancFindRequestHandler" class. |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1045 **/ |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1046 |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1047 DicomTag tag(0, 0); |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1048 ResourceType level; |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1049 switch (service) |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1050 { |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1051 case _OrthancPluginService_LookupPatient: |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1052 tag = DICOM_TAG_PATIENT_ID; |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1053 level = ResourceType_Patient; |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1054 break; |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1055 |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1056 case _OrthancPluginService_LookupStudy: |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1057 tag = DICOM_TAG_STUDY_INSTANCE_UID; |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1058 level = ResourceType_Study; |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1059 break; |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1060 |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1061 case _OrthancPluginService_LookupStudyWithAccessionNumber: |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1062 tag = DICOM_TAG_ACCESSION_NUMBER; |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1063 level = ResourceType_Study; |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1064 break; |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1065 |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1066 case _OrthancPluginService_LookupSeries: |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1067 tag = DICOM_TAG_SERIES_INSTANCE_UID; |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1068 level = ResourceType_Series; |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1069 break; |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1070 |
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1071 case _OrthancPluginService_LookupInstance: |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1072 tag = DICOM_TAG_SOP_INSTANCE_UID; |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1073 level = ResourceType_Instance; |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1074 break; |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1075 |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1076 default: |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1077 throw OrthancException(ErrorCode_InternalError); |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1078 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1079 |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
1080 CheckContextAvailable(); |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1081 |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1082 std::list<std::string> result; |
1728
4941494b5dd8
rename LookupIdentifier as LookupIdentifierExact
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1727
diff
changeset
|
1083 pimpl_->context_->GetIndex().LookupIdentifierExact(result, level, tag, p.argument); |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1084 |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1085 if (result.size() == 1) |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1086 { |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1087 *p.result = CopyString(result.front()); |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1088 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1089 else |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1090 { |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1091 throw OrthancException(ErrorCode_UnknownResource); |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1092 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1093 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1094 |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1095 |
1067
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1096 static void AccessInstanceMetadataInternal(bool checkExistence, |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1097 const _OrthancPluginAccessDicomInstance& params, |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1098 const DicomInstanceToStore& instance) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1099 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1100 MetadataType metadata; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1101 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1102 try |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1103 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1104 metadata = StringToMetadata(params.key); |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1105 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1106 catch (OrthancException&) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1107 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1108 // Unknown metadata |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1109 if (checkExistence) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1110 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1111 *params.resultInt64 = -1; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1112 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1113 else |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1114 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1115 *params.resultString = NULL; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1116 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1117 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1118 return; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1119 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1120 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1121 ServerIndex::MetadataMap::const_iterator it = |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1122 instance.GetMetadata().find(std::make_pair(ResourceType_Instance, metadata)); |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1123 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1124 if (checkExistence) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1125 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1126 if (it != instance.GetMetadata().end()) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1127 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1128 *params.resultInt64 = 1; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1129 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1130 else |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1131 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1132 *params.resultInt64 = 0; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1133 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1134 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1135 else |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1136 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1137 if (it != instance.GetMetadata().end()) |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1138 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1139 *params.resultString = it->second.c_str(); |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1140 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1141 else |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1142 { |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1143 // Error: Missing metadata |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1144 *params.resultString = NULL; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1145 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1146 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1147 } |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1148 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1149 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1150 static void AccessDicomInstance(_OrthancPluginService service, |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1151 const void* parameters) |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1152 { |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1153 const _OrthancPluginAccessDicomInstance& p = |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1154 *reinterpret_cast<const _OrthancPluginAccessDicomInstance*>(parameters); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1155 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1156 DicomInstanceToStore& instance = |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1157 *reinterpret_cast<DicomInstanceToStore*>(p.instance); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1158 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1159 switch (service) |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1160 { |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1161 case _OrthancPluginService_GetInstanceRemoteAet: |
1572
904096e7367e
More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
1162 *p.resultString = instance.GetRemoteAet(); |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1163 return; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1164 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1165 case _OrthancPluginService_GetInstanceSize: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1166 *p.resultInt64 = instance.GetBufferSize(); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1167 return; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1168 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1169 case _OrthancPluginService_GetInstanceData: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1170 *p.resultString = instance.GetBufferData(); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1171 return; |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1172 |
1067
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1173 case _OrthancPluginService_HasInstanceMetadata: |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1174 AccessInstanceMetadataInternal(true, p, instance); |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1175 return; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1176 |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1177 case _OrthancPluginService_GetInstanceMetadata: |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1178 AccessInstanceMetadataInternal(false, p, instance); |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1179 return; |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1180 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1181 case _OrthancPluginService_GetInstanceJson: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1182 case _OrthancPluginService_GetInstanceSimplifiedJson: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1183 { |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1184 Json::StyledWriter writer; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1185 std::string s; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1186 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1187 if (service == _OrthancPluginService_GetInstanceJson) |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1188 { |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1189 s = writer.write(instance.GetJson()); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1190 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1191 else |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1192 { |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1193 Json::Value simplified; |
1860
c7d70f659190
DicomToJsonFormat_Simple -> DicomToJsonFormat_Human
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1859
diff
changeset
|
1194 Toolbox::SimplifyTags(simplified, instance.GetJson(), DicomToJsonFormat_Human); |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1195 s = writer.write(simplified); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1196 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1197 |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1198 *p.resultStringToFree = CopyString(s); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1199 return; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1200 } |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1201 |
1815
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
1202 case _OrthancPluginService_GetInstanceOrigin: // New in Orthanc 0.9.5 |
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
1203 *p.resultOrigin = Plugins::Convert(instance.GetRequestOrigin()); |
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
1204 return; |
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
1205 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1206 default: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1207 throw OrthancException(ErrorCode_InternalError); |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1208 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1209 } |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1210 |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1211 |
1554
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1212 void OrthancPlugins::BufferCompression(const void* parameters) |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1213 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1214 const _OrthancPluginBufferCompression& p = |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1215 *reinterpret_cast<const _OrthancPluginBufferCompression*>(parameters); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1216 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1217 std::string result; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1218 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1219 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1220 std::auto_ptr<DeflateBaseCompressor> compressor; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1221 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1222 switch (p.compression) |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1223 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1224 case OrthancPluginCompressionType_Zlib: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1225 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1226 compressor.reset(new ZlibCompressor); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1227 compressor->SetPrefixWithUncompressedSize(false); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1228 break; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1229 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1230 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1231 case OrthancPluginCompressionType_ZlibWithSize: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1232 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1233 compressor.reset(new ZlibCompressor); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1234 compressor->SetPrefixWithUncompressedSize(true); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1235 break; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1236 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1237 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1238 case OrthancPluginCompressionType_Gzip: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1239 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1240 compressor.reset(new GzipCompressor); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1241 compressor->SetPrefixWithUncompressedSize(false); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1242 break; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1243 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1244 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1245 case OrthancPluginCompressionType_GzipWithSize: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1246 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1247 compressor.reset(new GzipCompressor); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1248 compressor->SetPrefixWithUncompressedSize(true); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1249 break; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1250 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1251 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1252 default: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1253 throw OrthancException(ErrorCode_ParameterOutOfRange); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1254 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1255 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1256 if (p.uncompress) |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1257 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1258 compressor->Uncompress(result, p.source, p.size); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1259 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1260 else |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1261 { |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1262 compressor->Compress(result, p.source, p.size); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1263 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1264 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1265 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1266 CopyToMemoryBuffer(*p.target, result); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1267 } |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1268 |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1269 |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1270 static OrthancPluginImage* ReturnImage(std::auto_ptr<ImageAccessor>& image) |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1271 { |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1272 // Images returned to plugins are assumed to be writeable. If the |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1273 // input image is read-only, we return a copy so that it can be modified. |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1274 |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1275 if (image->IsReadOnly()) |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1276 { |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1277 std::auto_ptr<Image> copy(new Image(image->GetFormat(), image->GetWidth(), image->GetHeight())); |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1278 ImageProcessing::Copy(*copy, *image); |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1279 image.reset(NULL); |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1280 return reinterpret_cast<OrthancPluginImage*>(copy.release()); |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1281 } |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1282 else |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1283 { |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1284 return reinterpret_cast<OrthancPluginImage*>(image.release()); |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1285 } |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1286 } |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1287 |
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1288 |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1289 void OrthancPlugins::UncompressImage(const void* parameters) |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1290 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
1291 const _OrthancPluginUncompressImage& p = *reinterpret_cast<const _OrthancPluginUncompressImage*>(parameters); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1292 |
1604 | 1293 std::auto_ptr<ImageAccessor> image; |
1294 | |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1295 switch (p.format) |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1296 { |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1297 case OrthancPluginImageFormat_Png: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1298 { |
1604 | 1299 image.reset(new PngReader); |
1300 reinterpret_cast<PngReader&>(*image).ReadFromMemory(p.data, p.size); | |
1301 break; | |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1302 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1303 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1304 case OrthancPluginImageFormat_Jpeg: |
1604 | 1305 { |
1306 image.reset(new JpegReader); | |
1307 reinterpret_cast<JpegReader&>(*image).ReadFromMemory(p.data, p.size); | |
1308 break; | |
1309 } | |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1310 |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1311 case OrthancPluginImageFormat_Dicom: |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1312 { |
1902
8b0ee8d5e6d0
Refactoring leading to speedups with custom image decoders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1313 image.reset(Decode(p.data, p.size, 0)); |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1314 break; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1315 } |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1316 |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1317 default: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1318 throw OrthancException(ErrorCode_ParameterOutOfRange); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1319 } |
1604 | 1320 |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1321 *(p.target) = ReturnImage(image); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1322 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1323 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1324 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1325 void OrthancPlugins::CompressImage(const void* parameters) |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1326 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
1327 const _OrthancPluginCompressImage& p = *reinterpret_cast<const _OrthancPluginCompressImage*>(parameters); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1328 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1329 std::string compressed; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1330 |
1916 | 1331 ImageAccessor accessor; |
1332 accessor.AssignReadOnly(Plugins::Convert(p.pixelFormat), p.width, p.height, p.pitch, p.buffer); | |
1333 | |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1334 switch (p.imageFormat) |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1335 { |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1336 case OrthancPluginImageFormat_Png: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1337 { |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1338 PngWriter writer; |
1916 | 1339 writer.WriteToMemory(compressed, accessor); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1340 break; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1341 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1342 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1343 case OrthancPluginImageFormat_Jpeg: |
1604 | 1344 { |
1345 JpegWriter writer; | |
1346 writer.SetQuality(p.quality); | |
1916 | 1347 writer.WriteToMemory(compressed, accessor); |
1604 | 1348 break; |
1349 } | |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1350 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1351 default: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1352 throw OrthancException(ErrorCode_ParameterOutOfRange); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1353 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1354 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1355 CopyToMemoryBuffer(*p.target, compressed.size() > 0 ? compressed.c_str() : NULL, compressed.size()); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1356 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1357 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
1358 |
1606
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1359 void OrthancPlugins::CallHttpClient(const void* parameters) |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1360 { |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1361 const _OrthancPluginCallHttpClient& p = *reinterpret_cast<const _OrthancPluginCallHttpClient*>(parameters); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1362 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1363 HttpClient client; |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1364 client.SetUrl(p.url); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1365 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1366 if (p.username != NULL && |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1367 p.password != NULL) |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1368 { |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1369 client.SetCredentials(p.username, p.password); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1370 } |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1371 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1372 switch (p.method) |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1373 { |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1374 case OrthancPluginHttpMethod_Get: |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1375 client.SetMethod(HttpMethod_Get); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1376 break; |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1377 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1378 case OrthancPluginHttpMethod_Post: |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1379 client.SetMethod(HttpMethod_Post); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1380 client.GetBody().assign(p.body, p.bodySize); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1381 break; |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1382 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1383 case OrthancPluginHttpMethod_Put: |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1384 client.SetMethod(HttpMethod_Put); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1385 client.GetBody().assign(p.body, p.bodySize); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1386 break; |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1387 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1388 case OrthancPluginHttpMethod_Delete: |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1389 client.SetMethod(HttpMethod_Delete); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1390 break; |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1391 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1392 default: |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1393 throw OrthancException(ErrorCode_ParameterOutOfRange); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1394 } |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1395 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1396 std::string s; |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1397 client.ApplyAndThrowException(s); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1398 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1399 if (p.method != OrthancPluginHttpMethod_Delete) |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1400 { |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1401 CopyToMemoryBuffer(*p.target, s); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1402 } |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1403 } |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1404 |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
1405 |
1608
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
1406 void OrthancPlugins::ConvertPixelFormat(const void* parameters) |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
1407 { |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
1408 const _OrthancPluginConvertPixelFormat& p = *reinterpret_cast<const _OrthancPluginConvertPixelFormat*>(parameters); |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
1409 const ImageAccessor& source = *reinterpret_cast<const ImageAccessor*>(p.source); |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
1410 |
1625 | 1411 std::auto_ptr<ImageAccessor> target(new Image(Plugins::Convert(p.targetFormat), source.GetWidth(), source.GetHeight())); |
1608
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
1412 ImageProcessing::Convert(*target, source); |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
1413 |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1414 *(p.target) = ReturnImage(target); |
1608
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
1415 } |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
1416 |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
1417 |
1613
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1418 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1419 void OrthancPlugins::GetFontInfo(const void* parameters) |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1420 { |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1421 const _OrthancPluginGetFontInfo& p = *reinterpret_cast<const _OrthancPluginGetFontInfo*>(parameters); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1422 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1423 const Font& font = Configuration::GetFontRegistry().GetFont(p.fontIndex); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1424 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1425 if (p.name != NULL) |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1426 { |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1427 *(p.name) = font.GetName().c_str(); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1428 } |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1429 else if (p.size != NULL) |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1430 { |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1431 *(p.size) = font.GetSize(); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1432 } |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1433 else |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1434 { |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1435 throw OrthancException(ErrorCode_InternalError); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1436 } |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1437 } |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1438 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1439 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1440 void OrthancPlugins::DrawText(const void* parameters) |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1441 { |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1442 const _OrthancPluginDrawText& p = *reinterpret_cast<const _OrthancPluginDrawText*>(parameters); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1443 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1444 ImageAccessor& target = *reinterpret_cast<ImageAccessor*>(p.image); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1445 const Font& font = Configuration::GetFontRegistry().GetFont(p.fontIndex); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1446 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1447 font.Draw(target, p.utf8Text, p.x, p.y, p.r, p.g, p.b); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1448 } |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1449 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1450 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1451 void OrthancPlugins::ApplyDicomToJson(_OrthancPluginService service, |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1452 const void* parameters) |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1453 { |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1454 const _OrthancPluginDicomToJson& p = |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1455 *reinterpret_cast<const _OrthancPluginDicomToJson*>(parameters); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1456 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1457 std::auto_ptr<ParsedDicomFile> dicom; |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1458 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1459 if (service == _OrthancPluginService_DicomBufferToJson) |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1460 { |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1461 dicom.reset(new ParsedDicomFile(p.buffer, p.size)); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1462 } |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1463 else |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1464 { |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1465 if (p.instanceId == NULL) |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1466 { |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1467 throw OrthancException(ErrorCode_ParameterOutOfRange); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1468 } |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1469 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1470 std::string content; |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1471 pimpl_->context_->ReadFile(content, p.instanceId, FileContentType_Dicom); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1472 dicom.reset(new ParsedDicomFile(content)); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1473 } |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1474 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1475 Json::Value json; |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1476 dicom->ToJson(json, Plugins::Convert(p.format), |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1477 static_cast<DicomToJsonFlags>(p.flags), p.maxStringLength); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1478 |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1479 Json::FastWriter writer; |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1480 *p.result = CopyString(writer.write(json)); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
1481 } |
1613
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1482 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
1483 |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1484 void OrthancPlugins::ApplyCreateDicom(_OrthancPluginService service, |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1485 const void* parameters) |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1486 { |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1487 const _OrthancPluginCreateDicom& p = |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1488 *reinterpret_cast<const _OrthancPluginCreateDicom*>(parameters); |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1489 |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1490 Json::Value json; |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1491 |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1492 if (p.json == NULL) |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1493 { |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1494 json = Json::objectValue; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1495 } |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1496 else |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1497 { |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1498 Json::Reader reader; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1499 if (!reader.parse(p.json, json)) |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1500 { |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1501 throw OrthancException(ErrorCode_BadJson); |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1502 } |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1503 } |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1504 |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1505 std::string dicom; |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1506 |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1507 { |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1508 std::auto_ptr<ParsedDicomFile> file |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1509 (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(p.flags))); |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1510 |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1511 if (p.pixelData) |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1512 { |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1513 file->EmbedImage(*reinterpret_cast<const ImageAccessor*>(p.pixelData)); |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1514 } |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1515 |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1516 file->SaveToMemoryBuffer(dicom); |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1517 } |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1518 |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1519 CopyToMemoryBuffer(*p.target, dicom); |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1520 } |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1521 |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1522 |
1833
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1523 void OrthancPlugins::ComputeHash(_OrthancPluginService service, |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1524 const void* parameters) |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1525 { |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1526 const _OrthancPluginComputeHash& p = |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1527 *reinterpret_cast<const _OrthancPluginComputeHash*>(parameters); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1528 |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1529 std::string hash; |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1530 switch (service) |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1531 { |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1532 case _OrthancPluginService_ComputeMd5: |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1533 Toolbox::ComputeMD5(hash, p.buffer, p.size); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1534 break; |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1535 |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1536 case _OrthancPluginService_ComputeSha1: |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1537 Toolbox::ComputeSHA1(hash, p.buffer, p.size); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1538 break; |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1539 |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1540 default: |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1541 throw OrthancException(ErrorCode_ParameterOutOfRange); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1542 } |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1543 |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1544 *p.result = CopyString(hash); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1545 } |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1546 |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
1547 |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1548 void OrthancPlugins::ApplyCreateImage(_OrthancPluginService service, |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1549 const void* parameters) |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1550 { |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1551 const _OrthancPluginCreateImage& p = |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1552 *reinterpret_cast<const _OrthancPluginCreateImage*>(parameters); |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1553 |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1554 std::auto_ptr<ImageAccessor> result; |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1555 |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1556 switch (service) |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1557 { |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1558 case _OrthancPluginService_CreateImage: |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1559 result.reset(new Image(Plugins::Convert(p.format), p.width, p.height)); |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1560 break; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1561 |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1562 case _OrthancPluginService_CreateImageAccessor: |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1563 result.reset(new ImageAccessor); |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1564 result->AssignWritable(Plugins::Convert(p.format), p.width, p.height, p.pitch, p.buffer); |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1565 break; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1566 |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1567 case _OrthancPluginService_DecodeDicomImage: |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1568 { |
1902
8b0ee8d5e6d0
Refactoring leading to speedups with custom image decoders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1569 result.reset(Decode(p.constBuffer, p.bufferSize, p.frameIndex)); |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1570 break; |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1571 } |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1572 |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1573 default: |
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
1574 throw OrthancException(ErrorCode_InternalError); |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1575 } |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1576 |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
1577 *(p.target) = ReturnImage(result); |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
1578 } |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1579 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1580 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1581 void OrthancPlugins::ApplySendMultipartItem(const void* parameters) |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1582 { |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1583 // An exception might be raised in this function if the |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1584 // connection was closed by the HTTP client. |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1585 const _OrthancPluginAnswerBuffer& p = |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1586 *reinterpret_cast<const _OrthancPluginAnswerBuffer*>(parameters); |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1587 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1588 HttpOutput* output = reinterpret_cast<HttpOutput*>(p.output); |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1589 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1590 std::map<std::string, std::string> headers; // No custom headers |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1591 output->SendMultipartItem(p.answer, p.answerSize, headers); |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1592 } |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1593 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1594 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1595 void OrthancPlugins::ApplySendMultipartItem2(const void* parameters) |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1596 { |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1597 // An exception might be raised in this function if the |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1598 // connection was closed by the HTTP client. |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1599 const _OrthancPluginSendMultipartItem2& p = |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1600 *reinterpret_cast<const _OrthancPluginSendMultipartItem2*>(parameters); |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1601 HttpOutput* output = reinterpret_cast<HttpOutput*>(p.output); |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1602 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1603 std::map<std::string, std::string> headers; |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1604 for (uint32_t i = 0; i < p.headersCount; i++) |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1605 { |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1606 headers[p.headersKeys[i]] = p.headersValues[i]; |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1607 } |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1608 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1609 output->SendMultipartItem(p.answer, p.answerSize, headers); |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1610 } |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
1611 |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
1612 |
1771 | 1613 void OrthancPlugins::DatabaseAnswer(const void* parameters) |
1614 { | |
1615 const _OrthancPluginDatabaseAnswer& p = | |
1616 *reinterpret_cast<const _OrthancPluginDatabaseAnswer*>(parameters); | |
1617 | |
1618 if (pimpl_->database_.get() != NULL) | |
1619 { | |
1620 pimpl_->database_->AnswerReceived(p); | |
1621 } | |
1622 else | |
1623 { | |
1624 LOG(ERROR) << "Cannot invoke this service without a custom database back-end"; | |
1625 throw OrthancException(ErrorCode_BadRequest); | |
1626 } | |
1627 } | |
1628 | |
1629 | |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1630 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1631 namespace |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1632 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1633 class DictionaryReadLocker |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1634 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1635 private: |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1636 const DcmDataDictionary& dictionary_; |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1637 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1638 public: |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1639 DictionaryReadLocker() : dictionary_(dcmDataDict.rdlock()) |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1640 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1641 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1642 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1643 ~DictionaryReadLocker() |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1644 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1645 dcmDataDict.unlock(); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1646 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1647 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1648 const DcmDataDictionary* operator->() |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1649 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1650 return &dictionary_; |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1651 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1652 }; |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1653 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1654 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1655 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1656 void OrthancPlugins::ApplyLookupDictionary(const void* parameters) |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1657 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1658 const _OrthancPluginLookupDictionary& p = |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1659 *reinterpret_cast<const _OrthancPluginLookupDictionary*>(parameters); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1660 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1661 DicomTag tag(FromDcmtkBridge::ParseTag(p.name)); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1662 DcmTagKey tag2(tag.GetGroup(), tag.GetElement()); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1663 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1664 DictionaryReadLocker locker; |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1665 const DcmDictEntry* entry = locker->findEntry(tag2, NULL); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1666 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1667 if (entry == NULL) |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1668 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1669 throw OrthancException(ErrorCode_UnknownDicomTag); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1670 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1671 else |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1672 { |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1673 p.target->group = entry->getKey().getGroup(); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1674 p.target->element = entry->getKey().getElement(); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1675 p.target->vr = Plugins::Convert(entry->getEVR()); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1676 p.target->minMultiplicity = static_cast<uint32_t>(entry->getVMMin()); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1677 p.target->maxMultiplicity = (entry->getVMMax() == DcmVariableVM ? 0 : static_cast<uint32_t>(entry->getVMMax())); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1678 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1679 } |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1680 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1681 |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
1682 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1683 bool OrthancPlugins::InvokeService(SharedLibrary& plugin, |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1684 _OrthancPluginService service, |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1685 const void* parameters) |
899 | 1686 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1687 VLOG(1) << "Calling service " << service << " from plugin " << plugin.GetPath(); |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
1688 |
1768
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1689 if (service == _OrthancPluginService_DatabaseAnswer) |
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1690 { |
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1691 // This case solves a deadlock at (*) reported by James Webster |
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1692 // on 2015-10-27 that was present in versions of Orthanc <= |
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1693 // 0.9.4 and related to database plugins implementing a custom |
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1694 // index. The problem was that locking the database is already |
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1695 // ensured by the "ServerIndex" class if the invoked service is |
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1696 // "DatabaseAnswer". |
1771 | 1697 DatabaseAnswer(parameters); |
1698 return true; | |
1768
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1699 } |
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1700 |
1847 | 1701 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); // (*) |
1553
7c4b487b3b4a
ensure mutual exclusion in InvokeService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1545
diff
changeset
|
1702 |
899 | 1703 switch (service) |
1704 { | |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1705 case _OrthancPluginService_GetOrthancPath: |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1706 { |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1707 std::string s = Toolbox::GetPathToExecutable(); |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1708 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = CopyString(s); |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1709 return true; |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1710 } |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1711 |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1712 case _OrthancPluginService_GetOrthancDirectory: |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1713 { |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1714 std::string s = Toolbox::GetDirectoryOfExecutable(); |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1715 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = CopyString(s); |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1716 return true; |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1717 } |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1718 |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1719 case _OrthancPluginService_GetConfigurationPath: |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1720 { |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1721 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1722 CopyString(Configuration::GetConfigurationAbsolutePath()); |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1723 return true; |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1724 } |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
1725 |
1424
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
1726 case _OrthancPluginService_GetConfiguration: |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
1727 { |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
1728 std::string s; |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
1729 Configuration::FormatConfiguration(s); |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
1730 |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
1731 *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = CopyString(s); |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
1732 return true; |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
1733 } |
fe384a9d3b51
OrthancPluginGetConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1407
diff
changeset
|
1734 |
1554
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1735 case _OrthancPluginService_BufferCompression: |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1736 BufferCompression(parameters); |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1737 return true; |
89ab71a68fcf
New function OrthancPluginBufferCompression() to (un)compress memory buffers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1553
diff
changeset
|
1738 |
907 | 1739 case _OrthancPluginService_RegisterRestCallback: |
1595
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
1740 RegisterRestCallback(parameters, true); |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
1741 return true; |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
1742 |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
1743 case _OrthancPluginService_RegisterRestCallbackNoLock: |
e1e54a73ba8b
OrthancPluginRegisterRestCallbackNoLock, documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1594
diff
changeset
|
1744 RegisterRestCallback(parameters, false); |
899 | 1745 return true; |
1746 | |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1747 case _OrthancPluginService_RegisterOnStoredInstanceCallback: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1748 RegisterOnStoredInstanceCallback(parameters); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1749 return true; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1750 |
1177
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
1751 case _OrthancPluginService_RegisterOnChangeCallback: |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
1752 RegisterOnChangeCallback(parameters); |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
1753 return true; |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
1754 |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
1755 case _OrthancPluginService_RegisterWorklistCallback: |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
1756 RegisterWorklistCallback(parameters); |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
1757 return true; |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
1758 |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
1759 case _OrthancPluginService_RegisterDecodeImageCallback: |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
1760 RegisterDecodeImageCallback(parameters); |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
1761 return true; |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
1762 |
907 | 1763 case _OrthancPluginService_AnswerBuffer: |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
1764 AnswerBuffer(parameters); |
899 | 1765 return true; |
1766 | |
907 | 1767 case _OrthancPluginService_CompressAndAnswerPngImage: |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
1768 CompressAndAnswerPngImage(parameters); |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
1769 return true; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
900
diff
changeset
|
1770 |
1600
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
1771 case _OrthancPluginService_CompressAndAnswerImage: |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
1772 CompressAndAnswerImage(parameters); |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
1773 return true; |
7151d63e6d81
documentation, primitives for jpeg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1599
diff
changeset
|
1774 |
907 | 1775 case _OrthancPluginService_GetDicomForInstance: |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
1776 GetDicomForInstance(parameters); |
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
1777 return true; |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
1778 |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
909
diff
changeset
|
1779 case _OrthancPluginService_RestApiGet: |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1780 RestApiGet(parameters, false); |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1781 return true; |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1782 |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1783 case _OrthancPluginService_RestApiGetAfterPlugins: |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1784 RestApiGet(parameters, true); |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
1785 return true; |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1786 |
1780
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
1787 case _OrthancPluginService_RestApiGet2: |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
1788 RestApiGet2(parameters); |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
1789 return true; |
94990da8710e
OrthancPluginRestApiGet2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
1790 |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1791 case _OrthancPluginService_RestApiPost: |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1792 RestApiPostPut(true, parameters, false); |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1793 return true; |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1794 |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1795 case _OrthancPluginService_RestApiPostAfterPlugins: |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1796 RestApiPostPut(true, parameters, true); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1797 return true; |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1798 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1799 case _OrthancPluginService_RestApiDelete: |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1800 RestApiDelete(parameters, false); |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1801 return true; |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1802 |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1803 case _OrthancPluginService_RestApiDeleteAfterPlugins: |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1804 RestApiDelete(parameters, true); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1805 return true; |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1806 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1807 case _OrthancPluginService_RestApiPut: |
1282
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1808 RestApiPostPut(false, parameters, false); |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1809 return true; |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1810 |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1811 case _OrthancPluginService_RestApiPutAfterPlugins: |
7bccdd221e2b
Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1280
diff
changeset
|
1812 RestApiPostPut(false, parameters, true); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
1813 return true; |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
901
diff
changeset
|
1814 |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
1815 case _OrthancPluginService_Redirect: |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
1816 Redirect(parameters); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
1817 return true; |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
944
diff
changeset
|
1818 |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1819 case _OrthancPluginService_SendUnauthorized: |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1820 SendUnauthorized(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1821 return true; |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1822 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1823 case _OrthancPluginService_SendMethodNotAllowed: |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1824 SendMethodNotAllowed(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1825 return true; |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1826 |
1594
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
1827 case _OrthancPluginService_SendHttpStatus: |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
1828 SendHttpStatus(parameters); |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
1829 return true; |
2bac60a4f584
OrthancPluginSendHttpStatus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
1830 |
1042
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1831 case _OrthancPluginService_SendHttpStatusCode: |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1832 SendHttpStatusCode(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1833 return true; |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1834 |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1835 case _OrthancPluginService_SetCookie: |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1836 SetCookie(parameters); |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1837 return true; |
8d1845feb277
set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1041
diff
changeset
|
1838 |
1137
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
1839 case _OrthancPluginService_SetHttpHeader: |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
1840 SetHttpHeader(parameters); |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
1841 return true; |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
1842 |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1843 case _OrthancPluginService_LookupPatient: |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1844 case _OrthancPluginService_LookupStudy: |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1845 case _OrthancPluginService_LookupStudyWithAccessionNumber: |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1846 case _OrthancPluginService_LookupSeries: |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1847 case _OrthancPluginService_LookupInstance: |
1069
a91b4900f06a
plugin lookup using accession number
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1067
diff
changeset
|
1848 LookupResource(service, parameters); |
1037
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1849 return true; |
6208ab500ffd
LookupResource service in plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
1850 |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1851 case _OrthancPluginService_GetInstanceRemoteAet: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1852 case _OrthancPluginService_GetInstanceSize: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1853 case _OrthancPluginService_GetInstanceData: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1854 case _OrthancPluginService_GetInstanceJson: |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1855 case _OrthancPluginService_GetInstanceSimplifiedJson: |
1067
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1856 case _OrthancPluginService_HasInstanceMetadata: |
ace99e272203
access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
1857 case _OrthancPluginService_GetInstanceMetadata: |
1815
2abfdca9b915
OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1810
diff
changeset
|
1858 case _OrthancPluginService_GetInstanceOrigin: |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1859 AccessDicomInstance(service, parameters); |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1860 return true; |
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
1861 |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
1862 case _OrthancPluginService_RegisterStorageArea: |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
1863 { |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1864 LOG(INFO) << "Plugin has registered a custom storage area"; |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
1865 const _OrthancPluginRegisterStorageArea& p = |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
1866 *reinterpret_cast<const _OrthancPluginRegisterStorageArea*>(parameters); |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
1867 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1868 if (pimpl_->storageArea_.get() == NULL) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1869 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
1870 pimpl_->storageArea_.reset(new StorageAreaFactory(plugin, p, GetErrorDictionary())); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1871 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1872 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1873 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1874 throw OrthancException(ErrorCode_StorageAreaAlreadyRegistered); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1875 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1876 |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
1877 return true; |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
1878 } |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
1879 |
1249
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1880 case _OrthancPluginService_SetPluginProperty: |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1881 { |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1882 const _OrthancPluginSetPluginProperty& p = |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1883 *reinterpret_cast<const _OrthancPluginSetPluginProperty*>(parameters); |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1884 pimpl_->properties_[std::make_pair(p.plugin, p.property)] = p.value; |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1885 return true; |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1886 } |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1887 |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1888 case _OrthancPluginService_SetGlobalProperty: |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
1889 { |
1249
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1890 const _OrthancPluginGlobalProperty& p = |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1891 *reinterpret_cast<const _OrthancPluginGlobalProperty*>(parameters); |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1892 if (p.property < 1024) |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1893 { |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1894 return false; |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1895 } |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1896 else |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1897 { |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
1898 CheckContextAvailable(); |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1899 pimpl_->context_->GetIndex().SetGlobalProperty(static_cast<GlobalProperty>(p.property), p.value); |
1249
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1900 return true; |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1901 } |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1902 } |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1903 |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1904 case _OrthancPluginService_GetGlobalProperty: |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1905 { |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1424
diff
changeset
|
1906 CheckContextAvailable(); |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1907 |
1249
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1908 const _OrthancPluginGlobalProperty& p = |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1909 *reinterpret_cast<const _OrthancPluginGlobalProperty*>(parameters); |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1910 std::string result = pimpl_->context_->GetIndex().GetGlobalProperty(static_cast<GlobalProperty>(p.property), p.value); |
1249
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
1911 *(p.result) = CopyString(result); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
1912 return true; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
1913 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
1914 |
1280
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1915 case _OrthancPluginService_GetCommandLineArgumentsCount: |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1916 { |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1917 const _OrthancPluginReturnSingleValue& p = |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1918 *reinterpret_cast<const _OrthancPluginReturnSingleValue*>(parameters); |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1919 *(p.resultUint32) = pimpl_->argc_ - 1; |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1920 return true; |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1921 } |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1922 |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1923 case _OrthancPluginService_GetCommandLineArgument: |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1924 { |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1925 const _OrthancPluginGlobalProperty& p = |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1926 *reinterpret_cast<const _OrthancPluginGlobalProperty*>(parameters); |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1927 |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1928 if (p.property + 1 > pimpl_->argc_) |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1929 { |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1930 return false; |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1931 } |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1932 else |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1933 { |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1934 std::string arg = std::string(pimpl_->argv_[p.property + 1]); |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1935 *(p.result) = CopyString(arg); |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1936 return true; |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1937 } |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1938 } |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
1939 |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1940 case _OrthancPluginService_RegisterDatabaseBackend: |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1941 { |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1942 LOG(INFO) << "Plugin has registered a custom database back-end"; |
1609
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1943 |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1944 const _OrthancPluginRegisterDatabaseBackend& p = |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1945 *reinterpret_cast<const _OrthancPluginRegisterDatabaseBackend*>(parameters); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1946 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1947 if (pimpl_->database_.get() == NULL) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1948 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
1949 pimpl_->database_.reset(new OrthancPluginDatabase(plugin, GetErrorDictionary(), |
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
1950 *p.backend, NULL, 0, p.payload)); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1951 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1952 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1953 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1954 throw OrthancException(ErrorCode_DatabaseBackendAlreadyRegistered); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1955 } |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1956 |
1609
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1957 *(p.result) = reinterpret_cast<OrthancPluginDatabaseContext*>(pimpl_->database_.get()); |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1958 |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1959 return true; |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1960 } |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1961 |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1962 case _OrthancPluginService_RegisterDatabaseBackendV2: |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1963 { |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1964 LOG(INFO) << "Plugin has registered a custom database back-end"; |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1965 |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1966 const _OrthancPluginRegisterDatabaseBackendV2& p = |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1967 *reinterpret_cast<const _OrthancPluginRegisterDatabaseBackendV2*>(parameters); |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1968 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1969 if (pimpl_->database_.get() == NULL) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1970 { |
1651
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
1971 pimpl_->database_.reset(new OrthancPluginDatabase(plugin, GetErrorDictionary(), |
2e692c83e2f3
improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1649
diff
changeset
|
1972 *p.backend, p.extensions, |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1973 p.extensionsSize, p.payload)); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1974 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1975 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1976 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1977 throw OrthancException(ErrorCode_DatabaseBackendAlreadyRegistered); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
1978 } |
1609
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
1979 |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1980 *(p.result) = reinterpret_cast<OrthancPluginDatabaseContext*>(pimpl_->database_.get()); |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1981 |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1982 return true; |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1983 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1984 |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1985 case _OrthancPluginService_DatabaseAnswer: |
1768
70f544f9c38f
fix possible deadlock in custom database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1760
diff
changeset
|
1986 throw OrthancException(ErrorCode_InternalError); // Implemented before locking (*) |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
1987 |
1407
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
1988 case _OrthancPluginService_GetExpectedDatabaseVersion: |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
1989 { |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
1990 const _OrthancPluginReturnSingleValue& p = |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
1991 *reinterpret_cast<const _OrthancPluginReturnSingleValue*>(parameters); |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
1992 *(p.resultUint32) = ORTHANC_DATABASE_VERSION; |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
1993 return true; |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
1994 } |
d371a66972a4
OrthancPluginGetExpectedDatabaseVersion
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1363
diff
changeset
|
1995 |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
1996 case _OrthancPluginService_StartMultipartAnswer: |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
1997 { |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
1998 const _OrthancPluginStartMultipartAnswer& p = |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
1999 *reinterpret_cast<const _OrthancPluginStartMultipartAnswer*>(parameters); |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
2000 HttpOutput* output = reinterpret_cast<HttpOutput*>(p.output); |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
2001 output->StartMultipart(p.subType, p.contentType); |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
2002 return true; |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
2003 } |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
2004 |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
2005 case _OrthancPluginService_SendMultipartItem: |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
2006 ApplySendMultipartItem(parameters); |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
2007 return true; |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
2008 |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
2009 case _OrthancPluginService_SendMultipartItem2: |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
2010 ApplySendMultipartItem2(parameters); |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1861
diff
changeset
|
2011 return true; |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
2012 |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2013 case _OrthancPluginService_ReadFile: |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2014 { |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2015 const _OrthancPluginReadFile& p = |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2016 *reinterpret_cast<const _OrthancPluginReadFile*>(parameters); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2017 |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2018 std::string content; |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2019 Toolbox::ReadFile(content, p.path); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2020 CopyToMemoryBuffer(*p.target, content.size() > 0 ? content.c_str() : NULL, content.size()); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2021 |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2022 return true; |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2023 } |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2024 |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2025 case _OrthancPluginService_WriteFile: |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2026 { |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2027 const _OrthancPluginWriteFile& p = |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2028 *reinterpret_cast<const _OrthancPluginWriteFile*>(parameters); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2029 Toolbox::WriteFile(p.data, p.size, p.path); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2030 return true; |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2031 } |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1581
diff
changeset
|
2032 |
1593
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
2033 case _OrthancPluginService_GetErrorDescription: |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
2034 { |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
2035 const _OrthancPluginGetErrorDescription& p = |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
2036 *reinterpret_cast<const _OrthancPluginGetErrorDescription*>(parameters); |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
2037 *(p.target) = EnumerationToString(static_cast<ErrorCode>(p.error)); |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
2038 return true; |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
2039 } |
235d89817b89
OrthancPluginGetErrorDescription
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
2040 |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2041 case _OrthancPluginService_GetImagePixelFormat: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2042 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
2043 const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); |
1625 | 2044 *(p.resultPixelFormat) = Plugins::Convert(reinterpret_cast<const ImageAccessor*>(p.image)->GetFormat()); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2045 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2046 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2047 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2048 case _OrthancPluginService_GetImageWidth: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2049 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
2050 const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2051 *(p.resultUint32) = reinterpret_cast<const ImageAccessor*>(p.image)->GetWidth(); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2052 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2053 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2054 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2055 case _OrthancPluginService_GetImageHeight: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2056 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
2057 const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2058 *(p.resultUint32) = reinterpret_cast<const ImageAccessor*>(p.image)->GetHeight(); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2059 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2060 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2061 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2062 case _OrthancPluginService_GetImagePitch: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2063 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
2064 const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2065 *(p.resultUint32) = reinterpret_cast<const ImageAccessor*>(p.image)->GetPitch(); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2066 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2067 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2068 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2069 case _OrthancPluginService_GetImageBuffer: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2070 { |
1599
dd1f9e81f891
fixes to image primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
2071 const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
2072 *(p.resultBuffer) = reinterpret_cast<const ImageAccessor*>(p.image)->GetBuffer(); |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2073 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2074 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2075 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2076 case _OrthancPluginService_FreeImage: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2077 { |
1605 | 2078 const _OrthancPluginFreeImage& p = *reinterpret_cast<const _OrthancPluginFreeImage*>(parameters); |
1609
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
2079 if (p.image == NULL) |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
2080 { |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
2081 throw OrthancException(ErrorCode_ParameterOutOfRange); |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
2082 } |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
2083 else |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
2084 { |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
2085 delete reinterpret_cast<ImageAccessor*>(p.image); |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
2086 return true; |
c74495267acf
Implementation of the "GetAllPublicIdsWithLimit" extension
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1608
diff
changeset
|
2087 } |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2088 } |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2089 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2090 case _OrthancPluginService_UncompressImage: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2091 UncompressImage(parameters); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2092 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2093 |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2094 case _OrthancPluginService_CompressImage: |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2095 CompressImage(parameters); |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2096 return true; |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2097 |
1606
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
2098 case _OrthancPluginService_CallHttpClient: |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
2099 CallHttpClient(parameters); |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
2100 return true; |
31f4adefb88f
issuing HTTP requests from the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1605
diff
changeset
|
2101 |
1608
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
2102 case _OrthancPluginService_ConvertPixelFormat: |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
2103 ConvertPixelFormat(parameters); |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
2104 return true; |
adc6a5704cdb
OrthancPluginConvertPixelFormat
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
2105 |
1613
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2106 case _OrthancPluginService_GetFontsCount: |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2107 { |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2108 const _OrthancPluginReturnSingleValue& p = |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2109 *reinterpret_cast<const _OrthancPluginReturnSingleValue*>(parameters); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2110 *(p.resultUint32) = Configuration::GetFontRegistry().GetSize(); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2111 return true; |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2112 } |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2113 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2114 case _OrthancPluginService_GetFontInfo: |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2115 GetFontInfo(parameters); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2116 return true; |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2117 |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2118 case _OrthancPluginService_DrawText: |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2119 DrawText(parameters); |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2120 return true; |
1ec254a7c645
drawing texts on image from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1612
diff
changeset
|
2121 |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2122 case _OrthancPluginService_StorageAreaCreate: |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2123 { |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2124 const _OrthancPluginStorageAreaCreate& p = |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2125 *reinterpret_cast<const _OrthancPluginStorageAreaCreate*>(parameters); |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2126 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); |
1625 | 2127 storage.Create(p.uuid, p.content, p.size, Plugins::Convert(p.type)); |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2128 return true; |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2129 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2130 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2131 case _OrthancPluginService_StorageAreaRead: |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2132 { |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2133 const _OrthancPluginStorageAreaRead& p = |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2134 *reinterpret_cast<const _OrthancPluginStorageAreaRead*>(parameters); |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2135 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2136 std::string content; |
1625 | 2137 storage.Read(content, p.uuid, Plugins::Convert(p.type)); |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2138 CopyToMemoryBuffer(*p.target, content); |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2139 return true; |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2140 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2141 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2142 case _OrthancPluginService_StorageAreaRemove: |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2143 { |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2144 const _OrthancPluginStorageAreaRemove& p = |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2145 *reinterpret_cast<const _OrthancPluginStorageAreaRemove*>(parameters); |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2146 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); |
1625 | 2147 storage.Remove(p.uuid, Plugins::Convert(p.type)); |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2148 return true; |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2149 } |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1613
diff
changeset
|
2150 |
1649
8040d56cb0b3
New function "OrthancPluginRegisterErrorCode()" to declare custom error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2151 case _OrthancPluginService_RegisterErrorCode: |
8040d56cb0b3
New function "OrthancPluginRegisterErrorCode()" to declare custom error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2152 { |
8040d56cb0b3
New function "OrthancPluginRegisterErrorCode()" to declare custom error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2153 const _OrthancPluginRegisterErrorCode& p = |
8040d56cb0b3
New function "OrthancPluginRegisterErrorCode()" to declare custom error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2154 *reinterpret_cast<const _OrthancPluginRegisterErrorCode*>(parameters); |
8040d56cb0b3
New function "OrthancPluginRegisterErrorCode()" to declare custom error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2155 *(p.target) = pimpl_->dictionary_.Register(plugin, p.code, p.httpStatus, p.message); |
8040d56cb0b3
New function "OrthancPluginRegisterErrorCode()" to declare custom error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2156 return true; |
8040d56cb0b3
New function "OrthancPluginRegisterErrorCode()" to declare custom error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2157 } |
8040d56cb0b3
New function "OrthancPluginRegisterErrorCode()" to declare custom error codes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2158 |
1657
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
2159 case _OrthancPluginService_RegisterDictionaryTag: |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
2160 { |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
2161 const _OrthancPluginRegisterDictionaryTag& p = |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
2162 *reinterpret_cast<const _OrthancPluginRegisterDictionaryTag*>(parameters); |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
2163 FromDcmtkBridge::RegisterDictionaryTag(DicomTag(p.group, p.element), |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
2164 Plugins::Convert(p.vr), p.name, |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
2165 p.minMultiplicity, p.maxMultiplicity); |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
2166 return true; |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
2167 } |
5360cdba70d8
New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
2168 |
1669
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2169 case _OrthancPluginService_ReconstructMainDicomTags: |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2170 { |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2171 const _OrthancPluginReconstructMainDicomTags& p = |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2172 *reinterpret_cast<const _OrthancPluginReconstructMainDicomTags*>(parameters); |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2173 |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2174 if (pimpl_->database_.get() == NULL) |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2175 { |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2176 LOG(ERROR) << "The service ReconstructMainDicomTags can only be invoked by custom database plugins"; |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2177 throw OrthancException(ErrorCode_DatabasePlugin); |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2178 } |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2179 |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2180 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2181 Toolbox::ReconstructMainDicomTags(*pimpl_->database_, storage, Plugins::Convert(p.level)); |
1673
0bbcfd9695e5
UpgradeDatabase in the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1669
diff
changeset
|
2182 |
1669
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2183 return true; |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2184 } |
a412ad57f0f9
refactoring of sample plugins, OrthancPluginReconstructMainDicomTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2185 |
1740
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
2186 case _OrthancPluginService_DicomBufferToJson: |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
2187 case _OrthancPluginService_DicomInstanceToJson: |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
2188 ApplyDicomToJson(service, parameters); |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
2189 return true; |
5e99a70b0635
DicomToJson callable from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
2190 |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
2191 case _OrthancPluginService_CreateDicom: |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
2192 ApplyCreateDicom(service, parameters); |
1821
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
2193 return true; |
580951a33583
OrthancPluginDicomFromJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1817
diff
changeset
|
2194 |
1810
796d0b087fb8
more consistent naming in worklist primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
2195 case _OrthancPluginService_WorklistAddAnswer: |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2196 { |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2197 const _OrthancPluginWorklistAnswersOperation& p = |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2198 *reinterpret_cast<const _OrthancPluginWorklistAnswersOperation*>(parameters); |
1802
138664eb59de
sample worklist plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1801
diff
changeset
|
2199 reinterpret_cast<const WorklistHandler*>(p.query)->AddAnswer(p.answers, p.dicom, p.size); |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2200 return true; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2201 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2202 |
1810
796d0b087fb8
more consistent naming in worklist primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
2203 case _OrthancPluginService_WorklistMarkIncomplete: |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2204 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2205 const _OrthancPluginWorklistAnswersOperation& p = |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2206 *reinterpret_cast<const _OrthancPluginWorklistAnswersOperation*>(parameters); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2207 reinterpret_cast<DicomFindAnswers*>(p.answers)->SetComplete(false); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2208 return true; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2209 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2210 |
1810
796d0b087fb8
more consistent naming in worklist primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
2211 case _OrthancPluginService_WorklistIsMatch: |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2212 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2213 const _OrthancPluginWorklistQueryOperation& p = |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2214 *reinterpret_cast<const _OrthancPluginWorklistQueryOperation*>(parameters); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2215 *p.isMatch = reinterpret_cast<const WorklistHandler*>(p.query)->IsMatch(p.dicom, p.size); |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2216 return true; |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2217 } |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2218 |
1810
796d0b087fb8
more consistent naming in worklist primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
2219 case _OrthancPluginService_WorklistGetDicomQuery: |
1801
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2220 { |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2221 const _OrthancPluginWorklistQueryOperation& p = |
2c60c357ee3e
sdk primitives to handle worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
2222 *reinterpret_cast<const _OrthancPluginWorklistQueryOperation*>(parameters); |
1812 | 2223 reinterpret_cast<const WorklistHandler*>(p.query)->GetDicomQuery(*p.target); |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2224 return true; |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2225 } |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2226 |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
2227 case _OrthancPluginService_CreateImage: |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
2228 case _OrthancPluginService_CreateImageAccessor: |
1829
31df3b48925e
OrthancPluginDecodeDicomImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1828
diff
changeset
|
2229 case _OrthancPluginService_DecodeDicomImage: |
1827
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
2230 ApplyCreateImage(service, parameters); |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
2231 return true; |
4b6673e828f4
"OrthancPluginCreateImage()" and "OrthancPluginCreateImageAccessor()" to create images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1826
diff
changeset
|
2232 |
1833
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
2233 case _OrthancPluginService_ComputeMd5: |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
2234 case _OrthancPluginService_ComputeSha1: |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
2235 ComputeHash(service, parameters); |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
2236 return true; |
47d032c48818
"OrthancPluginComputeMd5()" and "OrthancPluginComputeSha1()" to compute MD5/SHA-1 hash
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1829
diff
changeset
|
2237 |
1861
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
2238 case _OrthancPluginService_LookupDictionary: |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
2239 ApplyLookupDictionary(parameters); |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
2240 return true; |
a7bea843a7bc
"OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1860
diff
changeset
|
2241 |
899 | 2242 default: |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2243 { |
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2244 // This service is unknown to the Orthanc plugin engine |
899 | 2245 return false; |
1598
c6b50b803387
primitives for image encoding/decoding in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1595
diff
changeset
|
2246 } |
899 | 2247 } |
2248 } | |
2249 | |
908
e078ea944089
refactoring HttpOutput
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
907
diff
changeset
|
2250 |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2251 bool OrthancPlugins::HasStorageArea() const |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2252 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2253 return pimpl_->storageArea_.get() != NULL; |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2254 } |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2255 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2256 bool OrthancPlugins::HasDatabaseBackend() const |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2257 { |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2258 return pimpl_->database_.get() != NULL; |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2259 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2260 |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2261 |
1452
b737acb13da5
refactoring of the main function
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1447
diff
changeset
|
2262 IStorageArea* OrthancPlugins::CreateStorageArea() |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2263 { |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2264 if (!HasStorageArea()) |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2265 { |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2266 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2267 } |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2268 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2269 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2270 return pimpl_->storageArea_->Create(); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2271 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2272 } |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2273 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2274 |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2275 const SharedLibrary& OrthancPlugins::GetStorageAreaLibrary() const |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2276 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2277 if (!HasStorageArea()) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2278 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2279 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2280 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2281 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2282 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2283 return pimpl_->storageArea_->GetSharedLibrary(); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2284 } |
1135
67c3c1e4a6e0
index-only mode, and custom storage area with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
2285 } |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2286 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2287 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2288 IDatabaseWrapper& OrthancPlugins::GetDatabaseBackend() |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2289 { |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2290 if (!HasDatabaseBackend()) |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2291 { |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2292 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2293 } |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2294 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2295 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2296 return *pimpl_->database_; |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2297 } |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2298 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2299 |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2300 |
1630
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2301 const SharedLibrary& OrthancPlugins::GetDatabaseBackendLibrary() const |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2302 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2303 if (!HasDatabaseBackend()) |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2304 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2305 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2306 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2307 else |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2308 { |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2309 return pimpl_->database_->GetSharedLibrary(); |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2310 } |
ffd23c0104af
"/system" URI gives information about the plugins used for storage area and DB back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1628
diff
changeset
|
2311 } |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1296
diff
changeset
|
2312 |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2313 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2314 const char* OrthancPlugins::GetProperty(const char* plugin, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2315 _OrthancPluginProperty property) const |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2316 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2317 PImpl::Property p = std::make_pair(plugin, property); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2318 PImpl::Properties::const_iterator it = pimpl_->properties_.find(p); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2319 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2320 if (it == pimpl_->properties_.end()) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2321 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2322 return NULL; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2323 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2324 else |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2325 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2326 return it->second.c_str(); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2327 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
2328 } |
1280
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2329 |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2330 |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2331 void OrthancPlugins::SetCommandLineArguments(int argc, char* argv[]) |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2332 { |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2333 if (argc < 1 || argv == NULL) |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2334 { |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2335 throw OrthancException(ErrorCode_ParameterOutOfRange); |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2336 } |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2337 |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2338 pimpl_->argc_ = argc; |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2339 pimpl_->argv_ = argv; |
d6a65dc6d0ac
Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1250
diff
changeset
|
2340 } |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2341 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2342 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2343 PluginsManager& OrthancPlugins::GetManager() |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2344 { |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2345 return pimpl_->manager_; |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2346 } |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2347 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2348 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2349 const PluginsManager& OrthancPlugins::GetManager() const |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2350 { |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2351 return pimpl_->manager_; |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
2352 } |
1644
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
2353 |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
2354 |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
2355 PluginsErrorDictionary& OrthancPlugins::GetErrorDictionary() |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
2356 { |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
2357 return pimpl_->dictionary_; |
939b921b2c81
plugin error dictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1643
diff
changeset
|
2358 } |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2359 |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2360 |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2361 IWorklistRequestHandler* OrthancPlugins::ConstructWorklistRequestHandler() |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2362 { |
1809
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
2363 if (HasWorklistHandler()) |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2364 { |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2365 return new WorklistHandler(*this); |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2366 } |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2367 else |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2368 { |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2369 return NULL; |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2370 } |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
2371 } |
1809
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
2372 |
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
2373 |
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
2374 bool OrthancPlugins::HasWorklistHandler() |
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
2375 { |
1825
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2376 boost::mutex::scoped_lock lock(pimpl_->worklistCallbackMutex_); |
f0f8a94c0858
only one modality worklist handler at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1821
diff
changeset
|
2377 return pimpl_->worklistCallback_ != NULL; |
1809
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
2378 } |
5ed8769b17f9
disable worklist support if no plugin has registered callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1802
diff
changeset
|
2379 |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2380 |
1906
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
2381 bool OrthancPlugins::HasCustomImageDecoder() |
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
2382 { |
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
2383 boost::mutex::scoped_lock lock(pimpl_->decodeImageCallbackMutex_); |
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
2384 return (pimpl_->decodeImageCallback_ != NULL); |
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
2385 } |
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
2386 |
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
2387 |
1902
8b0ee8d5e6d0
Refactoring leading to speedups with custom image decoders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
2388 ImageAccessor* OrthancPlugins::Decode(const void* dicom, |
8b0ee8d5e6d0
Refactoring leading to speedups with custom image decoders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
2389 size_t size, |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2390 unsigned int frame) |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2391 { |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2392 { |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2393 boost::mutex::scoped_lock lock(pimpl_->decodeImageCallbackMutex_); |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2394 if (pimpl_->decodeImageCallback_ != NULL) |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2395 { |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2396 OrthancPluginImage* pluginImage = NULL; |
1902
8b0ee8d5e6d0
Refactoring leading to speedups with custom image decoders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
2397 if (pimpl_->decodeImageCallback_(&pluginImage, dicom, size, frame) == OrthancPluginErrorCode_Success && |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2398 pluginImage != NULL) |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2399 { |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2400 return reinterpret_cast<ImageAccessor*>(pluginImage); |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2401 } |
1840
859224214616
simplification of the sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1833
diff
changeset
|
2402 |
1843
d10a8164da5f
ensure images returned to plugins are writable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1842
diff
changeset
|
2403 LOG(WARNING) << "The custom image decoder cannot handle an image, fallback to the built-in decoder"; |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2404 } |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2405 } |
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2406 |
1902
8b0ee8d5e6d0
Refactoring leading to speedups with custom image decoders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
2407 DefaultDicomImageDecoder defaultDecoder; |
1906
d7c1cb559431
optimization for multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1902
diff
changeset
|
2408 return defaultDecoder.Decode(dicom, size, frame); // TODO RETURN NULL ??? |
1826
ac5b0b4e2434
refactoring of DicomImageDecoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1825
diff
changeset
|
2409 } |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2410 } |