David Gobbi's comment on the VTK mailing list:
it would be more efficient to use vtkImageStencilToImage instead of vtkImageStencil and vtkImageCast. The vtkImageStencilToImage filter requires only one input (the stencil), i.e. it doesn't require 'binaryLabelMap' as input. Also, you can set the data type of the image that it produces as output, so it doesn't have to be followed by a cast