comparison Framework/Deprecated/Layers/DicomSeriesVolumeSlicer.h @ 732:c35e98d22764

move Deprecated classes to a separate folder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 May 2019 14:27:35 +0200
parents Framework/Layers/DicomSeriesVolumeSlicer.h@4f2416d519b4
children be9c1530d40a
comparison
equal deleted inserted replaced
729:529189f399ec 732:c35e98d22764
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-2019 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 #pragma once
23
24 #include "IVolumeSlicer.h"
25 #include "../Toolbox/IWebService.h"
26 #include "../Toolbox/OrthancSlicesLoader.h"
27 #include "../Toolbox/OrthancApiClient.h"
28
29 namespace Deprecated
30 {
31 // this class is in charge of loading a Frame.
32 // once it's been loaded (first the geometry and then the image),
33 // messages are sent to observers so they can use it
34 class DicomSeriesVolumeSlicer :
35 public IVolumeSlicer,
36 public OrthancStone::IObserver
37 //private OrthancSlicesLoader::ISliceLoaderObserver
38 {
39 public:
40 // TODO: Add "frame" and "instanceId"
41 class FrameReadyMessage : public OrthancStone::OriginMessage<DicomSeriesVolumeSlicer>
42 {
43 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
44
45 private:
46 const Orthanc::ImageAccessor& frame_;
47 OrthancStone::SliceImageQuality imageQuality_;
48 const Slice& slice_;
49
50 public:
51 FrameReadyMessage(DicomSeriesVolumeSlicer& origin,
52 const Orthanc::ImageAccessor& frame,
53 OrthancStone::SliceImageQuality imageQuality,
54 const Slice& slice) :
55 OriginMessage(origin),
56 frame_(frame),
57 imageQuality_(imageQuality),
58 slice_(slice)
59 {
60 }
61
62 const Orthanc::ImageAccessor& GetFrame() const
63 {
64 return frame_;
65 }
66
67 OrthancStone::SliceImageQuality GetImageQuality() const
68 {
69 return imageQuality_;
70 }
71
72 const Slice& GetSlice() const
73 {
74 return slice_;
75 }
76 };
77
78
79 private:
80 class RendererFactory;
81
82 OrthancSlicesLoader loader_;
83 OrthancStone::SliceImageQuality quality_;
84
85 public:
86 DicomSeriesVolumeSlicer(OrthancStone::MessageBroker& broker,
87 OrthancApiClient& orthanc);
88
89 void LoadSeries(const std::string& seriesId);
90
91 void LoadInstance(const std::string& instanceId);
92
93 void LoadFrame(const std::string& instanceId,
94 unsigned int frame);
95
96 void SetImageQuality(OrthancStone::SliceImageQuality quality)
97 {
98 quality_ = quality;
99 }
100
101 OrthancStone::SliceImageQuality GetImageQuality() const
102 {
103 return quality_;
104 }
105
106 size_t GetSlicesCount() const
107 {
108 return loader_.GetSlicesCount();
109 }
110
111 const Slice& GetSlice(size_t slice) const
112 {
113 return loader_.GetSlice(slice);
114 }
115
116 virtual bool GetExtent(std::vector<OrthancStone::Vector>& points,
117 const OrthancStone::CoordinateSystem3D& viewportSlice);
118
119 virtual void ScheduleLayerCreation(const OrthancStone::CoordinateSystem3D& viewportSlice);
120
121 protected:
122 void OnSliceGeometryReady(const OrthancSlicesLoader::SliceGeometryReadyMessage& message);
123 void OnSliceGeometryError(const OrthancSlicesLoader::SliceGeometryErrorMessage& message);
124 void OnSliceImageReady(const OrthancSlicesLoader::SliceImageReadyMessage& message);
125 void OnSliceImageError(const OrthancSlicesLoader::SliceImageErrorMessage& message);
126 };
127 }