From: David Sarrut Date: Wed, 19 Oct 2011 13:01:45 +0000 (+0200) Subject: Add a convenient function X-Git-Tag: v1.3.0~174^2~48 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a595d0ae02a42e1fc87d8cf044243da08e39414c;p=clitk.git Add a convenient function --- diff --git a/itk/clitkCropLikeImageFilter.h b/itk/clitkCropLikeImageFilter.h index 9281fca..9c12d78 100644 --- a/itk/clitkCropLikeImageFilter.h +++ b/itk/clitkCropLikeImageFilter.h @@ -100,6 +100,15 @@ namespace clitk { }; // end class //-------------------------------------------------------------------- + + //-------------------------------------------------------------------- + // Convenient function + template + typename ImageType::Pointer + ResizeImageLike(const ImageType * input, + const itk::ImageBase * like, + typename ImageType::PixelType BG); + } // end namespace clitk //-------------------------------------------------------------------- diff --git a/itk/clitkCropLikeImageFilter.txx b/itk/clitkCropLikeImageFilter.txx index 73dd7a7..5a9696e 100644 --- a/itk/clitkCropLikeImageFilter.txx +++ b/itk/clitkCropLikeImageFilter.txx @@ -23,9 +23,6 @@ #include "clitkCommon.h" #include "clitkPasteImageFilter.h" -// itk -//#include "itkPasteImageFilter.h" - //-------------------------------------------------------------------- template clitk::CropLikeImageFilter:: @@ -244,5 +241,23 @@ GenerateData() { } //-------------------------------------------------------------------- + +//-------------------------------------------------------------------- +template +typename ImageType::Pointer +clitk::ResizeImageLike(const ImageType * input, + const itk::ImageBase * like, + typename ImageType::PixelType backgroundValue) +{ + typedef clitk::CropLikeImageFilter CropFilterType; + typename CropFilterType::Pointer cropFilter = CropFilterType::New(); + cropFilter->SetInput(input); + cropFilter->SetCropLikeImage(like); + cropFilter->SetBackgroundValue(backgroundValue); + cropFilter->Update(); + return cropFilter->GetOutput(); +} +//-------------------------------------------------------------------- + -#endif //#define CLITKAUTOCROPFILTER +#endif //#define CLITKCROPLIKEIMAGEFILTER_TXX