From 0a6ce0aedf87be56afa381561b8d5b7b7822fa15 Mon Sep 17 00:00:00 2001
From: tbaudier <thomas.baudier@creatis.insa-lyon.fr>
Date: Tue, 18 Sep 2018 15:55:24 +0200
Subject: [PATCH] Ensure compatibility with ITK < 4.12 for throw exception

---
 itk/RelativePositionPropImageFilter.h                        | 5 ++++-
 itk/RelativePositionPropImageFilter.txx                      | 4 ++++
 itk/clitkBackProjectImageFilter.h                            | 4 ++++
 itk/clitkBackProjectImageFilter.txx                          | 4 ++++
 registration/clitkCorrelationRatioImageToImageMetric.h       | 4 ++++
 registration/clitkCorrelationRatioImageToImageMetric.txx     | 4 ++++
 .../clitkOptNormalizedCorrelationImageToImageMetric.h        | 4 ++++
 .../clitkOptNormalizedCorrelationImageToImageMetric.txx      | 4 ++++
 ...kOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h | 4 ++++
 ...ptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx | 4 ++++
 ...ptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h | 4 ++++
 ...MattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx | 4 ++++
 .../itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h        | 4 ++++
 .../itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx      | 4 ++++
 14 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/itk/RelativePositionPropImageFilter.h b/itk/RelativePositionPropImageFilter.h
index 4b30db1..e876f9f 100644
--- a/itk/RelativePositionPropImageFilter.h
+++ b/itk/RelativePositionPropImageFilter.h
@@ -169,8 +169,11 @@ namespace itk
       }
     }
   
-
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
     virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
+#else
+   virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError) ITK_OVERRIDE;
+#endif
     void EnlargeOutputRequestedRegion (DataObject * output) ITK_OVERRIDE;
 
   protected:
diff --git a/itk/RelativePositionPropImageFilter.txx b/itk/RelativePositionPropImageFilter.txx
index 3ee1d0f..c34c7c3 100644
--- a/itk/RelativePositionPropImageFilter.txx
+++ b/itk/RelativePositionPropImageFilter.txx
@@ -50,7 +50,11 @@ namespace itk
   template <class TInputImage, class TOutputImage,class TtNorm>
   void 
   RelativePositionPropImageFilter<TInputImage,TOutputImage,TtNorm>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
   ::GenerateInputRequestedRegion()
