Mercurial > hg > orthanc-stone
diff Framework/Deprecated/Layers/DicomStructureSetSlicer.cpp @ 1165:4d97f532f1e0 broker
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 19 Nov 2019 21:40:25 +0100 |
parents | f72d1ab42932 |
children | 0ca50d275b9a |
line wrap: on
line diff
--- a/Framework/Deprecated/Layers/DicomStructureSetSlicer.cpp Tue Nov 19 21:18:46 2019 +0100 +++ b/Framework/Deprecated/Layers/DicomStructureSetSlicer.cpp Tue Nov 19 21:40:25 2019 +0100 @@ -20,6 +20,8 @@ #include "DicomStructureSetSlicer.h" +#include "../../Toolbox/DicomStructureSet.h" + namespace Deprecated { class DicomStructureSetSlicer::Renderer : public ILayerRenderer @@ -28,13 +30,18 @@ class Structure { private: - bool visible_; - uint8_t red_; - uint8_t green_; - uint8_t blue_; - std::string name_; + bool visible_; + uint8_t red_; + uint8_t green_; + uint8_t blue_; + std::string name_; + +#if USE_BOOST_UNION_FOR_POLYGONS == 1 + std::vector< std::vector<OrthancStone::Point2D> > polygons_; +#else std::vector< std::pair<OrthancStone::Point2D, OrthancStone::Point2D> > segments_; - +#endif + public: Structure(OrthancStone::DicomStructureSet& structureSet, const OrthancStone::CoordinateSystem3D& plane, @@ -42,7 +49,12 @@ name_(structureSet.GetStructureName(index)) { structureSet.GetStructureColor(red_, green_, blue_, index); + +#if USE_BOOST_UNION_FOR_POLYGONS == 1 + visible_ = structureSet.ProjectStructure(polygons_, index, plane); +#else visible_ = structureSet.ProjectStructure(segments_, index, plane); +#endif } void Render(OrthancStone::CairoContext& context) @@ -53,12 +65,25 @@ context.SetSourceColor(red_, green_, blue_); +#if USE_BOOST_UNION_FOR_POLYGONS == 1 + for (size_t i = 0; i < polygons_.size(); i++) + { + cairo_move_to(cr, polygons_[i][0].x, polygons_[i][0].y); + for (size_t j = 0; j < polygons_[i].size(); j++) + { + cairo_line_to(cr, polygons_[i][j].x, polygons_[i][j].y); + } + cairo_line_to(cr, polygons_[i][0].x, polygons_[i][0].y); + cairo_stroke(cr); + } +#else for (size_t i = 0; i < segments_.size(); i++) { 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_line_to(cr, segments_[i].second.x, segments_[i].second.y); cairo_stroke(cr); } +#endif } } };