diff Framework/Deprecated/Layers/DicomStructureSetSlicer.cpp @ 1006:4f28d9459e31 toa2019092001

Fixed unit tests and deprecated classes according to last API changes. UT all run ok.
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 20 Sep 2019 12:13:10 +0200
parents 35ed6812d639
children e713f1a99861 287ec78f63b4
line wrap: on
line diff
--- a/Framework/Deprecated/Layers/DicomStructureSetSlicer.cpp	Fri Sep 20 12:01:20 2019 +0200
+++ b/Framework/Deprecated/Layers/DicomStructureSetSlicer.cpp	Fri Sep 20 12:13:10 2019 +0200
@@ -29,12 +29,12 @@
     class Structure
     {
     private:
-      bool                                                         visible_;
-      uint8_t                                                      red_;
-      uint8_t                                                      green_;
-      uint8_t                                                      blue_;
-      std::string                                                  name_;
-      std::vector< std::vector<OrthancStone::DicomStructureSet::PolygonPoint2D> >  polygons_;
+      bool                                                                   visible_;
+      uint8_t                                                                red_;
+      uint8_t                                                                green_;
+      uint8_t                                                                blue_;
+      std::string                                                            name_;
+      std::vector< std::pair<OrthancStone::Point2D, OrthancStone::Point2D> > segments_;
 
     public:
       Structure(OrthancStone::DicomStructureSet& structureSet,
@@ -43,7 +43,7 @@
         name_(structureSet.GetStructureName(index))
       {
         structureSet.GetStructureColor(red_, green_, blue_, index);
-        visible_ = structureSet.ProjectStructure(polygons_, index, plane);
+        visible_ = structureSet.ProjectStructure(segments_, index, plane);
       }
 
       void Render(OrthancStone::CairoContext& context)
@@ -54,16 +54,10 @@
         
           context.SetSourceColor(red_, green_, blue_);
 
-          for (size_t i = 0; i < polygons_.size(); i++)
+          for (size_t i = 0; i < segments_.size(); i++)
           {
-            cairo_move_to(cr, polygons_[i][0].first, polygons_[i][0].second);
-
-            for (size_t j = 1; j < polygons_[i].size(); j++)
-            {
-              cairo_line_to(cr, polygons_[i][j].first, polygons_[i][j].second);
-            }
-
-            cairo_line_to(cr, polygons_[i][0].first, polygons_[i][0].second);
+            cairo_move_to(cr, segments_[i].first.x, segments_[i].first.y);
+            cairo_move_to(cr, segments_[i].second.x, segments_[i].second.y);
             cairo_stroke(cr);
           }
         }