annotate Plugins/Samples/Basic/Plugin.c @ 3591:19d88138c30f

cleanup
author Alain Mazy <alain@mazy.be>
date Mon, 23 Dec 2019 10:44:09 +0100
parents cac5a3ddd441
children 94f4a18a79cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1861
diff changeset
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
3060
4e43e67f8ecf preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2997
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
1375
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
7 * This program is free software: you can redistribute it and/or
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
8 * modify it under the terms of the GNU General Public License as
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
10 * License, or (at your option) any later version.
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
11 *
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
12 * This program is distributed in the hope that it will be useful, but
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
15 * General Public License for more details.
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
1375
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
17 * You should have received a copy of the GNU General Public License
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
1425
97268448bdfc refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1375
diff changeset
22 #include <orthanc/OrthancCPlugin.h>
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include <string.h>
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include <stdio.h>
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
27 static OrthancPluginContext* context = NULL;
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
1651
2e692c83e2f3 improved custom error login
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
29 static OrthancPluginErrorCode customError;
1650
9f34ebfaf2c9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1627
diff changeset
30
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
32 ORTHANC_PLUGINS_API OrthancPluginErrorCode Callback1(OrthancPluginRestOutput* output,
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
33 const char* url,
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
34 const OrthancPluginHttpRequest* request)
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
35 {
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
36 char buffer[1024];
897
bafc9d592632 REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 896
diff changeset
37 uint32_t i;
bafc9d592632 REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 896
diff changeset
38
2957
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
39 if (request->method != OrthancPluginHttpMethod_Get)
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
40 {
3206
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3205
diff changeset
41 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3205
diff changeset
42 * NB: Calling "OrthancPluginSendMethodNotAllowed(context, output,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3205
diff changeset
43 * "GET");" is preferable. This is a sample to demonstrate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3205
diff changeset
44 * "OrthancPluginSetHttpErrorDetails()".
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3205
diff changeset
45 **/
2997
5a6a2c5bf73f fix basic plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2957
diff changeset
46 OrthancPluginSetHttpErrorDetails(context, output, "This Callback1() can only be used by a GET call", 1 /* log */);
2957
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
47 return OrthancPluginErrorCode_ParameterOutOfRange;
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
48 }
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
49
3543
cac5a3ddd441 fix warning in plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3216
diff changeset
50 sprintf(buffer, "Callback on URL [%s] with body [%s]\n", url, (const char*) request->body);
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
51 OrthancPluginLogWarning(context, buffer);
897
bafc9d592632 REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 896
diff changeset
52
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
53 OrthancPluginSetCookie(context, output, "hello", "world");
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
54 OrthancPluginAnswerBuffer(context, output, buffer, strlen(buffer), "text/plain");
897
bafc9d592632 REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 896
diff changeset
55
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
56 OrthancPluginLogWarning(context, "");
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
57
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
58 for (i = 0; i < request->groupsCount; i++)
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
59 {
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
60 sprintf(buffer, " REGEX GROUP %d = [%s]", i, request->groups[i]);
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
61 OrthancPluginLogWarning(context, buffer);
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
62 }
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
63
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
64 OrthancPluginLogWarning(context, "");
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
65
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
66 for (i = 0; i < request->getCount; i++)
897
bafc9d592632 REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 896
diff changeset
67 {
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
68 sprintf(buffer, " GET [%s] = [%s]", request->getKeys[i], request->getValues[i]);
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
69 OrthancPluginLogWarning(context, buffer);
897
bafc9d592632 REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 896
diff changeset
70 }
bafc9d592632 REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 896
diff changeset
71
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
72 OrthancPluginLogWarning(context, "");
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
73
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
74 for (i = 0; i < request->headersCount; i++)
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
75 {
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
76 sprintf(buffer, " HEADERS [%s] = [%s]", request->headersKeys[i], request->headersValues[i]);
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
77 OrthancPluginLogWarning(context, buffer);
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
78 }
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
79
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
80 OrthancPluginLogWarning(context, "");
1041
2c49b7dffcec plugins have access to the HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1040
diff changeset
81
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
82 return OrthancPluginErrorCode_Success;
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
83 }
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
84
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
85
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
86 ORTHANC_PLUGINS_API OrthancPluginErrorCode Callback2(OrthancPluginRestOutput* output,
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
87 const char* url,
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
88 const OrthancPluginHttpRequest* request)
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
89 {
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
90 /* Answer with a sample 16bpp image. */
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
91
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
92 uint16_t buffer[256 * 256];
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
93 uint32_t x, y, value;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
94
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
95 if (request->method != OrthancPluginHttpMethod_Get)
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
96 {
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
97 OrthancPluginSendMethodNotAllowed(context, output, "GET");
1043
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
98 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
99 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
100 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
101 value = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
102 for (y = 0; y < 256; y++)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
103 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
104 for (x = 0; x < 256; x++, value++)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
105 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
106 buffer[value] = value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
107 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
108 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
109
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
110 OrthancPluginCompressAndAnswerPngImage(context, output, OrthancPluginPixelFormat_Grayscale16,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
111 256, 256, sizeof(uint16_t) * 256, buffer);
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
112 }
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1041
diff changeset
113
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
114 return OrthancPluginErrorCode_Success;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
115 }
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
116
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
117
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
118 ORTHANC_PLUGINS_API OrthancPluginErrorCode Callback3(OrthancPluginRestOutput* output,
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
119 const char* url,
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
120 const OrthancPluginHttpRequest* request)
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
121 {
1044
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
122 if (request->method != OrthancPluginHttpMethod_Get)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
123 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
124 OrthancPluginSendMethodNotAllowed(context, output, "GET");
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
125 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
126 else
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
127 {
1044
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
128 OrthancPluginMemoryBuffer dicom;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
129 if (!OrthancPluginGetDicomForInstance(context, &dicom, request->groups[0]))
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
130 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
131 /* No error, forward the DICOM file */
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
132 OrthancPluginAnswerBuffer(context, output, dicom.data, dicom.size, "application/dicom");
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
133
1044
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
134 /* Free memory */
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
135 OrthancPluginFreeMemoryBuffer(context, &dicom);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
136 }
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
137 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
138
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
139 return OrthancPluginErrorCode_Success;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
140 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
141
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
142
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
143 ORTHANC_PLUGINS_API OrthancPluginErrorCode Callback4(OrthancPluginRestOutput* output,
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
144 const char* url,
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
145 const OrthancPluginHttpRequest* request)
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
146 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
147 /* Answer with a sample 8bpp image. */
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
148
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
149 uint8_t buffer[256 * 256];
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
150 uint32_t x, y, value;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
151
1044
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
152 if (request->method != OrthancPluginHttpMethod_Get)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
153 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
154 OrthancPluginSendMethodNotAllowed(context, output, "GET");
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
155 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
156 else
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
157 {
1044
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
158 value = 0;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
159 for (y = 0; y < 256; y++)
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
160 {
1044
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
161 for (x = 0; x < 256; x++, value++)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
162 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
163 buffer[value] = x;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
164 }
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
165 }
1044
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
166
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
167 OrthancPluginCompressAndAnswerPngImage(context, output, OrthancPluginPixelFormat_Grayscale8,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1043
diff changeset
168 256, 256, 256, buffer);
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
169 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
170
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
171 return OrthancPluginErrorCode_Success;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
172 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
173
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
174
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
175 ORTHANC_PLUGINS_API OrthancPluginErrorCode Callback5(OrthancPluginRestOutput* output,
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
176 const char* url,
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
177 const OrthancPluginHttpRequest* request)
1282
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
178 {
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
179 /**
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
180 * Demonstration the difference between the
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
181 * "OrthancPluginRestApiXXX()" and the
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
182 * "OrthancPluginRestApiXXXAfterPlugins()" mechanisms to forward
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
183 * REST calls.
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
184 *
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
185 * # curl http://localhost:8042/forward/built-in/system
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
186 * # curl http://localhost:8042/forward/plugins/system
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
187 * # curl http://localhost:8042/forward/built-in/plugin/image
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
188 * => FAILURE (because the "/plugin/image" URI is implemented by this plugin)
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
189 * # curl http://localhost:8042/forward/plugins/plugin/image => SUCCESS
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
190 **/
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
191
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
192 OrthancPluginMemoryBuffer tmp;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
193 int isBuiltIn, error;
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
194
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
195 if (request->method != OrthancPluginHttpMethod_Get)
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
196 {
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
197 OrthancPluginSendMethodNotAllowed(context, output, "GET");
2957
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
198 return OrthancPluginErrorCode_Success;
1282
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
199 }
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
200
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
201 isBuiltIn = strcmp("plugins", request->groups[0]);
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
202
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
203 if (isBuiltIn)
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
204 {
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
205 error = OrthancPluginRestApiGet(context, &tmp, request->groups[1]);
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
206 }
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
207 else
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
208 {
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
209 error = OrthancPluginRestApiGetAfterPlugins(context, &tmp, request->groups[1]);
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
210 }
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
211
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
212 if (error)
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
213 {
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
214 return OrthancPluginErrorCode_InternalError;
1282
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
215 }
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
216 else
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
217 {
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
218 OrthancPluginAnswerBuffer(context, output, tmp.data, tmp.size, "application/octet-stream");
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
219 OrthancPluginFreeMemoryBuffer(context, &tmp);
2135
cadfe0a2a393 fix in the sample basic plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1962
diff changeset
220 return OrthancPluginErrorCode_Success;
1282
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
221 }
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
222 }
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
223
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
224
1627
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
225 ORTHANC_PLUGINS_API OrthancPluginErrorCode CallbackCreateDicom(OrthancPluginRestOutput* output,
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
226 const char* url,
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
227 const OrthancPluginHttpRequest* request)
1137
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
228 {
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
229 const char* pathLocator = "\"Path\" : \"";
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
230 char info[1024];
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
231 char *id, *eos;
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
232 OrthancPluginMemoryBuffer tmp;
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
233
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
234 if (request->method != OrthancPluginHttpMethod_Post)
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
235 {
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
236 OrthancPluginSendMethodNotAllowed(context, output, "POST");
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
237 }
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
238 else
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
239 {
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
240 /* Make POST request to create a new DICOM instance */
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
241 sprintf(info, "{\"PatientName\":\"Test\"}");
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
242 OrthancPluginRestApiPost(context, &tmp, "/tools/create-dicom", info, strlen(info));
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
243
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
244 /**
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
245 * Recover the ID of the created instance is constructed by a
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
246 * quick-and-dirty parsing of a JSON string.
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
247 **/
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
248 id = strstr((char*) tmp.data, pathLocator) + strlen(pathLocator);
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
249 eos = strchr(id, '\"');
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
250 eos[0] = '\0';
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
251
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
252 /* Delete the newly created DICOM instance. */
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
253 OrthancPluginRestApiDelete(context, id);
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
254 OrthancPluginFreeMemoryBuffer(context, &tmp);
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
255
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
256 /* Set some cookie */
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
257 OrthancPluginSetCookie(context, output, "hello", "world");
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
258
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
259 /* Set some HTTP header */
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
260 OrthancPluginSetHttpHeader(context, output, "Cache-Control", "max-age=0, no-cache");
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
261
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
262 OrthancPluginAnswerBuffer(context, output, "OK\n", 3, "text/plain");
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
263 }
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
264
1627
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
265 return OrthancPluginErrorCode_Success;
1137
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
266 }
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
267
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
268
3206
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3205
diff changeset
269 ORTHANC_PLUGINS_API void DicomWebBinaryCallback(
3205
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
270 OrthancPluginDicomWebNode* node,
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
271 OrthancPluginDicomWebSetBinaryNode setter,
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
272 uint32_t levelDepth,
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
273 const uint16_t* levelTagGroup,
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
274 const uint16_t* levelTagElement,
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
275 const uint32_t* levelIndex,
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
276 uint16_t tagGroup,
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
277 uint16_t tagElement,
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
278 OrthancPluginValueRepresentation vr)
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
279 {
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
280 setter(node, OrthancPluginDicomWebBinaryMode_BulkDataUri, "HelloURI");
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
281 }
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
282
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
283
1627
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
284 ORTHANC_PLUGINS_API OrthancPluginErrorCode OnStoredCallback(OrthancPluginDicomInstance* instance,
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
285 const char* instanceId)
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
286 {
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
287 char buffer[256];
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
288 FILE* fp;
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
289 char* json;
1191
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
290 static int first = 1;
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
291
1815
2abfdca9b915 OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1780
diff changeset
292 sprintf(buffer, "Just received a DICOM instance of size %d and ID %s from origin %d (AET %s)",
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
293 (int) OrthancPluginGetInstanceSize(context, instance), instanceId,
1815
2abfdca9b915 OrthancPluginGetInstanceOrigin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1780
diff changeset
294 OrthancPluginGetInstanceOrigin(context, instance),
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
295 OrthancPluginGetInstanceRemoteAet(context, instance));
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
296
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
297 OrthancPluginLogWarning(context, buffer);
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
298
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
299 fp = fopen("PluginReceivedInstance.dcm", "wb");
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
300 fwrite(OrthancPluginGetInstanceData(context, instance),
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
301 OrthancPluginGetInstanceSize(context, instance), 1, fp);
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
302 fclose(fp);
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
303
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
304 json = OrthancPluginGetInstanceSimplifiedJson(context, instance);
1191
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
305 if (first)
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
306 {
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
307 printf("[%s]\n", json);
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
308 }
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
309 OrthancPluginFreeString(context, json);
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
310
1067
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
311 if (OrthancPluginHasInstanceMetadata(context, instance, "ReceptionDate"))
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
312 {
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
313 printf("Received on [%s]\n", OrthancPluginGetInstanceMetadata(context, instance, "ReceptionDate"));
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
314 }
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
315 else
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
316 {
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
317 OrthancPluginLogError(context, "Instance has no reception date, should never happen!");
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
318 }
ace99e272203 access metadata in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1066
diff changeset
319
3205
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
320 json = OrthancPluginEncodeDicomWebXml(context,
3216
c9a71eb4edcf fix basic plugin sample
s.jodogne@gmail.com
parents: 3206
diff changeset
321 OrthancPluginGetInstanceData(context, instance),
c9a71eb4edcf fix basic plugin sample
s.jodogne@gmail.com
parents: 3206
diff changeset
322 OrthancPluginGetInstanceSize(context, instance),
c9a71eb4edcf fix basic plugin sample
s.jodogne@gmail.com
parents: 3206
diff changeset
323 DicomWebBinaryCallback);
3205
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
324 if (first)
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
325 {
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
326 printf("[%s]\n", json);
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
327 first = 0; /* Only print the first DICOM instance */
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
328 }
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
329 OrthancPluginFreeString(context, json);
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
330
6c86d4d407da new in plugin sdk: OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3179
diff changeset
331
1627
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
332 return OrthancPluginErrorCode_Success;
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
333 }
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
334
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
335
1627
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
336 ORTHANC_PLUGINS_API OrthancPluginErrorCode OnChangeCallback(OrthancPluginChangeType changeType,
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
337 OrthancPluginResourceType resourceType,
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
338 const char* resourceId)
1191
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
339 {
3216
c9a71eb4edcf fix basic plugin sample
s.jodogne@gmail.com
parents: 3206
diff changeset
340 char info[1024];
c9a71eb4edcf fix basic plugin sample
s.jodogne@gmail.com
parents: 3206
diff changeset
341
2957
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
342 OrthancPluginMemoryBuffer tmp;
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
343 memset(&tmp, 0, sizeof(tmp));
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
344
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
345 sprintf(info, "Change %d on resource %s of type %d", changeType,
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
346 (resourceId == NULL ? "<none>" : resourceId), resourceType);
1191
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
347 OrthancPluginLogWarning(context, info);
1199
a843ee8bb903 separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1191
diff changeset
348
2957
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
349 switch (changeType)
1199
a843ee8bb903 separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1191
diff changeset
350 {
2957
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
351 case OrthancPluginChangeType_NewInstance:
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
352 {
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
353 sprintf(info, "/instances/%s/metadata/AnonymizedFrom", resourceId);
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
354 if (OrthancPluginRestApiGet(context, &tmp, info) == 0)
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
355 {
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
356 sprintf(info, " Instance %s comes from the anonymization of instance", resourceId);
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
357 strncat(info, (const char*) tmp.data, tmp.size);
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
358 OrthancPluginLogWarning(context, info);
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
359 OrthancPluginFreeMemoryBuffer(context, &tmp);
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
360 }
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
361
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
362 break;
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
363 }
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
364
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
365 case OrthancPluginChangeType_OrthancStarted:
1199
a843ee8bb903 separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1191
diff changeset
366 {
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
367 OrthancPluginSetMetricsValue(context, "sample_started", 1, OrthancPluginMetricsType_Default);
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
368
2957
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
369 /* Make REST requests to the built-in Orthanc API */
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
370 OrthancPluginRestApiGet(context, &tmp, "/changes");
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
371 OrthancPluginFreeMemoryBuffer(context, &tmp);
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
372 OrthancPluginRestApiGet(context, &tmp, "/changes?limit=1");
1199
a843ee8bb903 separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1191
diff changeset
373 OrthancPluginFreeMemoryBuffer(context, &tmp);
2957
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
374
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
375 /* Play with PUT by defining a new target modality. */
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
376 sprintf(info, "[ \"STORESCP\", \"localhost\", 2000 ]");
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
377 OrthancPluginRestApiPut(context, &tmp, "/modalities/demo", info, strlen(info));
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
378
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
379 break;
1199
a843ee8bb903 separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1191
diff changeset
380 }
2957
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
381
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
382 case OrthancPluginChangeType_OrthancStopped:
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
383 OrthancPluginLogWarning(context, "Orthanc has stopped");
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
384 break;
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
385
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
386 default:
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
387 break;
1199
a843ee8bb903 separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1191
diff changeset
388 }
a843ee8bb903 separated thread for change callbacks in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1191
diff changeset
389
1627
da7854deb662 Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1425
diff changeset
390 return OrthancPluginErrorCode_Success;
1191
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
391 }
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
392
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
393
1962
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
394 ORTHANC_PLUGINS_API int32_t FilterIncomingHttpRequest(OrthancPluginHttpMethod method,
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
395 const char* uri,
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
396 const char* ip,
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
397 uint32_t headersCount,
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
398 const char* const* headersKeys,
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
399 const char* const* headersValues)
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
400 {
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
401 uint32_t i;
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
402
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
403 if (headersCount > 0)
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
404 {
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
405 OrthancPluginLogInfo(context, "HTTP headers of an incoming REST request:");
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
406 for (i = 0; i < headersCount; i++)
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
407 {
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
408 char info[1024];
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
409 sprintf(info, " %s: %s", headersKeys[i], headersValues[i]);
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
410 OrthancPluginLogInfo(context, info);
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
411 }
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
412 }
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
413
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
414 if (method == OrthancPluginHttpMethod_Get ||
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
415 method == OrthancPluginHttpMethod_Post)
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
416 {
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
417 return 1; /* Allowed */
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
418 }
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
419 else
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
420 {
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
421 return 0; /* Only allow GET and POST requests */
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
422 }
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
423 }
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
424
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
425
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
426 ORTHANC_PLUGINS_API void RefreshMetrics()
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
427 {
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
428 static unsigned int count = 0;
3216
c9a71eb4edcf fix basic plugin sample
s.jodogne@gmail.com
parents: 3206
diff changeset
429 OrthancPluginSetMetricsValue(context, "sample_counter",
c9a71eb4edcf fix basic plugin sample
s.jodogne@gmail.com
parents: 3206
diff changeset
430 (float) (count++), OrthancPluginMetricsType_Default);
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
431 }
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
432
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
433
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
434 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 {
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
436 char info[1024], *s;
1280
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
437 int counter, i;
1861
a7bea843a7bc "OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
438 OrthancPluginDictionaryEntry entry;
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
439
1040
d06186cdc502 check plugin version in samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1039
diff changeset
440 context = c;
d06186cdc502 check plugin version in samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1039
diff changeset
441 OrthancPluginLogWarning(context, "Sample plugin is initializing");
d06186cdc502 check plugin version in samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1039
diff changeset
442
d06186cdc502 check plugin version in samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1039
diff changeset
443 /* Check the version of the Orthanc core */
1039
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
444 if (OrthancPluginCheckVersion(c) == 0)
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
445 {
1040
d06186cdc502 check plugin version in samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1039
diff changeset
446 sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin",
1039
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
447 c->orthancVersion,
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
448 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
449 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
450 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
1040
d06186cdc502 check plugin version in samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1039
diff changeset
451 OrthancPluginLogError(context, info);
1039
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
452 return -1;
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
453 }
5a5a4890ffca check version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 913
diff changeset
454
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
455 /* Print some information about Orthanc */
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 sprintf(info, "The version of Orthanc is '%s'", context->orthancVersion);
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
457 OrthancPluginLogWarning(context, info);
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
458
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
459 s = OrthancPluginGetOrthancPath(context);
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
460 sprintf(info, " Path to Orthanc: %s", s);
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
461 OrthancPluginLogWarning(context, info);
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
462 OrthancPluginFreeString(context, s);
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
464 s = OrthancPluginGetOrthancDirectory(context);
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
465 sprintf(info, " Directory of Orthanc: %s", s);
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
466 OrthancPluginLogWarning(context, info);
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
467 OrthancPluginFreeString(context, s);
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
468
1425
97268448bdfc refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1375
diff changeset
469 s = OrthancPluginGetConfiguration(context);
97268448bdfc refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1375
diff changeset
470 sprintf(info, " Content of the configuration file:\n");
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
471 OrthancPluginLogWarning(context, info);
1425
97268448bdfc refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1375
diff changeset
472 OrthancPluginLogWarning(context, s);
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
473 OrthancPluginFreeString(context, s);
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
474
1280
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
475 /* Print the command-line arguments of Orthanc */
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
476 counter = OrthancPluginGetCommandLineArgumentsCount(context);
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
477 for (i = 0; i < counter; i++)
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
478 {
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
479 s = OrthancPluginGetCommandLineArgument(context, i);
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
480 sprintf(info, " Command-line argument %d: \"%s\"", i, s);
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
481 OrthancPluginLogWarning(context, info);
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
482 OrthancPluginFreeString(context, s);
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
483 }
d6a65dc6d0ac Plugins can access the command-line arguments used to launch Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1249
diff changeset
484
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1137
diff changeset
485 /* Register the callbacks */
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
486 OrthancPluginRegisterRestCallback(context, "/(plu.*)/hello", Callback1);
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
487 OrthancPluginRegisterRestCallback(context, "/plu.*/image", Callback2);
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
488 OrthancPluginRegisterRestCallback(context, "/plugin/instances/([^/]+)/info", Callback3);
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
489 OrthancPluginRegisterRestCallback(context, "/instances/([^/]+)/preview", Callback4);
1282
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
490 OrthancPluginRegisterRestCallback(context, "/forward/(built-in)(/.+)", Callback5);
7bccdd221e2b Plugins can do REST calls to other plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1280
diff changeset
491 OrthancPluginRegisterRestCallback(context, "/forward/(plugins)(/.+)", Callback5);
1137
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
492 OrthancPluginRegisterRestCallback(context, "/plugin/create", CallbackCreateDicom);
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 903
diff changeset
493
1066
bb82e5e818e9 OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1044
diff changeset
494 OrthancPluginRegisterOnStoredInstanceCallback(context, OnStoredCallback);
1191
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
495 OrthancPluginRegisterOnChangeCallback(context, OnChangeCallback);
1962
22ddb22fce83 sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
496 OrthancPluginRegisterIncomingHttpRequestFilter(context, FilterIncomingHttpRequest);
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
497 OrthancPluginRegisterRefreshMetricsCallback(context, RefreshMetrics);
1191
d49505e377e3 demo of OnChangeCallback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1145
diff changeset
498
3179
fca730c267d7 New primitives to set and refresh metrics
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
499
1232
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1200
diff changeset
500 /* Declare several properties of the plugin */
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1200
diff changeset
501 OrthancPluginSetRootUri(context, "/plugin/hello");
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1200
diff changeset
502 OrthancPluginSetDescription(context, "This is the description of the sample plugin that can be seen in Orthanc Explorer.");
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1200
diff changeset
503 OrthancPluginExtendOrthancExplorer(context, "alert('Hello Orthanc! From sample plugin with love.');");
f1c01451a8ee Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1200
diff changeset
504
2957
ccf61f6e22ef New function in the SDK: "OrthancPluginSetHttpErrorDetails()"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
505 customError = OrthancPluginRegisterErrorCode(context, 4, 402, "Hello world");
1137
d9c27f9f1a51 OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1067
diff changeset
506
1657
5360cdba70d8 New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
507 OrthancPluginRegisterDictionaryTag(context, 0x0014, 0x1020, OrthancPluginValueRepresentation_DA,
5360cdba70d8 New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
508 "ValidationExpiryDate", 1, 1);
5360cdba70d8 New function "OrthancPluginRegisterDictionaryTag()" to declare DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
509
1861
a7bea843a7bc "OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
510 OrthancPluginLookupDictionary(context, &entry, "ValidationExpiryDate");
a7bea843a7bc "OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
511 OrthancPluginLookupDictionary(context, &entry, "0010-0010");
a7bea843a7bc "OrthancPluginLookupDictionary()" to get information about some DICOM tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
512
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513 return 0;
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514 }
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 ORTHANC_PLUGINS_API void OrthancPluginFinalize()
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 {
903
06b9a30f1e6d fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 902
diff changeset
519 OrthancPluginLogWarning(context, "Sample plugin is finalizing");
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520 }
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522
888
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
523 ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
524 {
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
525 return "sample";
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
526 }
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
527
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
528
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
529 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion()
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
530 {
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
531 return "1.0";
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
532 }
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
533