annotate Framework/Layers/OrthancFrameLayerSource.cpp @ 353:92a159481900 am-2

removed useless variable
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Oct 2018 11:53:34 +0100
parents b10dfdb96866
children 8eb4fe74000f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
135
e2fe9352f240 upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 121
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #include "OrthancFrameLayerSource.h"
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "FrameRenderer.h"
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "../Toolbox/DicomFrameConverter.h"
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
212
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
27 #include <Core/Logging.h>
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
28 #include <Core/OrthancException.h>
113
2eca030792aa using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 110
diff changeset
29
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #include <boost/lexical_cast.hpp>
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 namespace OrthancStone
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
34
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
35 void OrthancFrameLayerSource::OnSliceGeometryReady(const OrthancSlicesLoader::SliceGeometryReadyMessage& message)
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 {
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
37 if (message.origin_.GetSliceCount() > 0)
266
c9cf95b49a86 removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents: 257
diff changeset
38 {
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
39 LayerSourceBase::NotifyGeometryReady();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
40 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
41 else
266
c9cf95b49a86 removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents: 257
diff changeset
42 {
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
43 LayerSourceBase::NotifyGeometryError();
266
c9cf95b49a86 removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents: 257
diff changeset
44 }
77
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
45 }
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
47 void OrthancFrameLayerSource::OnSliceGeometryError(const OrthancSlicesLoader::SliceGeometryErrorMessage& message)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
48 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
49 LayerSourceBase::NotifyGeometryError();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
50 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
51
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
52 void OrthancFrameLayerSource::OnSliceImageReady(const OrthancSlicesLoader::SliceImageReadyMessage& message)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
53 {
318
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 300
diff changeset
54 // first notify that the image is ready (targeted to, i.e: an image cache)
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 300
diff changeset
55 LayerSourceBase::NotifyImageReady(message.image_, message.effectiveQuality_, message.slice_);
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 300
diff changeset
56
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 300
diff changeset
57 // then notify that the layer is ready for render
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
58 bool isFull = (message.effectiveQuality_ == SliceImageQuality_FullPng || message.effectiveQuality_ == SliceImageQuality_FullPam);
318
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 300
diff changeset
59 std::auto_ptr<Orthanc::ImageAccessor> accessor(new Orthanc::ImageAccessor());
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 300
diff changeset
60 message.image_->GetReadOnlyAccessor(*accessor);
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 300
diff changeset
61
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 300
diff changeset
62 LayerSourceBase::NotifyLayerReady(FrameRenderer::CreateRenderer(accessor.release(), message.slice_, isFull),
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
63 message.slice_.GetGeometry(), false);
318
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 300
diff changeset
64
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
65 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
66
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
67 void OrthancFrameLayerSource::OnSliceImageError(const OrthancSlicesLoader::SliceImageErrorMessage& message)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
68 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
69 LayerSourceBase::NotifyLayerReady(NULL, message.slice_.GetGeometry(), true);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
70 }
98
a33abae66344 scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
71
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
72 OrthancFrameLayerSource::OrthancFrameLayerSource(MessageBroker& broker, OrthancApiClient& orthanc) :
251
192e6e349e69 first usage of new message system (in SDL only)
am@osimis.io
parents: 212
diff changeset
73 LayerSourceBase(broker),
266
c9cf95b49a86 removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents: 257
diff changeset
74 IObserver(broker),
c9cf95b49a86 removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
am@osimis.io
parents: 257
diff changeset
75 loader_(broker, orthanc),
257
9afafb192180 using PAM
am@osimis.io
parents: 252
diff changeset
76 quality_(SliceImageQuality_FullPng)
66
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 65
diff changeset
77 {
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
78 loader_.RegisterObserverCallback(new Callable<OrthancFrameLayerSource, OrthancSlicesLoader::SliceGeometryReadyMessage>(*this, &OrthancFrameLayerSource::OnSliceGeometryReady));
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
79 loader_.RegisterObserverCallback(new Callable<OrthancFrameLayerSource, OrthancSlicesLoader::SliceGeometryErrorMessage>(*this, &OrthancFrameLayerSource::OnSliceGeometryError));
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
80 loader_.RegisterObserverCallback(new Callable<OrthancFrameLayerSource, OrthancSlicesLoader::SliceImageReadyMessage>(*this, &OrthancFrameLayerSource::OnSliceImageReady));
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 268
diff changeset
81 loader_.RegisterObserverCallback(new Callable<OrthancFrameLayerSource, OrthancSlicesLoader::SliceImageErrorMessage>(*this, &OrthancFrameLayerSource::OnSliceImageError));
98
a33abae66344 scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
82 }
a33abae66344 scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
83
a33abae66344 scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
84
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
85 void OrthancFrameLayerSource::LoadSeries(const std::string& seriesId)
98
a33abae66344 scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
86 {
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
87 loader_.ScheduleLoadSeries(seriesId);
98
a33abae66344 scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
88 }
a33abae66344 scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
89
a33abae66344 scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
90
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
91 void OrthancFrameLayerSource::LoadInstance(const std::string& instanceId)
98
a33abae66344 scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
92 {
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
93 loader_.ScheduleLoadInstance(instanceId);
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
94 }
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
95
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
96
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
97 void OrthancFrameLayerSource::LoadFrame(const std::string& instanceId,
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
98 unsigned int frame)
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
99 {
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
100 loader_.ScheduleLoadFrame(instanceId, frame);
66
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 65
diff changeset
101 }
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 65
diff changeset
102
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 65
diff changeset
103
97
d18dcc963930 separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 96
diff changeset
104 bool OrthancFrameLayerSource::GetExtent(std::vector<Vector>& points,
110
53025eecbc95 renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
105 const CoordinateSystem3D& viewportSlice)
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 {
97
d18dcc963930 separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 96
diff changeset
107 size_t index;
329
b10dfdb96866 removing WorldSceneWidget::IWorldObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 318
diff changeset
108
97
d18dcc963930 separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 96
diff changeset
109 if (loader_.IsGeometryReady() &&
d18dcc963930 separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 96
diff changeset
110 loader_.LookupSlice(index, viewportSlice))
d18dcc963930 separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 96
diff changeset
111 {
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 100
diff changeset
112 loader_.GetSlice(index).GetExtent(points);
97
d18dcc963930 separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 96
diff changeset
113 return true;
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }
97
d18dcc963930 separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 96
diff changeset
115 else
d18dcc963930 separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 96
diff changeset
116 {
d18dcc963930 separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 96
diff changeset
117 return false;
d18dcc963930 separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 96
diff changeset
118 }
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 }
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
110
53025eecbc95 renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
122 void OrthancFrameLayerSource::ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice)
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
77
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
124 size_t index;
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
125
329
b10dfdb96866 removing WorldSceneWidget::IWorldObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 318
diff changeset
126 if (loader_.IsGeometryReady() &&
b10dfdb96866 removing WorldSceneWidget::IWorldObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 318
diff changeset
127 loader_.LookupSlice(index, viewportSlice))
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 {
329
b10dfdb96866 removing WorldSceneWidget::IWorldObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 318
diff changeset
129 loader_.ScheduleLoadSliceImage(index, quality_);
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 }
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 }
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 }