Mercurial > hg > orthanc
annotate Plugins/Samples/Basic/Plugin.c @ 1029:9e04f9f36096
fix windows build
author | jodogne |
---|---|
date | Thu, 10 Jul 2014 13:54:00 +0200 |
parents | 3e43de893d88 |
children | 5a5a4890ffca |
rev | line source |
---|---|
886 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege, | |
4 * Belgium | |
5 * | |
6 * Permission is hereby granted, free of charge, to any person | |
7 * obtaining a copy of this software and associated documentation | |
8 * files (the "Software"), to deal in the Software without | |
9 * restriction, including without limitation the rights to use, copy, | |
10 * modify, merge, publish, distribute, sublicense, and/or sell copies | |
11 * of the Software, and to permit persons to whom the Software is | |
12 * furnished to do so, subject to the following conditions: | |
13 * | |
14 * The above copyright notice and this permission notice shall be | |
15 * included in all copies or substantial portions of the Software. | |
16 * | |
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | |
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | |
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
24 * SOFTWARE. | |
25 **/ | |
26 | |
27 | |
896 | 28 #include <OrthancCPlugin.h> |
886 | 29 |
30 #include <string.h> | |
31 #include <stdio.h> | |
32 | |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
33 static OrthancPluginContext* context = NULL; |
886 | 34 |
35 | |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
36 ORTHANC_PLUGINS_API int32_t Callback1(OrthancPluginRestOutput* output, |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
37 const char* url, |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
38 const OrthancPluginHttpRequest* request) |
894 | 39 { |
40 char buffer[1024]; | |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
896
diff
changeset
|
41 uint32_t i; |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
896
diff
changeset
|
42 |
899 | 43 sprintf(buffer, "Callback on URL [%s] with body [%s]", url, request->body); |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
44 OrthancPluginLogInfo(context, buffer); |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
896
diff
changeset
|
45 |
899 | 46 OrthancPluginAnswerBuffer(context, output, buffer, strlen(buffer), "text/plain"); |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
896
diff
changeset
|
47 |
899 | 48 for (i = 0; i < request->getCount; i++) |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
896
diff
changeset
|
49 { |
899 | 50 sprintf(buffer, " [%s] = [%s]", request->getKeys[i], request->getValues[i]); |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
51 OrthancPluginLogInfo(context, buffer); |
897
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
896
diff
changeset
|
52 } |
bafc9d592632
REST callbacks are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
896
diff
changeset
|
53 |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
54 printf("** %d\n", request->groupsCount); |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
55 for (i = 0; i < request->groupsCount; i++) |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
56 { |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
57 printf("** [%s]\n", request->groups[i]); |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
58 } |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
59 |
894 | 60 return 1; |
61 } | |
62 | |
63 | |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
64 ORTHANC_PLUGINS_API int32_t Callback2(OrthancPluginRestOutput* output, |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
65 const char* url, |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
66 const OrthancPluginHttpRequest* request) |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
67 { |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
68 /* 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
|
69 |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
70 uint16_t buffer[256 * 256]; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
71 uint32_t x, y, value; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
72 |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
73 value = 0; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
74 for (y = 0; y < 256; y++) |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
75 { |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
76 for (x = 0; x < 256; x++, value++) |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
77 { |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
78 buffer[value] = value; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
79 } |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
80 } |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
81 |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
82 OrthancPluginCompressAndAnswerPngImage(context, output, OrthancPluginPixelFormat_Grayscale16, |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
83 256, 256, sizeof(uint16_t) * 256, buffer); |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
84 return 0; |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
85 } |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
86 |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
87 |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
88 ORTHANC_PLUGINS_API int32_t Callback3(OrthancPluginRestOutput* output, |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
89 const char* url, |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
90 const OrthancPluginHttpRequest* request) |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
91 { |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
92 OrthancPluginMemoryBuffer dicom; |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
93 if (!OrthancPluginGetDicomForInstance(context, &dicom, request->groups[0])) |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
94 { |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
95 /* No error, forward the DICOM file */ |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
96 OrthancPluginAnswerBuffer(context, output, dicom.data, dicom.size, "application/dicom"); |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
97 |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
98 /* Free memory */ |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
99 OrthancPluginFreeMemoryBuffer(context, &dicom); |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
100 } |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
101 |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
102 return 0; |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
103 } |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
104 |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
105 |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
106 ORTHANC_PLUGINS_API int32_t Callback4(OrthancPluginRestOutput* output, |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
107 const char* url, |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
108 const OrthancPluginHttpRequest* request) |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
109 { |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
110 /* Answer with a sample 8bpp image. */ |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
111 |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
112 uint8_t buffer[256 * 256]; |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
113 uint32_t x, y, value; |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
114 |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
115 value = 0; |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
116 for (y = 0; y < 256; y++) |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
117 { |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
118 for (x = 0; x < 256; x++, value++) |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
119 { |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
120 buffer[value] = x; |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
121 } |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
122 } |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
123 |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
124 OrthancPluginCompressAndAnswerPngImage(context, output, OrthancPluginPixelFormat_Grayscale8, |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
125 256, 256, 256, buffer); |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
126 return 0; |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
127 } |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
128 |
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
129 |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
130 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c) |
886 | 131 { |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
132 const char* pathLocator = "\"Path\" : \""; |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
904
diff
changeset
|
133 OrthancPluginMemoryBuffer tmp; |
894 | 134 char info[1024]; |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
135 char *id, *eos; |
894 | 136 |
886 | 137 context = c; |
903 | 138 OrthancPluginLogWarning(context, "Sample plugin is initializing"); |
886 | 139 |
140 sprintf(info, "The version of Orthanc is '%s'", context->orthancVersion); | |
898
7000fc86fe62
improved plugin api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
897
diff
changeset
|
141 OrthancPluginLogInfo(context, info); |
886 | 142 |
901
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
143 OrthancPluginRegisterRestCallback(context, "/(plu.*)/hello", Callback1); |
7d88f3f4a3b3
refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
899
diff
changeset
|
144 OrthancPluginRegisterRestCallback(context, "/plu.*/image", Callback2); |
904
2732b5f57d9c
sample to forward dicom data
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
903
diff
changeset
|
145 OrthancPluginRegisterRestCallback(context, "/plugin/instances/([^/]+)/info", Callback3); |
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 OrthancPluginRegisterRestCallback(context, "/instances/([^/]+)/preview", Callback4); |
886 | 148 |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
149 /* Make REST requests to the built-in Orthanc API */ |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
150 OrthancPluginRestApiGet(context, &tmp, "/changes"); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
151 OrthancPluginFreeMemoryBuffer(context, &tmp); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
152 OrthancPluginRestApiGet(context, &tmp, "/changes?limit=1"); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
904
diff
changeset
|
153 OrthancPluginFreeMemoryBuffer(context, &tmp); |
913
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
154 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
155 /* Make POST request to create a new DICOM instance */ |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
156 sprintf(info, "{\"PatientName\":\"Test\"}"); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
157 OrthancPluginRestApiPost(context, &tmp, "/tools/create-dicom", info, strlen(info)); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
158 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
159 /** |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
160 * Recover he ID of the created instance is constructed by a |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
161 * quick-and-dirty parsing of a JSON string. |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
162 **/ |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
163 id = strstr((char*) tmp.data, pathLocator) + strlen(pathLocator); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
164 eos = strchr(id, '\"'); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
165 eos[0] = '\0'; |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
166 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
167 /* Delete the newly created DICOM instance. */ |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
168 OrthancPluginRestApiDelete(context, id); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
169 OrthancPluginFreeMemoryBuffer(context, &tmp); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
170 |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
171 /* Play with PUT by defining a new target modality. */ |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
172 sprintf(info, "[ \"STORESCP\", \"localhost\", 2000 ]"); |
3e43de893d88
POST, DELETE, PUT from Orthanc plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
173 OrthancPluginRestApiPut(context, &tmp, "/modalities/demo", info, strlen(info)); |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
904
diff
changeset
|
174 |
886 | 175 return 0; |
176 } | |
177 | |
178 | |
179 ORTHANC_PLUGINS_API void OrthancPluginFinalize() | |
180 { | |
903 | 181 OrthancPluginLogWarning(context, "Sample plugin is finalizing"); |
886 | 182 } |
183 | |
184 | |
888
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
185 ORTHANC_PLUGINS_API const char* OrthancPluginGetName() |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
186 { |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
187 return "sample"; |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
188 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
189 |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
190 |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
191 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion() |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
192 { |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
193 return "1.0"; |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
194 } |
d44b845c1c89
recursive scan for plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
886
diff
changeset
|
195 |