+#else
+  ::GenerateInputRequestedRegion() throw (InvalidRequestedRegionError)
+#endif
   {
     // call the superclass' implementation of this method
     Superclass::GenerateInputRequestedRegion ();
diff --git a/itk/clitkBackProjectImageFilter.h b/itk/clitkBackProjectImageFilter.h
index cb68779..9ffaffb 100644
--- a/itk/clitkBackProjectImageFilter.h
+++ b/itk/clitkBackProjectImageFilter.h
@@ -210,7 +210,11 @@ namespace clitk
     void SetOutputParametersFromImage( const OutputImageConstPointer  image );
 
 
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
     void Initialize(void);
+#else
+    void Initialize(void) throw (itk::ExceptionObject);
+#endif
 
   protected:
 
diff --git a/itk/clitkBackProjectImageFilter.txx b/itk/clitkBackProjectImageFilter.txx
index e643226..fa8d261 100644
--- a/itk/clitkBackProjectImageFilter.txx
+++ b/itk/clitkBackProjectImageFilter.txx
@@ -190,7 +190,11 @@ namespace clitk
   template <class InputImageType, class OutputImageType>
   void 
   BackProjectImageFilter<InputImageType, OutputImageType>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
   ::Initialize( void )
+#else
+  ::Initialize( void ) throw (itk::ExceptionObject)
+#endif
   {
     //Change the origin of the 2D input
     typename  InputImageType::ConstPointer inputPtr=this->GetInput();
diff --git a/registration/clitkCorrelationRatioImageToImageMetric.h b/registration/clitkCorrelationRatioImageToImageMetric.h
index 51e15ae..a4bc342 100644
--- a/registration/clitkCorrelationRatioImageToImageMetric.h
+++ b/registration/clitkCorrelationRatioImageToImageMetric.h
@@ -105,7 +105,11 @@ public:
     *  (1) making sure that all the components are present and plugged
     *      together correctly,
     *  (3) allocate memory for bin data structures. */
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
   virtual void Initialize(void) ITK_OVERRIDE;
+#else
+  virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE;
+#endif
 
   /** Get the derivatives of the match measure. */
   void GetDerivative( const TransformParametersType & parameters,
diff --git a/registration/clitkCorrelationRatioImageToImageMetric.txx b/registration/clitkCorrelationRatioImageToImageMetric.txx
index 685a043..1454539 100644
--- a/registration/clitkCorrelationRatioImageToImageMetric.txx
+++ b/registration/clitkCorrelationRatioImageToImageMetric.txx
@@ -51,7 +51,11 @@ CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 CorrelationRatioImageToImageMetric<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
 ::Initialize(void)
+#else
+::Initialize(void) throw ( ExceptionObject )
+#endif
 {
 
   this->Superclass::Initialize();
diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetric.h b/registration/clitkOptNormalizedCorrelationImageToImageMetric.h
index 12a90ec..067cd87 100644
--- a/registration/clitkOptNormalizedCorrelationImageToImageMetric.h
+++ b/registration/clitkOptNormalizedCorrelationImageToImageMetric.h
@@ -95,7 +95,11 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
   virtual void Initialize(void) ITK_OVERRIDE;
+#else
+  virtual void Initialize(void) throw ( itk::ExceptionObject ) ITK_OVERRIDE;
+#endif
 
   /**  Get the value. */
   MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx b/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx
index b5d28cc..ea2c52a 100644
--- a/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx
+++ b/registration/clitkOptNormalizedCorrelationImageToImageMetric.txx
@@ -117,7 +117,11 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
 ::Initialize(void)
+#else
+::Initialize(void) throw ( itk::ExceptionObject )
+#endif
 {
 
   this->Superclass::Initialize();
diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h
index 6718316..208cb38 100644
--- a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h
+++ b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h
@@ -95,7 +95,11 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
   virtual void Initialize(void) ITK_OVERRIDE;
+#else
+  virtual void Initialize(void) throw ( itk::ExceptionObject ) ITK_OVERRIDE;
+#endif
 
   /**  Get the value. */
   MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
diff --git a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx
index 0389fc5..042b4b7 100644
--- a/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx
+++ b/registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx
@@ -117,7 +117,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
 ::Initialize(void)
+#else
+::Initialize(void) throw ( itk::ExceptionObject )
+#endif
 {
 
   this->Superclass::Initialize();
diff --git a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h
index 9973cc6..c51414e 100644
--- a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h
+++ b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h
@@ -187,7 +187,11 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
   virtual void Initialize(void) ITK_OVERRIDE;
+#else
+  virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE;
+#endif
 
   /**  Get the value. */
   MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
diff --git a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx
index 592fe22..ef4257e 100644
--- a/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx
+++ b/registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx
@@ -183,7 +183,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
 ::Initialize(void)
+#else
+::Initialize(void) throw ( ExceptionObject )
+#endif
 {
   this->Superclass::Initialize();
   this->Superclass::MultiThreadingInitialize();
diff --git a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h
index ffa6ac9..e12b42f 100644
--- a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h
+++ b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h
@@ -98,7 +98,11 @@ public:
    *  (2) uniformly select NumberOfSpatialSamples within
    *      the FixedImageRegion, and
    *  (3) allocate memory for pdf data structures. */
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
   virtual void Initialize(void) ITK_OVERRIDE;
+#else
+  virtual void Initialize(void) throw ( ExceptionObject ) ITK_OVERRIDE;
+#endif
 
   /**  Get the value. */
   MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
diff --git a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx
index af1c986..02427a3 100644
--- a/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx
+++ b/registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx
@@ -100,7 +100,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 template <class TFixedImage, class TMovingImage>
 void
 MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
+#if ( ( ITK_VERSION_MAJOR == 4 ) && ( ITK_VERSION_MINOR > 12 ) || ( ITK_VERSION_MAJOR > 4 ))
 ::Initialize(void)
+#else
+::Initialize(void) throw ( ExceptionObject )
+#endif
 {
 
   this->Superclass::Initialize();
-- 
2.47.1