]> Creatis software - clitk.git/commitdiff
Add a convenient function
authorDavid Sarrut <david.sarrut@gmail.com>
Wed, 19 Oct 2011 13:01:45 +0000 (15:01 +0200)
committerDavid Sarrut <david.sarrut@gmail.com>
Wed, 19 Oct 2011 13:01:45 +0000 (15:01 +0200)
itk/clitkCropLikeImageFilter.h
itk/clitkCropLikeImageFilter.txx

index 9281fcad71fc7ec7ce2c7cd5a049a76078670861..9c12d784dfd0543436bf30c6604b8d5b94cc0c4c 100644 (file)
@@ -100,6 +100,15 @@ namespace clitk {
   }; // end class
   //--------------------------------------------------------------------
 
+
+  //--------------------------------------------------------------------
+  // Convenient function 
+  template<class ImageType>
+  typename ImageType::Pointer
+  ResizeImageLike(const ImageType * input,
+                  const itk::ImageBase<ImageType::ImageDimension> * like, 
+                  typename ImageType::PixelType BG);
+
 } // end namespace clitk
 //--------------------------------------------------------------------
 
index 73dd7a7d1532f0f885d1a35f71296145b9691f9f..5a9696e8b935434ed969194e89c1e7dd4236c09d 100644 (file)
@@ -23,9 +23,6 @@
 #include "clitkCommon.h"
 #include "clitkPasteImageFilter.h"
 
-// itk
-//#include "itkPasteImageFilter.h"
-
 //--------------------------------------------------------------------
 template <class ImageType>
 clitk::CropLikeImageFilter<ImageType>::
@@ -244,5 +241,23 @@ GenerateData() {
 }
 //--------------------------------------------------------------------
    
+
+//--------------------------------------------------------------------
+template<class ImageType>
+typename ImageType::Pointer
+clitk::ResizeImageLike(const ImageType * input,                       
+                       const itk::ImageBase<ImageType::ImageDimension> * like, 
+                       typename ImageType::PixelType backgroundValue) 
+{
+  typedef clitk::CropLikeImageFilter<ImageType> 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