The code trains the trees in parallel. Sample of pixels are taken only withing the mask and not entire bounding box.