annotate Plugins/OrthancCPlugin/OrthancCPlugin.h @ 904:2732b5f57d9c plugins

sample to forward dicom data
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Jun 2014 16:07:47 +0200
parents 7d88f3f4a3b3
children cbc0ea03dffe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
1 /**
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
2 * @defgroup CInterface C Interface
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
3 * @brief The C interface to create Orthanc plugins.
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
4 *
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
5 * These functions must be used to create C plugins for Orthanc.
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
6 **/
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
7
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
8
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 /**
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * Orthanc - A Lightweight, RESTful DICOM Store
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * Belgium
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is free software: you can redistribute it and/or
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * modify it under the terms of the GNU General Public License as
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * published by the Free Software Foundation, either version 3 of the
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * License, or (at your option) any later version.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * In addition, as a special exception, the copyright holders of this
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * program give permission to link the code of its release with the
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * OpenSSL project's "OpenSSL" library (or with modified versions of it
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * that use the same license as the "OpenSSL" library), and distribute
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * the linked executables. You must obey the GNU General Public License
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * in all respects for all of the code used other than "OpenSSL". If you
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * modify file(s) with this exception, you may extend this exception to
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * your version of the file(s), but you are not obligated to do so. If
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * you do not wish to do so, delete this exception statement from your
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * version. If you delete this exception statement from all source files
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * in the program, then also delete it here.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 * This program is distributed in the hope that it will be useful, but
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 * WITHOUT ANY WARRANTY; without even the implied warranty of
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 * General Public License for more details.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 *
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 * You should have received a copy of the GNU General Public License
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 **/
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 #pragma once
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
44 #include <stdio.h>
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
45 #include <string.h>
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
46
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 #ifdef WIN32
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 #define ORTHANC_PLUGINS_API __declspec(dllexport)
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 #else
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 #define ORTHANC_PLUGINS_API
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 #endif
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
54
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
55 /********************************************************************
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
56 ** Check that function inlining is properly supported. The use of
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
57 ** inlining is required, to avoid the duplication of object code
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
58 ** between two compilation modules that would use the Orthanc Plugin
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
59 ** API.
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
60 ********************************************************************/
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
61
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
62 /* If the auto-detection of the "inline" keyword below does not work
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
63 automatically and that your compiler is known to properly support
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
64 inlining, uncomment the following #define and adapt the definition
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
65 of "static inline". */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
66
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
67 /* #define ORTHANC_PLUGIN_INLINE static inline */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
68
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
69 #ifndef ORTHANC_PLUGIN_INLINE
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
70 # if __STDC_VERSION__ >= 199901L
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
71 /* This is C99 or above: http://predef.sourceforge.net/prestd.html */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
72 # define ORTHANC_PLUGIN_INLINE static inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
73 # elif defined(__cplusplus)
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
74 /* This is C++ */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
75 # define ORTHANC_PLUGIN_INLINE static inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
76 # elif defined(__GNUC__)
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
77 /* This is GCC running in C89 mode */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
78 # define ORTHANC_PLUGIN_INLINE static __inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
79 # elif defined(_MSC_VER)
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
80 /* This is Visual Studio running in C89 mode */
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
81 # define ORTHANC_PLUGIN_INLINE static __inline
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
82 # else
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
83 # error Your compiler is not known to support the "inline" keyword
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
84 # endif
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
85 #endif
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
86
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
87
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
88
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
89 /********************************************************************
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
90 ** Inclusion of standard libaries.
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
91 ********************************************************************/
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
92
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
93 #ifdef _MSC_VER
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
94 #include "../../Resources/VisualStudio/stdint.h"
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
95 #else
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
96 #include <stdint.h>
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
97 #endif
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
98
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 #include <stdlib.h>
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
102
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
103 /********************************************************************
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
104 ** Definition of the Orthanc Plugin API.
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
105 ********************************************************************/
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
106
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
107 /** @{ */
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
108
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 #ifdef __cplusplus
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 extern "C"
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 {
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 #endif
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
114 typedef enum
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
115 {
896
c4053ac5db04 better plugni api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 894
diff changeset
116 OrthancPluginHttpMethod_Get = 1,
c4053ac5db04 better plugni api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 894
diff changeset
117 OrthancPluginHttpMethod_Post = 2,
c4053ac5db04 better plugni api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 894
diff changeset
118 OrthancPluginHttpMethod_Put = 3,
c4053ac5db04 better plugni api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 894
diff changeset
119 OrthancPluginHttpMethod_Delete = 4
c4053ac5db04 better plugni api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 894
diff changeset
120 } OrthancPluginHttpMethod;
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
122 typedef struct
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
123 {
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
124 OrthancPluginHttpMethod method;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
125
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
126 /* Groups of the regular expression */
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
127 const char* const* groups;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
128 uint32_t groupsCount;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
129
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
130 /* For GET requests */
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
131 const char* const* getKeys;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
132 const char* const* getValues;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
133 uint32_t getCount;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
134
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
135 /* For POST and PUT requests */
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
136 const char* body;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
137 uint32_t bodySize;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
138 } OrthancPluginHttpRequest;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
139
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
140 typedef enum
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 {
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
142 /* Generic services */
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
143 OrthancPluginService_LogInfo = 1,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
144 OrthancPluginService_LogWarning = 2,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
145 OrthancPluginService_LogError = 3,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
146
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
147 /* Registration of callbacks */
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
148 OrthancPluginService_RegisterRestCallback = 1000,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
149
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
150 /* Sending answers to REST calls */
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
151 OrthancPluginService_AnswerBuffer = 2000,
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
152 OrthancPluginService_CompressAndAnswerPngImage = 2001,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
153
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
154 /* Access to the Orthanc database */
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
155 OrthancPluginService_GetDicomForInstance = 3000
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
156 } OrthancPluginService;
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
157
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
158
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
159
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
160 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
161 * The memory layout of the pixels of an image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
162 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
163 typedef enum
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
164 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
165 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
166 * @brief Graylevel 8bpp image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
167 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
168 * The image is graylevel. Each pixel is unsigned and stored in
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
169 * one byte.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
170 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
171 OrthancPluginPixelFormat_Grayscale8 = 1,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
172
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
173 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
174 * @brief Graylevel, unsigned 16bpp image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
175 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
176 * The image is graylevel. Each pixel is unsigned and stored in
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
177 * two bytes.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
178 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
179 OrthancPluginPixelFormat_Grayscale16 = 2,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
180
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
181 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
182 * @brief Graylevel, signed 16bpp image.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
183 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
184 * The image is graylevel. Each pixel is signed and stored in two
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
185 * bytes.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
186 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
187 OrthancPluginPixelFormat_SignedGrayscale16 = 3,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
188
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
189 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
190 * @brief Color image in RGB24 format.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
191 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
192 * This format describes a color image. The pixels are stored in 3
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
193 * consecutive bytes. The memory layout is RGB.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
194 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
195 OrthancPluginPixelFormat_RGB24 = 4,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
196
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
197 /**
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
198 * @brief Color image in RGBA32 format.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
199 *
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
200 * This format describes a color image. The pixels are stored in 4
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
201 * consecutive bytes. The memory layout is RGBA.
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
202 **/
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
203 OrthancPluginPixelFormat_RGBA32 = 5
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
204 } OrthancPluginPixelFormat;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
205
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
206
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
207 typedef struct
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
208 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
209 void* data;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
210 uint32_t size;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
211 } OrthancPluginMemoryBuffer;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
212
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
213
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
214
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
215
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
216 typedef struct _OrthancPluginRestOutput_t OrthancPluginRestOutput;
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
217
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
218 typedef int32_t (*OrthancPluginRestCallback) (
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
219 OrthancPluginRestOutput* output,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
220 const char* url,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
221 const OrthancPluginHttpRequest* request);
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
222
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
223 typedef struct _OrthancPluginContext_t
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
224 {
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
225 void* pluginsManager;
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
226 const char* orthancVersion;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
227 void (*Free) (void* buffer);
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
228 int32_t (*InvokeService) (struct _OrthancPluginContext_t* context,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
229 OrthancPluginService service,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
230 const void* params);
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
231 } OrthancPluginContext;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
232
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
234 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString(
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
235 OrthancPluginContext* context,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
236 char* str)
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
237 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
238 context->Free(str);
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
239 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
240
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
241
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
242 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeMemoryBuffer(
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
243 OrthancPluginContext* context,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
244 OrthancPluginMemoryBuffer* buffer)
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
245 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
246 context->Free(buffer->data);
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
247 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
248
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
249
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
250 ORTHANC_PLUGIN_INLINE void OrthancPluginLogError(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
251 OrthancPluginContext* context,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
252 const char* str)
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
253 {
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
254 context->InvokeService(context, OrthancPluginService_LogError, str);
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
255 }
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
256
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
257
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
258 ORTHANC_PLUGIN_INLINE void OrthancPluginLogWarning(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
259 OrthancPluginContext* context,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
260 const char* str)
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
261 {
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
262 context->InvokeService(context, OrthancPluginService_LogWarning, str);
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
263 }
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
264
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
265
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
266 ORTHANC_PLUGIN_INLINE void OrthancPluginLogInfo(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
267 OrthancPluginContext* context,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
268 const char* str)
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
269 {
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
270 context->InvokeService(context, OrthancPluginService_LogInfo, str);
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
271 }
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
272
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
273
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
274 typedef struct
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
275 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
276 const char* pathRegularExpression;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
277 OrthancPluginRestCallback callback;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
278 } _OrthancPluginRestCallback;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
279
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
280
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
281 ORTHANC_PLUGIN_INLINE void OrthancPluginRegisterRestCallback(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
282 OrthancPluginContext* context,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
283 const char* pathRegularExpression,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
284 OrthancPluginRestCallback callback)
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
285 {
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
286 _OrthancPluginRestCallback params;
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
287 params.pathRegularExpression = pathRegularExpression;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
288 params.callback = callback;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
289 context->InvokeService(context, OrthancPluginService_RegisterRestCallback, &params);
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
290 }
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
291
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
292
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
293 typedef struct
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
294 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
295 OrthancPluginRestOutput* output;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
296 const char* answer;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
297 uint32_t answerSize;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
298 const char* mimeType;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
299 } _OrthancPluginAnswerBuffer;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
300
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
301 ORTHANC_PLUGIN_INLINE void OrthancPluginAnswerBuffer(
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
302 OrthancPluginContext* context,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
303 OrthancPluginRestOutput* output,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
304 const char* answer,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
305 uint32_t answerSize,
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
306 const char* mimeType)
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
307 {
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
308 _OrthancPluginAnswerBuffer params;
899
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
309 params.output = output;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
310 params.answer = answer;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
311 params.answerSize = answerSize;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
312 params.mimeType = mimeType;
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
313 context->InvokeService(context, OrthancPluginService_AnswerBuffer, &params);
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
314 }
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
315
bb0a51561016 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 898
diff changeset
316
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
317 typedef struct
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
318 {
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
319 OrthancPluginRestOutput* output;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
320 OrthancPluginPixelFormat format;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
321 uint32_t width;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
322 uint32_t height;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
323 uint32_t pitch;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
324 const void* buffer;
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
325 } _OrthancPluginCompressAndAnswerPngImage;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
326
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
327 ORTHANC_PLUGIN_INLINE void OrthancPluginCompressAndAnswerPngImage(
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
328 OrthancPluginContext* context,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
329 OrthancPluginRestOutput* output,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
330 OrthancPluginPixelFormat format,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
331 uint32_t width,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
332 uint32_t height,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
333 uint32_t pitch,
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
334 const void* buffer)
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
335 {
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
336 _OrthancPluginCompressAndAnswerPngImage params;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
337 params.output = output;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
338 params.format = format;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
339 params.width = width;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
340 params.height = height;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
341 params.pitch = pitch;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
342 params.buffer = buffer;
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
343 context->InvokeService(context, OrthancPluginService_CompressAndAnswerPngImage, &params);
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
344 }
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
345
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 900
diff changeset
346
904
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
347 typedef struct
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
348 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
349 OrthancPluginMemoryBuffer* target;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
350 const char* instanceId;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
351 } _OrthancPluginGetDicomForInstance;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
352
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
353 ORTHANC_PLUGIN_INLINE int OrthancPluginGetDicomForInstance(
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
354 OrthancPluginContext* context,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
355 OrthancPluginMemoryBuffer* target,
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
356 const char* instanceId)
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
357 {
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
358 _OrthancPluginGetDicomForInstance params;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
359 params.target = target;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
360 params.instanceId = instanceId;
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
361 return context->InvokeService(context, OrthancPluginService_GetDicomForInstance, &params);
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
362 }
2732b5f57d9c sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 901
diff changeset
363
898
7000fc86fe62 improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 897
diff changeset
364
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 /**
894
690aeb4cb899 REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 888
diff changeset
366 Each plugin must define 4 functions, whose signature are:
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 - int32_t OrthancPluginInitialize(const OrthancPluginContext*);
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 - void OrthancPluginFinalize();
888
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
369 - const char* OrthancPluginGetName();
d44b845c1c89 recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 886
diff changeset
370 - const char* OrthancPluginGetVersion();
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 nm -C -D --defined-only libPluginTest.so
896
c4053ac5db04 better plugni api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 894
diff changeset
373 **/
886
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 #ifdef __cplusplus
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 }
29087d728e0a plugin sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 #endif
900
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
378
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
379
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
380 /** @} */
1b92ce45cc8d plugin doc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 899
diff changeset
381