Encode and decode ROI