Mercurial > hg > orthanc-stone
annotate Framework/Toolbox/OrthancSlicesLoader.h @ 98:a33abae66344 wasm
scrolling over series
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 May 2017 15:02:24 +0200 |
parents | 5945e81734a3 |
children | efd9ef2b67f1 |
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 | |
5 * Copyright (C) 2017 Osimis, 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 #pragma once | |
23 | |
24 #include "IWebService.h" | |
25 #include "SlicesSorter.h" | |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
26 #include "../Enumerations.h" |
73 | 27 |
28 #include <boost/shared_ptr.hpp> | |
29 | |
30 namespace OrthancStone | |
31 { | |
32 class OrthancSlicesLoader : public boost::noncopyable | |
33 { | |
34 public: | |
35 class ICallback : public boost::noncopyable | |
36 { | |
37 public: | |
38 virtual ~ICallback() | |
39 { | |
40 } | |
41 | |
42 virtual void NotifyGeometryReady(const OrthancSlicesLoader& loader) = 0; | |
43 | |
44 virtual void NotifyGeometryError(const OrthancSlicesLoader& loader) = 0; | |
45 | |
46 virtual void NotifySliceImageReady(const OrthancSlicesLoader& loader, | |
47 unsigned int sliceIndex, | |
48 const Slice& slice, | |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
49 Orthanc::ImageAccessor* image, |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
50 SliceImageQuality quality) = 0; |
73 | 51 |
52 virtual void NotifySliceImageError(const OrthancSlicesLoader& loader, | |
53 unsigned int sliceIndex, | |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
54 const Slice& slice, |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
55 SliceImageQuality quality) = 0; |
73 | 56 }; |
57 | |
58 private: | |
59 enum State | |
60 { | |
61 State_Error, | |
62 State_Initialization, | |
63 State_LoadingGeometry, | |
64 State_GeometryReady | |
65 }; | |
66 | |
67 enum Mode | |
68 { | |
69 Mode_SeriesGeometry, | |
70 Mode_InstanceGeometry, | |
71 Mode_LoadImage | |
72 }; | |
73 | |
74 class Operation; | |
75 class WebCallback; | |
76 | |
77 boost::shared_ptr<WebCallback> webCallback_; // This is a PImpl pattern | |
78 | |
79 ICallback& userCallback_; | |
80 IWebService& orthanc_; | |
81 State state_; | |
82 SlicesSorter slices_; | |
83 | |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
84 void NotifySliceImageSuccess(const Operation& operation, |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
85 Orthanc::ImageAccessor* image) const; |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
86 |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
87 void NotifySliceImageError(const Operation& operation) const; |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
88 |
73 | 89 void ParseSeriesGeometry(const void* answer, |
90 size_t size); | |
91 | |
92 void ParseInstanceGeometry(const std::string& instanceId, | |
93 unsigned int frame, | |
94 const void* answer, | |
95 size_t size); | |
96 | |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
97 void ParseSliceImagePng(const Operation& operation, |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
98 const void* answer, |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
99 size_t size); |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
100 |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
101 void ParseSliceImageJpeg(const Operation& operation, |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
102 const void* answer, |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
103 size_t size); |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
104 |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
105 void ScheduleSliceImagePng(size_t index); |
73 | 106 |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
107 void ScheduleSliceImageJpeg(size_t index, |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
108 SliceImageQuality quality); |
73 | 109 |
110 public: | |
111 OrthancSlicesLoader(ICallback& callback, | |
112 IWebService& orthanc); | |
113 | |
114 void ScheduleLoadSeries(const std::string& seriesId); | |
115 | |
116 void ScheduleLoadInstance(const std::string& instanceId, | |
117 unsigned int frame); | |
118 | |
77 | 119 bool IsGeometryReady() const; |
120 | |
73 | 121 size_t GetSliceCount() const; |
122 | |
123 const Slice& GetSlice(size_t index) const; | |
124 | |
77 | 125 bool LookupSlice(size_t& index, |
126 const SliceGeometry& plane) const; | |
127 | |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
128 void ScheduleLoadSliceImage(size_t index, |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
77
diff
changeset
|
129 SliceImageQuality quality); |
73 | 130 }; |
131 } |