comparison Framework/Layers/DicomStructureSetSlicer.cpp @ 726:4f2416d519b4

moving layers, widgets and loaders to Deprecated namespace
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 May 2019 11:43:25 +0200
parents 42dadae61fa9
children
comparison
equal deleted inserted replaced
714:d2c0e347ddc2 726:4f2416d519b4
19 **/ 19 **/
20 20
21 21
22 #include "DicomStructureSetSlicer.h" 22 #include "DicomStructureSetSlicer.h"
23 23
24 namespace OrthancStone 24 namespace Deprecated
25 { 25 {
26 class DicomStructureSetSlicer::Renderer : public ILayerRenderer 26 class DicomStructureSetSlicer::Renderer : public ILayerRenderer
27 { 27 {
28 private: 28 private:
29 class Structure 29 class Structure
32 bool visible_; 32 bool visible_;
33 uint8_t red_; 33 uint8_t red_;
34 uint8_t green_; 34 uint8_t green_;
35 uint8_t blue_; 35 uint8_t blue_;
36 std::string name_; 36 std::string name_;
37 std::vector< std::vector<DicomStructureSet::PolygonPoint> > polygons_; 37 std::vector< std::vector<OrthancStone::DicomStructureSet::PolygonPoint> > polygons_;
38 38
39 public: 39 public:
40 Structure(DicomStructureSet& structureSet, 40 Structure(OrthancStone::DicomStructureSet& structureSet,
41 const CoordinateSystem3D& plane, 41 const OrthancStone::CoordinateSystem3D& plane,
42 size_t index) : 42 size_t index) :
43 name_(structureSet.GetStructureName(index)) 43 name_(structureSet.GetStructureName(index))
44 { 44 {
45 structureSet.GetStructureColor(red_, green_, blue_, index); 45 structureSet.GetStructureColor(red_, green_, blue_, index);
46 visible_ = structureSet.ProjectStructure(polygons_, index, plane); 46 visible_ = structureSet.ProjectStructure(polygons_, index, plane);
47 } 47 }
48 48
49 void Render(CairoContext& context) 49 void Render(OrthancStone::CairoContext& context)
50 { 50 {
51 if (visible_) 51 if (visible_)
52 { 52 {
53 cairo_t* cr = context.GetObject(); 53 cairo_t* cr = context.GetObject();
54 54
70 } 70 }
71 }; 71 };
72 72
73 typedef std::list<Structure*> Structures; 73 typedef std::list<Structure*> Structures;
74 74
75 CoordinateSystem3D plane_; 75 OrthancStone::CoordinateSystem3D plane_;
76 Structures structures_; 76 Structures structures_;
77 77
78 public: 78 public:
79 Renderer(DicomStructureSet& structureSet, 79 Renderer(OrthancStone::DicomStructureSet& structureSet,
80 const CoordinateSystem3D& plane) : 80 const OrthancStone::CoordinateSystem3D& plane) :
81 plane_(plane) 81 plane_(plane)
82 { 82 {
83 for (size_t k = 0; k < structureSet.GetStructureCount(); k++) 83 for (size_t k = 0; k < structureSet.GetStructureCount(); k++)
84 { 84 {
85 structures_.push_back(new Structure(structureSet, plane, k)); 85 structures_.push_back(new Structure(structureSet, plane, k));
93 { 93 {
94 delete *it; 94 delete *it;
95 } 95 }
96 } 96 }
97 97
98 virtual bool RenderLayer(CairoContext& context, 98 virtual bool RenderLayer(OrthancStone::CairoContext& context,
99 const ViewportGeometry& view) 99 const ViewportGeometry& view)
100 { 100 {
101 cairo_set_line_width(context.GetObject(), 2.0f / view.GetZoom()); 101 cairo_set_line_width(context.GetObject(), 2.0f / view.GetZoom());
102 102
103 for (Structures::const_iterator it = structures_.begin(); 103 for (Structures::const_iterator it = structures_.begin();
108 } 108 }
109 109
110 return true; 110 return true;
111 } 111 }
112 112
113 virtual const CoordinateSystem3D& GetLayerPlane() 113 virtual const OrthancStone::CoordinateSystem3D& GetLayerPlane()
114 { 114 {
115 return plane_; 115 return plane_;
116 } 116 }
117 117
118 virtual void SetLayerStyle(const RenderStyle& style) 118 virtual void SetLayerStyle(const RenderStyle& style)
127 127
128 128
129 class DicomStructureSetSlicer::RendererFactory : public LayerReadyMessage::IRendererFactory 129 class DicomStructureSetSlicer::RendererFactory : public LayerReadyMessage::IRendererFactory
130 { 130 {
131 private: 131 private:
132 DicomStructureSet& structureSet_; 132 OrthancStone::DicomStructureSet& structureSet_;
133 const CoordinateSystem3D& plane_; 133 const OrthancStone::CoordinateSystem3D& plane_;
134 134
135 public: 135 public:
136 RendererFactory(DicomStructureSet& structureSet, 136 RendererFactory(OrthancStone::DicomStructureSet& structureSet,
137 const CoordinateSystem3D& plane) : 137 const OrthancStone::CoordinateSystem3D& plane) :
138 structureSet_(structureSet), 138 structureSet_(structureSet),
139 plane_(plane) 139 plane_(plane)
140 { 140 {
141 } 141 }
142 142
145 return new Renderer(structureSet_, plane_); 145 return new Renderer(structureSet_, plane_);
146 } 146 }
147 }; 147 };
148 148
149 149
150 DicomStructureSetSlicer::DicomStructureSetSlicer(MessageBroker& broker, 150 DicomStructureSetSlicer::DicomStructureSetSlicer(OrthancStone::MessageBroker& broker,
151 StructureSetLoader& loader) : 151 StructureSetLoader& loader) :
152 IVolumeSlicer(broker), 152 IVolumeSlicer(broker),
153 IObserver(broker), 153 IObserver(broker),
154 loader_(loader) 154 loader_(loader)
155 { 155 {
156 loader_.RegisterObserverCallback( 156 loader_.RegisterObserverCallback(
157 new Callable<DicomStructureSetSlicer, StructureSetLoader::ContentChangedMessage> 157 new OrthancStone::Callable<DicomStructureSetSlicer, StructureSetLoader::ContentChangedMessage>
158 (*this, &DicomStructureSetSlicer::OnStructureSetLoaded)); 158 (*this, &DicomStructureSetSlicer::OnStructureSetLoaded));
159 } 159 }
160 160
161 161
162 void DicomStructureSetSlicer::ScheduleLayerCreation(const CoordinateSystem3D& viewportPlane) 162 void DicomStructureSetSlicer::ScheduleLayerCreation(const OrthancStone::CoordinateSystem3D& viewportPlane)
163 { 163 {
164 if (loader_.HasStructureSet()) 164 if (loader_.HasStructureSet())
165 { 165 {
166 RendererFactory factory(loader_.GetStructureSet(), viewportPlane); 166 RendererFactory factory(loader_.GetStructureSet(), viewportPlane);
167 BroadcastMessage(IVolumeSlicer::LayerReadyMessage(*this, factory, viewportPlane)); 167 BroadcastMessage(IVolumeSlicer::LayerReadyMessage(*this, factory, viewportPlane));