annotate OrthancServer/Plugins/Samples/AutomatedJpeg2kCompression/Plugin.cpp @ 4833:970092a67897

fix PrintVersion()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 25 Nov 2021 19:05:41 +0100
parents 7053502fbf97
children 43e613a7756b
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
4437
d9473bd5ed43 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
4831
7053502fbf97 added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1816
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * 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
9 * 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
10 * 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
11 * License, or (at your option) any later version.
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * 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
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * 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
16 * General Public License for more details.
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * 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
19 * 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
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #include <orthanc/OrthancCPlugin.h>
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include <string>
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 static OrthancPluginContext* context_ = NULL;
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 static bool ReadFile(std::string& result,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 const std::string& path)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 OrthancPluginMemoryBuffer tmp;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 if (OrthancPluginReadFile(context_, &tmp, path.c_str()) == OrthancPluginErrorCode_Success)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 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
37 OrthancPluginFreeMemoryBuffer(context_, &tmp);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 return true;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 else
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 return false;
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
3984
4769db115a02 fix Plugins/Samples/AutomatedJpeg2kCompression/Plugin.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
47 OrthancPluginErrorCode OnStoredCallback(const OrthancPluginDicomInstance* instance,
1816
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 const char* instanceId)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 char buffer[1024];
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 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
52 (int) OrthancPluginGetInstanceSize(context_, instance), instanceId,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 OrthancPluginGetInstanceOrigin(context_, instance),
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 OrthancPluginGetInstanceRemoteAet(context_, instance));
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 OrthancPluginLogInfo(context_, buffer);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 if (OrthancPluginGetInstanceOrigin(context_, instance) == OrthancPluginInstanceOrigin_Plugin)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 // Do not compress twice the same file
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 return OrthancPluginErrorCode_Success;
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 // Write the uncompressed DICOM content to some temporary file
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 std::string uncompressed = "uncompressed-" + std::string(instanceId) + ".dcm";
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 OrthancPluginErrorCode error = OrthancPluginWriteFile(context_, uncompressed.c_str(),
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 OrthancPluginGetInstanceData(context_, instance),
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 OrthancPluginGetInstanceSize(context_, instance));
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 if (error)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 return error;
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 // Remove the original DICOM instance
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 std::string uri = "/instances/" + std::string(instanceId);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 error = OrthancPluginRestApiDelete(context_, uri.c_str());
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 if (error)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 return error;
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 // 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
82 std::string compressed = "compressed-" + std::string(instanceId) + ".dcm";
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 // Compress to JPEG2000 using gdcm
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 std::string command1 = "gdcmconv --j2k " + uncompressed + " " + compressed;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 // 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
88 // does not do this by itself
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 std::string command2 = "dcmodify --no-backup -gin " + compressed;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 // Make the required system calls
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 system(command1.c_str());
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 system(command2.c_str());
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 // Read the result of the JPEG2000 compression
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 std::string j2k;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 bool ok = ReadFile(j2k, compressed);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 // Remove the two temporary files
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 remove(compressed.c_str());
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 remove(uncompressed.c_str());
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 if (!ok)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 return OrthancPluginErrorCode_Plugin;
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 // Upload the JPEG2000 file through the REST API
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 OrthancPluginMemoryBuffer tmp;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 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
111 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 ok = false;
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 if (ok)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 OrthancPluginFreeMemoryBuffer(context_, &tmp);
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 return ok ? OrthancPluginErrorCode_Success : OrthancPluginErrorCode_Plugin;
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 extern "C"
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 context_ = c;
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 /* Check the version of the Orthanc core */
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 if (OrthancPluginCheckVersion(c) == 0)
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 char info[1024];
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 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
135 context_->orthancVersion,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 OrthancPluginLogError(context_, info);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 return -1;
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 OrthancPluginRegisterOnStoredInstanceCallback(context_, OnStoredCallback);
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 return 0;
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 ORTHANC_PLUGINS_API void OrthancPluginFinalize()
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 return "sample-jpeg2k";
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
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion()
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 {
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 return "0.0";
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 }
87c069c94ac9 plugin sample: automated jpeg2k compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }