Refactored common code from ROI shapes