]> Creatis software - clitk.git/commitdiff
Add ResizeImageLike with region or bb
authorDavid Sarrut <david.sarrut@gmail.com>
Mon, 24 Oct 2011 06:30:47 +0000 (08:30 +0200)
committerDavid Sarrut <david.sarrut@gmail.com>
Mon, 24 Oct 2011 06:30:47 +0000 (08:30 +0200)
itk/clitkCropLikeImageFilter.h
itk/clitkCropLikeImageFilter.txx

index 9c12d784dfd0543436bf30c6604b8d5b94cc0c4c..c8fae32891eef1c3a7b1f305fcf4e3fbb716cb06 100644 (file)
 #ifndef CLITKCROPLIKEIMAGEFILTER_H
 #define CLITKCROPLIKEIMAGEFILTER_H
 
+// clitk
+#include "clitkBoundingBoxUtils.h"
+
+// itk
 #include <itkImageToImageFilter.h>
 
 namespace clitk {
@@ -109,6 +113,19 @@ namespace clitk {
                   const itk::ImageBase<ImageType::ImageDimension> * like, 
                   typename ImageType::PixelType BG);
 
+  template<class ImageType>
+  typename ImageType::Pointer
+  ResizeImageLike(const ImageType * input,
+                  typename itk::ImageBase<ImageType::ImageDimension>::RegionType * like, 
+                  typename ImageType::PixelType BG);
+
+  template<class ImageType>
+  typename ImageType::Pointer
+  ResizeImageLike(const ImageType * input, 
+                  typename itk::BoundingBox<unsigned long, ImageType::ImageDimension>::Pointer bb, 
+                  typename ImageType::PixelType BG);
+
+
 } // end namespace clitk
 //--------------------------------------------------------------------
 
index 5a9696e8b935434ed969194e89c1e7dd4236c09d..93644a57c57f9a4a664de713aaab5524b603b06d 100644 (file)
@@ -259,5 +259,38 @@ clitk::ResizeImageLike(const ImageType * input,
 }
 //--------------------------------------------------------------------
 
+
+//--------------------------------------------------------------------
+template<class ImageType>
+typename ImageType::Pointer
+clitk::ResizeImageLike(const ImageType * input,                       
+                       typename itk::ImageBase<ImageType::ImageDimension>::RegionType * region, 
+                       typename ImageType::PixelType backgroundValue) 
+{
+  typename ImageType::Pointer output = ImageType::New();
+  output->CopyInformation(input);
+  output->SetRegions(region);
+  output->Allocate();
+  return clitk::ResizeImageLike<ImageType>(input, output, backgroundValue);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class ImageType>
+typename ImageType::Pointer
+clitk::ResizeImageLike(const ImageType * input, 
+                       typename itk::BoundingBox<unsigned long, ImageType::ImageDimension>::Pointer bb, 
+                       typename ImageType::PixelType BG)
+{
+  typename ImageType::RegionType region;
+  clitk::ComputeRegionFromBB<ImageType>(input, bb, region);
+  typename ImageType::Pointer output = ImageType::New();
+  output->CopyInformation(input);
+  output->SetRegions(region);
+  output->Allocate();
+  return clitk::ResizeImageLike<ImageType>(input, output, BG);   
+}
+//--------------------------------------------------------------------
+
 #endif //#define CLITKCROPLIKEIMAGEFILTER_TXX