Refactored code to use new polyline ROI interface