annotate Framework/Deprecated/Layers/DicomStructureSetSlicer.cpp @ 1510:1005c1cbe4dd

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 09:45:27 +0200
parents 7ec8fea061b9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
10 * the License, or (at your option) any later version.
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
15 * Affero General Public License for more details.
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
16 *
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
398
d257ea56b7be renamed DicomStructureSetRendererFactory as DicomStructureSetSlicer, VolumeImageSource as VolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 394
diff changeset
21 #include "DicomStructureSetSlicer.h"
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
23 #include "../../Toolbox/DicomStructureSet.h"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
24
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
25 namespace Deprecated
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 {
398
d257ea56b7be renamed DicomStructureSetRendererFactory as DicomStructureSetSlicer, VolumeImageSource as VolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 394
diff changeset
27 class DicomStructureSetSlicer::Renderer : public ILayerRenderer
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 private:
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
30 class Structure
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
31 {
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
32 private:
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
33 bool visible_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
34 uint8_t red_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
35 uint8_t green_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
36 uint8_t blue_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
37 std::string name_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
38
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
39 #if USE_BOOST_UNION_FOR_POLYGONS == 1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
40 std::vector< std::vector<OrthancStone::Point2D> > polygons_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
41 #else
1006
4f28d9459e31 Fixed unit tests and deprecated classes according to last API changes. UT all run ok.
Benjamin Golinvaux <bgo@osimis.io>
parents: 984
diff changeset
42 std::vector< std::pair<OrthancStone::Point2D, OrthancStone::Point2D> > segments_;
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
43 #endif
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
44
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
45 public:
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
46 Structure(OrthancStone::DicomStructureSet& structureSet,
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
47 const OrthancStone::CoordinateSystem3D& plane,
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
48 size_t index) :
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
49 name_(structureSet.GetStructureName(index))
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
50 {
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
51 structureSet.GetStructureColor(red_, green_, blue_, index);
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
52
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
53 #if USE_BOOST_UNION_FOR_POLYGONS == 1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
54 visible_ = structureSet.ProjectStructure(polygons_, index, plane);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
55 #else
1006
4f28d9459e31 Fixed unit tests and deprecated classes according to last API changes. UT all run ok.
Benjamin Golinvaux <bgo@osimis.io>
parents: 984
diff changeset
56 visible_ = structureSet.ProjectStructure(segments_, index, plane);
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
57 #endif
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
58 }
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
60 void Render(OrthancStone::CairoContext& context)
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
61 {
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
62 if (visible_)
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
63 {
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
64 cairo_t* cr = context.GetObject();
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
65
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
66 context.SetSourceColor(red_, green_, blue_);
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
67
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
68 #if USE_BOOST_UNION_FOR_POLYGONS == 1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
69 for (size_t i = 0; i < polygons_.size(); i++)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
70 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
71 cairo_move_to(cr, polygons_[i][0].x, polygons_[i][0].y);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
72 for (size_t j = 0; j < polygons_[i].size(); j++)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
73 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
74 cairo_line_to(cr, polygons_[i][j].x, polygons_[i][j].y);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
75 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
76 cairo_line_to(cr, polygons_[i][0].x, polygons_[i][0].y);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
77 cairo_stroke(cr);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
78 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
79 #else
1006
4f28d9459e31 Fixed unit tests and deprecated classes according to last API changes. UT all run ok.
Benjamin Golinvaux <bgo@osimis.io>
parents: 984
diff changeset
80 for (size_t i = 0; i < segments_.size(); i++)
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
81 {
1006
4f28d9459e31 Fixed unit tests and deprecated classes according to last API changes. UT all run ok.
Benjamin Golinvaux <bgo@osimis.io>
parents: 984
diff changeset
82 cairo_move_to(cr, segments_[i].first.x, segments_[i].first.y);
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
83 cairo_line_to(cr, segments_[i].second.x, segments_[i].second.y);
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
84 cairo_stroke(cr);
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
85 }
1165
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1083
diff changeset
86 #endif
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
87 }
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
88 }
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
89 };
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
90
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
91 typedef std::list<Structure*> Structures;
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
92
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
93 OrthancStone::CoordinateSystem3D plane_;
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
94 Structures structures_;
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
95
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 public:
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
97 Renderer(OrthancStone::DicomStructureSet& structureSet,
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
98 const OrthancStone::CoordinateSystem3D& plane) :
394
17d54c028805 rename ILayerRenderer::GetLayerSlice() to GetLayerPlane()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 381
diff changeset
99 plane_(plane)
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 {
794
04f518ebd132 LoaderStateMachine
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
101 for (size_t k = 0; k < structureSet.GetStructuresCount(); k++)
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
102 {
394
17d54c028805 rename ILayerRenderer::GetLayerSlice() to GetLayerPlane()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 381
diff changeset
103 structures_.push_back(new Structure(structureSet, plane, k));
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
104 }
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
105 }
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
106
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
107 virtual ~Renderer()
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
108 {
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
109 for (Structures::iterator it = structures_.begin();
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
110 it != structures_.end(); ++it)
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
111 {
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
112 delete *it;
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
113 }
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
116 virtual bool RenderLayer(OrthancStone::CairoContext& context,
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 const ViewportGeometry& view)
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 {
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
119 cairo_set_line_width(context.GetObject(), 2.0f / view.GetZoom());
125
44fc253d4876 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 123
diff changeset
120
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
121 for (Structures::const_iterator it = structures_.begin();
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
122 it != structures_.end(); ++it)
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
124 assert(*it != NULL);
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
125 (*it)->Render(context);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 return true;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
131 virtual const OrthancStone::CoordinateSystem3D& GetLayerPlane()
121
e66b2c757790 displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
132 {
394
17d54c028805 rename ILayerRenderer::GetLayerSlice() to GetLayerPlane()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 381
diff changeset
133 return plane_;
121
e66b2c757790 displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
134 }
e66b2c757790 displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
135
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 virtual void SetLayerStyle(const RenderStyle& style)
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 }
132
35c2b85836ce fix rtstruct projections
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 130
diff changeset
139
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 virtual bool IsFullQuality()
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 return true;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
398
d257ea56b7be renamed DicomStructureSetRendererFactory as DicomStructureSetSlicer, VolumeImageSource as VolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 394
diff changeset
147 class DicomStructureSetSlicer::RendererFactory : public LayerReadyMessage::IRendererFactory
381
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
148 {
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
149 private:
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
150 OrthancStone::DicomStructureSet& structureSet_;
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
151 const OrthancStone::CoordinateSystem3D& plane_;
381
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
152
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
153 public:
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
154 RendererFactory(OrthancStone::DicomStructureSet& structureSet,
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
155 const OrthancStone::CoordinateSystem3D& plane) :
381
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
156 structureSet_(structureSet),
394
17d54c028805 rename ILayerRenderer::GetLayerSlice() to GetLayerPlane()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 381
diff changeset
157 plane_(plane)
381
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
158 {
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
159 }
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
160
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
161 virtual ILayerRenderer* CreateRenderer() const
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
162 {
394
17d54c028805 rename ILayerRenderer::GetLayerSlice() to GetLayerPlane()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 381
diff changeset
163 return new Renderer(structureSet_, plane_);
381
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
164 }
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
165 };
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
166
19bd222283ae uncoupling LayerReadyMessage from the creation of the renderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 380
diff changeset
167
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1059
diff changeset
168 DicomStructureSetSlicer::DicomStructureSetSlicer(StructureSetLoader& loader) :
404
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 401
diff changeset
169 loader_(loader)
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 401
diff changeset
170 {
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1059
diff changeset
171 Register<StructureSetLoader::ContentChangedMessage>(loader_, &DicomStructureSetSlicer::OnStructureSetLoaded);
404
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 401
diff changeset
172 }
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 401
diff changeset
173
ba4ace20454e use of MessageBroker in DicomStructureSetSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 401
diff changeset
174
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 623
diff changeset
175 void DicomStructureSetSlicer::ScheduleLayerCreation(const OrthancStone::CoordinateSystem3D& viewportPlane)
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 {
130
1982d6c1d2ff IVolumeLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 129
diff changeset
177 if (loader_.HasStructureSet())
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 {
394
17d54c028805 rename ILayerRenderer::GetLayerSlice() to GetLayerPlane()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 381
diff changeset
179 RendererFactory factory(loader_.GetStructureSet(), viewportPlane);
623
42dadae61fa9 renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
180 BroadcastMessage(IVolumeSlicer::LayerReadyMessage(*this, factory, viewportPlane));
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 }