Mercurial > hg > orthanc-stone
annotate Framework/SmartLoader.cpp @ 317:b66d13708f40 am-2
cleanup
author | am@osimis.io |
---|---|
date | Fri, 05 Oct 2018 11:57:36 +0200 |
parents | b4abaeb783b1 |
children | 3a4ca166fafa |
rev | line source |
---|---|
260 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
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. | |
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 | |
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 | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #include "SmartLoader.h" | |
23 #include "Layers/OrthancFrameLayerSource.h" | |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
24 #include "Messages/MessageForwarder.h" |
260 | 25 |
26 namespace OrthancStone | |
27 { | |
317 | 28 SmartLoader::SmartLoader(MessageBroker& broker, OrthancApiClient& orthancApiClient) : |
260 | 29 IObservable(broker), |
30 IObserver(broker), | |
31 imageQuality_(SliceImageQuality_FullPam), | |
317 | 32 orthancApiClient_(orthancApiClient) |
267 | 33 { |
260 | 34 } |
35 | |
36 ILayerSource* SmartLoader::GetFrame(const std::string& instanceId, unsigned int frame) | |
37 { | |
262 | 38 // TODO: check if this frame has already been loaded or is already being loaded. |
39 // - if already loaded: create a "clone" that will emit the GeometryReady/ImageReady messages "immediately" | |
40 // (it can not be immediate because Observers needs to register first and this is done after this method returns) | |
41 // - if currently loading, we need to return an object that will observe the existing LayerSource and forward | |
42 // the messages to its observables | |
43 // in both cases, we must be carefull about objects lifecycle !!! | |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
44 std::auto_ptr<OrthancFrameLayerSource> layerSource (new OrthancFrameLayerSource(IObserver::broker_, orthancApiClient_)); |
260 | 45 layerSource->SetImageQuality(imageQuality_); |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
46 layerSource->RegisterObserverCallback(new MessageForwarder<ILayerSource::GeometryReadyMessage>(IObserver::broker_, *this)); |
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
47 layerSource->RegisterObserverCallback(new MessageForwarder<ILayerSource::LayerReadyMessage>(IObserver::broker_, *this)); |
260 | 48 layerSource->LoadFrame(instanceId, frame); |
49 | |
50 return layerSource.release(); | |
51 } | |
52 | |
270 | 53 void SmartLoader::LoadStudyList() |
54 { | |
55 // orthancApiClient_.ScheduleGetJsonRequest("/studies"); | |
56 } | |
260 | 57 |
266
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
58 void PreloadStudy(const std::string studyId) |
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
59 { |
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
60 /* TODO */ |
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
61 } |
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
62 |
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
63 void PreloadSeries(const std::string seriesId) |
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
64 { |
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
65 /* TODO */ |
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
66 } |
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
67 |
c9cf95b49a86
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents:
262
diff
changeset
|
68 |
260 | 69 } |