annotate Plugins/Samples/CustomImageDecoder/Plugin.cpp @ 3346:f509d3c6d570

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