ENH: Add CastImageFilter.py and code cleanup

Change-Id: I76b824ec30505f6bf0b4459f76251aa4aad9c494
Merge "ENH: Add CastImageFilter.py and code cleanup"