added minn parameter for removing undersampled ROIs
made groupres optional