Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/OrthancSlicesLoader.h @ 73:ffa6dded91bd wasm
reorganization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 24 May 2017 11:59:24 +0200 |
parents | |
children | f5f54ed8d307 |
comparison
equal
deleted
inserted
replaced
72:c1cc3bdba18c | 73:ffa6dded91bd |
---|---|
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" | |
26 | |
27 #include <boost/shared_ptr.hpp> | |
28 | |
29 namespace OrthancStone | |
30 { | |
31 class OrthancSlicesLoader : public boost::noncopyable | |
32 { | |
33 public: | |
34 class ICallback : public boost::noncopyable | |
35 { | |
36 public: | |
37 virtual ~ICallback() | |
38 { | |
39 } | |
40 | |
41 virtual void NotifyGeometryReady(const OrthancSlicesLoader& loader) = 0; | |
42 | |
43 virtual void NotifyGeometryError(const OrthancSlicesLoader& loader) = 0; | |
44 | |
45 virtual void NotifySliceImageReady(const OrthancSlicesLoader& loader, | |
46 unsigned int sliceIndex, | |
47 const Slice& slice, | |
48 Orthanc::ImageAccessor* image) = 0; | |
49 | |
50 virtual void NotifySliceImageError(const OrthancSlicesLoader& loader, | |
51 unsigned int sliceIndex, | |
52 const Slice& slice) = 0; | |
53 }; | |
54 | |
55 private: | |
56 enum State | |
57 { | |
58 State_Error, | |
59 State_Initialization, | |
60 State_LoadingGeometry, | |
61 State_GeometryReady | |
62 }; | |
63 | |
64 enum Mode | |
65 { | |
66 Mode_SeriesGeometry, | |
67 Mode_InstanceGeometry, | |
68 Mode_LoadImage | |
69 }; | |
70 | |
71 class Operation; | |
72 class WebCallback; | |
73 | |
74 boost::shared_ptr<WebCallback> webCallback_; // This is a PImpl pattern | |
75 | |
76 ICallback& userCallback_; | |
77 IWebService& orthanc_; | |
78 State state_; | |
79 SlicesSorter slices_; | |
80 | |
81 | |
82 void ParseSeriesGeometry(const void* answer, | |
83 size_t size); | |
84 | |
85 void ParseInstanceGeometry(const std::string& instanceId, | |
86 unsigned int frame, | |
87 const void* answer, | |
88 size_t size); | |
89 | |
90 void ParseSliceImage(const Operation& operation, | |
91 const void* answer, | |
92 size_t size); | |
93 | |
94 | |
95 public: | |
96 OrthancSlicesLoader(ICallback& callback, | |
97 IWebService& orthanc); | |
98 | |
99 void ScheduleLoadSeries(const std::string& seriesId); | |
100 | |
101 void ScheduleLoadInstance(const std::string& instanceId, | |
102 unsigned int frame); | |
103 | |
104 size_t GetSliceCount() const; | |
105 | |
106 const Slice& GetSlice(size_t index) const; | |
107 | |
108 void ScheduleLoadSliceImage(size_t index); | |
109 }; | |
110 } |