PCLVisualizer has already this feature.
Hit x while inside PCLVisualizer window and it will turn into rubber
band selection mode.
You will have to set the area picking callback and that is it.
Just be carefull that if your data is compromised (with nan values for
instance) the indices you will get may not be correct.