comparison Framework/Toolbox/DicomStructureSet.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 50e5acf5553b
children 53cc787bd7bc
comparison
equal deleted inserted replaced
1005:7e861cfd142d 1006:4f28d9459e31
79 output = tmp; 79 output = tmp;
80 } 80 }
81 } 81 }
82 } 82 }
83 83
84 #ifdef USE_OLD_SJO_CUT_CODE 84 #ifdef USE_BOOST_UNION_FOR_POLYGONS
85 85
86 static BoostPolygon CreateRectangle(float x1, float y1, 86 static BoostPolygon CreateRectangle(float x1, float y1,
87 float x2, float y2) 87 float x2, float y2)
88 { 88 {
89 BoostPolygon r; 89 BoostPolygon r;
801 { 801 {
802 return referencedSlices_.begin()->second.geometry_.GetNormal(); 802 return referencedSlices_.begin()->second.geometry_.GetNormal();
803 } 803 }
804 } 804 }
805 805
806 #ifdef USE_OLD_SJO_CUT_CODE 806 #ifdef USE_BOOST_UNION_FOR_POLYGONS
807 bool DicomStructureSet::ProjectStructure(std::vector< std::vector<Point2D> >& polygons, 807 bool DicomStructureSet::ProjectStructure(std::vector< std::vector<Point2D> >& polygons,
808 const Structure& structure, 808 const Structure& structure,
809 const CoordinateSystem3D& slice) const 809 const CoordinateSystem3D& slice) const
810 #else 810 #else
811 bool DicomStructureSet::ProjectStructure(std::vector< std::pair<Point2D, Point2D> >& segments, 811 bool DicomStructureSet::ProjectStructure(std::vector< std::pair<Point2D, Point2D> >& segments,
812 const Structure& structure, 812 const Structure& structure,
813 const CoordinateSystem3D& slice) const 813 const CoordinateSystem3D& slice) const
814 #endif 814 #endif
815 { 815 {
816 #ifdef USE_OLD_SJO_CUT_CODE 816 #ifdef USE_BOOST_UNION_FOR_POLYGONS
817 polygons.clear(); 817 polygons.clear();
818 #else 818 #else
819 segments.clear(); 819 segments.clear();
820 #endif 820 #endif
821 821
829 for (Polygons::const_iterator polygon = structure.polygons_.begin(); 829 for (Polygons::const_iterator polygon = structure.polygons_.begin();
830 polygon != structure.polygons_.end(); ++polygon) 830 polygon != structure.polygons_.end(); ++polygon)
831 { 831 {
832 if (polygon->IsOnSlice(slice)) 832 if (polygon->IsOnSlice(slice))
833 { 833 {
834 #ifdef USE_OLD_SJO_CUT_CODE 834 #ifdef USE_BOOST_UNION_FOR_POLYGONS
835 polygons.push_back(std::vector<Point2D>()); 835 polygons.push_back(std::vector<Point2D>());
836 836
837 for (Points::const_iterator p = polygon->GetPoints().begin(); 837 for (Points::const_iterator p = polygon->GetPoints().begin();
838 p != polygon->GetPoints().end(); ++p) 838 p != polygon->GetPoints().end(); ++p)
839 { 839 {
880 GeometryToolbox::IsParallelOrOpposite(isOpposite, normal, slice.GetAxisY())) 880 GeometryToolbox::IsParallelOrOpposite(isOpposite, normal, slice.GetAxisY()))
881 { 881 {
882 #if 1 882 #if 1
883 // Sagittal or coronal projection 883 // Sagittal or coronal projection
884 884
885 #ifdef USE_OLD_SJO_CUT_CODE 885 #ifdef USE_BOOST_UNION_FOR_POLYGONS
886 std::vector<BoostPolygon> projected; 886 std::vector<BoostPolygon> projected;
887 #else 887 #else
888 // this will contain the intersection of the polygon slab with 888 // this will contain the intersection of the polygon slab with
889 // the cutting plane, projected on the cutting plane coord system 889 // the cutting plane, projected on the cutting plane coord system
890 // (that yields a rectangle) + the Z coordinate of the polygon 890 // (that yields a rectangle) + the Z coordinate of the polygon
907 static_cast<float>(y1), 907 static_cast<float>(y1),
908 static_cast<float>(x2), 908 static_cast<float>(x2),
909 static_cast<float>(y2)),curZ)); 909 static_cast<float>(y2)),curZ));
910 } 910 }
911 } 911 }
912 #ifndef USE_OLD_SJO_CUT_CODE 912 #ifndef USE_BOOST_UNION_FOR_POLYGONS
913 // projected contains a set of rectangles specified by two opposite 913 // projected contains a set of rectangles specified by two opposite
914 // corners (x1,y1,x2,y2) 914 // corners (x1,y1,x2,y2)
915 // we need to merge them 915 // we need to merge them
916 // each slab yields ONE polygon! 916 // each slab yields ONE polygon!
917 917