annotate Plugins/Samples/AutomatedJpeg2kCompression/Plugin.cpp @ 3092:fc57988dbfd8 db-changes

new extension for database plugin SDK: getChildrenMetadata
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 05 Jan 2019 15:50:55 +0100
parents 4e43e67f8ecf
children 94f4a18a79cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1816
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1816
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1816
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
3060
4e43e67f8ecf preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
1816
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * General Public License for more details.
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #include <orthanc/OrthancCPlugin.h>
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include <string>
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 static OrthancPluginContext* context_ = NULL;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 static bool ReadFile(std::string& result,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 const std::string& path)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 OrthancPluginMemoryBuffer tmp;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 if (OrthancPluginReadFile(context_, &tmp, path.c_str()) == OrthancPluginErrorCode_Success)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 result.assign(reinterpret_cast<const char*>(tmp.data), tmp.size);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 OrthancPluginFreeMemoryBuffer(context_, &tmp);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 return true;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 else
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 return false;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 OrthancPluginErrorCode OnStoredCallback(OrthancPluginDicomInstance* instance,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 const char* instanceId)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 char buffer[1024];
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 sprintf(buffer, "Just received a DICOM instance of size %d and ID %s from origin %d (AET %s)",
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 (int) OrthancPluginGetInstanceSize(context_, instance), instanceId,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 OrthancPluginGetInstanceOrigin(context_, instance),
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 OrthancPluginGetInstanceRemoteAet(context_, instance));
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 OrthancPluginLogInfo(context_, buffer);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 if (OrthancPluginGetInstanceOrigin(context_, instance) == OrthancPluginInstanceOrigin_Plugin)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 // Do not compress twice the same file
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 return OrthancPluginErrorCode_Success;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 // Write the uncompressed DICOM content to some temporary file
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 std::string uncompressed = "uncompressed-" + std::string(instanceId) + ".dcm";
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 OrthancPluginErrorCode error = OrthancPluginWriteFile(context_, uncompressed.c_str(),
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 OrthancPluginGetInstanceData(context_, instance),
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 OrthancPluginGetInstanceSize(context_, instance));
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 if (error)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 return error;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 // Remove the original DICOM instance
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 std::string uri = "/instances/" + std::string(instanceId);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 error = OrthancPluginRestApiDelete(context_, uri.c_str());
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 if (error)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 return error;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 // Path to the temporary file that will contain the compressed DICOM content
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 std::string compressed = "compressed-" + std::string(instanceId) + ".dcm";
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 // Compress to JPEG2000 using gdcm
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 std::string command1 = "gdcmconv --j2k " + uncompressed + " " + compressed;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 // Generate a new SOPInstanceUID for the JPEG2000 file, as gdcmconv
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 // does not do this by itself
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 std::string command2 = "dcmodify --no-backup -gin " + compressed;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 // Make the required system calls
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 system(command1.c_str());
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 system(command2.c_str());
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 // Read the result of the JPEG2000 compression
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 std::string j2k;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 bool ok = ReadFile(j2k, compressed);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 // Remove the two temporary files
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 remove(compressed.c_str());
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 remove(uncompressed.c_str());
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 if (!ok)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 return OrthancPluginErrorCode_Plugin;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 // Upload the JPEG2000 file through the REST API
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 OrthancPluginMemoryBuffer tmp;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 if (OrthancPluginRestApiPost(context_, &tmp, "/instances", j2k.c_str(), j2k.size()))
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 ok = false;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 if (ok)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 OrthancPluginFreeMemoryBuffer(context_, &tmp);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 return ok ? OrthancPluginErrorCode_Success : OrthancPluginErrorCode_Plugin;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 extern "C"
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 context_ = c;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 /* Check the version of the Orthanc core */
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 if (OrthancPluginCheckVersion(c) == 0)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 char info[1024];
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin",
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 context_->orthancVersion,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 OrthancPluginLogError(context_, info);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 return -1;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 OrthancPluginRegisterOnStoredInstanceCallback(context_, OnStoredCallback);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 return 0;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 ORTHANC_PLUGINS_API void OrthancPluginFinalize()
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 return "sample-jpeg2k";
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion()
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 return "0.0";
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 }