define ROIs definition pipeline and the related functions