Mercurial > hg > orthanc-stone
annotate Samples/Sdl/Loader.cpp @ 1310:9bea7e15b519 broker
- first pass at changes to cope with the refactoring of the loading system
- global loader-related data accessible through ILoadersContext::ILock
- many changes in legacy loaders (CT, RTSTRUCT, DOSE) + loader cache
- NOT FINISHED! there are shared_from_this calls in ctors! this will crash!
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 09 Mar 2020 14:53:22 +0100 |
parents | 8a0a62189f46 |
children |
rev | line source |
---|---|
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
840
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
745 | 21 |
815 | 22 #include "../../Framework/Loaders/DicomStructureSetLoader.h" |
23 #include "../../Framework/Loaders/OrthancMultiframeVolumeLoader.h" | |
814 | 24 #include "../../Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.h" |
815 | 25 #include "../../Framework/Oracle/SleepOracleCommand.h" |
26 #include "../../Framework/Oracle/ThreadedOracle.h" | |
27 #include "../../Framework/Scene2D/CairoCompositor.h" | |
814 | 28 #include "../../Framework/Scene2D/GrayscaleStyleConfigurator.h" |
29 #include "../../Framework/Scene2D/LookupTableStyleConfigurator.h" | |
625
2eeb5857eb43
DicomInstanceParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
623
diff
changeset
|
30 #include "../../Framework/StoneInitialization.h" |
815 | 31 #include "../../Framework/Volumes/VolumeSceneLayerSource.h" |
32 #include "../../Framework/Volumes/DicomVolumeImageMPRSlicer.h" | |
33 #include "../../Framework/Volumes/DicomVolumeImageReslicer.h" | |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 // From Orthanc framework |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #include <Core/Images/ImageProcessing.h> |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
37 #include <Core/Images/PngWriter.h> |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 #include <Core/Logging.h> |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 #include <Core/OrthancException.h> |
683
dbc1d8bfc68a
reorganizing ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
681
diff
changeset
|
40 #include <Core/SystemToolbox.h> |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
767
diff
changeset
|
41 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
767
diff
changeset
|
42 |
745 | 43 namespace OrthancStone |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 { |
681
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
45 class NativeApplicationContext : public IMessageEmitter |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
46 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
47 private: |
815 | 48 boost::shared_mutex mutex_; |
49 MessageBroker broker_; | |
50 IObservable oracleObservable_; | |
681
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
51 |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
52 public: |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
53 NativeApplicationContext() : |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
54 oracleObservable_(broker_) |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
55 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
56 } |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
57 |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
58 |
745 | 59 virtual void EmitMessage(const IObserver& observer, |
827
2fd96a637a59
Added FusioMpr sample + small dumb changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
815
diff
changeset
|
60 const IMessage& message) ORTHANC_OVERRIDE |
681
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
61 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
62 try |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
63 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
64 boost::unique_lock<boost::shared_mutex> lock(mutex_); |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
65 oracleObservable_.EmitMessage(observer, message); |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
66 } |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
67 catch (Orthanc::OrthancException& e) |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
68 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
69 LOG(ERROR) << "Exception while emitting a message: " << e.What(); |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
70 } |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
71 } |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
72 |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
73 |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
74 class ReaderLock : public boost::noncopyable |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
75 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
76 private: |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
77 NativeApplicationContext& that_; |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
78 boost::shared_lock<boost::shared_mutex> lock_; |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
79 |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
80 public: |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
81 ReaderLock(NativeApplicationContext& that) : |
782
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
82 that_(that), |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
83 lock_(that.mutex_) |
681
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
84 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
85 } |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
86 }; |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
87 |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
88 |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
89 class WriterLock : public boost::noncopyable |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
90 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
91 private: |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
92 NativeApplicationContext& that_; |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
93 boost::unique_lock<boost::shared_mutex> lock_; |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
94 |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
95 public: |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
96 WriterLock(NativeApplicationContext& that) : |
782
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
97 that_(that), |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
98 lock_(that.mutex_) |
681
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
99 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
100 } |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
101 |
745 | 102 MessageBroker& GetBroker() |
681
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
103 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
104 return that_.broker_; |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
105 } |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
106 |
745 | 107 IObservable& GetOracleObservable() |
681
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
108 { |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
109 return that_.oracleObservable_; |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
110 } |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
111 }; |
9723fceccb9f
revision counters in DicomVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
680
diff
changeset
|
112 }; |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 } |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 class Toto : public OrthancStone::IObserver |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 { |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 private: |
778
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
120 OrthancStone::CoordinateSystem3D plane_; |
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
121 OrthancStone::IOracle& oracle_; |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
122 OrthancStone::Scene2D scene_; |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
123 std::unique_ptr<OrthancStone::VolumeSceneLayerSource> source1_, source2_, source3_; |
766 | 124 |
778
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
125 |
779 | 126 void Refresh() |
127 { | |
128 if (source1_.get() != NULL) | |
129 { | |
130 source1_->Update(plane_); | |
131 } | |
132 | |
133 if (source2_.get() != NULL) | |
134 { | |
135 source2_->Update(plane_); | |
136 } | |
137 | |
794 | 138 if (source3_.get() != NULL) |
139 { | |
140 source3_->Update(plane_); | |
141 } | |
142 | |
779 | 143 scene_.FitContent(1024, 768); |
144 | |
145 { | |
146 OrthancStone::CairoCompositor compositor(scene_, 1024, 768); | |
147 compositor.Refresh(); | |
148 | |
149 Orthanc::ImageAccessor accessor; | |
150 compositor.GetCanvas().GetReadOnlyAccessor(accessor); | |
151 | |
152 Orthanc::Image tmp(Orthanc::PixelFormat_RGB24, accessor.GetWidth(), accessor.GetHeight(), false); | |
153 Orthanc::ImageProcessing::Convert(tmp, accessor); | |
154 | |
155 static unsigned int count = 0; | |
156 char buf[64]; | |
157 sprintf(buf, "scene-%06d.png", count++); | |
158 | |
159 Orthanc::PngWriter writer; | |
160 writer.WriteToFile(buf, tmp); | |
161 } | |
162 } | |
163 | |
164 | |
783 | 165 void Handle(const OrthancStone::DicomVolumeImage::GeometryReadyMessage& message) |
766 | 166 { |
778
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
167 printf("Geometry ready\n"); |
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
168 |
820 | 169 plane_ = message.GetOrigin().GetGeometry().GetSagittalGeometry(); |
795
bc20e4c417ec
refactoring OrthancMultiframeVolumeLoader using LoaderStateMachine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
794
diff
changeset
|
170 //plane_ = message.GetOrigin().GetGeometry().GetAxialGeometry(); |
820 | 171 //plane_ = message.GetOrigin().GetGeometry().GetCoronalGeometry(); |
782
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
172 plane_.SetOrigin(message.GetOrigin().GetGeometry().GetCoordinates(0.5f, 0.5f, 0.5f)); |
779 | 173 |
174 Refresh(); | |
766 | 175 } |
176 | |
778
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
177 |
745 | 178 void Handle(const OrthancStone::SleepOracleCommand::TimeoutMessage& message) |
744 | 179 { |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
180 if (message.GetOrigin().HasPayload()) |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
181 { |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
182 printf("TIMEOUT! %d\n", dynamic_cast<const Orthanc::SingleValueObject<unsigned int>& >(message.GetOrigin().GetPayload()).GetValue()); |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
183 } |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
184 else |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
185 { |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
186 printf("TIMEOUT\n"); |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
187 |
779 | 188 Refresh(); |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
189 |
765 | 190 /** |
191 * The sleep() leads to a crash if the oracle is still running, | |
192 * while this object is destroyed. Always stop the oracle before | |
193 * destroying active objects. (*) | |
194 **/ | |
195 // boost::this_thread::sleep(boost::posix_time::seconds(2)); | |
196 | |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
197 oracle_.Schedule(*this, new OrthancStone::SleepOracleCommand(message.GetOrigin().GetDelay())); |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
198 } |
744 | 199 } |
200 | |
745 | 201 void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 { |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 Json::Value v; |
625
2eeb5857eb43
DicomInstanceParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
623
diff
changeset
|
204 message.ParseJsonBody(v); |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 printf("ICI [%s]\n", v.toStyledString().c_str()); |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 } |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 |
745 | 209 void Handle(const OrthancStone::GetOrthancImageCommand::SuccessMessage& message) |
637
afc91cdc5128
decoding of images by oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
636
diff
changeset
|
210 { |
afc91cdc5128
decoding of images by oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
636
diff
changeset
|
211 printf("IMAGE %dx%d\n", message.GetImage().GetWidth(), message.GetImage().GetHeight()); |
afc91cdc5128
decoding of images by oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
636
diff
changeset
|
212 } |
afc91cdc5128
decoding of images by oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
636
diff
changeset
|
213 |
745 | 214 void Handle(const OrthancStone::GetOrthancWebViewerJpegCommand::SuccessMessage& message) |
642
7ca8dc7ec17b
GetOrthancWebViewerJpegCommand::ProcessHttpHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
641
diff
changeset
|
215 { |
7ca8dc7ec17b
GetOrthancWebViewerJpegCommand::ProcessHttpHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
641
diff
changeset
|
216 printf("WebViewer %dx%d\n", message.GetImage().GetWidth(), message.GetImage().GetHeight()); |
7ca8dc7ec17b
GetOrthancWebViewerJpegCommand::ProcessHttpHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
641
diff
changeset
|
217 } |
7ca8dc7ec17b
GetOrthancWebViewerJpegCommand::ProcessHttpHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
641
diff
changeset
|
218 |
745 | 219 void Handle(const OrthancStone::OracleCommandExceptionMessage& message) |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 { |
639
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
221 printf("EXCEPTION: [%s] on command type %d\n", message.GetException().What(), message.GetCommand().GetType()); |
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
222 |
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
223 switch (message.GetCommand().GetType()) |
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
224 { |
745 | 225 case OrthancStone::IOracleCommand::Type_GetOrthancWebViewerJpeg: |
226 printf("URI: [%s]\n", dynamic_cast<const OrthancStone::GetOrthancWebViewerJpegCommand&> | |
639
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
227 (message.GetCommand()).GetUri().c_str()); |
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
228 break; |
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
229 |
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
230 default: |
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
231 break; |
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
232 } |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 } |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 public: |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
236 Toto(OrthancStone::IOracle& oracle, |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
237 OrthancStone::IObservable& oracleObservable) : |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
238 IObserver(oracleObservable.GetBroker()), |
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
239 oracle_(oracle) |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 { |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
241 oracleObservable.RegisterObserverCallback |
623
42dadae61fa9
renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
622
diff
changeset
|
242 (new OrthancStone::Callable |
745 | 243 <Toto, OrthancStone::SleepOracleCommand::TimeoutMessage>(*this, &Toto::Handle)); |
744 | 244 |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
245 oracleObservable.RegisterObserverCallback |
744 | 246 (new OrthancStone::Callable |
745 | 247 <Toto, OrthancStone::OrthancRestApiCommand::SuccessMessage>(*this, &Toto::Handle)); |
637
afc91cdc5128
decoding of images by oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
636
diff
changeset
|
248 |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
249 oracleObservable.RegisterObserverCallback |
637
afc91cdc5128
decoding of images by oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
636
diff
changeset
|
250 (new OrthancStone::Callable |
745 | 251 <Toto, OrthancStone::GetOrthancImageCommand::SuccessMessage>(*this, &Toto::Handle)); |
639
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
252 |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
253 oracleObservable.RegisterObserverCallback |
639
d1f4521b9bbb
OracleCommandExceptionMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
638
diff
changeset
|
254 (new OrthancStone::Callable |
745 | 255 <Toto, OrthancStone::GetOrthancWebViewerJpegCommand::SuccessMessage>(*this, &Toto::Handle)); |
642
7ca8dc7ec17b
GetOrthancWebViewerJpegCommand::ProcessHttpHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
641
diff
changeset
|
256 |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
257 oracleObservable.RegisterObserverCallback |
642
7ca8dc7ec17b
GetOrthancWebViewerJpegCommand::ProcessHttpHandler()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
641
diff
changeset
|
258 (new OrthancStone::Callable |
745 | 259 <Toto, OrthancStone::OracleCommandExceptionMessage>(*this, &Toto::Handle)); |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 } |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
261 |
783 | 262 void SetReferenceLoader(OrthancStone::IObservable& loader) |
263 { | |
264 loader.RegisterObserverCallback | |
265 (new OrthancStone::Callable | |
266 <Toto, OrthancStone::DicomVolumeImage::GeometryReadyMessage>(*this, &Toto::Handle)); | |
267 } | |
268 | |
766 | 269 void SetVolume1(int depth, |
778
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
270 const boost::shared_ptr<OrthancStone::IVolumeSlicer>& volume, |
776
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
271 OrthancStone::ILayerStyleConfigurator* style) |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
272 { |
776
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
273 source1_.reset(new OrthancStone::VolumeSceneLayerSource(scene_, depth, volume)); |
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
274 |
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
275 if (style != NULL) |
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
276 { |
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
277 source1_->SetConfigurator(style); |
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
278 } |
766 | 279 } |
280 | |
281 void SetVolume2(int depth, | |
778
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
282 const boost::shared_ptr<OrthancStone::IVolumeSlicer>& volume, |
776
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
283 OrthancStone::ILayerStyleConfigurator* style) |
766 | 284 { |
776
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
285 source2_.reset(new OrthancStone::VolumeSceneLayerSource(scene_, depth, volume)); |
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
286 |
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
287 if (style != NULL) |
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
288 { |
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
289 source2_->SetConfigurator(style); |
0387485f048b
ILayerStyleConfigurator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
290 } |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
291 } |
794 | 292 |
293 void SetStructureSet(int depth, | |
294 const boost::shared_ptr<OrthancStone::DicomStructureSetLoader>& volume) | |
295 { | |
296 source3_.reset(new OrthancStone::VolumeSceneLayerSource(scene_, depth, volume)); | |
297 } | |
298 | |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 }; |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 |
745 | 302 void Run(OrthancStone::NativeApplicationContext& context, |
765 | 303 OrthancStone::ThreadedOracle& oracle) |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
304 { |
828 | 305 // the oracle has been supplied with the context (as an IEmitter) upon |
306 // creation | |
783 | 307 boost::shared_ptr<OrthancStone::DicomVolumeImage> ct(new OrthancStone::DicomVolumeImage); |
308 boost::shared_ptr<OrthancStone::DicomVolumeImage> dose(new OrthancStone::DicomVolumeImage); | |
309 | |
310 | |
762
26f4345e771e
creation of OrthancMultiframeVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
760
diff
changeset
|
311 boost::shared_ptr<Toto> toto; |
783 | 312 boost::shared_ptr<OrthancStone::OrthancSeriesVolumeProgressiveLoader> ctLoader; |
313 boost::shared_ptr<OrthancStone::OrthancMultiframeVolumeLoader> doseLoader; | |
784
9f3b2027a4a9
DicomStructureSetLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
783
diff
changeset
|
314 boost::shared_ptr<OrthancStone::DicomStructureSetLoader> rtstructLoader; |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 { |
745 | 317 OrthancStone::NativeApplicationContext::WriterLock lock(context); |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
318 toto.reset(new Toto(oracle, lock.GetOracleObservable())); |
828 | 319 |
320 // the oracle is used to schedule commands | |
321 // the oracleObservable is used by the loaders to: | |
322 // - request the broker (lifetime mgmt) | |
323 // - register the loader callbacks (called indirectly by the oracle) | |
783 | 324 ctLoader.reset(new OrthancStone::OrthancSeriesVolumeProgressiveLoader(ct, oracle, lock.GetOracleObservable())); |
325 doseLoader.reset(new OrthancStone::OrthancMultiframeVolumeLoader(dose, oracle, lock.GetOracleObservable())); | |
784
9f3b2027a4a9
DicomStructureSetLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
783
diff
changeset
|
326 rtstructLoader.reset(new OrthancStone::DicomStructureSetLoader(oracle, lock.GetOracleObservable())); |
623
42dadae61fa9
renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
622
diff
changeset
|
327 } |
42dadae61fa9
renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
622
diff
changeset
|
328 |
782
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
329 |
794 | 330 //toto->SetReferenceLoader(*ctLoader); |
331 toto->SetReferenceLoader(*doseLoader); | |
783 | 332 |
333 | |
782
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
334 #if 1 |
783 | 335 toto->SetVolume1(0, ctLoader, new OrthancStone::GrayscaleStyleConfigurator); |
782
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
336 #else |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
337 { |
796
d3197e0e321d
DicomStructureSetLoader is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
795
diff
changeset
|
338 boost::shared_ptr<OrthancStone::IVolumeSlicer> reslicer(new OrthancStone::DicomVolumeImageReslicer(ct)); |
782
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
339 toto->SetVolume1(0, reslicer, new OrthancStone::GrayscaleStyleConfigurator); |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
340 } |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
341 #endif |
b24c208fa953
VolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
781
diff
changeset
|
342 |
780 | 343 |
344 { | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
345 std::unique_ptr<OrthancStone::LookupTableStyleConfigurator> config(new OrthancStone::LookupTableStyleConfigurator); |
780 | 346 config->SetLookupTable(Orthanc::EmbeddedResources::COLORMAP_HOT); |
793
f72b49954f62
DicomVolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
792
diff
changeset
|
347 |
f72b49954f62
DicomVolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
792
diff
changeset
|
348 boost::shared_ptr<OrthancStone::DicomVolumeImageMPRSlicer> tmp(new OrthancStone::DicomVolumeImageMPRSlicer(dose)); |
f72b49954f62
DicomVolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
792
diff
changeset
|
349 toto->SetVolume2(1, tmp, config.release()); |
780 | 350 } |
778
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
351 |
794 | 352 toto->SetStructureSet(2, rtstructLoader); |
353 | |
793
f72b49954f62
DicomVolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
792
diff
changeset
|
354 oracle.Schedule(*toto, new OrthancStone::SleepOracleCommand(100)); |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
355 |
744 | 356 if (0) |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 { |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 Json::Value v = Json::objectValue; |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 v["Level"] = "Series"; |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 v["Query"] = Json::objectValue; |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
362 std::unique_ptr<OrthancStone::OrthancRestApiCommand> command(new OrthancStone::OrthancRestApiCommand); |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 command->SetMethod(Orthanc::HttpMethod_Post); |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 command->SetUri("/tools/find"); |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 command->SetBody(v); |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 |
623
42dadae61fa9
renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
622
diff
changeset
|
367 oracle.Schedule(*toto, command.release()); |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 } |
625
2eeb5857eb43
DicomInstanceParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
623
diff
changeset
|
369 |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
370 if(0) |
636
fb00a8be03e2
starting DecodeOrthancImageCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
631
diff
changeset
|
371 { |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
372 if (0) |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
373 { |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
374 std::unique_ptr<OrthancStone::GetOrthancImageCommand> command(new OrthancStone::GetOrthancImageCommand); |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
375 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Jpeg))); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
376 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/preview"); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
377 oracle.Schedule(*toto, command.release()); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
378 } |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
379 |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
380 if (0) |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
381 { |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
382 std::unique_ptr<OrthancStone::GetOrthancImageCommand> command(new OrthancStone::GetOrthancImageCommand); |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
383 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Png))); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
384 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/preview"); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
385 oracle.Schedule(*toto, command.release()); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
386 } |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
387 |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
388 if (0) |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
389 { |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
390 std::unique_ptr<OrthancStone::GetOrthancImageCommand> command(new OrthancStone::GetOrthancImageCommand); |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
391 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Png))); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
392 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16"); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
393 oracle.Schedule(*toto, command.release()); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
394 } |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
395 |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
396 if (0) |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
397 { |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
398 std::unique_ptr<OrthancStone::GetOrthancImageCommand> command(new OrthancStone::GetOrthancImageCommand); |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
399 command->SetHttpHeader("Accept-Encoding", "gzip"); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
400 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam))); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
401 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16"); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
402 oracle.Schedule(*toto, command.release()); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
403 } |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
404 |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
405 if (0) |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
406 { |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
407 std::unique_ptr<OrthancStone::GetOrthancImageCommand> command(new OrthancStone::GetOrthancImageCommand); |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
408 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam))); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
409 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16"); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
410 oracle.Schedule(*toto, command.release()); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
411 } |
638
e626f38c5512
DecodeOrthancWebViewerJpegCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
412 |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
413 if (0) |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
414 { |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
415 std::unique_ptr<OrthancStone::GetOrthancWebViewerJpegCommand> command(new OrthancStone::GetOrthancWebViewerJpegCommand); |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
416 command->SetHttpHeader("Accept-Encoding", "gzip"); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
417 command->SetInstance("e6c7c20b-c9f65d7e-0d76f2e2-830186f2-3e3c600e"); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
418 command->SetQuality(90); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
419 oracle.Schedule(*toto, command.release()); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
420 } |
638
e626f38c5512
DecodeOrthancWebViewerJpegCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
421 |
e626f38c5512
DecodeOrthancWebViewerJpegCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
422 |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
423 if (0) |
744 | 424 { |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
425 for (unsigned int i = 0; i < 10; i++) |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
426 { |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
427 std::unique_ptr<OrthancStone::SleepOracleCommand> command(new OrthancStone::SleepOracleCommand(i * 1000)); |
840
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
428 command->SetPayload(new Orthanc::SingleValueObject<unsigned int>(42 * i)); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
429 oracle.Schedule(*toto, command.release()); |
47fc7919977d
Added details on errors in LoaderStateMachine + dummy change in loader.cpp
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
430 } |
744 | 431 } |
432 } | |
784
9f3b2027a4a9
DicomStructureSetLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
783
diff
changeset
|
433 |
625
2eeb5857eb43
DicomInstanceParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
623
diff
changeset
|
434 // 2017-11-17-Anonymized |
800
98a89b116b62
Added doc + fixed truncation warnings (+ inactive Orthanc IDs for BGO tests)
Benjamin Golinvaux <bgo@osimis.io>
parents:
795
diff
changeset
|
435 #if 0 |
98a89b116b62
Added doc + fixed truncation warnings (+ inactive Orthanc IDs for BGO tests)
Benjamin Golinvaux <bgo@osimis.io>
parents:
795
diff
changeset
|
436 // BGO data |
98a89b116b62
Added doc + fixed truncation warnings (+ inactive Orthanc IDs for BGO tests)
Benjamin Golinvaux <bgo@osimis.io>
parents:
795
diff
changeset
|
437 ctLoader->LoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // CT |
98a89b116b62
Added doc + fixed truncation warnings (+ inactive Orthanc IDs for BGO tests)
Benjamin Golinvaux <bgo@osimis.io>
parents:
795
diff
changeset
|
438 doseLoader->LoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // RT-DOSE |
98a89b116b62
Added doc + fixed truncation warnings (+ inactive Orthanc IDs for BGO tests)
Benjamin Golinvaux <bgo@osimis.io>
parents:
795
diff
changeset
|
439 //rtstructLoader->LoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // RT-STRUCT |
98a89b116b62
Added doc + fixed truncation warnings (+ inactive Orthanc IDs for BGO tests)
Benjamin Golinvaux <bgo@osimis.io>
parents:
795
diff
changeset
|
440 #else |
794 | 441 //ctLoader->LoadSeries("cb3ea4d1-d08f3856-ad7b6314-74d88d77-60b05618"); // CT |
796
d3197e0e321d
DicomStructureSetLoader is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
795
diff
changeset
|
442 //doseLoader->LoadInstance("41029085-71718346-811efac4-420e2c15-d39f99b6"); // RT-DOSE |
795
bc20e4c417ec
refactoring OrthancMultiframeVolumeLoader using LoaderStateMachine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
794
diff
changeset
|
443 //rtstructLoader->LoadInstance("83d9c0c3-913a7fee-610097d7-cbf0522d-fd75bee6"); // RT-STRUCT |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 |
796
d3197e0e321d
DicomStructureSetLoader is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
795
diff
changeset
|
445 // 2017-05-16 |
d3197e0e321d
DicomStructureSetLoader is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
795
diff
changeset
|
446 ctLoader->LoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // CT |
d3197e0e321d
DicomStructureSetLoader is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
795
diff
changeset
|
447 doseLoader->LoadInstance("eac822ef-a395f94e-e8121fe0-8411fef8-1f7bffad"); // RT-DOSE |
d3197e0e321d
DicomStructureSetLoader is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
795
diff
changeset
|
448 rtstructLoader->LoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // RT-STRUCT |
800
98a89b116b62
Added doc + fixed truncation warnings (+ inactive Orthanc IDs for BGO tests)
Benjamin Golinvaux <bgo@osimis.io>
parents:
795
diff
changeset
|
449 #endif |
764 | 450 // 2015-01-28-Multiframe |
783 | 451 //doseLoader->LoadInstance("88f71e2a-5fad1c61-96ed14d6-5b3d3cf7-a5825279"); // Multiframe CT |
764 | 452 |
661 | 453 // Delphine |
783 | 454 //ctLoader->LoadSeries("5990e39c-51e5f201-fe87a54c-31a55943-e59ef80e"); // CT |
455 //ctLoader->LoadSeries("67f1b334-02c16752-45026e40-a5b60b6b-030ecab5"); // Lung 1/10mm | |
661 | 456 |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
457 |
778
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
458 { |
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
459 LOG(WARNING) << "...Waiting for Ctrl-C..."; |
760
1181e1ad98ec
progressive loading working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
759
diff
changeset
|
460 |
765 | 461 oracle.Start(); |
462 | |
463 Orthanc::SystemToolbox::ServerBarrier(); | |
464 | |
465 /** | |
466 * WARNING => The oracle must be stopped BEFORE the objects using | |
467 * it are destroyed!!! This forces to wait for the completion of | |
468 * the running callback methods. Otherwise, the callbacks methods | |
469 * might still be running while their parent object is destroyed, | |
470 * resulting in crashes. This is very visible if adding a sleep(), | |
471 * as in (*). | |
472 **/ | |
473 | |
474 oracle.Stop(); | |
475 } | |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
476 } |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
477 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
478 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
479 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
480 /** |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
481 * IMPORTANT: The full arguments to "main()" are needed for SDL on |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
482 * Windows. Otherwise, one gets the linking error "undefined reference |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
483 * to `SDL_main'". https://wiki.libsdl.org/FAQWindows |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
484 **/ |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
485 int main(int argc, char* argv[]) |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
486 { |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
487 OrthancStone::StoneInitialize(); |
778
78fcb907caf6
VolumeGeometryReadyMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
488 //Orthanc::Logging::EnableInfoLevel(true); |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
489 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
490 try |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
491 { |
745 | 492 OrthancStone::NativeApplicationContext context; |
493 | |
494 OrthancStone::ThreadedOracle oracle(context); | |
767 | 495 //oracle.SetThreadsCount(1); |
680
0eb26f514ac5
loading of slice images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
678
diff
changeset
|
496 |
0eb26f514ac5
loading of slice images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
678
diff
changeset
|
497 { |
0eb26f514ac5
loading of slice images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
678
diff
changeset
|
498 Orthanc::WebServiceParameters p; |
0eb26f514ac5
loading of slice images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
678
diff
changeset
|
499 //p.SetUrl("http://localhost:8043/"); |
0eb26f514ac5
loading of slice images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
678
diff
changeset
|
500 p.SetCredentials("orthanc", "orthanc"); |
0eb26f514ac5
loading of slice images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
678
diff
changeset
|
501 oracle.SetOrthancParameters(p); |
0eb26f514ac5
loading of slice images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
678
diff
changeset
|
502 } |
0eb26f514ac5
loading of slice images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
678
diff
changeset
|
503 |
765 | 504 //oracle.Start(); |
680
0eb26f514ac5
loading of slice images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
678
diff
changeset
|
505 |
0eb26f514ac5
loading of slice images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
678
diff
changeset
|
506 Run(context, oracle); |
765 | 507 |
508 //oracle.Stop(); | |
619
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
509 } |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
510 catch (Orthanc::OrthancException& e) |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
511 { |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
512 LOG(ERROR) << "EXCEPTION: " << e.What(); |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
513 } |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
514 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
515 OrthancStone::StoneFinalize(); |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
516 |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
517 return 0; |
9cd19b28f011
test: refactoring oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
518 } |