comparison OrthancStone/Sources/Deprecated/Layers/DicomSeriesVolumeSlicer.h @ 1512:244ad1e4e76a

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