Mercurial > hg > orthanc-stone
annotate Applications/StoneApplicationContext.cpp @ 1364:dd50d0852ae2 broker
SdlSimpleViewer fixes
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Sat, 18 Apr 2020 14:35:10 +0200 |
parents | 7ec8fea061b9 |
children |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
47 | 8 * modify it under the terms of the GNU Affero General Public License |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
0 | 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 | |
47 | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
288 | 22 #include "StoneApplicationContext.h" |
0 | 23 |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
24 #include <Core/OrthancException.h> |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
25 |
0 | 26 namespace OrthancStone |
27 { | |
418 | 28 void StoneApplicationContext::InitializeOrthanc() |
29 { | |
30 if (webService_ == NULL) | |
31 { | |
32 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | |
33 } | |
34 | |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
35 orthanc_.reset(new Deprecated::OrthancApiClient(*webService_, orthancBaseUrl_)); |
418 | 36 } |
37 | |
38 | |
1068
04a95ee91327
recovery of OrthancStoneSingleFrame
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
39 boost::shared_ptr<Deprecated::IWebService> StoneApplicationContext::GetWebService() |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
40 { |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
41 if (webService_ == NULL) |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
42 { |
418 | 43 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
44 } |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
45 |
1068
04a95ee91327
recovery of OrthancStoneSingleFrame
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
46 return webService_; |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
47 } |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
48 |
418 | 49 |
1068
04a95ee91327
recovery of OrthancStoneSingleFrame
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
50 boost::shared_ptr<Deprecated::OrthancApiClient> StoneApplicationContext::GetOrthancApiClient() |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
51 { |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
52 if (orthanc_.get() == NULL) |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
53 { |
418 | 54 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
55 } |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
56 |
1068
04a95ee91327
recovery of OrthancStoneSingleFrame
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
57 return orthanc_; |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
58 } |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
59 |
418 | 60 |
1068
04a95ee91327
recovery of OrthancStoneSingleFrame
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
61 void StoneApplicationContext::SetWebService(boost::shared_ptr<Deprecated::IWebService> webService) |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
62 { |
1068
04a95ee91327
recovery of OrthancStoneSingleFrame
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
63 webService_ = webService; |
418 | 64 InitializeOrthanc(); |
65 } | |
66 | |
67 | |
68 void StoneApplicationContext::SetOrthancBaseUrl(const std::string& baseUrl) | |
69 { | |
70 // Make sure the base url ends with "/" | |
71 if (baseUrl.empty() || | |
72 baseUrl[baseUrl.size() - 1] != '/') | |
73 { | |
74 orthancBaseUrl_ = baseUrl + "/"; | |
75 } | |
76 else | |
77 { | |
78 orthancBaseUrl_ = baseUrl; | |
79 } | |
80 | |
81 if (webService_ != NULL) | |
82 { | |
83 InitializeOrthanc(); | |
84 } | |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
288
diff
changeset
|
85 } |
0 | 86 } |