]> Creatis software - clitk.git/blobdiff - itk/clitkCropLikeImageFilter.h
With ITK 5.0, itk::ProcessObject::VerifyInputInformation are now declared const
[clitk.git] / itk / clitkCropLikeImageFilter.h
index 9281fcad71fc7ec7ce2c7cd5a049a76078670861..6e6360891c05112f5a9505a7970c82918dfa3cba 100644 (file)
@@ -1,7 +1,7 @@
 /*=========================================================================
   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
 
-  Authors belong to: 
+  Authors belong to:
   - University of LYON              http://www.universite-lyon.fr/
   - Léon Bérard cancer center       http://www.centreleonberard.fr
   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
 #ifndef CLITKCROPLIKEIMAGEFILTER_H
 #define CLITKCROPLIKEIMAGEFILTER_H
 
+// clitk
+#include "clitkBoundingBoxUtils.h"
+#include "clitkImageCommon.h"
+
+// itk
 #include <itkImageToImageFilter.h>
 
 namespace clitk {
-  
+
   //--------------------------------------------------------------------
   /*
     Perform various cropping operation on a image
   */
   //--------------------------------------------------------------------
-  
+
   template <class ImageType>
   class ITK_EXPORT CropLikeImageFilter: public itk::ImageToImageFilter<ImageType, ImageType> {
   public:
@@ -37,10 +42,10 @@ namespace clitk {
     typedef itk::ImageToImageFilter<ImageType, ImageType>  Superclass;
     typedef itk::SmartPointer<Self>                        Pointer;
     typedef itk::SmartPointer<const Self>                  ConstPointer;
-    
+
     /** Method for creation through the object factory. */
     itkNewMacro(Self);
-    
+
     /** Run-time type information (and related methods). */
     itkTypeMacro(CropLikeImageFilter, ImageToImageFilter);
 
@@ -60,22 +65,26 @@ namespace clitk {
 
     // Set Background if 'like' is greater than input
     itkSetMacro(BackgroundValue, PixelType);
-    itkGetConstMacro(BackgroundValue, PixelType); 
+    itkGetConstMacro(BackgroundValue, PixelType);
 
     /** ImageDimension constants */
     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
 
     // I dont want to verify inputs information
-    virtual void VerifyInputInformation() { }
+#if ITK_VERSION_MAJOR <= 4
+    virtual void VerifyInputInformation() ITK_OVERRIDE { }
+#else
+    virtual void VerifyInputInformation() const ITK_OVERRIDE { }
+#endif
 
   protected:
     CropLikeImageFilter();
     virtual ~CropLikeImageFilter() {}
-    
-    virtual void GenerateOutputInformation();
-    virtual void GenerateData();
-    virtual void GenerateInputRequestedRegion();
-    
+
+    virtual void GenerateOutputInformation() ITK_OVERRIDE;
+    virtual void GenerateData() ITK_OVERRIDE;
+    virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
+
     PixelType m_BackgroundValue;
     RegionType m_OutputRegion;
     RegionType m_Region;
@@ -84,22 +93,44 @@ namespace clitk {
     PointType m_Origin;
     const itk::ImageBase<ImageDimension> * m_LikeImage;
     std::vector<bool> m_CropAlongThisDimension;
-    
+
     PointType m_StartPoint;         // start point in physical world
-    IndexType m_StartSourceIndex;   // start index in "source" image 
-    IndexType m_StartDestIndex;     // start index in "destination" image 
-    
+    IndexType m_StartSourceIndex;   // start index in "source" image
+    IndexType m_StartDestIndex;     // start index in "destination" image
+
     PointType m_StopPoint;         // stop point in physical world
-    IndexType m_StopSourceIndex;   // stop index in "source" image 
-    IndexType m_StopDestIndex;     // stop index in "destination" image 
-    
+    IndexType m_StopSourceIndex;   // stop index in "source" image
+    IndexType m_StopDestIndex;     // stop index in "destination" image
+
   private:
     CropLikeImageFilter(const Self&); //purposely not implemented
     void operator=(const Self&); //purposely not implemented
-    
+
   }; // end class
   //--------------------------------------------------------------------
 
+
+  //--------------------------------------------------------------------
+  // Convenient function
+  template<class ImageType>
+  typename ImageType::Pointer
+  ResizeImageLike(const ImageType * input,
+                  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
 //--------------------------------------------------------------------