Mercurial > hg > orthanc
comparison OrthancServer/Plugins/Samples/CustomImageDecoder/Plugin.cpp @ 4044:d25f4c0fa160 framework
splitting code into OrthancFramework and OrthancServer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Jun 2020 20:30:34 +0200 |
parents | Plugins/Samples/CustomImageDecoder/Plugin.cpp@94f4a18a79cc |
children | d9473bd5ed43 |
comparison
equal
deleted
inserted
replaced
4043:6c6239aec462 | 4044:d25f4c0fa160 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #include <orthanc/OrthancCPlugin.h> | |
23 | |
24 static OrthancPluginContext* context_ = NULL; | |
25 | |
26 | |
27 static OrthancPluginErrorCode DecodeImageCallback(OrthancPluginImage** target, | |
28 const void* dicom, | |
29 const uint32_t size, | |
30 uint32_t frameIndex) | |
31 { | |
32 *target = OrthancPluginCreateImage(context_, OrthancPluginPixelFormat_RGB24, 512, 512); | |
33 | |
34 memset(OrthancPluginGetImageBuffer(context_, *target), 128, | |
35 OrthancPluginGetImageHeight(context_, *target) * OrthancPluginGetImagePitch(context_, *target)); | |
36 | |
37 return OrthancPluginDrawText(context_, *target, 0, "Hello world", 100, 50, 255, 0, 0); | |
38 } | |
39 | |
40 | |
41 extern "C" | |
42 { | |
43 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c) | |
44 { | |
45 context_ = c; | |
46 | |
47 /* Check the version of the Orthanc core */ | |
48 if (OrthancPluginCheckVersion(c) == 0) | |
49 { | |
50 char info[1024]; | |
51 sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin", | |
52 context_->orthancVersion, | |
53 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, | |
54 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, | |
55 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); | |
56 OrthancPluginLogError(context_, info); | |
57 return -1; | |
58 } | |
59 | |
60 OrthancPluginRegisterDecodeImageCallback(context_, DecodeImageCallback); | |
61 | |
62 return 0; | |
63 } | |
64 | |
65 | |
66 ORTHANC_PLUGINS_API void OrthancPluginFinalize() | |
67 { | |
68 } | |
69 | |
70 | |
71 ORTHANC_PLUGINS_API const char* OrthancPluginGetName() | |
72 { | |
73 return "custom-image-decoder"; | |
74 } | |
75 | |
76 | |
77 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion() | |
78 { | |
79 return "0.0"; | |
80 } | |
81 } |