Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Deprecated/Toolbox/OrthancSlicesLoader.h @ 1513:24068dd8c445
fix path
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Jul 2020 16:28:52 +0200 |
parents | 244ad1e4e76a |
children |
rev | line source |
---|---|
73 | 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:
739
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
73 | 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. | |
318
3a4ca166fafa
ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents:
300
diff
changeset
|
16 * |
73 | 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 #pragma once | |
23 | |
732
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
24 #include "../../Messages/IObservable.h" |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
739
diff
changeset
|
25 #include "../../Messages/ObserverBase.h" |
732
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
26 #include "../../StoneEnumerations.h" |
736
c0fcb2757b0a
enforce relative includes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
27 #include "../../Toolbox/SlicesSorter.h" |
378 | 28 #include "IWebService.h" |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
29 #include "OrthancApiClient.h" |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
643
diff
changeset
|
30 #include "Slice.h" |
378 | 31 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
32 #include <Images/Image.h> |
318
3a4ca166fafa
ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents:
300
diff
changeset
|
33 |
73 | 34 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
35 namespace Deprecated |
73 | 36 { |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
739
diff
changeset
|
37 class OrthancSlicesLoader : |
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
739
diff
changeset
|
38 public OrthancStone::IObservable, |
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
739
diff
changeset
|
39 public OrthancStone::ObserverBase<OrthancSlicesLoader> |
73 | 40 { |
41 public: | |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
42 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, SliceGeometryReadyMessage, OrthancSlicesLoader); |
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
43 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, SliceGeometryErrorMessage, OrthancSlicesLoader); |
299
3897f9f28cfa
backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
268
diff
changeset
|
44 |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
45 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
46 class SliceImageReadyMessage : public OrthancStone::OriginMessage<OrthancSlicesLoader> |
252 | 47 { |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
48 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
49 |
378 | 50 private: |
51 unsigned int sliceIndex_; | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
52 const Slice& slice_; |
378 | 53 const Orthanc::ImageAccessor& image_; |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
736
diff
changeset
|
54 SliceImageQuality effectiveQuality_; |
252 | 55 |
378 | 56 public: |
406
5d359b115b29
use of callables in OrthancVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
57 SliceImageReadyMessage(const OrthancSlicesLoader& origin, |
5d359b115b29
use of callables in OrthancVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
58 unsigned int sliceIndex, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
59 const Slice& slice, |
378 | 60 const Orthanc::ImageAccessor& image, |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
736
diff
changeset
|
61 SliceImageQuality effectiveQuality) : |
406
5d359b115b29
use of callables in OrthancVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
62 OriginMessage(origin), |
378 | 63 sliceIndex_(sliceIndex), |
64 slice_(slice), | |
65 image_(image), | |
66 effectiveQuality_(effectiveQuality) | |
252 | 67 { |
68 } | |
378 | 69 |
70 unsigned int GetSliceIndex() const | |
71 { | |
72 return sliceIndex_; | |
73 } | |
74 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
75 const Slice& GetSlice() const |
378 | 76 { |
77 return slice_; | |
78 } | |
252 | 79 |
378 | 80 const Orthanc::ImageAccessor& GetImage() const |
81 { | |
82 return image_; | |
83 } | |
84 | |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
736
diff
changeset
|
85 SliceImageQuality GetEffectiveQuality() const |
378 | 86 { |
87 return effectiveQuality_; | |
88 } | |
89 }; | |
90 | |
91 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
92 class SliceImageErrorMessage : public OrthancStone::OriginMessage<OrthancSlicesLoader> |
252 | 93 { |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
94 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
95 |
378 | 96 private: |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
97 const Slice& slice_; |
378 | 98 unsigned int sliceIndex_; |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
736
diff
changeset
|
99 SliceImageQuality effectiveQuality_; |
252 | 100 |
378 | 101 public: |
406
5d359b115b29
use of callables in OrthancVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
102 SliceImageErrorMessage(const OrthancSlicesLoader& origin, |
5d359b115b29
use of callables in OrthancVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
103 unsigned int sliceIndex, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
104 const Slice& slice, |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
736
diff
changeset
|
105 SliceImageQuality effectiveQuality) : |
406
5d359b115b29
use of callables in OrthancVolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
106 OriginMessage(origin), |
378 | 107 slice_(slice), |
108 sliceIndex_(sliceIndex), | |
109 effectiveQuality_(effectiveQuality) | |
252 | 110 { |
111 } | |
378 | 112 unsigned int GetSliceIndex() const |
113 { | |
114 return sliceIndex_; | |
115 } | |
116 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
117 const Slice& GetSlice() const |
378 | 118 { |
119 return slice_; | |
120 } | |
121 | |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
736
diff
changeset
|
122 SliceImageQuality GetEffectiveQuality() const |
378 | 123 { |
124 return effectiveQuality_; | |
125 } | |
252 | 126 }; |
73 | 127 |
128 private: | |
129 enum State | |
130 { | |
131 State_Error, | |
132 State_Initialization, | |
133 State_LoadingGeometry, | |
134 State_GeometryReady | |
135 }; | |
136 | |
137 enum Mode | |
138 { | |
139 Mode_SeriesGeometry, | |
140 Mode_InstanceGeometry, | |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
141 Mode_FrameGeometry, |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
142 Mode_LoadImage, |
257 | 143 Mode_LoadRawImage, |
144 Mode_LoadDicomFile | |
73 | 145 }; |
146 | |
147 class Operation; | |
148 | |
1068
04a95ee91327
recovery of OrthancStoneSingleFrame
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
149 boost::shared_ptr<OrthancApiClient> orthanc_; |
73 | 150 State state_; |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
151 OrthancStone::SlicesSorter slices_; |
73 | 152 |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
153 void NotifySliceImageSuccess(const Operation& operation, |
378 | 154 const Orthanc::ImageAccessor& image); |
155 | |
268
5bd4161bf11b
removed constness of the observable when emitting a message
am@osimis.io
parents:
267
diff
changeset
|
156 void NotifySliceImageError(const Operation& operation); |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
157 |
382
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
378
diff
changeset
|
158 void OnGeometryError(const IWebService::HttpRequestErrorMessage& message); |
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
378
diff
changeset
|
159 |
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
378
diff
changeset
|
160 void OnSliceImageError(const IWebService::HttpRequestErrorMessage& message); |
73 | 161 |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
162 void ParseSeriesGeometry(const OrthancApiClient::JsonResponseReadyMessage& message); |
73 | 163 |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
164 void ParseInstanceGeometry(const OrthancApiClient::JsonResponseReadyMessage& message); |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
165 |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
166 void ParseFrameGeometry(const OrthancApiClient::JsonResponseReadyMessage& message); |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
167 |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
168 void ParseSliceImagePng(const OrthancApiClient::BinaryResponseReadyMessage& message); |
257 | 169 |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
170 void ParseSliceImagePam(const OrthancApiClient::BinaryResponseReadyMessage& message); |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
171 |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
172 void ParseSliceImageJpeg(const OrthancApiClient::JsonResponseReadyMessage& message); |
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
173 |
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
174 void ParseSliceRawImage(const OrthancApiClient::BinaryResponseReadyMessage& message); |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
175 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
176 void ScheduleSliceImagePng(const Slice& slice, |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
177 size_t index); |
257 | 178 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
179 void ScheduleSliceImagePam(const Slice& slice, |
257 | 180 size_t index); |
181 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
182 void ScheduleSliceImageJpeg(const Slice& slice, |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
183 size_t index, |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
736
diff
changeset
|
184 SliceImageQuality quality); |
120
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
185 |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
186 void SortAndFinalizeSlices(); |
73 | 187 |
188 public: | |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
739
diff
changeset
|
189 OrthancSlicesLoader(//ISliceLoaderObserver& callback, |
1068
04a95ee91327
recovery of OrthancStoneSingleFrame
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1066
diff
changeset
|
190 boost::shared_ptr<OrthancApiClient> orthancApi); |
73 | 191 |
192 void ScheduleLoadSeries(const std::string& seriesId); | |
193 | |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
194 void ScheduleLoadInstance(const std::string& instanceId); |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
195 |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
196 void ScheduleLoadFrame(const std::string& instanceId, |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
197 unsigned int frame); |
73 | 198 |
77 | 199 bool IsGeometryReady() const; |
200 | |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
643
diff
changeset
|
201 size_t GetSlicesCount() const; |
73 | 202 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
203 const Slice& GetSlice(size_t index) const; |
73 | 204 |
77 | 205 bool LookupSlice(size_t& index, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
206 const OrthancStone::CoordinateSystem3D& plane) const; |
77 | 207 |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
208 void ScheduleLoadSliceImage(size_t index, |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
736
diff
changeset
|
209 SliceImageQuality requestedQuality); |
73 | 210 }; |
211 } |