BUG: Enable different output types for InPlaceImageFilter
BUG: Enable different output types for InPlaceImageFilter

If a filter derived from InPlaceImageFilter has different output types
other then TOuptutImageType then a dynamic_cast would fail, and a
dereferenced null pointer would follow. This patch uses the same
approach as used in ImageToImageFilter which tries to case to an
ImageBase type, and checks for casting failure.

Change-Id: I6803e744de7ebad3d6d0a6a4c0b85999a5185538

paulnovo/ITK,fuentesdt/InsightToolkit-dev,jcfr/ITK,blowekamp/ITK,zachary-williamson/ITK,InsightSoftwareConsortium/ITK,atsnyder/ITK,cpatrick/ITK-RemoteIO,BRAINSia/ITK,CapeDrew/DITK,blowekamp/ITK,itkvideo/ITK,heimdali/ITK,spinicist/ITK,cpatrick/ITK-RemoteIO,atsnyder/ITK,jmerkow/ITK,eile/ITK,msmolens/ITK,CapeDrew/DCMTK-ITK,vfonov/ITK,Kitware/ITK,Kitware/ITK,PlutoniumHeart/ITK,fbudin69500/ITK,malaterre/ITK,ajjl/ITK,hinerm/ITK,stnava/ITK,BlueBrain/ITK,stnava/ITK,itkvideo/ITK,InsightSoftwareConsortium/ITK,LucHermitte/ITK,fuentesdt/InsightToolkit-dev,LucasGandel/ITK,hendradarwin/ITK,itkvideo/ITK,zachary-williamson/ITK,CapeDrew/DCMTK-ITK,biotrump/ITK,daviddoria/itkHoughTransform,ajjl/ITK,InsightSoftwareConsortium/ITK,blowekamp/ITK,rhgong/itk-with-dom,eile/ITK,LucHermitte/ITK,BlueBrain/ITK,stnava/ITK,fuentesdt/InsightToolkit-dev,CapeDrew/DITK,ajjl/ITK,biotrump/ITK,fuentesdt/InsightToolkit-dev,spinicist/ITK,biotrump/ITK,InsightSoftwareConsortium/ITK,hjmjohnson/ITK,BRAINSia/ITK,GEHC-Surgery/ITK,malaterre/ITK,atsnyder/ITK,jmerkow/ITK,hendradarwin/ITK,wkjeong/ITK,BlueBrain/ITK,biotrump/ITK,paulnovo/ITK,msmolens/ITK,blowekamp/ITK,CapeDrew/DCMTK-ITK,GEHC-Surgery/ITK,stnava/ITK,BlueBrain/ITK,daviddoria/itkHoughTransform,hinerm/ITK,fedral/ITK,LucasGandel/ITK,GEHC-Surgery/ITK,itkvideo/ITK,fedral/ITK,spinicist/ITK,fedral/ITK,hinerm/ITK,thewtex/ITK,hinerm/ITK,thewtex/ITK,malaterre/ITK,cpatrick/ITK-RemoteIO,eile/ITK,stnava/ITK,ajjl/ITK,blowekamp/ITK,richardbeare/ITK,heimdali/ITK,jmerkow/ITK,jmerkow/ITK,CapeDrew/DITK,eile/ITK,LucHermitte/ITK,malaterre/ITK,hjmjohnson/ITK,BlueBrain/ITK,jcfr/ITK,thewtex/ITK,hinerm/ITK,hendradarwin/ITK,biotrump/ITK,eile/ITK,CapeDrew/DCMTK-ITK,jcfr/ITK,cpatrick/ITK-RemoteIO,atsnyder/ITK,paulnovo/ITK,jcfr/ITK,jcfr/ITK,itkvideo/ITK,GEHC-Surgery/ITK,thewtex/ITK,hendradarwin/ITK,ajjl/ITK,rhgong/itk-with-dom,GEHC-Surgery/ITK,paulnovo/ITK,richardbeare/ITK,cpatrick/ITK-RemoteIO,thewtex/ITK,daviddoria/itkHoughTransform,zachary-williamson/ITK,spinicist/ITK,hjmjohnson/ITK,LucHermitte/ITK,PlutoniumHeart/ITK,jcfr/ITK,hjmjohnson/ITK,zachary-williamson/ITK,cpatrick/ITK-RemoteIO,BRAINSia/ITK,malaterre/ITK,hjmjohnson/ITK,zachary-williamson/ITK,blowekamp/ITK,CapeDrew/DCMTK-ITK,hjmjohnson/ITK,hendradarwin/ITK,stnava/ITK,InsightSoftwareConsortium/ITK,BRAINSia/ITK,msmolens/ITK,malaterre/ITK,malaterre/ITK,hendradarwin/ITK,rhgong/itk-with-dom,wkjeong/ITK,jmerkow/ITK,itkvideo/ITK,malaterre/ITK,atsnyder/ITK,atsnyder/ITK,daviddoria/itkHoughTransform,CapeDrew/DITK,CapeDrew/DITK,ajjl/ITK,jmerkow/ITK,wkjeong/ITK,fedral/ITK,fbudin69500/ITK,hinerm/ITK,fbudin69500/ITK,hjmjohnson/ITK,vfonov/ITK,PlutoniumHeart/ITK,PlutoniumHeart/ITK,fbudin69500/ITK,CapeDrew/DCMTK-ITK,vfonov/ITK,richardbeare/ITK,LucHermitte/ITK,wkjeong/ITK,vfonov/ITK,richardbeare/ITK,LucHermitte/ITK,thewtex/ITK,BRAINSia/ITK,PlutoniumHeart/ITK,ajjl/ITK,InsightSoftwareConsortium/ITK,eile/ITK,fuentesdt/InsightToolkit-dev,blowekamp/ITK,zachary-williamson/ITK,stnava/ITK,cpatrick/ITK-RemoteIO,fbudin69500/ITK,heimdali/ITK,daviddoria/itkHoughTransform,heimdali/ITK,rhgong/itk-with-dom,msmolens/ITK,paulnovo/ITK,fedral/ITK,paulnovo/ITK,richardbeare/ITK,hendradarwin/ITK,blowekamp/ITK,CapeDrew/DCMTK-ITK,jcfr/ITK,hendradarwin/ITK,Kitware/ITK,thewtex/ITK,eile/ITK,jmerkow/ITK,GEHC-Surgery/ITK,fuentesdt/InsightToolkit-dev,CapeDrew/DCMTK-ITK,zachary-williamson/ITK,jcfr/ITK,CapeDrew/DITK,paulnovo/ITK,BlueBrain/ITK,BlueBrain/ITK,fbudin69500/ITK,paulnovo/ITK,stnava/ITK,Kitware/ITK,itkvideo/ITK,cpatrick/ITK-RemoteIO,Kitware/ITK,vfonov/ITK,fuentesdt/InsightToolkit-dev,zachary-williamson/ITK,daviddoria/itkHoughTransform,daviddoria/itkHoughTransform,vfonov/ITK,BRAINSia/ITK,Kitware/ITK,fuentesdt/InsightToolkit-dev,fbudin69500/ITK,spinicist/ITK,PlutoniumHeart/ITK,wkjeong/ITK,LucasGandel/ITK,zachary-williamson/ITK,spinicist/ITK,spinicist/ITK,biotrump/ITK,CapeDrew/DITK,LucasGandel/ITK,Kitware/ITK,daviddoria/itkHoughTransform,rhgong/itk-with-dom,itkvideo/ITK,jmerkow/ITK,wkjeong/ITK,LucHermitte/ITK,GEHC-Surgery/ITK,PlutoniumHeart/ITK,CapeDrew/DITK,fbudin69500/ITK,CapeDrew/DITK,CapeDrew/DCMTK-ITK,eile/ITK,richardbeare/ITK,heimdali/ITK,daviddoria/itkHoughTransform,GEHC-Surgery/ITK,rhgong/itk-with-dom,LucasGandel/ITK,LucasGandel/ITK,vfonov/ITK,hinerm/ITK,vfonov/ITK,LucHermitte/ITK,msmolens/ITK,InsightSoftwareConsortium/ITK,LucasGandel/ITK,PlutoniumHeart/ITK,fedral/ITK,LucasGandel/ITK,msmolens/ITK,BlueBrain/ITK,malaterre/ITK,fuentesdt/InsightToolkit-dev,spinicist/ITK,atsnyder/ITK,heimdali/ITK,vfonov/ITK,hinerm/ITK,ajjl/ITK,hinerm/ITK,BRAINSia/ITK,heimdali/ITK,rhgong/itk-with-dom,itkvideo/ITK,atsnyder/ITK,msmolens/ITK,spinicist/ITK,atsnyder/ITK,eile/ITK,rhgong/itk-with-dom,wkjeong/ITK,wkjeong/ITK,heimdali/ITK,biotrump/ITK,biotrump/ITK,fedral/ITK,fedral/ITK,richardbeare/ITK,msmolens/ITK,stnava/ITK