Mercurial > hg > orthanc
annotate Plugins/Samples/GdcmDecoding/Plugin.cpp @ 1026:a13ccd93df28
fix OS X build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Jul 2014 12:18:40 +0200 |
parents | 501880d76474 |
children | d06186cdc502 |
rev | line source |
---|---|
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege, |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Belgium |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * Permission is hereby granted, free of charge, to any person |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * obtaining a copy of this software and associated documentation |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * files (the "Software"), to deal in the Software without |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * restriction, including without limitation the rights to use, copy, |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * modify, merge, publish, distribute, sublicense, and/or sell copies |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * of the Software, and to permit persons to whom the Software is |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * furnished to do so, subject to the following conditions: |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * The above copyright notice and this permission notice shall be |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * included in all copies or substantial portions of the Software. |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * SOFTWARE. |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 **/ |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #include <map> |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 #include <string> |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 #include <stdexcept> |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 #include <sstream> |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 #include "OrthancContext.h" |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 #include "../../../Core/ImageFormats/ImageProcessing.h" |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #include <gdcmReader.h> |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 #include <gdcmImageReader.h> |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
38 #include <gdcmImageChangePlanarConfiguration.h> |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
39 |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
40 |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
41 static void AnswerUnsupportedImage(OrthancPluginRestOutput* output) |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
42 { |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
43 OrthancContext::GetInstance().Redirect(output, "/app/images/unsupported.png"); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
44 } |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 static bool GetOrthancPixelFormat(Orthanc::PixelFormat& format, |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 const gdcm::Image& image) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 if (image.GetPlanarConfiguration() != 0 && |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 image.GetPixelFormat().GetSamplesPerPixel() != 1) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 OrthancContext::GetInstance().LogError("Planar configurations are not supported"); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 return false; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 if (image.GetPixelFormat().GetSamplesPerPixel() == 1) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 switch (image.GetPixelFormat().GetScalarType()) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 case gdcm::PixelFormat::UINT8: |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 format = Orthanc::PixelFormat_Grayscale8; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 return true; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 case gdcm::PixelFormat::UINT16: |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 format = Orthanc::PixelFormat_Grayscale16; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 return true; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 case gdcm::PixelFormat::INT16: |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 format = Orthanc::PixelFormat_SignedGrayscale16; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 return true; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 default: |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 return false; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 else if (image.GetPixelFormat().GetSamplesPerPixel() == 3 && |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 image.GetPixelFormat().GetScalarType() == gdcm::PixelFormat::UINT8) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 format = Orthanc::PixelFormat_RGB24; |
985 | 81 return true; |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 else if (image.GetPixelFormat().GetSamplesPerPixel() == 4 && |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 image.GetPixelFormat().GetScalarType() == gdcm::PixelFormat::UINT8) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 format = Orthanc::PixelFormat_RGBA32; |
985 | 87 return true; |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 } |
985 | 89 |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 return false; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 ORTHANC_PLUGINS_API int32_t DecodeImage(OrthancPluginRestOutput* output, |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 const char* url, |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 const OrthancPluginHttpRequest* request) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 std::string instance(request->groups[0]); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 std::string outputFormat(request->groups[1]); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 OrthancContext::GetInstance().LogWarning("Using GDCM to decode instance " + instance); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 // Download the request DICOM instance from Orthanc into a memory buffer |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 std::string dicom; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 OrthancContext::GetInstance().GetDicomForInstance(dicom, instance); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 // Prepare a memory stream over the DICOM instance |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 std::stringstream stream(dicom); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 // Parse the DICOM instance using GDCM |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 gdcm::ImageReader imageReader; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 imageReader.SetStream(stream); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 if (!imageReader.Read()) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 OrthancContext::GetInstance().LogError("GDCM cannot extract an image from this DICOM instance"); |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
115 AnswerUnsupportedImage(output); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
116 return 0; |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 gdcm::Image& image = imageReader.GetImage(); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
121 |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 // Log information about the decoded image |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 char tmp[1024]; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 sprintf(tmp, "Image format: %dx%d %s with %d color channel(s)", image.GetRows(), image.GetColumns(), |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 image.GetPixelFormat().GetScalarTypeAsString(), image.GetPixelFormat().GetSamplesPerPixel()); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 OrthancContext::GetInstance().LogWarning(tmp); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
128 |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
129 // Convert planar configuration |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
130 gdcm::ImageChangePlanarConfiguration planar; |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
131 if (image.GetPlanarConfiguration() != 0 && |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
132 image.GetPixelFormat().GetSamplesPerPixel() != 1) |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
133 { |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
134 OrthancContext::GetInstance().LogWarning("Converting planar configuration to interleaved"); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
135 planar.SetInput(imageReader.GetImage()); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
136 planar.Change(); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
137 image = planar.GetOutput(); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
138 } |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
139 |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
140 |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 // Create a read-only accessor to the bitmap decoded by GDCM |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 Orthanc::PixelFormat format; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 if (!GetOrthancPixelFormat(format, image)) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 OrthancContext::GetInstance().LogError("This sample plugin does not support this image format"); |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
146 AnswerUnsupportedImage(output); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
147 return 0; |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 Orthanc::ImageAccessor decodedImage; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 std::vector<char> decodedBuffer(image.GetBufferLength()); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 if (decodedBuffer.size()) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 image.GetBuffer(&decodedBuffer[0]); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 unsigned int pitch = image.GetColumns() * ::Orthanc::GetBytesPerPixel(format); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 decodedImage.AssignWritable(format, image.GetColumns(), image.GetRows(), pitch, &decodedBuffer[0]); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 else |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 // Empty image |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 decodedImage.AssignWritable(format, 0, 0, 0, NULL); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 // Convert the pixel format from GDCM to the format requested by the REST query |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 Orthanc::ImageBuffer converted; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 converted.SetWidth(decodedImage.GetWidth()); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 converted.SetHeight(decodedImage.GetHeight()); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 if (outputFormat == "preview") |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 if (format == Orthanc::PixelFormat_RGB24 || |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 format == Orthanc::PixelFormat_RGBA32) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 // Do not rescale color image |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 converted.SetFormat(Orthanc::PixelFormat_RGB24); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 else |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 converted.SetFormat(Orthanc::PixelFormat_Grayscale8); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 // Rescale the image to the [0,255] range |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 int64_t a, b; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 Orthanc::ImageProcessing::GetMinMaxValue(a, b, decodedImage); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 float offset = -a; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 float scaling = 255.0f / static_cast<float>(b - a); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 Orthanc::ImageProcessing::ShiftScale(decodedImage, offset, scaling); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
190 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
192 else |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 { |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
194 if (format == Orthanc::PixelFormat_RGB24 || |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
195 format == Orthanc::PixelFormat_RGBA32) |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
196 { |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
197 // Do not convert color images to grayscale values (this is Orthanc convention) |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
198 AnswerUnsupportedImage(output); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
199 return 0; |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
200 } |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
201 |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
202 if (outputFormat == "image-uint8") |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
203 { |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
204 converted.SetFormat(Orthanc::PixelFormat_Grayscale8); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
205 } |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
206 else if (outputFormat == "image-uint16") |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
207 { |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
208 converted.SetFormat(Orthanc::PixelFormat_Grayscale16); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
209 } |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
210 else if (outputFormat == "image-int16") |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
211 { |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
212 converted.SetFormat(Orthanc::PixelFormat_SignedGrayscale16); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
213 } |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
214 else |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
215 { |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
216 OrthancContext::GetInstance().LogError("Unknown output format: " + outputFormat); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
217 AnswerUnsupportedImage(output); |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
218 return 0; |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
985
diff
changeset
|
219 } |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 Orthanc::ImageAccessor convertedAccessor(converted.GetAccessor()); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 Orthanc::ImageProcessing::Convert(convertedAccessor, decodedImage); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 // Compress the converted image as a PNG file |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 OrthancContext::GetInstance().CompressAndAnswerPngImage(output, convertedAccessor); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 return 0; // Success |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 extern "C" |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 OrthancContext::GetInstance().Initialize(context); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
237 OrthancContext::GetInstance().LogWarning("Initializing GDCM decoding"); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 OrthancContext::GetInstance().Register("/instances/([^/]+)/(preview|image-uint8|image-uint16|image-int16)", DecodeImage); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
239 return 0; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 ORTHANC_PLUGINS_API void OrthancPluginFinalize() |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 OrthancContext::GetInstance().LogWarning("Finalizing GDCM decoding"); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 OrthancContext::GetInstance().Finalize(); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
246 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 ORTHANC_PLUGINS_API const char* OrthancPluginGetName() |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 return "gdcm-decoding"; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion() |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 return "1.0"; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 } |