# HG changeset patch # User Sebastien Jodogne # Date 1643651435 -3600 # Node ID e318b524ad3f2fe8114e4044b84b4f980646331c # Parent 738814c24574e426ec1b1dde70d500e591233478 use UnionOfRectangles algorithm to render RT-STRUCT diff -r 738814c24574 -r e318b524ad3f OrthancStone/Sources/Toolbox/DicomStructureSet.cpp --- a/OrthancStone/Sources/Toolbox/DicomStructureSet.cpp Mon Jan 31 18:22:57 2022 +0100 +++ b/OrthancStone/Sources/Toolbox/DicomStructureSet.cpp Mon Jan 31 18:50:35 2022 +0100 @@ -900,7 +900,7 @@ { double x1, y1, x2, y2; - if (polygon->Project(x1, y1, x2, y2, slice)) + if (polygon->Project(x1, y1, x2, y2, slice, GetEstimatedNormal(), GetEstimatedSliceThickness())) { projected.push_back(CreateRectangle(x1, y1, x2, y2)); } @@ -921,10 +921,8 @@ } } -#elif 0 +#elif 1 - // TODO - Fix possible infinite loop in UnionOfRectangles - std::list rectangles; for (Polygons::const_iterator polygon = structure.polygons_.begin(); @@ -932,7 +930,7 @@ { double x1, y1, x2, y2; - if (polygon->Project(x1, y1, x2, y2, slice)) + if (polygon->Project(x1, y1, x2, y2, slice, GetEstimatedNormal(), GetEstimatedSliceThickness())) { rectangles.push_back(Extent2D(x1, y1, x2, y2)); } diff -r 738814c24574 -r e318b524ad3f OrthancStone/Sources/Toolbox/Internals/RectanglesIntegerProjection.cpp --- a/OrthancStone/Sources/Toolbox/Internals/RectanglesIntegerProjection.cpp Mon Jan 31 18:22:57 2022 +0100 +++ b/OrthancStone/Sources/Toolbox/Internals/RectanglesIntegerProjection.cpp Mon Jan 31 18:50:35 2022 +0100 @@ -58,7 +58,7 @@ } else if (value_ == other.value_) { - return isLow_; + return static_cast(isLow_) < static_cast(other.isLow_); } else { diff -r 738814c24574 -r e318b524ad3f OrthancStone/Sources/Toolbox/UnionOfRectangles.cpp --- a/OrthancStone/Sources/Toolbox/UnionOfRectangles.cpp Mon Jan 31 18:22:57 2022 +0100 +++ b/OrthancStone/Sources/Toolbox/UnionOfRectangles.cpp Mon Jan 31 18:50:35 2022 +0100 @@ -307,7 +307,7 @@ } else if (x_ == other.x_) { - return isLeft_; + return static_cast(isLeft_) < static_cast(other.isLeft_); } else {