Mercurial > hg > orthanc
annotate Plugins/Samples/GdcmDecoding/OrthancContext.h @ 1807:91216c42c6e5 worklists
integration mainline->worklists
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 23 Nov 2015 15:26:42 +0100 |
parents | da7854deb662 |
children |
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 |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1040
diff
changeset
|
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics |
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1040
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * |
1375
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
6 * This program is free software: you can redistribute it and/or |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
7 * modify it under the terms of the GNU General Public License as |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
8 * published by the Free Software Foundation, either version 3 of the |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
9 * License, or (at your option) any later version. |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
10 * |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, but |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
14 * General Public License for more details. |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * |
1375
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 **/ |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 #pragma once |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1375
diff
changeset
|
23 #include <orthanc/OrthancCPlugin.h> |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
25 #include "../../../Core/Images/ImageBuffer.h" |
983
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 #include <map> |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #include <string> |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 #include <boost/noncopyable.hpp> |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 class OrthancContext : public boost::noncopyable |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 private: |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 OrthancPluginContext* context_; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 OrthancContext() : context_(NULL) |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 } |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 void Check(); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 public: |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 typedef std::map<std::string, std::string> Arguments; |
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 static OrthancContext& GetInstance(); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 void Initialize(OrthancPluginContext* context) |
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 context_ = context; |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 } |
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 void Finalize() |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 { |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 context_ = NULL; |
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 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 void ExtractGetArguments(Arguments& arguments, |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 const OrthancPluginHttpRequest& request); |
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 void LogError(const std::string& s); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 void LogWarning(const std::string& s); |
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 void LogInfo(const std::string& s); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 void Register(const std::string& uri, |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 OrthancPluginRestCallback callback); |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 void GetDicomForInstance(std::string& result, |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 const std::string& instanceId); |
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 void CompressAndAnswerPngImage(OrthancPluginRestOutput* output, |
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 const Orthanc::ImageAccessor& accessor); |
993
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
983
diff
changeset
|
75 |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
983
diff
changeset
|
76 void Redirect(OrthancPluginRestOutput* output, |
501880d76474
improvements to GDCM plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
983
diff
changeset
|
77 const std::string& s); |
983
80d4f1618b33
Sample plugin to replace DCMTK by GDCM when decoding images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 }; |