From f723adbd2176138b339d3d8d3820bfa3293ec9c0 Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@c-s.fr>
Date: Mon, 1 Dec 2008 16:21:58 +0100
Subject: [PATCH] COMP: Fixed compilation of the StreamingWarpImageFilter tests
 and class

---
 .../otbStreamingWarpImageFilter.h             | 35 +++++++++----------
 .../otbStreamingWarpImageFilter.txx           | 11 +++---
 .../otbStreamingWarpImageFilter.cxx           |  8 ++---
 .../otbStreamingWarpImageFilterNew.cxx        |  2 +-
 4 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/Code/DisparityMap/otbStreamingWarpImageFilter.h b/Code/DisparityMap/otbStreamingWarpImageFilter.h
index f705349192..566da07046 100644
--- a/Code/DisparityMap/otbStreamingWarpImageFilter.h
+++ b/Code/DisparityMap/otbStreamingWarpImageFilter.h
@@ -49,20 +49,18 @@ public:
   itkTypeMacro(StreamingWarpImageFilter, itk::WarpImageFilter);
   
   /** template parameters typedef */
-  typedef TInputImage                            InputImageType;
-  typedef InputImageType::Pointer                InputImagePointerType;
-  typedef TOutputImage                           OutputImageType;
-  typedef typename OutputImageType::Pointer      OutputImagePointerType;
-  typedef TDeformationField                      DeformationFieldType;
-  typedef DeformationFieldType::PixelType        DeformationValueType;
-  typedef typename DeformationFieldType::Pointer DeformationFieldPointerType;
+  typedef TInputImage                              InputImageType;
+  typedef typename  InputImageType::Pointer        InputImagePointerType;
+  typedef TOutputImage                             OutputImageType;
+  typedef typename OutputImageType::Pointer        OutputImagePointerType;
+  typedef TDeformationField                        DeformationFieldType;
+  typedef typename DeformationFieldType::PixelType DeformationValueType;
+  typedef typename DeformationFieldType::Pointer   DeformationFieldPointerType;
 
-  /** 
-   * This filters requires only a part of the input and of the deformation field to
-   * produce its output. As such, we need to overload the GenerateInputRequestedRegion() method.
-   */
-  virtual void GenerateInputRequestedRegion() ;
-	
+  /** Accessors */
+  itkSetMacro(MaximumDeformation,DeformationValueType);
+  itkGetConstReferenceMacro(MaximumDeformation,DeformationValueType);
+  
 protected:
   /** Constructor */
   StreamingWarpImageFilter();
@@ -70,17 +68,18 @@ protected:
   virtual ~StreamingWarpImageFilter() {};
   /** PrintSelf */
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
+  /** 
+   * This filters requires only a part of the input and of the deformation field to
+   * produce its output. As such, we need to overload the GenerateInputRequestedRegion() method.
+   */
+  virtual void GenerateInputRequestedRegion() ;
 	
-  /** Accessors */
-  itkSetMacro(MaximumDeformation,DeformationValueType);
-  itkGetConstReferenceMacro(MaximumDeformation,DeformationValueType);
-
 private:
   StreamingWarpImageFilter(const Self&); //purposely not implemented
   void operator=(const Self&); //purposely not implemented
 	
   // Assesment of the maximum deformation for streaming
-  DeformationValueType m_MaximumDeformation;s
+  DeformationValueType m_MaximumDeformation;
 };
 
 } // end namespace otb
