3D multi-scale segmentation of granular materials