diff --git a/Code/DisparityMap/otbStreamingWarpImageFilter.txx b/Code/DisparityMap/otbStreamingWarpImageFilter.txx
index f33442f87b..9ce17120e2 100644
--- a/Code/DisparityMap/otbStreamingWarpImageFilter.txx
+++ b/Code/DisparityMap/otbStreamingWarpImageFilter.txx
@@ -31,8 +31,6 @@ template<class TInputImage, class TOutputImage, class TDeformationField>
 StreamingWarpImageFilter<TInputImage,TOutputImage,TDeformationField>
 ::StreamingWarpImageFilter()
 {
-  // Default neighborhood interpolation radius is one pixel
-  m_InterpolatorNeighborhoodRadius = 1 ;
   // Fill the default maximum deformation
   m_MaximumDeformation.SetSize(InputImageType::ImageDimension);
   m_MaximumDeformation.Fill(1);
@@ -59,7 +57,7 @@ StreamingWarpImageFilter<TInputImage,TOutputImage,TDeformationField>
   
   // Compute the security margin radius
   typename InputImageType::SizeType radius;
-  typename InputImageType::SpacingType sapcing = inputPtr->GetSpacing();
+  typename InputImageType::SpacingType spacing = inputPtr->GetSpacing();
 
   // Add the padding due to the interpolator
   unsigned int interpolatorRadius = StreamingTraits<typename Superclass::InputImageType>::CalculateNeededRadiusForInterpolator(this->GetInterpolator());
@@ -67,7 +65,7 @@ StreamingWarpImageFilter<TInputImage,TOutputImage,TDeformationField>
   // Compute the margin due to the maximum deformation value and interpolator radius
   for(unsigned int i = 0; i<InputImageType::ImageDimension;++i)
     {
-      radius[i]=interpolatorRadius + static_cast<unsigned int>(vcl_ceil(m_MaximumDeformation/spacing[i]));
+      radius[i]=interpolatorRadius + static_cast<unsigned int>(vcl_ceil(m_MaximumDeformation[i]/spacing[i]));
     }
 
   otbMsgDevMacro(<<"WarpImageFilter: MaximumDeformation: "<<m_MaximumDeformation<<", interpolator radius: "<<interpolatorRadius<<", total radius:  "<<radius);
@@ -95,7 +93,7 @@ StreamingWarpImageFilter<TInputImage,TOutputImage,TDeformationField>
     inputPtr->SetRequestedRegion( inputRequestedRegion );
     
     // build an exception
-    InvalidRequestedRegionError e(__FILE__, __LINE__);
+    itk::InvalidRequestedRegionError e(__FILE__, __LINE__);
     e.SetLocation(ITK_LOCATION);
     e.SetDescription("Requested region is (at least partially) outside the largest possible region.");
     e.SetDataObject(inputPtr);
@@ -109,8 +107,7 @@ StreamingWarpImageFilter<TInputImage,TOutputImage,TDeformationField>
 ::PrintSelf(std::ostream& os, itk::Indent indent) const
 {
   Superclass::PrintSelf(os,indent);
-  os << indent << "m_InterpolatorNeighborhoodRadius: " << m_InterpolatorNeighborhoodRadius<<std::endl;
-  os << indent << "m_AddedRadius: " <<m_AddedRadius<< std::endl;
+  os << indent << "Maximum deformation: " << m_MaximumDeformation<<std::endl;
 }
 
 
diff --git a/Testing/Code/DisparityMap/otbStreamingWarpImageFilter.cxx b/Testing/Code/DisparityMap/otbStreamingWarpImageFilter.cxx
index fabca18971..b2d8f157b7 100644
--- a/Testing/Code/DisparityMap/otbStreamingWarpImageFilter.cxx
+++ b/Testing/Code/DisparityMap/otbStreamingWarpImageFilter.cxx
@@ -20,7 +20,7 @@
 #include "otbImageFileReader.h"
 #include "otbStreamingImageFileWriter.h"
 
-#include "itkWarpImageFilter.h"
+#include "otbStreamingWarpImageFilter.h"
 
 
 int otbStreamingWarpImageFilter(int argc, char* argv[])
@@ -52,9 +52,9 @@ int otbStreamingWarpImageFilter(int argc, char* argv[])
   typedef otb::StreamingImageFileWriter<ImageType> WriterType;
   
   // Objects creation
-  DeformationReaderType::Pointer deformationReader::New();
-  ReaderType::Pointer movingReader = ReaderType::New();
-  WriterType::pointer writer WriterType::New();
+  DeformationReaderType::Pointer deformationReader = DeformationReaderType::New();
+  ReaderType::Pointer reader = ReaderType::New();
+  WriterType::Pointer writer = WriterType::New();
   ImageWarperType::Pointer warper = ImageWarperType::New();
   
   // Reading
diff --git a/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx b/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx
index 6e5edb2249..62499b69d0 100644
--- a/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx
+++ b/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx
@@ -20,7 +20,7 @@
 #include "otbImageFileReader.h"
 #include "otbStreamingImageFileWriter.h"
 
-#include "itkWarpImageFilter.h"
+#include "otbStreamingWarpImageFilter.h"
 
 
 int otbStreamingWarpImageFilterNew(int argc, char* argv[])
-- 
GitLab