diff --git a/Code/Common/otbPersistentFilterStreamingDecorator.h b/Code/Common/otbPersistentFilterStreamingDecorator.h
index 1d0000e3090d6a42838bc15a27af656ed52002a9..94d782c02bd257f2838c1fb36a479a3089675ad6 100644
--- a/Code/Common/otbPersistentFilterStreamingDecorator.h
+++ b/Code/Common/otbPersistentFilterStreamingDecorator.h
@@ -31,7 +31,7 @@ namespace otb
  *  its data on the whole image, but never loads the whole of it, and eventually processes
  *  each piece with multiple threads. Before the streaming of the whole image is triggered,
  *  the Reset() method of the persistent filter is called to clear the temporary data it might
- *  contain. Afther the streaming, the Synthetize() method is called to synthetize the
+ *  contain. After the streaming, the Synthetize() method is called to synthetize the
  *  temporary data. One can access the persistent filter via the GetFilter() method, and
  * StreamingVirtualWriter via the GetStreamer() method.
  *
@@ -68,10 +68,6 @@ public:
   itkGetConstObjectMacro(Filter, FilterType);
   itkGetObjectMacro(Streamer, StreamerType);
 
-  void SetInput(const ImageType *input);
-  const ImageType * GetInput(void);
-  const ImageType * GetInput(unsigned int idx);
-
   virtual void Update(void);
 
 protected:
@@ -84,15 +80,16 @@ protected:
 
   virtual void GenerateData(void);
 
-private:
-  PersistentFilterStreamingDecorator(const Self &); //purposely not implemented
-  void operator =(const Self&); //purposely not implemented
-
   /// Object responsible for streaming
   StreamerPointerType m_Streamer;
 
   /// Object responsible for computation
   FilterPointerType m_Filter;
+
+private:
+  PersistentFilterStreamingDecorator(const Self &); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
 };
 } // End namespace otb
 #ifndef OTB_MANUAL_INSTANTIATION
diff --git a/Code/Common/otbPersistentFilterStreamingDecorator.txx b/Code/Common/otbPersistentFilterStreamingDecorator.txx
index 3024bd5f87e88b3ed8e62aa079f52d57408a1463..d3a1704cb684e37bd54c6f6985602efaf51210d4 100644
--- a/Code/Common/otbPersistentFilterStreamingDecorator.txx
+++ b/Code/Common/otbPersistentFilterStreamingDecorator.txx
@@ -32,33 +32,7 @@ PersistentFilterStreamingDecorator<TFilter>
   m_Filter = FilterType::New();
   m_Streamer = StreamerType::New();
 }
-template <class TFilter>
-void
-PersistentFilterStreamingDecorator<TFilter>
-::SetInput(const ImageType *input)
-{
-  // ProcessObject is not const_correct so this cast is required here.
-  this->ProcessObject::SetNthInput(0, const_cast<ImageType *>(input));
-}
-template <class TFilter>
-const typename PersistentFilterStreamingDecorator<TFilter>::ImageType *
-PersistentFilterStreamingDecorator<TFilter>
-::GetInput(void)
-{
-  if (this->GetNumberOfInputs() < 1)
-    {
-    return 0;
-    }
 
-  return static_cast<ImageType*>(this->ProcessObject::GetInput(0));
-}
-template <class TFilter>
-const typename PersistentFilterStreamingDecorator<TFilter>::ImageType *
-PersistentFilterStreamingDecorator<TFilter>
-::GetInput(unsigned int idx)
-{
-  return static_cast<ImageType*>(this->ProcessObject::GetInput(idx));
-}
 template <class TFilter>
 void
 PersistentFilterStreamingDecorator<TFilter>
@@ -66,9 +40,18 @@ PersistentFilterStreamingDecorator<TFilter>
 {
   // Reset the filter before the generation.
   this->GetFilter()->Reset();
-  m_Streamer->SetInput(m_Filter->GetOutput());
-  m_Streamer->Update();
-  // Synthetize data afther the streaming of the whole image.
+
+  /*
+  for (unsigned int idx = 0; idx < this->GetFilter()->GetNumberOfOutputs(); ++idx)
+    {
+    this->GetStreamer()->SetNthInput(idx, this->GetFilter()->GetOutput(idx));
+    }
+  */
+
+  this->GetStreamer()->SetInput(this->GetFilter()->GetOutput());
+  this->GetStreamer()->Update();
+
+  // Synthetize data after the streaming of the whole image.
   this->GetFilter()->Synthetize();
 }
 
@@ -79,6 +62,7 @@ PersistentFilterStreamingDecorator<TFilter>
 {
   this->GenerateData();
 }
+
 /**
  * PrintSelf Method
  */
diff --git a/Code/Common/otbPersistentImageFilter.h b/Code/Common/otbPersistentImageFilter.h
index 8df8f21b979673c159483490e1cc7bab9fb3f45b..ccea263130c7e5727c5757df6b5802dc8fc1a4b1 100644
--- a/Code/Common/otbPersistentImageFilter.h
+++ b/Code/Common/otbPersistentImageFilter.h
@@ -27,9 +27,9 @@ namespace otb
  *   update.
  *   For instance, a filter computing global statistics on an image with streaming
  *   capabilities will have to keep the temporary results for each streamed piece of the
- *   image in order to synthetize the global statistics at the end. This filter is an
+ *   image in order to synthesize the global statistics at the end. This filter is an
  *   itk::ImageToImageFilter, providing two additional methods. The first one, Synthetize(),
- *   allows the user to synthetize() temporary data produced by the multiple updates on different
+ *   allows the user to synthesize temporary data produced by the multiple updates on different
  *   pieces of the image to the global result. The second one, Reset(), allows the user to
  *   reset the temporary data for a new input image for instance.
  *
@@ -60,7 +60,7 @@ public:
    */
   virtual void Reset(void) = 0;
   /**
-   * Synthetize the persistent data of the filter.
+   * Synthesize the persistent data of the filter.
    */
   virtual void Synthetize(void) = 0;
 
diff --git a/Code/FeatureExtraction/otbRadiometricMomentsImageFunction.txx b/Code/FeatureExtraction/otbRadiometricMomentsImageFunction.txx
index 993898604607db33e59755fcf6635e5385dcd496..06d89f38c1fb147cf10ca619cfc4bbb3907824bf 100644
--- a/Code/FeatureExtraction/otbRadiometricMomentsImageFunction.txx
+++ b/Code/FeatureExtraction/otbRadiometricMomentsImageFunction.txx
@@ -64,6 +64,8 @@ RadiometricMomentsImageFunction<TInputImage,TCoordRep>
     }
   
   // Check for out of buffer
+  Self* _this = const_cast<Self*>(this);
+  _this->SetInputImage( this->GetInputImage() );
   if ( !this->IsInsideBuffer( index ) )
     {
     return moments;
diff --git a/Code/IO/otbStreamingImageVirtualWriter.h b/Code/IO/otbStreamingImageVirtualWriter.h
index c4105a2ee38725425f85edbaf2ecefb2b2fee894..9ae59e84295c01dce381482e85a1852d6378d888 100644
--- a/Code/IO/otbStreamingImageVirtualWriter.h
+++ b/Code/IO/otbStreamingImageVirtualWriter.h
@@ -79,6 +79,9 @@ public:
   const InputImageType * GetInput(void);
   const InputImageType * GetInput(unsigned int idx);
 
+  void SetNthInput(unsigned int idx, const InputImageType *input);
+
+
   /** SmartPointer to a region splitting object */
   typedef itk::ImageRegionSplitter<itkGetStaticConstMacro(InputImageDimension)> SplitterType;
   typedef typename SplitterType::Pointer                                        RegionSplitterPointer;
diff --git a/Code/IO/otbStreamingImageVirtualWriter.txx b/Code/IO/otbStreamingImageVirtualWriter.txx
index 8f41e0f902d665a92bfa0e6c498ad875ab7367cb..ce0b5938974e80d17265524e360b278f9aa013df 100644
--- a/Code/IO/otbStreamingImageVirtualWriter.txx
+++ b/Code/IO/otbStreamingImageVirtualWriter.txx
@@ -136,13 +136,20 @@ template <class TInputImage>
 void
 StreamingImageVirtualWriter<TInputImage>
 ::SetInput(const InputImageType *input)
+{
+  this->SetNthInput(0, input);
+}
+
+template <class TInputImage>
+void
+StreamingImageVirtualWriter<TInputImage>
+::SetNthInput(unsigned int idx, const InputImageType *input)
 {
   // ProcessObject is not const_correct so this cast is required here.
-  this->itk::ProcessObject::SetNthInput(0,
+  this->itk::ProcessObject::SetNthInput(idx,
                                         const_cast<TInputImage *>(input));
 }
 
-//---------------------------------------------------------
 template <class TInputImage>
 const typename StreamingImageVirtualWriter<TInputImage>::InputImageType *
 StreamingImageVirtualWriter<TInputImage>
@@ -164,6 +171,7 @@ StreamingImageVirtualWriter<TInputImage>
 {
   return static_cast<TInputImage*> (this->itk::ProcessObject::GetInput(idx));
 }
+
 template <class TInputImage>
 void
 StreamingImageVirtualWriter<TInputImage>
diff --git a/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.h b/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.h
index b947924032ddc9405ca2ae11ed02525b9d842d20..7ce4b7c432d4db673236e5a49949a7a02274c3d9 100644
--- a/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.h
+++ b/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.h
@@ -26,13 +26,14 @@ namespace Statistics {
 /** \class GaussianAdditiveNoiseSampleListFilter
  *  \brief This class generate a noised version of the input sample list
  *
- * For each component of the samples, a random value of the sequence
- * value is added.
+ * For each component of the samples, a white gaussian random is added.
  * 
  * It use the MersenneTwisterRandomVariateGenerator to generate a
  * sequence of numbers following the normal law considered as White
  * Gaussian Noise.
  * Mean and Variance are set via the methods SetMean() and SetVariance().
+ * The input SampleList can be noised m_NumberOfIteration times via the
+ * method SetNumberOfIteration()
  *
  * \sa ListSampleToListSampleFilter
  */
@@ -78,6 +79,10 @@ public:
   /** Set/Get the Scales for this sample list */
   itkSetMacro(Variance,double);
   itkGetMacro(Variance,double);
+
+  /** Set how many times the ListSample must be noised */
+  itkSetMacro(NumberOfIteration,unsigned int);
+  itkGetMacro(NumberOfIteration,unsigned int);
   
 protected:
   /** This method causes the filter to generate its output. */
@@ -100,7 +105,8 @@ private:
   double              m_Mean;
   double              m_Variance;
   std::vector<double> m_WhiteGaussianNoiseCoefficients;
-
+  unsigned int        m_NumberOfIteration;
+  
 }; // end of class ImageToListGenerator
 
 } // end of namespace Statistics
diff --git a/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.txx b/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.txx
index 133f15884007dddd7897f839c88de8449545dfa0..5f5871ccee5c73eee155229e27ac3b85489c2b00 100644
--- a/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.txx
+++ b/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.txx
@@ -31,6 +31,7 @@ GaussianAdditiveNoiseSampleListFilter<TInputSampleList,TOutputSampleList>
 {
   m_Mean = 0.;
   m_Variance = 1e-3;
+  m_NumberOfIteration = 1;
 }
 
 template < class TInputSampleList, class TOutputSampleList >
@@ -48,7 +49,7 @@ GaussianAdditiveNoiseSampleListFilter<TInputSampleList,TOutputSampleList>
   unsigned int size = this->GetInput()->Get()->GetMeasurementVectorSize();
   if(size == 0)
     {
-    itkExceptionMacro(<< "MeasurementVector size is  "<<size << " , excpect non null size " );
+    itkExceptionMacro(<< "MeasurementVector size is  "<<size << " , expected non null size " );
     }
   else
     for(unsigned int i = 0; i <size; i++)
@@ -73,39 +74,43 @@ GaussianAdditiveNoiseSampleListFilter<TInputSampleList,TOutputSampleList>
   
   // Clear any previous output
   outputSampleListPtr->Clear();
-
-  typename InputSampleListType::ConstIterator inputIt = inputSampleListPtr->Begin();
-
+  
   // Set-up progress reporting
-  itk::ProgressReporter progress(this,0,inputSampleListPtr->Size());
+  itk::ProgressReporter progress(this,0,inputSampleListPtr->Size()*m_NumberOfIteration);
 
-  // Iterate on the InputSampleList
-  while(inputIt != inputSampleListPtr->End())
+  // Iterate m_NumberOfIteration-times the noising process
+  for (unsigned int currIteration = 0; currIteration< m_NumberOfIteration ; currIteration++)
     {
-    // Generate Random sequence 
-    this->GenerateRandomSequence();
-
-    // Retrieve current input sample
-    InputMeasurementVectorType currentInputMeasurement = inputIt.GetMeasurementVector();
+    typename InputSampleListType::ConstIterator inputIt = inputSampleListPtr->Begin();
 
-    // Build current output sample
-    OutputMeasurementVectorType currentOutputMeasurement;
-    currentOutputMeasurement.SetSize(currentInputMeasurement.GetSize());
-
-    // Add the white noise to each component of the sample
-    for(unsigned int idx = 0;idx < inputSampleListPtr->GetMeasurementVectorSize();++idx)
+    // Iterate on the InputSampleList
+    while(inputIt != inputSampleListPtr->End())
       {
-      currentOutputMeasurement[idx] = static_cast<OutputValueType>(
-        (static_cast<double>(currentInputMeasurement[idx])+m_WhiteGaussianNoiseCoefficients[idx]));
+      // Generate Random sequence 
+      this->GenerateRandomSequence();
+
+      // Retrieve current input sample
+      InputMeasurementVectorType currentInputMeasurement = inputIt.GetMeasurementVector();
+
+      // Build current output sample
+      OutputMeasurementVectorType currentOutputMeasurement;
+      currentOutputMeasurement.SetSize(currentInputMeasurement.GetSize());
+
+      // Add the white noise to each component of the sample
+      for(unsigned int idx = 0;idx < inputSampleListPtr->GetMeasurementVectorSize();++idx)
+        {
+        currentOutputMeasurement[idx] = static_cast<OutputValueType>(
+          (static_cast<double>(currentInputMeasurement[idx])+m_WhiteGaussianNoiseCoefficients[idx]));
+        }
+      
+      // Add the current output sample to the output SampleList
+      outputSampleListPtr->PushBack(currentOutputMeasurement);
+
+      // Update progress
+      progress.CompletedPixel();
+
+      ++inputIt;
       }
-
-    // Add the current output sample to the output SampleList
-    outputSampleListPtr->PushBack(currentOutputMeasurement);
-
-    // Update progress
-    progress.CompletedPixel();
-
-    ++inputIt;
     }
 }
 
diff --git a/Code/Learning/otbListSampleSource.h b/Code/Learning/otbListSampleSource.h
new file mode 100644
index 0000000000000000000000000000000000000000..78a784e289cd0d6b12870606d5fe31043b873cbe
--- /dev/null
+++ b/Code/Learning/otbListSampleSource.h
@@ -0,0 +1,94 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __otbListSampleSource_h
+#define __otbListSampleSource_h
+
+#include "itkProcessObject.h"
+#include "itkDataObject.h"
+#include "itkDataObjectDecorator.h"
+
+namespace otb {
+namespace Statistics {
+
+/** \class ListSampleSource
+ *  \brief This class is a base class for filters using ListSample as
+ *  input and returning ListSample.
+ *
+ *
+ *	This filter provides pipeline support for itk::Statistics::ListSample via itk::DataObjectDecorator for
+ *	the output sample list.
+ *
+ */
+template < class TInputSampleList, class TOutputSampleList = TInputSampleList >
+class ITK_EXPORT ListSampleSource :
+  public itk::ProcessObject
+{
+public:
+  /** Standard class typedefs */
+  typedef ListSampleSource               Self;
+  typedef itk::ProcessObject                         Superclass;
+  typedef itk::SmartPointer< Self >                  Pointer;
+  typedef itk::SmartPointer<const Self>              ConstPointer;
+  
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(ListSampleSource,itk::ProcessObject);
+  
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+  
+  /** OutputSampleList typedefs */
+  typedef TOutputSampleList                                    OutputSampleListType;
+  typedef typename OutputSampleListType::Pointer               OutputSampleListPointer;
+  typedef typename OutputSampleListType::ConstPointer          OutputSampleListConstPointer;
+  typedef typename OutputSampleListType::MeasurementVectorType OutputMeasurementVectorType;
+  typedef typename OutputMeasurementVectorType::ValueType      OutputValueType;
+  
+  /** ListSample is not a DataObject, we need to decorate it to push it down
+   * a ProcessObject's pipeline */
+  typedef itk::DataObject::Pointer                             DataObjectPointer;
+
+  typedef itk::DataObjectDecorator< OutputSampleListType >     OutputSampleListObjectType;
+
+  /** Returns the output sample list */
+  OutputSampleListType * GetOutputSampleList();
+
+  /** Returns the output sample list as a data object */
+  OutputSampleListObjectType * GetOutput();
+
+protected:
+  /** Standard itk::ProcessObject subclass method. */
+  virtual DataObjectPointer MakeOutput(unsigned int idx);
+
+  ListSampleSource();
+  virtual ~ListSampleSource() {}
+  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+private:
+  ListSampleSource(const Self&); //purposely not implemented
+  void operator=(const Self&); //purposely not implemented
+
+}; // end of class ListSampleSource
+
+} // end of namespace Statistics
+} // end of namespace otb
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbListSampleSource.txx"
+#endif
+
+#endif
diff --git a/Code/Learning/otbListSampleSource.txx b/Code/Learning/otbListSampleSource.txx
new file mode 100644
index 0000000000000000000000000000000000000000..784955efe1527464f74760a51859d80670b4c5a1
--- /dev/null
+++ b/Code/Learning/otbListSampleSource.txx
@@ -0,0 +1,83 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __otbListSampleSource_txx
+#define __otbListSampleSource_txx
+
+#include "otbListSampleSource.h"
+
+namespace otb {
+namespace Statistics {
+
+template < class TInputSampleList, class TOutputSampleList >
+ListSampleSource<TInputSampleList,TOutputSampleList>
+::ListSampleSource()
+{
+  this->SetNumberOfRequiredOutputs(1);
+
+  // Generate the output sample list
+  typename OutputSampleListObjectType::Pointer outputPtr =
+    static_cast< OutputSampleListObjectType * >(this->MakeOutput(0).GetPointer());
+  this->ProcessObject::SetNthOutput(0, outputPtr.GetPointer());
+}
+
+template < class TInputSampleList, class TOutputSampleList >
+typename ListSampleSource<TInputSampleList,TOutputSampleList>
+::DataObjectPointer
+ListSampleSource<TInputSampleList,TOutputSampleList>
+::MakeOutput(unsigned int itkNotUsed(idx))
+{
+  typename OutputSampleListObjectType::Pointer outputPtr = OutputSampleListObjectType::New();
+  OutputSampleListPointer outputSampleList = OutputSampleListType::New();
+  outputPtr->Set(outputSampleList);
+  return static_cast<DataObjectPointer>(outputPtr);
+}
+
+template < class TInputSampleList, class TOutputSampleList >
+typename ListSampleSource<TInputSampleList,TOutputSampleList>
+::OutputSampleListType *
+ListSampleSource<TInputSampleList,TOutputSampleList>
+::GetOutputSampleList()
+{
+  typename OutputSampleListObjectType::Pointer dataObjectPointer = static_cast<OutputSampleListObjectType * >
+    (this->ProcessObject::GetOutput(0) );
+  return const_cast<OutputSampleListType *>(dataObjectPointer->Get());
+}
+
+template < class TInputSampleList, class TOutputSampleList >
+typename ListSampleSource<TInputSampleList,TOutputSampleList>
+::OutputSampleListObjectType *
+ListSampleSource<TInputSampleList,TOutputSampleList>
+::GetOutput()
+{
+  return static_cast<OutputSampleListObjectType * >
+    (this->ProcessObject::GetOutput(0) );
+}
+
+template < class TInputSampleList, class TOutputSampleList >
+void
+ListSampleSource<TInputSampleList,TOutputSampleList>
+::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  // Call superclass implementation
+  Superclass::PrintSelf(os,indent);
+}
+
+} // End namespace Statistics
+} // End namespace otb
+
+#endif
diff --git a/Code/Learning/otbListSampleToBalancedListSampleFilter.h b/Code/Learning/otbListSampleToBalancedListSampleFilter.h
new file mode 100644
index 0000000000000000000000000000000000000000..38da0e2e6477dba219bd2c3cc0be65a9945514e6
--- /dev/null
+++ b/Code/Learning/otbListSampleToBalancedListSampleFilter.h
@@ -0,0 +1,149 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __otbListSampleToBalancedListSampleFilter_h
+#define __otbListSampleToBalancedListSampleFilter_h
+
+#include "otbListSampleToListSampleFilter.h"
+#include "otbGaussianAdditiveNoiseSampleListFilter.h"
+#include "itkDataObjectDecorator.h"
+#include "otbMacro.h"
+
+namespace otb {
+namespace Statistics {
+
+/** \class ListSampleToBalancedListSampleFilter
+ *  \brief This class generate a balanced ListSample in order to have
+ *  fair distribution of learning samples.
+ *
+ * The maximum number of samples with same labels are first
+ * computed. This maximum number by the m_BalacingFactor determines
+ * the final number of samples belonging to each label.    
+ * 
+ * Mean and Variance are set via the methods SetMean() and SetVariance().
+ *
+ * \sa ListSampleToListSampleFilter, GaussianAdditiveNoiseSampleListFilter
+ */
+template < class TInputSampleList, 
+           class TLabelSampleList, 
+           class TOutputSampleList = TInputSampleList >
+class ITK_EXPORT ListSampleToBalancedListSampleFilter :
+    public otb::Statistics::ListSampleToListSampleFilter<TInputSampleList,
+                                                         TOutputSampleList>
+{
+public:
+  /** Standard class typedefs */
+  typedef ListSampleToBalancedListSampleFilter       Self;
+  typedef otb::Statistics::ListSampleToListSampleFilter
+  <TInputSampleList,TOutputSampleList>               Superclass;
+  typedef itk::SmartPointer< Self >                  Pointer;
+  typedef itk::SmartPointer<const Self>              ConstPointer;
+  
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(ListSampleToBalancedListSampleFilter,otb::Statistics::ListSampleToListSampleFilter);
+  
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+  
+  /** InputSampleList typedefs */
+  typedef TInputSampleList                                    InputSampleListType;
+  typedef typename InputSampleListType::Pointer               InputSampleListPointer;
+  typedef typename InputSampleListType::ConstPointer          InputSampleListConstPointer;
+  typedef typename InputSampleListType::MeasurementVectorType InputMeasurementVectorType;
+  typedef typename InputMeasurementVectorType::ValueType      InputValueType;
+
+  /** LabelSampleList typedefs */
+  typedef TLabelSampleList                                    LabelSampleListType;
+  typedef typename LabelSampleListType::Pointer               LabelSampleListPointer;
+  typedef typename LabelSampleListType::ConstPointer          LabelSampleListConstPointer;
+  typedef typename LabelSampleListType::MeasurementVectorType LabelMeasurementVectorType;
+  typedef typename LabelMeasurementVectorType::ValueType      LabelValueType;
+  typedef itk::DataObjectDecorator< LabelSampleListType >     LabelSampleListObjectType;
+
+  /** OutputSampleList typedefs */
+  typedef TOutputSampleList                                    OutputSampleListType;
+  typedef typename OutputSampleListType::Pointer               OutputSampleListPointer;
+  typedef typename OutputSampleListType::ConstPointer          OutputSampleListConstPointer;
+  typedef typename OutputSampleListType::MeasurementVectorType OutputMeasurementVectorType;
+  typedef typename OutputMeasurementVectorType::ValueType      OutputValueType;
+  
+  /** Input & Output sample list as data object */
+  typedef typename Superclass::InputSampleListObjectType       InputSampleListObjectType;  
+  typedef typename Superclass::OutputSampleListObjectType      OutputSampleListObjectType;
+
+  /** Filter adding noise to a ListSample */
+  typedef otb::Statistics::GaussianAdditiveNoiseSampleListFilter
+  <InputSampleListType,OutputSampleListType>                   GaussianAdditiveNoiseType;
+  typedef typename GaussianAdditiveNoiseType::Pointer          GaussianAdditiveNoisePointerType;
+  
+  /** Get/Set the label sample list */
+  void SetInputLabel( const LabelSampleListType * label );
+  void SetInputLabel( const LabelSampleListObjectType * labelPtr );
+
+  /** Returns the label sample list */
+  const LabelSampleListType * GetLabelSampleList() const;
+  
+  /** Returns the label sample list as a data object */
+  const LabelSampleListObjectType * GetInputLabel() const;
+  
+  /** Set/Get the mean for the white gaussian noise to generate  */
+  otbSetObjectMemberMacro(AddGaussianNoiseFilter,Mean,double);
+  otbGetObjectMemberConstMacro(AddGaussianNoiseFilter,Mean,double);
+  
+  /** Set/Get the variance for the white gaussian noise to generate  */
+  otbSetObjectMemberMacro(AddGaussianNoiseFilter,Variance,double);
+  otbGetObjectMemberConstMacro(AddGaussianNoiseFilter,Variance,double);
+
+  /** Set/Get the multiplicative factor : this value is used to
+    * determine the maximum number of samples in each label in order 
+    * to reach a balanced output ListSample
+    */
+  itkSetMacro(BalancingFactor,unsigned int);
+  itkGetMacro(BalancingFactor,unsigned int);
+  
+protected:
+  /** This method causes the filter to generate its output. */
+   virtual void GenerateData();
+  
+  /** In order to respect the fair data principle, the number of samples for
+    * each label must be the same. This method computes the label that
+    * have the higher number of sample.
+    */
+  void ComputeMaxSampleFrequency();
+  
+  ListSampleToBalancedListSampleFilter();
+  virtual ~ListSampleToBalancedListSampleFilter() {}
+  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+private:
+  ListSampleToBalancedListSampleFilter(const Self&); //purposely not implemented
+  void operator=(const Self&); //purposely not implemented
+
+  GaussianAdditiveNoisePointerType       m_AddGaussianNoiseFilter;
+  std::vector<unsigned int>              m_MultiplicativeCoefficient;
+  unsigned int                           m_BalancingFactor;
+  
+}; // end of class ListSampleToBalancedListSampleFilter
+
+} // end of namespace Statistics
+} // end of namespace otb
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbListSampleToBalancedListSampleFilter.txx"
+#endif
+
+#endif
diff --git a/Code/Learning/otbListSampleToBalancedListSampleFilter.txx b/Code/Learning/otbListSampleToBalancedListSampleFilter.txx
new file mode 100644
index 0000000000000000000000000000000000000000..45610b7ce9d85cc8ecb654043be22e5c08af9a6e
--- /dev/null
+++ b/Code/Learning/otbListSampleToBalancedListSampleFilter.txx
@@ -0,0 +1,257 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __otbListSampleToBalancedListSampleFilter_txx
+#define __otbListSampleToBalancedListSampleFilter_txx
+
+#include "otbListSampleToBalancedListSampleFilter.h"
+#include "itkProgressReporter.h"
+#include "itkHistogram.h"
+#include "itkNumericTraits.h"
+
+namespace otb {
+namespace Statistics {
+
+// constructor
+template < class TInputSampleList, class TLabelSampleList, class TOutputSampleList >
+ListSampleToBalancedListSampleFilter<TInputSampleList,TLabelSampleList,TOutputSampleList>
+::ListSampleToBalancedListSampleFilter()
+{
+  this->SetNumberOfRequiredInputs(2);
+  
+  m_AddGaussianNoiseFilter = GaussianAdditiveNoiseType::New();
+  m_BalancingFactor  = 5;
+}
+
+// Method to set the SampleList 
+template < class TInputSampleList, class TLabelSampleList, class TOutputSampleList >
+void
+ListSampleToBalancedListSampleFilter<TInputSampleList,TLabelSampleList,TOutputSampleList>
+::SetInputLabel( const LabelSampleListType * label )
+{
+  typename LabelSampleListObjectType::Pointer labelPtr = LabelSampleListObjectType::New();
+  labelPtr->Set(label);
+  this->SetInputLabel(labelPtr);
+}
+
+// Method to set the SampleList as DataObject
+template < class TInputSampleList, class TLabelSampleList, class TOutputSampleList >
+void
+ListSampleToBalancedListSampleFilter<TInputSampleList,TLabelSampleList,TOutputSampleList>
+::SetInputLabel( const LabelSampleListObjectType * labelPtr ) 
+{
+  // Process object is not const-correct so the const_cast is required here
+  Superclass::ProcessObject::SetNthInput(1,
+                                   const_cast< LabelSampleListObjectType* >( labelPtr  ) );
+}
+
+// Method to get the SampleList as DataObject
+template < class TInputSampleList, class TLabelSampleList, class TOutputSampleList >
+const typename ListSampleToBalancedListSampleFilter<TInputSampleList,TLabelSampleList,TOutputSampleList>
+::LabelSampleListObjectType *
+ListSampleToBalancedListSampleFilter<TInputSampleList,TLabelSampleList,TOutputSampleList>
+::GetInputLabel() const
+{
+  if (this->GetNumberOfInputs() < 2)
+    {
+    return 0;
+    }
+
+  return static_cast<const  LabelSampleListObjectType* >
+    (Superclass::ProcessObject::GetInput(1) );
+}
+
+// Method to get the SampleList
+template < class TInputSampleList, class TLabelSampleList, class TOutputSampleList >
+const typename ListSampleToBalancedListSampleFilter<TInputSampleList,TLabelSampleList,TOutputSampleList>
+::LabelSampleListType *
+ListSampleToBalancedListSampleFilter<TInputSampleList,TLabelSampleList,TOutputSampleList>
+::GetLabelSampleList() const
+{
+ if (this->GetNumberOfInputs() < 2)
+    {
+    return 0;
+    }
+
+ typename LabelSampleListObjectType::ConstPointer dataObjectPointer = static_cast<const LabelSampleListObjectType * >
+   (Superclass::ProcessObject::GetInput(1) );
+  return dataObjectPointer->Get();
+}
+
+// Get the max sample number having the same label
+template < class TInputSampleList, class TLabelSampleList, class TOutputSampleList >
+void
+ListSampleToBalancedListSampleFilter<TInputSampleList,TLabelSampleList,TOutputSampleList>
+::ComputeMaxSampleFrequency()
+{
+  // Iterate on the labelSampleList to get the min and max label
+  LabelValueType   maxLabel = itk::NumericTraits<LabelValueType>::min();
+  
+  // Number of bins to add to the histogram
+  typename LabelSampleListType::ConstPointer  labelPtr = this->GetLabelSampleList();
+  typename LabelSampleListType::ConstIterator labelIt = labelPtr->Begin();
+  
+  while(labelIt != labelPtr->End())
+    {
+    // Get the current label sample
+    LabelMeasurementVectorType currentInputMeasurement = labelIt.GetMeasurementVector();
+    
+    if (currentInputMeasurement[0] > maxLabel)
+      maxLabel = currentInputMeasurement[0];  
+    
+    ++labelIt;
+    }
+  
+  // Prepare histogram with dimension 1 : default template parameters
+  typedef typename itk::Statistics::Histogram<unsigned int>    HistogramType;
+  typename HistogramType::Pointer histogram = HistogramType::New();
+  typename HistogramType::SizeType  size;
+  size.Fill(maxLabel +1);
+  histogram->Initialize(size);
+
+  labelIt = labelPtr->Begin();
+  while (labelIt != labelPtr->End())
+    {
+    // Get the current label sample
+    LabelMeasurementVectorType currentInputMeasurement = labelIt.GetMeasurementVector();
+    histogram->IncreaseFrequency(currentInputMeasurement[0], 1.);
+    ++labelIt;
+    }
+  
+  // Iterate through the histogram to get the maximum
+  unsigned int maxvalue  = 0;
+  HistogramType::Iterator iter = histogram->Begin();
+  
+  while ( iter != histogram->End() )
+    {
+    if( static_cast<unsigned int>(iter.GetFrequency()) > maxvalue )
+      maxvalue = static_cast<unsigned int>(iter.GetFrequency());
+    ++iter;
+    }
+
+  // Number of sample per label to reach in order to have a balanced
+  // ListSample 
+  unsigned int balancedFrequency = m_BalancingFactor * maxvalue;
+  
+  // Guess how much noised samples must be added per sample to get
+  // a balanced ListSample : Computed using the
+  //  - Frequency of each label  (stored in the histogram)
+  //  - The value maxvalue by m_BalancingFactor
+  // The std::vector below stores the multiplicative factor 
+  iter = histogram->Begin();
+  while ( iter != histogram->End() )
+    {
+    unsigned int coeff = static_cast<unsigned int>(balancedFrequency/iter.GetFrequency());
+    m_MultiplicativeCoefficient.push_back(coeff);
+    ++iter;
+    }
+}
+
+template < class TInputSampleList, class TLabelSampleList, class TOutputSampleList >
+void
+ListSampleToBalancedListSampleFilter<TInputSampleList,TLabelSampleList,TOutputSampleList>
+::GenerateData()
+{
+  // Get the how much each sample must be expanded
+  this->ComputeMaxSampleFrequency();
+  
+  // Retrieve input and output pointers
+  typename InputSampleListObjectType::ConstPointer inputPtr  = this->GetInput();
+  typename LabelSampleListObjectType::ConstPointer labelPtr  = this->GetInputLabel();
+  typename OutputSampleListObjectType::Pointer     outputPtr = this->GetOutput();
+
+  // Retrieve the ListSample
+   InputSampleListConstPointer inputSampleListPtr = inputPtr->Get();
+   LabelSampleListConstPointer labelSampleListPtr = labelPtr->Get();
+   OutputSampleListPointer outputSampleListPtr    = const_cast<OutputSampleListType *>(outputPtr->Get());
+  
+   // Clear any previous output
+   outputSampleListPtr->Clear();
+
+   typename InputSampleListType::ConstIterator inputIt = inputSampleListPtr->Begin();
+   typename LabelSampleListType::ConstIterator labelIt = labelSampleListPtr->Begin();
+   
+   // Set-up progress reporting
+   itk::ProgressReporter progress(this,0,inputSampleListPtr->Size());
+
+   // Iterate on the InputSampleList
+   while(inputIt != inputSampleListPtr->End() && labelIt != labelSampleListPtr->End())
+     {
+     // Retrieve current input sample
+     InputMeasurementVectorType currentInputMeasurement = inputIt.GetMeasurementVector();
+     // Retrieve the current label
+     LabelMeasurementVectorType currentLabelMeasurement = labelIt.GetMeasurementVector();
+
+     // Build a temporary ListSample wiht the current 
+     // measurement vector to generate noised versions of this
+     // measurement vector 
+     InputSampleListPointer tempListSample = InputSampleListType::New();
+     tempListSample->PushBack(currentInputMeasurement);
+     
+     // Get how many times we have to noise this sample
+     unsigned int iterations =  m_MultiplicativeCoefficient[currentLabelMeasurement[0]];
+     
+     // Noising filter
+     GaussianAdditiveNoisePointerType  noisingFilter = GaussianAdditiveNoiseType::New();
+     noisingFilter->SetInput(tempListSample);
+     noisingFilter->SetNumberOfIteration(iterations);
+     noisingFilter->Update();
+
+     // Build current output sample
+     OutputMeasurementVectorType currentOutputMeasurement;
+     currentOutputMeasurement.SetSize(currentInputMeasurement.GetSize());
+    
+     // Cast the current sample in outputSampleValue
+     for(unsigned int idx = 0;idx < inputSampleListPtr->GetMeasurementVectorSize();++idx)
+       currentOutputMeasurement[idx] = static_cast<OutputValueType>(currentInputMeasurement[idx]);
+     
+     // Add the current input casted sample to the output SampleList
+     outputSampleListPtr->PushBack(currentOutputMeasurement);
+
+     // Add the noised versions of the current sample to OutputSampleList
+     typename OutputSampleListType::ConstIterator tempIt = noisingFilter->GetOutput()->Get()->Begin();
+     
+     while(tempIt != noisingFilter->GetOutput()->Get()->End())
+       {
+       // Get the noised sample of the current measurement vector
+       OutputMeasurementVectorType currentTempMeasurement = tempIt.GetMeasurementVector();
+       // Add to output SampleList
+       outputSampleListPtr->PushBack(currentTempMeasurement);
+       ++tempIt;
+       }
+     
+     // Update progress
+     progress.CompletedPixel();
+
+     ++inputIt;
+     ++ labelIt;
+     }
+}
+
+template < class TInputSampleList, class TLabelSampleList, class TOutputSampleList >
+void
+ListSampleToBalancedListSampleFilter<TInputSampleList,TLabelSampleList,TOutputSampleList>
+::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  // Call superclass implementation
+  Superclass::PrintSelf(os,indent);
+}
+
+} // End namespace Statistics
+} // End namespace otb
+
+#endif
diff --git a/Code/Learning/otbListSampleToListSampleFilter.h b/Code/Learning/otbListSampleToListSampleFilter.h
index 23a8af41c45876c47489338004256436dcf7dec8..d7f4ec4a8b66a9db6be7cbe911ebcd5e40de42bb 100644
--- a/Code/Learning/otbListSampleToListSampleFilter.h
+++ b/Code/Learning/otbListSampleToListSampleFilter.h
@@ -18,9 +18,7 @@
 #ifndef __otbListSampleToListSampleFilter_h
 #define __otbListSampleToListSampleFilter_h
 
-#include "itkProcessObject.h"
-#include "itkDataObject.h"
-#include "itkDataObjectDecorator.h"
+#include "otbListSampleSource.h"
 
 namespace otb {
 namespace Statistics {
@@ -36,17 +34,17 @@ namespace Statistics {
  */
 template < class TInputSampleList, class TOutputSampleList = TInputSampleList >
 class ITK_EXPORT ListSampleToListSampleFilter :
-  public itk::ProcessObject
+  public ListSampleSource<TOutputSampleList>
 {
 public:
   /** Standard class typedefs */
   typedef ListSampleToListSampleFilter               Self;
-  typedef itk::ProcessObject                         Superclass;
+  typedef ListSampleSource<TOutputSampleList>        Superclass;
   typedef itk::SmartPointer< Self >                  Pointer;
   typedef itk::SmartPointer<const Self>              ConstPointer;
   
   /** Run-time type information (and related methods). */
-  itkTypeMacro(ListSampleToListSampleFilter,itk::ProcessObject);
+  itkTypeMacro(ListSampleToListSampleFilter,ListSampleSource);
   
   /** Method for creation through the object factory. */
   itkNewMacro(Self);
@@ -59,18 +57,17 @@ public:
   typedef typename InputMeasurementVectorType::ValueType      InputValueType;
 
   /** OutputSampleList typedefs */
-  typedef TOutputSampleList                                    OutputSampleListType;
-  typedef typename OutputSampleListType::Pointer               OutputSampleListPointer;
-  typedef typename OutputSampleListType::ConstPointer          OutputSampleListConstPointer;
-  typedef typename OutputSampleListType::MeasurementVectorType OutputMeasurementVectorType;
-  typedef typename OutputMeasurementVectorType::ValueType      OutputValueType;
+  typedef typename Superclass::OutputSampleListType            OutputSampleListType;
+  typedef typename Superclass::OutputSampleListPointer         OutputSampleListPointer;
+  typedef typename Superclass::OutputSampleListConstPointer    OutputSampleListConstPointer;
+  typedef typename Superclass::OutputMeasurementVectorType     OutputMeasurementVectorType;
+  typedef typename Superclass::OutputValueType                 OutputValueType;
   
   /** ListSample is not a DataObject, we need to decorate it to push it down
    * a ProcessObject's pipeline */
   typedef itk::DataObject::Pointer                             DataObjectPointer;
-
   typedef itk::DataObjectDecorator< InputSampleListType >      InputSampleListObjectType;
-  typedef itk::DataObjectDecorator< OutputSampleListType >     OutputSampleListObjectType;
+  typedef typename Superclass::OutputSampleListObjectType      OutputSampleListObjectType;
 
   /** Method to set/get the input list sample */
   void SetInput( const InputSampleListType * inputPtr );
@@ -82,16 +79,7 @@ public:
   /** Returns the input sample list as a data object */
   const InputSampleListObjectType * GetInput() const;
 
-  /** Returns the output sample list */
-  OutputSampleListType * GetOutputSampleList();
-
-  /** Returns the output sample list as a data object */
-  OutputSampleListObjectType * GetOutput();
-
-
 protected:
-  /** Standard itk::ProcessObject subclass method. */
-  virtual DataObjectPointer MakeOutput(unsigned int idx);
 
   ListSampleToListSampleFilter();
   virtual ~ListSampleToListSampleFilter() {}
diff --git a/Code/Learning/otbListSampleToListSampleFilter.txx b/Code/Learning/otbListSampleToListSampleFilter.txx
index 7b5f4aab1666f3eb5466536367e36e301aac5ee0..619c9ed2ccf9745854fd834f6d1d26a8e97bb491 100644
--- a/Code/Learning/otbListSampleToListSampleFilter.txx
+++ b/Code/Learning/otbListSampleToListSampleFilter.txx
@@ -29,24 +29,6 @@ ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
 ::ListSampleToListSampleFilter()
 {
   this->SetNumberOfRequiredInputs(1);
-  this->SetNumberOfRequiredOutputs(1);
-
-  // Generate the output sample list
-  typename OutputSampleListObjectType::Pointer outputPtr =
-    static_cast< OutputSampleListObjectType * >(this->MakeOutput(0).GetPointer());
-  this->ProcessObject::SetNthOutput(0, outputPtr.GetPointer());
-}
-
-template < class TInputSampleList, class TOutputSampleList >
-typename ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
-::DataObjectPointer
-ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
-::MakeOutput(unsigned int itkNotUsed(idx))
-{
-  typename OutputSampleListObjectType::Pointer outputPtr = OutputSampleListObjectType::New();
-  OutputSampleListPointer outputSampleList = OutputSampleListType::New();
-  outputPtr->Set(outputSampleList);
-  return static_cast<DataObjectPointer>(outputPtr);
 }
 
 template < class TInputSampleList, class TOutputSampleList >
@@ -65,8 +47,8 @@ ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
 ::SetInput( const InputSampleListObjectType * inputPtr )
 {
   // Process object is not const-correct so the const_cast is required here
-  this->ProcessObject::SetNthInput(0,
-                                   const_cast< InputSampleListObjectType* >( inputPtr ) );
+  this->itk::ProcessObject::SetNthInput(0,
+                                        const_cast< InputSampleListObjectType* >( inputPtr ) );
 }
 
 template < class TInputSampleList, class TOutputSampleList >
@@ -81,7 +63,7 @@ ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
     }
 
   return static_cast<const InputSampleListObjectType * >
-    (this->ProcessObject::GetInput(0) );
+    (this->itk::ProcessObject::GetInput(0) );
 }
 
 template < class TInputSampleList, class TOutputSampleList >
@@ -96,32 +78,10 @@ ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
     }
 
   typename InputSampleListObjectType::Pointer dataObjectPointer = static_cast<const InputSampleListObjectType * >
-    (this->ProcessObject::GetInput(0) );
+    (this->itk::ProcessObject::GetInput(0) );
   return dataObjectPointer->Get();
 }
 
-template < class TInputSampleList, class TOutputSampleList >
-typename ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
-::OutputSampleListType *
-ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
-::GetOutputSampleList()
-{
-  typename OutputSampleListObjectType::Pointer dataObjectPointer = static_cast<OutputSampleListObjectType * >
-    (this->ProcessObject::GetOutput(0) );
-  return const_cast<OutputSampleListType *>(dataObjectPointer->Get());
-}
-
-template < class TInputSampleList, class TOutputSampleList >
-typename ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
-::OutputSampleListObjectType *
-ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
-::GetOutput()
-{
-  return static_cast<OutputSampleListObjectType * >
-    (this->ProcessObject::GetOutput(0) );
-}
-
-
 template < class TInputSampleList, class TOutputSampleList >
 void
 ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
@@ -131,7 +91,6 @@ ListSampleToListSampleFilter<TInputSampleList,TOutputSampleList>
   Superclass::PrintSelf(os,indent);
 }
 
-
 } // End namespace Statistics
 } // End namespace otb
 
diff --git a/Code/ObjectDetection/CMakeLists.txt b/Code/ObjectDetection/CMakeLists.txt
index d46402bc95631075fa8f4c6d525bc9cc95a4783c..0ec0fb425272dc905eb1e8e01ab97128cf14e1ce 100644
--- a/Code/ObjectDetection/CMakeLists.txt
+++ b/Code/ObjectDetection/CMakeLists.txt
@@ -19,6 +19,6 @@ IF(NOT OTB_INSTALL_NO_DEVELOPMENT)
   FILE(GLOB __files1 "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
   FILE(GLOB __files2 "${CMAKE_CURRENT_SOURCE_DIR}/*.txx")
   INSTALL(FILES ${__files1} ${__files2}
-    DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/OTBObjectDetection
+    DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/ObjectDetection
     COMPONENT Development)
 ENDIF(NOT OTB_INSTALL_NO_DEVELOPMENT)
diff --git a/Code/ObjectDetection/otbDescriptorsListSampleGenerator.h b/Code/ObjectDetection/otbDescriptorsListSampleGenerator.h
new file mode 100644
index 0000000000000000000000000000000000000000..09ad56ec0d78ebab3af1f1e04b2b179851dbf6fd
--- /dev/null
+++ b/Code/ObjectDetection/otbDescriptorsListSampleGenerator.h
@@ -0,0 +1,374 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __otbDescriptorsListSampleGenerator_h
+#define __otbDescriptorsListSampleGenerator_h
+
+#include <vector>
+
+#include "itkFixedArray.h"
+#include "itkImageRegion.h"
+
+#include "otbListSampleSource.h"
+#include "otbVectorData.h"
+
+#include "itkDataObject.h"
+#include "itkDataObjectDecorator.h"
+#include "itkSimpleDataObjectDecorator.h"
+
+#include "otbPersistentImageFilter.h"
+#include "otbPersistentFilterStreamingDecorator.h"
+
+namespace otb
+{
+
+template <class TOutputPrecision>
+class DefaultDescriptorsType
+{
+public:
+  typedef itk::FixedArray<TOutputPrecision, 4> Type;
+};
+
+/** \class PersistentDescriptorsListSampleGenerator
+ *  \brief
+ *
+ *
+ */
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+class ITK_EXPORT PersistentDescriptorsListSampleGenerator :
+  public PersistentImageFilter<TInputImage, TInputImage>
+{
+public:
+  /** Standard Self typedef */
+  typedef PersistentDescriptorsListSampleGenerator        Self;
+  typedef PersistentImageFilter<TInputImage, TInputImage> Superclass;
+  typedef itk::SmartPointer<Self>                         Pointer;
+  typedef itk::SmartPointer<const Self>                   ConstPointer;
+
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+
+  /** Runtime information support. */
+  itkTypeMacro(PersistentDescriptorsListSampleGenerator, PersistentImageFilter);
+
+  /** Image related typedefs. */
+  typedef TInputImage                      InputImageType;
+  typedef typename TInputImage::Pointer    InputImagePointer;
+  typedef typename TInputImage::RegionType RegionType;
+  typedef typename TInputImage::SizeType   SizeType;
+  typedef typename TInputImage::IndexType  IndexType;
+  typedef typename TInputImage::PixelType  PixelType;
+
+  itkStaticConstMacro(InputImageDimension, unsigned int,
+                      TInputImage::ImageDimension);
+
+  /** Image related typedefs. */
+  itkStaticConstMacro(ImageDimension, unsigned int,
+                      TInputImage::ImageDimension);
+
+  /** Smart Pointer type to a DataObject. */
+  typedef typename itk::DataObject::Pointer DataObjectPointer;
+
+  /** Input VectorData */
+  typedef TVectorData                                     VectorDataType;
+  typedef itk::DataObjectDecorator<VectorDataType>        VectorDataObjectType;
+  typedef typename VectorDataObjectType::Pointer          VectorDataObjectPointerType;
+  typedef typename VectorDataType::DataNodeType           VectorDataNodeType;
+  typedef typename VectorDataType::DataNodePointerType    VectorDataNodePointerType;
+  typedef typename VectorDataType::DataTreeType           VectorDataTreeType;
+  typedef typename VectorDataType::DataTreePointerType    VectorDataTreePointerType;
+  typedef typename VectorDataNodeType::PointType          VectorDataPointType;
+  typedef typename VectorDataNodeType::LineType           VectorDataLineType;
+  typedef typename VectorDataNodeType::PolygonType        VectorDataPolygonType;
+  typedef itk::PreOrderTreeIterator<VectorDataTreeType>   VectorDataTreeIteratorType;
+
+  /** Function type for descriptors extraction */
+  typedef TFunctionType                                   DescriptorsFunctionType;
+  typedef typename DescriptorsFunctionType::Pointer       DescriptorsFunctionPointerType;
+  typedef typename DescriptorsFunctionType::InputType     DescriptorsFunctionPointType;
+
+  typedef itk::ContinuousIndex
+        <typename DescriptorsFunctionPointType::ValueType,
+         itkGetStaticConstMacro(InputImageDimension)>     ContinuousIndexType;
+
+  /** ListSample output */
+  typedef TListSample                                     ListSampleType;
+  typedef typename ListSampleType::Pointer                ListSamplePointerType;
+  typedef itk::DataObjectDecorator<ListSampleType>        ListSampleObjectType;
+  typedef typename ListSampleObjectType::Pointer          ListSampleObjectPointerType;
+  typedef typename ListSampleType::MeasurementVectorType  SampleMeasurementVectorType;
+  typedef typename ListSampleType::MeasurementType        SampleMeasurementType;
+
+  /** LabelListSample output */
+  typedef TLabelListSample                                LabelListSampleType;
+  typedef typename LabelListSampleType::Pointer           LabelListSamplePointerType;
+  typedef itk::DataObjectDecorator<LabelListSampleType>   LabelListSampleObjectType;
+  typedef typename LabelListSampleObjectType::Pointer     LabelListSampleObjectPointerType;
+  typedef typename LabelListSampleType::MeasurementVectorType LabelMeasurementVectorType;
+  typedef typename LabelListSampleType::MeasurementType   LabelMeasurementType;
+
+  /** ListSamplePositions output */
+  typedef std::vector<DescriptorsFunctionPointType>               SamplesPositionType;
+  typedef itk::SimpleDataObjectDecorator<SamplesPositionType>     SamplesPositionObjectType;
+  typedef typename SamplesPositionObjectType::Pointer             SamplesPositionObjectPointerType;
+
+  void SetSamplesLocations(VectorDataType * input);
+  VectorDataType * GetSamplesLocations(void);
+
+  /** The function to evaluate */
+  itkSetObjectMacro(DescriptorsFunction,      DescriptorsFunctionType);
+  itkGetObjectMacro(DescriptorsFunction,      DescriptorsFunctionType);
+  itkGetConstObjectMacro(DescriptorsFunction, DescriptorsFunctionType);
+
+  /** Output sample list */
+  ListSampleType*             GetListSample();
+  ListSampleObjectType*       GetListSampleObject();
+
+  /** Output label list */
+  LabelListSampleType*        GetLabelListSample();
+  LabelListSampleObjectType*  GetLabelListSampleObject();
+
+  /** Output sample position list */
+  SamplesPositionType&             GetSamplesPositions();
+  SamplesPositionObjectType*       GetSamplesPositionsObject();
+
+  itkSetMacro( NeighborhoodRadius, unsigned int );
+  itkGetConstReferenceMacro( NeighborhoodRadius, unsigned int );
+
+  /** Make a DataObject of the correct type to be used as the specified
+   * output. */
+  itk::DataObject::Pointer MakeOutput(unsigned int idx);
+
+  void AllocateOutputs();
+  void GenerateOutputInformation();
+  void Reset(void);
+  void Synthetize(void);
+
+protected:
+  PersistentDescriptorsListSampleGenerator();
+  virtual ~PersistentDescriptorsListSampleGenerator();
+  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+  void GenerateInputRequestedRegion();
+
+  void BeforeThreadedGenerateData();
+
+  /** Multi-thread version GenerateData. */
+  void  ThreadedGenerateData(const RegionType& outputRegionForThread,
+                             int threadId);
+
+private:
+  PersistentDescriptorsListSampleGenerator(const Self &); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
+  template <typename TCoordRepType>
+  bool
+  IsInsideWithNeighborhoodRadius(const RegionType& region, const ContinuousIndexType &index) const
+    {
+    typedef typename RegionType::IndexType     IndexType;
+    typedef typename IndexType::IndexValueType IndexValueType;
+
+    for(unsigned int i=0; i<ImageDimension; i++)
+      {
+#ifdef ITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY
+      if( itk::Math::RoundHalfIntegerUp<IndexValueType>(index[i]) < static_cast<IndexValueType>( region.GetIndex(i) ) + m_NeighborhoodRadius  + 1 )
+#else
+      if( index[i] < static_cast<TCoordRepType>( region.GetIndex(i) ) + m_NeighborhoodRadius )
+#endif
+        {
+        return false;
+        }
+      // bound is the last valid pixel location
+#ifdef ITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY
+      const TCoordRepType bound = static_cast<TCoordRepType>(
+          region.GetIndex(i) + region.GetSize(i) - 0.5);
+#else
+      const TCoordRepType bound = static_cast<TCoordRepType>(
+          region.GetIndex(i) + static_cast<IndexValueType>(region.GetSize(i)) - 1);
+#endif
+
+      if( index[i] > bound - m_NeighborhoodRadius - 1 )
+        {
+        return false;
+        }
+      }
+    return true;
+    }
+  typedef std::vector<ListSamplePointerType>      ListSampleArray;
+  typedef std::vector<LabelListSamplePointerType> LabelListSampleArray;
+  typedef std::vector<SamplesPositionType>        SamplesPositionArray;
+
+  ListSampleArray                m_ThreadListSample;
+  LabelListSampleArray           m_ThreadLabelListSample;
+  SamplesPositionArray           m_ThreadSamplesPosition;
+
+  DescriptorsFunctionPointerType m_DescriptorsFunction;
+
+  unsigned int m_NeighborhoodRadius;
+};
+
+
+/** \class DescriptorsListSampleGenerator
+ *  \brief
+ *
+ *  
+ *
+ */
+template <class TInputImage, class TVectorData, class TListSample, class TLabelListSample, class TOutputPrecision = double, class TCoordRep = double>
+class ITK_EXPORT DescriptorsListSampleGenerator :
+    public PersistentFilterStreamingDecorator<
+              PersistentDescriptorsListSampleGenerator< TInputImage,
+                                                        TVectorData,
+                                                        itk::FunctionBase< itk::Point<TCoordRep, 2>,
+                                                                           typename DefaultDescriptorsType<TOutputPrecision>::Type >,
+                                                        TListSample,
+                                                        TLabelListSample > >
+{
+public:
+    /** Standard Self typedef */
+    typedef DescriptorsListSampleGenerator      Self;
+    typedef PersistentFilterStreamingDecorator
+              < PersistentDescriptorsListSampleGenerator
+                  <TInputImage,
+                   TVectorData,
+                   itk::FunctionBase< itk::Point<TCoordRep, 2>, typename DefaultDescriptorsType<TOutputPrecision>::Type >,
+                   TListSample,
+                   TLabelListSample> >          Superclass;
+    typedef itk::SmartPointer<Self>             Pointer;
+    typedef itk::SmartPointer<const Self>       ConstPointer;
+
+    /** Type macro */
+    itkNewMacro(Self);
+
+    /** Creation through object factory macro */
+    itkTypeMacro(DescriptorsListSampleGenerator, PersistentFilterStreamingDecorator);
+
+    typedef TInputImage                              InputImageType;
+    typedef TVectorData                              InputVectorDataType;
+    typedef TListSample                              ListSampleType;
+    typedef TLabelListSample                         LabelListSampleType;
+    typedef TCoordRep                                CoordRepType;
+    typedef TOutputPrecision                         OutputPrecision;
+
+    /** The coordinates used when evaluating function */
+    typedef itk::Point<TCoordRep, 2> PointType;
+
+    /** The return value of the function */
+    typedef typename DefaultDescriptorsType<TOutputPrecision>::Type DescriptorType;
+
+    /** The function evaluated on the input image at locations specified by the vector data */
+    typedef itk::FunctionBase<PointType, DescriptorType> DescriptorsFunctionType;
+    typedef typename DescriptorsFunctionType::Pointer    DescriptorsFunctionPointerType;
+
+    typedef typename Superclass::FilterType                           PersistentFilterType;
+    typedef typename PersistentFilterType::ListSampleObjectType       ListSampleObjectType;
+    typedef typename PersistentFilterType::LabelListSampleObjectType  LabelListSampleObjectType;
+    typedef typename PersistentFilterType::SamplesPositionObjectType  SamplesPositionObjectType;
+    typedef typename PersistentFilterType::SamplesPositionType        SamplesPositionType;
+
+
+    /** Input image to extract feature */
+    void SetInputImage(InputImageType * input)
+    {
+      this->GetFilter()->SetInput(input);
+    }
+
+    /** Input image to extract feature */
+    InputImageType * GetInputImage()
+    {
+      return this->GetFilter()->GetInput();
+    }
+
+    /** Sample locations as a VectorData of points. The label is in the ClassKey feature */
+    void SetSamplesLocations(InputVectorDataType * input)
+    {
+      this->GetFilter()->SetSamplesLocations(input);
+    }
+
+    /** Sample locations as a VectorData of points. The label is in the ClassKey feature  */
+    InputImageType * GetSamplesLocations()
+    {
+      return this->GetFilter()->GetSamplesLocations();
+    }
+
+    /** The function to evaluate */
+    void SetDescriptorsFunction(DescriptorsFunctionType * input)
+    {
+      this->GetFilter()->SetDescriptorsFunction(input);
+    }
+
+    /** The function to evaluate */
+    DescriptorsFunctionType * GetDescriptorsFunction()
+    {
+      return this->GetFilter()->GetDescriptorsFunction();
+    }
+
+    /** Final sample list */
+    ListSampleType*       GetListSample()
+    {
+      return this->GetFilter()->GetListSample();
+    }
+
+    ListSampleObjectType*       GetListSampleObject()
+    {
+      return this->GetFilter()->GetListSampleObject();
+    }
+
+    /** Final label list */
+    LabelListSampleType*        GetLabelListSample()
+    {
+      return this->GetFilter()->GetLabelListSample();
+    }
+
+    LabelListSampleObjectType*        GetLabelListSampleObject()
+    {
+      return this->GetFilter()->GetLabelListSampleObject();
+    }
+
+    /** Final label list */
+    SamplesPositionType&        GetSamplesPositions()
+    {
+      return this->GetFilter()->GetSamplesPositions();
+    }
+
+    SamplesPositionObjectType*  GetSamplesPositionsObject()
+    {
+      return this->GetFilter()->GetSamplesPositionsObject();
+    }
+
+    otbSetObjectMemberMacro(Filter, NeighborhoodRadius, unsigned int);
+    otbGetObjectMemberMacro(Filter, NeighborhoodRadius, unsigned int);
+
+  protected:
+    /** Constructor */
+    DescriptorsListSampleGenerator();
+
+    /** Destructor */
+    virtual ~DescriptorsListSampleGenerator();
+
+  private:
+    DescriptorsListSampleGenerator(const Self &); //purposely not implemented
+    void operator =(const Self&); //purposely not implemented
+};
+
+} // end namespace otb
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbDescriptorsListSampleGenerator.txx"
+#endif
+
+#endif
diff --git a/Code/ObjectDetection/otbDescriptorsListSampleGenerator.txx b/Code/ObjectDetection/otbDescriptorsListSampleGenerator.txx
new file mode 100644
index 0000000000000000000000000000000000000000..7291e710f9d45a2b71a8014259ac3005ace4b2a1
--- /dev/null
+++ b/Code/ObjectDetection/otbDescriptorsListSampleGenerator.txx
@@ -0,0 +1,352 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __otbDescriptorsListSampleGenerator_txx
+#define __otbDescriptorsListSampleGenerator_txx
+
+#include "otbDescriptorsListSampleGenerator.h"
+
+#include "itkContinuousIndex.h"
+
+namespace otb
+{
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::PersistentDescriptorsListSampleGenerator()
+  : m_NeighborhoodRadius(0)
+{
+  // Need 2 inputs : a vector image and a vectordata
+  this->SetNumberOfRequiredInputs(2);
+
+  // Have 4 outputs : the image created by Superclass,
+  // the sample list, the label sample list, the positions of the samples
+  this->SetNumberOfRequiredOutputs(3);
+  this->itk::ProcessObject::SetNthOutput(1, this->MakeOutput(1).GetPointer());
+  this->itk::ProcessObject::SetNthOutput(2, this->MakeOutput(2).GetPointer());
+  this->itk::ProcessObject::SetNthOutput(3, this->MakeOutput(3).GetPointer());
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::~PersistentDescriptorsListSampleGenerator()
+{
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+void
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::AllocateOutputs()
+{
+  // This is commented to prevent the streaming of the whole image for the first stream strip
+  // It shall not cause any problem because the output image of this filter is not intended to be used.
+  //InputImagePointer image = const_cast< TInputImage * >( this->GetInput() );
+  //this->GraftOutput( image );
+  // Nothing that needs to be allocated for the remaining outputs
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+void
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::GenerateOutputInformation()
+{
+  Superclass::GenerateOutputInformation();
+  if (this->GetInput())
+    {
+    this->GetOutput()->CopyInformation(this->GetInput());
+    this->GetOutput()->SetLargestPossibleRegion(this->GetInput()->GetLargestPossibleRegion());
+
+    if (this->GetOutput()->GetRequestedRegion().GetNumberOfPixels() == 0)
+      {
+      this->GetOutput()->SetRequestedRegion(this->GetOutput()->GetLargestPossibleRegion());
+      }
+    }
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+void
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::SetSamplesLocations(VectorDataType* location)
+{
+  this->SetNthInput(1, location);
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+typename PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>::VectorDataType*
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::GetSamplesLocations()
+{
+
+  return static_cast<VectorDataType*>(this->itk::ProcessObject::GetInput(1));
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+typename PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>::ListSampleType*
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::GetListSample()
+{
+  return const_cast<ListSampleType*>(this->GetListSampleObject()->Get());
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+typename PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>::ListSampleObjectType*
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::GetListSampleObject()
+{
+  return dynamic_cast<ListSampleObjectType*>( this->itk::ProcessObject::GetOutput(1) );
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+typename PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>::LabelListSampleType*
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::GetLabelListSample()
+{
+  return const_cast<LabelListSampleType*>(this->GetLabelListSampleObject()->Get());
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+typename PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>::LabelListSampleObjectType*
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::GetLabelListSampleObject()
+{
+  return dynamic_cast<LabelListSampleObjectType*>(this->itk::ProcessObject::GetOutput(2));
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+typename PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>::SamplesPositionType&
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::GetSamplesPositions()
+{
+  return this->GetSamplesPositionsObject()->Get();
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+typename PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>::SamplesPositionObjectType*
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::GetSamplesPositionsObject()
+{
+  return dynamic_cast<SamplesPositionObjectType*>(this->itk::ProcessObject::GetOutput(3));
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+itk::DataObject::Pointer
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::MakeOutput(unsigned int idx)
+{
+  itk::DataObject::Pointer output;
+  switch (idx)
+    {
+    case 0:
+      output = static_cast<itk::DataObject*>(InputImageType::New().GetPointer());
+      break;
+    case 1:
+      {
+      ListSampleObjectPointerType listSample = ListSampleObjectType::New();
+      listSample->Set(ListSampleType::New());
+      output = static_cast<itk::DataObject*>(listSample.GetPointer());
+      break;
+      }
+    case 2:
+      {
+      LabelListSampleObjectPointerType labelListSample = LabelListSampleObjectType::New();
+      labelListSample->Set(LabelListSampleType::New());
+      output = static_cast<itk::DataObject*>(labelListSample.GetPointer());
+      break;
+      }
+    case 3:
+      {
+      SamplesPositionObjectPointerType samplesPositions = SamplesPositionObjectType::New();
+      output = static_cast<itk::DataObject*>(samplesPositions.GetPointer());
+      break;
+      }
+    default:
+      output = static_cast<itk::DataObject*>(InputImageType::New().GetPointer());
+      break;
+    }
+  return output;
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+void
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::Reset()
+{
+  m_ThreadListSample = ListSampleArray(this->GetNumberOfThreads());
+  for (int i = 0; i < this->GetNumberOfThreads(); ++i)
+    {
+    m_ThreadListSample[i] = ListSampleType::New();
+    }
+
+  m_ThreadLabelListSample = LabelListSampleArray(this->GetNumberOfThreads());
+  for (int i = 0; i < this->GetNumberOfThreads(); ++i)
+    {
+    m_ThreadLabelListSample[i] = LabelListSampleType::New();
+    }
+
+  m_ThreadSamplesPosition = SamplesPositionArray(this->GetNumberOfThreads());
+
+  this->GetListSample()->Clear();
+  this->GetLabelListSample()->Clear();
+  this->GetSamplesPositions().clear();
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+void
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::Synthetize()
+{
+  // Merge the ListSample from all the threads
+
+  ListSampleType* listSample = this->GetListSample();
+  LabelListSampleType* labelListSample = this->GetLabelListSample();
+  SamplesPositionType& samplesPosition = this->GetSamplesPositions();
+
+  for (int threadId = 0; threadId < this->GetNumberOfThreads(); ++threadId )
+    {
+    ListSampleType* threadListSample = m_ThreadListSample[threadId];
+    LabelListSampleType* threadLabelListSample = m_ThreadLabelListSample[threadId];
+    SamplesPositionType& threadSamplesPosition = m_ThreadSamplesPosition[threadId];
+
+    for (unsigned int i = 0; i < threadListSample->Size(); ++i)
+      {
+      listSample->PushBack( threadListSample->GetMeasurementVector(i) );
+      labelListSample->PushBack( threadLabelListSample->GetMeasurementVector(i) );
+      samplesPosition.push_back( threadSamplesPosition[i] );
+      }
+    }
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+void
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  Superclass::PrintSelf(os, indent);
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+void
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::GenerateInputRequestedRegion()
+{
+  Superclass::GenerateInputRequestedRegion();
+
+  // get pointers to the input and output
+  typename Superclass::InputImagePointer inputPtr =
+    const_cast< TInputImage * >( this->GetInput() );
+  typename Superclass::OutputImagePointer outputPtr = this->GetOutput();
+
+  if ( !inputPtr || !outputPtr )
+    {
+    return;
+    }
+
+  // get a copy of the input requested region (should equal the output
+  // requested region)
+  typename TInputImage::RegionType inputRequestedRegion;
+  inputRequestedRegion = inputPtr->GetRequestedRegion();
+
+  // pad the input requested region by the operator radius
+  inputRequestedRegion.PadByRadius( m_NeighborhoodRadius );
+
+  // crop the input requested region at the input's largest possible region
+  if ( inputRequestedRegion.Crop(inputPtr->GetLargestPossibleRegion()) )
+    {
+    inputPtr->SetRequestedRegion( inputRequestedRegion );
+    return;
+    }
+  else
+    {
+    // Couldn't crop the region (requested region is outside the largest
+    // possible region).  Throw an exception.
+
+    // store what we tried to request (prior to trying to crop)
+    inputPtr->SetRequestedRegion( inputRequestedRegion );
+    }
+}
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+void
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::BeforeThreadedGenerateData()
+{
+  std::cout << "Buffered Region : " << this->GetInput()->GetBufferedRegion() << std::endl;
+}
+
+
+template <class TInputImage, class TVectorData, class TFunctionType, class TListSample, class TLabelListSample>
+void
+PersistentDescriptorsListSampleGenerator<TInputImage,TVectorData,TFunctionType,TListSample,TLabelListSample>
+::ThreadedGenerateData(const RegionType&  outputRegionForThread,
+                       int threadId)
+{
+  ListSampleType* listSample = m_ThreadListSample[threadId];
+  LabelListSampleType* labelListSample = m_ThreadLabelListSample[threadId];
+  SamplesPositionType& samplesPosition = m_ThreadSamplesPosition[threadId];
+
+  VectorDataTreeIteratorType vectorDataIt(this->GetSamplesLocations()->GetDataTree());
+
+  for (vectorDataIt.GoToBegin(); !vectorDataIt.IsAtEnd(); ++vectorDataIt)
+    {
+    if (vectorDataIt.Get()->IsPointFeature())
+      {
+      VectorDataPointType point = vectorDataIt.Get()->GetPoint();
+      ContinuousIndexType cidx;
+
+      // Without removing 0.5, some samples are processed two times
+      // TODO : check ImageRegion::InInside( ContinuousIndex )
+      cidx[0] = point[0] - 0.5;
+      cidx[1] = point[1] - 0.5;
+
+      if (outputRegionForThread.IsInside(cidx))
+        {
+        SampleMeasurementVectorType sample(m_DescriptorsFunction->Evaluate(point));
+        listSample->PushBack( sample );
+
+        LabelMeasurementVectorType label;
+        label[0] = static_cast<LabelMeasurementType>(vectorDataIt.Get()->GetFieldAsString("Class")[0]);
+        labelListSample->PushBack( label );
+
+        samplesPosition.push_back(point);
+        }
+      }
+    }
+}
+
+
+
+
+
+template <class TInputImage, class TVectorData, class TListSample, class TLabelListSample, class TOutputPrecision, class TCoordRep>
+DescriptorsListSampleGenerator<TInputImage,TVectorData,TListSample,TLabelListSample,TOutputPrecision,TCoordRep>
+::DescriptorsListSampleGenerator()
+{
+
+}
+
+template <class TInputImage, class TVectorData, class TListSample, class TLabelListSample, class TOutputPrecision, class TCoordRep>
+DescriptorsListSampleGenerator<TInputImage,TVectorData,TListSample,TLabelListSample,TOutputPrecision,TCoordRep>
+::~DescriptorsListSampleGenerator()
+{
+
+}
+
+
+
+} // end namespace otb
+
+#endif
diff --git a/Code/Radiometry/otbSarBrightnessFunction.h b/Code/Radiometry/otbSarBrightnessFunction.h
new file mode 100644
index 0000000000000000000000000000000000000000..c7aa67e54f42a73cf1be5894b8c61b68ff66921b
--- /dev/null
+++ b/Code/Radiometry/otbSarBrightnessFunction.h
@@ -0,0 +1,156 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __otbSarBrightnessFunction_h
+#define __otbSarBrightnessFunction_h
+
+#include "itkNumericTraits.h"
+#include "itkImageFunction.h"
+#include "otbSarBrightnessFunctor.h"
+#include "otbSarParametricMapFunction.h"
+
+
+namespace otb
+{
+
+/**
+ * \class SarBrightnessFunction
+ * \brief Calculate the backscatter for the given pixel
+ *
+ * Calculate the brigthness value for the given pixel
+ *
+ * If called with a ContinuousIndex or Point, the calculation is performed
+ * at the nearest neighbor.
+ *
+ * This class is templated over the input image type and the
+ * coordinate representation type (e.g. float or double ).
+ *
+ * \ingroup ImageFunctions
+ */
+
+template <class TInputImage, class TCoordRep = float>
+class ITK_EXPORT SarBrightnessFunction :
+  public itk::ImageFunction<TInputImage, typename itk::NumericTraits<typename TInputImage::PixelType>::AbsType,
+      TCoordRep>
+{
+public:
+  /** Standard class typedefs. */
+  typedef SarBrightnessFunction Self;
+  typedef itk::ImageFunction<TInputImage, typename itk::NumericTraits<typename TInputImage::PixelType>::AbsType,
+      TCoordRep>                        Superclass;
+  typedef itk::SmartPointer<Self>       Pointer;
+  typedef itk::SmartPointer<const Self> ConstPointer;
+
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(SarBrightnessFunction, itk::ImageFunction);
+
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+
+  /** InputImageType typedef support. */
+  typedef TInputImage                              InputImageType;
+  typedef typename InputImageType::PixelType       InputPixelType;
+  typedef typename Superclass::OutputType          OutputType;
+  typedef typename Superclass::IndexType           IndexType;
+  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
+  typedef typename Superclass::PointType           PointType;
+
+  itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
+
+
+  /** Datatype used for the evaluation */
+  typedef double                                                 RealType;
+  typedef otb::Functor::SarBrightnessFunctor<RealType,RealType>  FunctorType;
+  typedef typename FunctorType::RealType                         FunctorRealType;
+
+  typedef otb::SarParametricMapFunction<InputImageType>               ParametricFunctionType;
+  typedef typename ParametricFunctionType::Pointer                    ParametricFunctionPointer;
+  typedef typename ParametricFunctionType::ConstPointer               ParametricFunctionConstPointer;
+
+  /** Evalulate the function at specified index */
+  virtual OutputType EvaluateAtIndex(const IndexType& index) const;
+
+  /** Evaluate the function at non-integer positions */
+  virtual OutputType Evaluate(const PointType& point) const
+  {
+    IndexType index;
+    this->ConvertPointToNearestIndex(point, index);
+    return this->EvaluateAtIndex(index);
+  }
+  virtual OutputType EvaluateAtContinuousIndex(
+    const ContinuousIndexType& cindex) const
+  {
+    IndexType index;
+    this->ConvertContinuousIndexToNearestIndex(cindex, index);
+    return this->EvaluateAtIndex(index);
+  }
+
+  /** Set the input image.
+   * \warning this method caches BufferedRegion information.
+   * If the BufferedRegion has changed, user must call
+   * SetInputImage again to update cached values. */
+  virtual void SetInputImage( const InputImageType * ptr );
+
+
+  /** Get/Set the Scale value */
+  itkSetMacro(Scale, FunctorRealType);
+  itkGetMacro(Scale, FunctorRealType);
+
+  /** Get/Set the Offset value */
+  itkSetObjectMacro(Noise, ParametricFunctionType);
+  itkGetConstObjectMacro(Noise, ParametricFunctionType);
+  itkGetObjectMacro(Noise, ParametricFunctionType);
+
+  /** Get/Set the AntennaPatternNewGain value */
+  itkSetObjectMacro(AntennaPatternNewGain, ParametricFunctionType);
+  itkGetConstObjectMacro(AntennaPatternNewGain, ParametricFunctionType);
+  itkGetObjectMacro(AntennaPatternNewGain, ParametricFunctionType);
+
+  /** Get/Set the AntennaPatternOldGain value */
+  itkSetObjectMacro(AntennaPatternOldGain, ParametricFunctionType);
+  itkGetObjectMacro(AntennaPatternOldGain, ParametricFunctionType);
+  itkGetConstObjectMacro(AntennaPatternOldGain, ParametricFunctionType);
+
+  /** Get/Set the RangeSpreadLoss value */
+  itkSetObjectMacro(RangeSpreadLoss, ParametricFunctionType);
+  itkGetConstObjectMacro(RangeSpreadLoss, ParametricFunctionType);
+  itkGetObjectMacro(RangeSpreadLoss, ParametricFunctionType);
+
+
+protected:
+  SarBrightnessFunction();
+  virtual ~SarBrightnessFunction(){}
+  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+private:
+  SarBrightnessFunction(const Self &);  //purposely not implemented
+  void operator =(const Self&);  //purposely not implemented
+
+  FunctorRealType             m_Scale;
+  ParametricFunctionPointer   m_Noise;
+  ParametricFunctionPointer   m_AntennaPatternNewGain;
+  ParametricFunctionPointer   m_AntennaPatternOldGain;
+  ParametricFunctionPointer   m_RangeSpreadLoss;
+};
+
+} // end namespace otb
+
+#ifndef OTB_MANUAL_INSTANTIATION
+# include "otbSarBrightnessFunction.txx"
+#endif
+
+#endif
diff --git a/Code/Radiometry/otbSarBrightnessFunction.txx b/Code/Radiometry/otbSarBrightnessFunction.txx
new file mode 100644
index 0000000000000000000000000000000000000000..ace8a2f810a8fe66ebc5ef3800b928dffcbad952
--- /dev/null
+++ b/Code/Radiometry/otbSarBrightnessFunction.txx
@@ -0,0 +1,123 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef __otbSarBrightnessFunction_txx
+#define __otbSarBrightnessFunction_txx
+
+#include "otbSarBrightnessFunction.h"
+#include "otbSarParametricMapFunction.h"
+#include "itkNumericTraits.h"
+
+namespace otb
+{
+
+/**
+ * Constructor
+ */
+template <class TInputImage, class TCoordRep>
+SarBrightnessFunction<TInputImage, TCoordRep>
+::SarBrightnessFunction():
+  m_Scale(1.0)
+{
+  m_Noise = ParametricFunctionType::New();
+  m_AntennaPatternNewGain = ParametricFunctionType::New();
+  m_AntennaPatternOldGain = ParametricFunctionType::New();
+  m_RangeSpreadLoss = ParametricFunctionType::New();
+
+  m_Noise->SetConstantValue(0.0);
+  m_AntennaPatternNewGain->SetConstantValue(1.0);
+  m_AntennaPatternOldGain->SetConstantValue(1.0);
+  m_RangeSpreadLoss->SetConstantValue(1.0);
+}
+
+/**
+ * Initialize by setting the input image
+ */
+template <class TInputImage, class TCoordRep>
+void
+SarBrightnessFunction<TInputImage, TCoordRep>
+::SetInputImage(
+  const InputImageType * ptr )
+{
+  Superclass::SetInputImage(ptr);
+  m_Noise->SetInputImage(ptr);
+  m_AntennaPatternNewGain->SetInputImage(ptr);
+  m_AntennaPatternOldGain->SetInputImage(ptr);
+  m_RangeSpreadLoss->SetInputImage(ptr);
+}
+
+/**
+ *
+ */
+template <class TInputImage, class TCoordRep>
+void
+SarBrightnessFunction<TInputImage, TCoordRep>
+::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  this->Superclass::PrintSelf(os, indent);
+}
+
+/**
+ *
+ */
+template <class TInputImage, class TCoordRep>
+typename SarBrightnessFunction<TInputImage, TCoordRep>
+::OutputType
+SarBrightnessFunction<TInputImage, TCoordRep>
+::EvaluateAtIndex(const IndexType& index) const
+{
+  RealType result;
+  result = itk::NumericTraits<RealType>::Zero;
+
+  if (!this->GetInputImage())
+    {
+    return (itk::NumericTraits<OutputType>::max());
+    }
+
+  if (!this->IsInsideBuffer(index))
+    {
+    return (itk::NumericTraits<OutputType>::max());
+    }
+
+
+  FunctorRealType noise;
+  FunctorRealType antennaPatternNewGain;
+  FunctorRealType antennaPatternOldGain;
+  FunctorRealType rangeSpreadLoss;
+
+  noise = static_cast<FunctorRealType>(m_Noise->EvaluateAtIndex(index));
+  antennaPatternNewGain = static_cast<FunctorRealType>(m_AntennaPatternNewGain->EvaluateAtIndex(index));
+  antennaPatternOldGain = static_cast<FunctorRealType>(m_AntennaPatternOldGain->EvaluateAtIndex(index));
+  rangeSpreadLoss = static_cast<FunctorRealType>(m_RangeSpreadLoss->EvaluateAtIndex(index));
+
+  FunctorType functor;
+  functor.SetNoise(noise);
+  functor.SetScale(m_Scale);
+  functor.SetAntennaPatternNewGain(antennaPatternNewGain);
+  functor.SetAntennaPatternOldGain(antennaPatternOldGain);
+  functor.SetRangeSpreadLoss(rangeSpreadLoss);
+
+  const RealType value = static_cast<RealType>(vcl_abs(this->GetInputImage()->GetPixel(index)));
+  result = functor(value);
+
+  return static_cast<OutputType>(result);
+}
+
+} // end namespace otb
+
+#endif
diff --git a/Code/Radiometry/otbSarBrightnessFunctor.h b/Code/Radiometry/otbSarBrightnessFunctor.h
new file mode 100644
index 0000000000000000000000000000000000000000..c62eec3bc7208fdf3d856d24f4cfb1ae46e57a6a
--- /dev/null
+++ b/Code/Radiometry/otbSarBrightnessFunctor.h
@@ -0,0 +1,144 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef __otbSarBrightnessFunctor_h
+#define __otbSarBrightnessFunctor_h
+
+#include "otbMath.h"
+#include "itkNumericTraits.h"
+
+namespace otb
+{
+
+namespace Functor
+{
+/**
+ * \class SarBrightnessFunctor
+ * \brief Compute the brightness value.
+ *  \f$ \beta^{0} = (scale * DN^{2} + offset) * OldGain / NewGain * RangeSpreadLoss \f$
+ *
+ */
+template<class TInput, class TOutput>
+class ITK_EXPORT SarBrightnessFunctor
+{
+public:
+  typedef TInput                                            InputType;
+  typedef TOutput                                           OutputType;
+  typedef typename itk::NumericTraits<InputType>::AbsType   RealType;
+
+  SarBrightnessFunctor()
+  {
+    m_Noise = 0.0;
+    m_Scale = 1.0;
+    m_AntennaPatternOldGain = 1.0;
+    m_AntennaPatternNewGain = 1.0;
+    m_RangeSpreadLoss = 1.0;
+  };
+
+  ~SarBrightnessFunctor(){};
+
+  inline TOutput operator ()(const TInput& value) const
+  {
+    RealType digitalNumber = static_cast<RealType> (vcl_abs(value));
+    RealType beta;
+
+    beta  = m_Scale * (digitalNumber * digitalNumber - m_Noise);
+    beta *= m_AntennaPatternOldGain;
+    beta /= m_AntennaPatternNewGain;
+    beta *= m_RangeSpreadLoss;
+
+    if(beta < 0.0)
+    {
+      beta = 0.0;
+    }
+
+    return static_cast<OutputType>(beta);
+  }
+
+  /** Set offset method */
+  void SetNoise(RealType value)
+  {
+    m_Noise = value;
+  }
+
+  /** Get offset method */
+  RealType GetNoise() const
+  {
+    return m_Noise;
+  }
+
+  /** Set scale method */
+  void SetScale(RealType value)
+  {
+    m_Scale = value;
+  }
+
+  /** Get scale method */
+  RealType GetScale() const
+  {
+    return m_Scale;
+  }
+
+  /** Set antennaPatternNewGain method */
+  void SetAntennaPatternNewGain(RealType value)
+  {
+    m_AntennaPatternNewGain = value;
+  }
+
+  /** Get antennaPatternNewGain method */
+  RealType GetAntennaPatternNewGain() const
+  {
+    return m_AntennaPatternNewGain;
+  }
+
+  /** Set antennaPatternOldGain method */
+  void SetAntennaPatternOldGain(RealType value)
+  {
+    m_AntennaPatternOldGain = value;
+  }
+
+  /** Get antennaPatternOldGain method */
+  RealType GetAntennaPatternOldGain() const
+  {
+    return m_AntennaPatternOldGain;
+  }
+  
+  /** Set rangeSpreadLoss method */
+  void SetRangeSpreadLoss(RealType value)
+  {
+    m_RangeSpreadLoss = value;
+  }
+
+  /** Get scale method */
+  RealType GetRangeSpreadLoss() const
+  {
+    return m_RangeSpreadLoss;
+  }
+
+private:
+  RealType   m_Noise;
+  RealType   m_Scale;
+  RealType   m_AntennaPatternNewGain;
+  RealType   m_AntennaPatternOldGain;
+  RealType   m_RangeSpreadLoss;
+};
+}
+
+}
+
+#endif
diff --git a/Code/Radiometry/otbSarBrightnessToImageFilter.h b/Code/Radiometry/otbSarBrightnessToImageFilter.h
new file mode 100644
index 0000000000000000000000000000000000000000..7ee3b2d35857b6bca1295397883fce818cd11c38
--- /dev/null
+++ b/Code/Radiometry/otbSarBrightnessToImageFilter.h
@@ -0,0 +1,95 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+  Some parts of this code are derived from ITK. See ITKCopyright.txt
+  for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __otbSarBrightnessToImageFilter_h
+#define __otbSarBrightnessToImageFilter_h
+
+#include "otbSarBrightnessFunction.h"
+#include "otbFunctionToImageFilter.h"
+
+namespace otb
+{
+
+/** \class SarBrightnessToImageFilter
+  * \brief Evaluates the SarBrightnessFunction onto a source image
+ *
+ * The function has to inherit from itkImageFunction
+ *
+ * \ingroup ImageFilters
+ */
+
+template <class TInputImage, class TOutputImage>
+class ITK_EXPORT SarBrightnessToImageFilter :
+  public FunctionToImageFilter<TInputImage, TOutputImage, 
+                 SarBrightnessFunction<TInputImage> >
+{
+public:
+  /** Standard class typedefs. */
+  typedef SarBrightnessToImageFilter                         Self;
+  typedef FunctionToImageFilter<TInputImage, TOutputImage, 
+                     SarBrightnessFunction<TInputImage> >    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(SarBrightnessToImageFilter, FunctionToImageFilter);
+
+  /** Some typedefs. */
+  /** Image size typedef. */
+  typedef typename Superclass::InputImageType           InputImageType; 
+  typedef typename Superclass::InputImagePointer        InputImagePointer;
+  typedef typename Superclass::InputImageRegionType     InputImageRegionType;
+  typedef typename Superclass::InputImagePixelType      InputImagePixelType;
+  typedef typename Superclass::OutputImageType          OutputImageType;
+  typedef typename Superclass::OutputImagePointer       OutputImagePointer;
+  typedef typename Superclass::OutputImageRegionType    OutputImageRegionType;
+  typedef typename Superclass::OutputImagePixelType     OutputImagePixelType;
+  /** Type of function. */
+
+  typedef typename Superclass::FunctionType                     FunctionType;
+  typedef typename Superclass::FunctionPointer                  FunctionPointer;
+  typedef typename Superclass::FunctionValueType                FunctionValueType;
+  typedef typename Superclass::FunctionPositionType             FunctionPositionType;
+  typedef typename FunctionType::ParametricFunctionPointer      ParametricFunctionPointer;
+  typedef typename FunctionType::ParametricFunctionConstPointer ParametricFunctionConstPointer;
+  typedef typename FunctionType::ParametricFunctionType         ParametricFunctionType;
+
+protected:
+  SarBrightnessToImageFilter();
+  virtual ~SarBrightnessToImageFilter() {}
+
+  /** Update the function list and input parameters*/
+  virtual void BeforeThreadedGenerateData();
+private:
+  SarBrightnessToImageFilter(const Self &); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
+};
+
+} // end namespace otb
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbSarBrightnessToImageFilter.txx"
+#endif
+
+#endif
diff --git a/Code/Radiometry/otbSarBrightnessToImageFilter.txx b/Code/Radiometry/otbSarBrightnessToImageFilter.txx
new file mode 100644
index 0000000000000000000000000000000000000000..a97f7fea3181d5c5b2c8c4f34c750c9c2dd78892
--- /dev/null
+++ b/Code/Radiometry/otbSarBrightnessToImageFilter.txx
@@ -0,0 +1,85 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+  Some parts of this code are derived from ITK. See ITKCopyright.txt
+  for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef __otbSarBrightnessToImageFilter_txx
+#define __otbSarBrightnessToImageFilter_txx
+
+#include "otbSarBrightnessToImageFilter.h"
+
+#include "otbSarImageMetadataInterface.h"
+#include "otbSarImageMetadataInterfaceFactory.h"
+
+namespace otb
+{
+
+/**
+ * Constructor
+ */
+template<class TInputImage, class TOutputImage>
+SarBrightnessToImageFilter<TInputImage, TOutputImage>
+::SarBrightnessToImageFilter()
+{
+}
+
+template<class TInputImage, class TOutputImage>
+void
+SarBrightnessToImageFilter<TInputImage, TOutputImage>
+::BeforeThreadedGenerateData()
+{
+  // will SetInputImage on the function
+  Superclass::BeforeThreadedGenerateData();
+
+  SarImageMetadataInterface::Pointer imageMetadataInterface = SarImageMetadataInterfaceFactory::CreateIMI(
+      this->GetInput()->GetMetaDataDictionary());
+
+  FunctionPointer function = this->GetFunction();
+
+  function->SetScale(imageMetadataInterface->GetRadiometricCalibrationScale());
+  
+  ParametricFunctionPointer   noise;
+  ParametricFunctionPointer   antennaPatternNewGain;
+  ParametricFunctionPointer   antennaPatternOldGain;
+  ParametricFunctionPointer   rangeSpreadLoss;
+  
+  noise = function->GetNoise();
+  noise->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationNoise());
+  noise->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationNoisePolynomialDegree());
+  noise->EvaluateParametricCoefficient();
+  
+  antennaPatternNewGain = function->GetAntennaPatternNewGain();
+  antennaPatternNewGain->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternNewGain());
+  antennaPatternNewGain->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree());
+  antennaPatternNewGain->EvaluateParametricCoefficient();
+  
+  antennaPatternOldGain = function->GetAntennaPatternOldGain();
+  antennaPatternOldGain->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternOldGain());
+  antennaPatternOldGain->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree());
+  antennaPatternOldGain->EvaluateParametricCoefficient();
+  
+  rangeSpreadLoss = function->GetRangeSpreadLoss();
+  rangeSpreadLoss->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationRangeSpreadLoss());
+  rangeSpreadLoss->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationRangeSpreadLossPolynomialDegree());
+  rangeSpreadLoss->EvaluateParametricCoefficient();
+}
+
+
+} // end namespace otb
+
+#endif
diff --git a/Examples/Filtering/DiscreteGaussianImageFilter.cxx b/Examples/Filtering/DiscreteGaussianImageFilter.cxx
index 65ffec8687457599cb4e6528629db8ce0ba4284f..ed4d70db79a983f4a2d8e4cafd7ba3f272396e59 100644
--- a/Examples/Filtering/DiscreteGaussianImageFilter.cxx
+++ b/Examples/Filtering/DiscreteGaussianImageFilter.cxx
@@ -182,7 +182,7 @@ int main(int argc, char * argv[])
   rescaler->SetOutputMinimum(0);
   rescaler->SetOutputMaximum(255);
 
-  typedef itk::ImageFileWriter<WriteImageType> WriterType;
+  typedef otb::ImageFileWriter<WriteImageType> WriterType;
   WriterType::Pointer writer = WriterType::New();
   writer->SetFileName(argv[2]);
 
diff --git a/Examples/IO/MultibandImageReadWrite.cxx b/Examples/IO/MultibandImageReadWrite.cxx
index aaa9a484495678b0424a11886d77a28bc9a80935..efa7d02b8a1f9cd3c99465cb2c8ecd370af78181 100644
--- a/Examples/IO/MultibandImageReadWrite.cxx
+++ b/Examples/IO/MultibandImageReadWrite.cxx
@@ -84,8 +84,8 @@ int main(int argc, char * argv[])
   //  We can now instantiate the types of the reader and writer. These two
   //  classes are parameterized over the image type.
   //
-  //  \index{itk::ImageFileReader!Instantiation}
-  //  \index{itk::ImageFileWriter!Instantiation}
+  //  \index{otb::ImageFileReader!Instantiation}
+  //  \index{otb::ImageFileWriter!Instantiation}
   //
   //  Software Guide : EndLatex
 
diff --git a/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx b/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx
index 2356cce8ba62654315aac9789c37468ec3a3694c..23ade6df52428ec5a6ff646d4a5cdcc0243cffac 100644
--- a/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx
+++ b/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx
@@ -32,12 +32,12 @@
 //
 // Software Guide : EndLatex
 
-#include "itkImage.h"
+#include "otbImage.h"
 // Software Guide : BeginCodeSnippet
 #include "itkImageLinearConstIteratorWithIndex.h"
 // Software Guide : EndCodeSnippet
-#include "itkImageFileReader.h"
-#include "itkImageFileWriter.h"
+#include "otbImageFileReader.h"
+#include "otbImageFileWriter.h"
 
 int main(int argc, char *argv[])
 {
@@ -60,11 +60,11 @@ int main(int argc, char *argv[])
 
 // Software Guide : BeginCodeSnippet
   typedef unsigned char            PixelType;
-  typedef itk::Image<PixelType, 3> Image3DType;
-  typedef itk::Image<PixelType, 4> Image4DType;
+  typedef otb::Image<PixelType, 3> Image3DType;
+  typedef otb::Image<PixelType, 4> Image4DType;
 
-  typedef itk::ImageFileReader<Image4DType> Reader4DType;
-  typedef itk::ImageFileWriter<Image3DType> Writer3DType;
+  typedef otb::ImageFileReader<Image4DType> Reader4DType;
+  typedef otb::ImageFileWriter<Image3DType> Writer3DType;
 
   Reader4DType::Pointer reader4D = Reader4DType::New();
   reader4D->SetFileName(argv[1]);
diff --git a/Examples/Iterators/ImageSliceIteratorWithIndex.cxx b/Examples/Iterators/ImageSliceIteratorWithIndex.cxx
index 56029ff1cf54df099fb3c62454a34d5fa504cbdf..23586a664526ef2c5f7d4132bafab7dd18fc648d 100644
--- a/Examples/Iterators/ImageSliceIteratorWithIndex.cxx
+++ b/Examples/Iterators/ImageSliceIteratorWithIndex.cxx
@@ -98,15 +98,15 @@
 //
 // Software Guide : EndLatex
 
-#include "itkImage.h"
+#include "otbImage.h"
 #include "vnl/vnl_math.h"
 
 // Software Guide : BeginCodeSnippet
 #include "itkImageSliceConstIteratorWithIndex.h"
 #include "itkImageLinearIteratorWithIndex.h"
 // Software Guide : EndCodeSnippet
-#include "itkImageFileReader.h"
-#include "itkImageFileWriter.h"
+#include "otbImageFileReader.h"
+#include "otbImageFileWriter.h"
 
 int main(int argc, char *argv[])
 {
@@ -131,8 +131,8 @@ int main(int argc, char *argv[])
 
 // Software Guide : BeginCodeSnippet
   typedef unsigned short           PixelType;
-  typedef itk::Image<PixelType, 2> ImageType2D;
-  typedef itk::Image<PixelType, 3> ImageType3D;
+  typedef otb::Image<PixelType, 2> ImageType2D;
+  typedef otb::Image<PixelType, 3> ImageType3D;
 // Software Guide : EndCodeSnippet
 
 // Software Guide : BeginLatex
@@ -146,8 +146,8 @@ int main(int argc, char *argv[])
   typedef itk::ImageSliceConstIteratorWithIndex<ImageType3D> SliceIteratorType;
 // Software Guide : EndCodeSnippet
 
-  typedef itk::ImageFileReader<ImageType3D> ReaderType;
-  typedef itk::ImageFileWriter<ImageType2D> WriterType;
+  typedef otb::ImageFileReader<ImageType3D> ReaderType;
+  typedef otb::ImageFileWriter<ImageType2D> WriterType;
 
   ImageType3D::ConstPointer inputImage;
   ReaderType::Pointer       reader = ReaderType::New();
diff --git a/Examples/Iterators/NeighborhoodIterators5.cxx b/Examples/Iterators/NeighborhoodIterators5.cxx
index 8d478a41fe1d6706ad5434f3ea9fe9bf24e2af64..918f25bc8fde15a85990782cb78d616da89d5292 100644
--- a/Examples/Iterators/NeighborhoodIterators5.cxx
+++ b/Examples/Iterators/NeighborhoodIterators5.cxx
@@ -72,8 +72,8 @@ int main(int argc, char * argv[])
     }
 
   typedef float                           PixelType;
-  typedef itk::Image<PixelType, 2>        ImageType;
-  typedef itk::ImageFileReader<ImageType> ReaderType;
+  typedef otb::Image<PixelType, 2>        ImageType;
+  typedef otb::ImageFileReader<ImageType> ReaderType;
 
   typedef itk::ConstNeighborhoodIterator<ImageType> NeighborhoodIteratorType;
   typedef itk::ImageRegionIterator<ImageType>       IteratorType;
@@ -187,8 +187,8 @@ int main(int argc, char * argv[])
 // Software Guide : EndLatex
 
   typedef unsigned char                        WritePixelType;
-  typedef itk::Image<WritePixelType, 2>        WriteImageType;
-  typedef itk::ImageFileWriter<WriteImageType> WriterType;
+  typedef otb::Image<WritePixelType, 2>        WriteImageType;
+  typedef otb::ImageFileWriter<WriteImageType> WriterType;
 
   typedef itk::RescaleIntensityImageFilter<ImageType,
       WriteImageType> RescaleFilterType;
diff --git a/Examples/OBIA/ImageToLabelToImage.cxx b/Examples/OBIA/ImageToLabelToImage.cxx
index 461e50793e8ffef66e0a295b5a41d2917ad802c4..5fb66e55a5de857aef82275718c066dfb6534fd7 100644
--- a/Examples/OBIA/ImageToLabelToImage.cxx
+++ b/Examples/OBIA/ImageToLabelToImage.cxx
@@ -76,7 +76,7 @@ int main(int argc, char * argv[])
   // Software Guide : EndLatex
 
   // Software Guide : BeginCodeSnippet
-  typedef itk::ImageFileReader<ImageType> ReaderType;
+  typedef otb::ImageFileReader<ImageType> ReaderType;
   ReaderType::Pointer reader = ReaderType::New();
   reader->SetFileName(argv[1]);
   // Software Guide : EndCodeSnippet
@@ -127,7 +127,7 @@ int main(int argc, char * argv[])
   //  Software Guide : EndLatex
 
   // Software Guide : BeginCodeSnippet
-  typedef itk::ImageFileWriter<ImageType> WriterType;
+  typedef otb::ImageFileWriter<ImageType> WriterType;
   WriterType::Pointer writer = WriterType::New();
   writer->SetInput(l2i->GetOutput());
   writer->SetFileName(argv[2]);
diff --git a/Examples/OBIA/KeepNObjects.cxx b/Examples/OBIA/KeepNObjects.cxx
index 34ff89d1251948dd101e52097d416ac57fbf6ac5..d3e5463440fc51261a0c01f713567146902bba5c 100644
--- a/Examples/OBIA/KeepNObjects.cxx
+++ b/Examples/OBIA/KeepNObjects.cxx
@@ -29,8 +29,9 @@
 
 // Software Guide : BeginCodeSnippet
 // Software Guide : EndCodeSnippet
-#include "itkImageFileReader.h"
-#include "itkImageFileWriter.h"
+#include "otbImage.h"
+#include "otbImageFileReader.h"
+#include "otbImageFileWriter.h"
 #include "itkSimpleFilterWatcher.h"
 
 //#include "itkLabelStatisticsKeepNObjectsImageFilter.h"
@@ -55,16 +56,16 @@ int main(int argc, char * argv[])
   const int dim = 3;
 
   typedef unsigned char              PixelType;
-  typedef itk::Image<PixelType, dim> IType;
+  typedef otb::Image<PixelType, dim> IType;
 
-  typedef itk::ImageFileReader<IType> ReaderType;
+  typedef otb::ImageFileReader<IType> ReaderType;
   ReaderType::Pointer reader = ReaderType::New();
   reader->SetFileName(argv[1]);
 
   ReaderType::Pointer reader2 = ReaderType::New();
   reader2->SetFileName(argv[2]);
 
-  typedef itk::StatisticsLabelObject<PixelType, dim>            LabelObjectType;
+  typedef  itk::StatisticsLabelObject<PixelType, dim>           LabelObjectType;
   typedef  itk::LabelMap<LabelObjectType>                       LabelMapType;
   typedef  itk::LabelImageToLabelMapFilter<IType, LabelMapType> LabelizerType;
 
@@ -107,7 +108,7 @@ int main(int argc, char * argv[])
   opening->SetAttribute( argv[7] );
   itk::SimpleFilterWatcher watcher(opening, "filter");
 */
-  typedef itk::ImageFileWriter<IType> WriterType;
+  typedef otb::ImageFileWriter<IType> WriterType;
   WriterType::Pointer writer = WriterType::New();
   writer->SetInput(binarizer->GetOutput());
   writer->SetFileName(argv[3]);
diff --git a/Examples/OBIA/ShapeAttributeComputation.cxx b/Examples/OBIA/ShapeAttributeComputation.cxx
index eadd361df8151cd79957eb4fb440991ba174a6ac..b08d35a3869f1cb2aefce7276c37e2a67347f032 100644
--- a/Examples/OBIA/ShapeAttributeComputation.cxx
+++ b/Examples/OBIA/ShapeAttributeComputation.cxx
@@ -74,7 +74,7 @@ int main(int argc, char * argv[])
   // Software Guide : EndLatex
 
   // Software Guide : BeginCodeSnippet
-  typedef itk::ImageFileReader<ImageType> ReaderType;
+  typedef otb::ImageFileReader<ImageType> ReaderType;
   ReaderType::Pointer reader = ReaderType::New();
   reader->SetFileName(argv[1]);
   // Software Guide : EndCodeSnippet
diff --git a/Examples/Patented/ScaleInvariantFeatureImageFilter.cxx b/Examples/Patented/ScaleInvariantFeatureImageFilter.cxx
index 069f06f4efbf61d1cd1273cbe9a2520db65461ce..91328da14c7ec60b197bbf741587f68194c7b183 100644
--- a/Examples/Patented/ScaleInvariantFeatureImageFilter.cxx
+++ b/Examples/Patented/ScaleInvariantFeatureImageFilter.cxx
@@ -55,7 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "itkImageSeriesReader.h"
 #include "itkNumericSeriesFileNames.h"
 #include "itkPointSetToImageFilter.h"
-#include "itkImageFileWriter.h"
+#include "otbImageFileWriter.h"
 
 int main(int argc, char *argv[])
 {
@@ -90,11 +90,11 @@ int main(int argc, char *argv[])
 
   typedef float
   PixelType;
-  typedef itk::Image<PixelType,
+  typedef otb::Image<PixelType,
       Dimension>                            FixedImageType;
   typedef itk::ScaleInvariantFeatureImageFilter<FixedImageType,
       Dimension> SiftFilterType;
-  typedef itk::Image<unsigned char,
+  typedef otb::Image<unsigned char,
       Dimension>                            OutputImageType;
 
   typedef itk::ImageSource<FixedImageType> ImageSourceType;
@@ -112,7 +112,7 @@ int main(int argc, char *argv[])
   std::cerr << "ImageFile1 = " << inputImage1 << "\n";
   std::cerr << "SIFT Feature\n" << std::endl;
 
-  typedef itk::ImageFileReader<FixedImageType> FixedImageReaderType;
+  typedef otb::ImageFileReader<FixedImageType> FixedImageReaderType;
   FixedImageReaderType::Pointer tmpImageReader  = FixedImageReaderType::New();
   tmpImageReader  = FixedImageReaderType::New();
 
@@ -159,7 +159,7 @@ int main(int argc, char *argv[])
   pointSet1->SetSize(fixedImage->GetLargestPossibleRegion().GetSize());
   pointSet1->Update();
 
-  typedef itk::ImageFileWriter<OutputImageType> WriterType;
+  typedef otb::ImageFileWriter<OutputImageType> WriterType;
 
   WriterType::Pointer writer = WriterType::New();
   writer->SetFileName(outputImageKeys1);
diff --git a/Examples/Registration/ImageRegistration5.cxx b/Examples/Registration/ImageRegistration5.cxx
index 09a4d769a0a7127e6601ca6dfc695508f09c9324..87273b96094ddc6624226bd4df785957520a1033 100644
--- a/Examples/Registration/ImageRegistration5.cxx
+++ b/Examples/Registration/ImageRegistration5.cxx
@@ -530,7 +530,7 @@ int main(int argc, char *argv[])
   resample->SetOutputSpacing(fixedImage->GetSpacing());
   resample->SetDefaultPixelValue(100);
 
-  typedef itk::ImageFileWriter<FixedImageType> WriterFixedType;
+  typedef otb::ImageFileWriter<FixedImageType> WriterFixedType;
 
   WriterFixedType::Pointer writer =  WriterFixedType::New();
 
@@ -579,7 +579,7 @@ int main(int argc, char *argv[])
 
   intensityRescaler->SetInput(difference->GetOutput());
 
-  typedef itk::ImageFileWriter<OutputImageType> WriterType;
+  typedef otb::ImageFileWriter<OutputImageType> WriterType;
 
   WriterType::Pointer writer2 =  WriterType::New();
 
diff --git a/Examples/Segmentation/FastMarchingImageFilter.cxx b/Examples/Segmentation/FastMarchingImageFilter.cxx
index 7338edf4cf2b0b96d4476c515a7a2df560bc618b..6b67b29b167629ff48a49f4204fbbebe6437a8ae 100644
--- a/Examples/Segmentation/FastMarchingImageFilter.cxx
+++ b/Examples/Segmentation/FastMarchingImageFilter.cxx
@@ -632,21 +632,21 @@ int main(int argc, char *argv[])
   // with a viewer to help determine an appropriate threshold to be used on
   // the output of the \code{fastmarching} filter.
   //
-  typedef itk::ImageFileWriter<InternalImageType> InternalWriterType;
+  typedef otb::ImageFileWriter<InternalImageType> InternalWriterType;
 
   InternalWriterType::Pointer mapWriter = InternalWriterType::New();
   mapWriter->SetInput(fastMarching->GetOutput());
-  mapWriter->SetFileName("FastMarchingFilterOutput4.mha");
+  mapWriter->SetFileName("FastMarchingFilterOutput4.tif");
   mapWriter->Update();
 
   InternalWriterType::Pointer speedWriter = InternalWriterType::New();
   speedWriter->SetInput(sigmoid->GetOutput());
-  speedWriter->SetFileName("FastMarchingFilterOutput3.mha");
+  speedWriter->SetFileName("FastMarchingFilterOutput3.tif");
   speedWriter->Update();
 
   InternalWriterType::Pointer gradientWriter = InternalWriterType::New();
   gradientWriter->SetInput(gradientMagnitude->GetOutput());
-  gradientWriter->SetFileName("FastMarchingFilterOutput2.mha");
+  gradientWriter->SetFileName("FastMarchingFilterOutput2.tif");
   gradientWriter->Update();
 
   //  Software Guide : BeginLatex
diff --git a/Testing/Code/FeatureExtraction/otbDrawPath.cxx b/Testing/Code/FeatureExtraction/otbDrawPath.cxx
index c436d2958b285324f28c99b986d43f485d98cd81..19223c9f3e4cb7f36b61932601c65d54bcc11711 100644
--- a/Testing/Code/FeatureExtraction/otbDrawPath.cxx
+++ b/Testing/Code/FeatureExtraction/otbDrawPath.cxx
@@ -21,8 +21,7 @@
 #endif
 
 #include "itkExceptionObject.h"
-#include "itkImage.h"
-#include "itkImageFileWriter.h"
+#include "otbImage.h"
 #include "itkPolyLineParametricPath.h"
 
 #include "otbImageFileReader.h"
@@ -38,14 +37,14 @@ int otbDrawPathDessinCarre(int argc, char * argv[])
   typedef unsigned char OutputPixelType;
   const unsigned int Dimension = 2;
 
-  typedef itk::Image<InputPixelType,  Dimension> InputImageType;
-  typedef itk::Image<OutputPixelType, Dimension> OutputImageType;
+  typedef otb::Image<InputPixelType,  Dimension> InputImageType;
+  typedef otb::Image<OutputPixelType, Dimension> OutputImageType;
   typedef InputImageType::PointType              InputImagePointType;
 
   typedef itk::PolyLineParametricPath<Dimension> PathType;
 
   typedef otb::ImageFileReader<InputImageType>  ReaderType;
-  typedef itk::ImageFileWriter<OutputImageType> WriterType;
+  typedef otb::ImageFileWriter<OutputImageType> WriterType;
 
   typedef otb::DrawPathFilter<InputImageType, PathType, OutputImageType> DrawPathFilterType;
 
diff --git a/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx b/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx
index ed80eaa26b44434adde56ff0373a45fe97388e17..5715ea318fad6501ca752d3c470d488adb3153fd 100644
--- a/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx
+++ b/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx
@@ -21,8 +21,7 @@
 #endif
 
 #include "itkExceptionObject.h"
-#include "itkImage.h"
-#include "itkImageFileWriter.h"
+#include "otbImage.h"
 #include "itkPolyLineParametricPath.h"
 
 #include "otbImageFileReader.h"
@@ -40,14 +39,14 @@ int otbDrawPathAlign(int argc, char * argv[])
   typedef unsigned char OutputPixelType;
   const unsigned int Dimension = 2;
 
-  typedef itk::Image<InputPixelType,  Dimension> InputImageType;
-  typedef itk::Image<OutputPixelType, Dimension> OutputImageType;
+  typedef otb::Image<InputPixelType,  Dimension> InputImageType;
+  typedef otb::Image<OutputPixelType, Dimension> OutputImageType;
 
   typedef itk::PolyLineParametricPath<Dimension> PathType;
   typedef PathType::Pointer                      PathPointerType;
 
   typedef otb::ImageFileReader<InputImageType>  ReaderType;
-  typedef itk::ImageFileWriter<OutputImageType> WriterType;
+  typedef otb::ImageFileWriter<OutputImageType> WriterType;
 
   typedef otb::ImageToPathListAlignFilter<InputImageType, PathType> PathListType;
   typedef PathListType::OutputPathListType                          OutputPathListType;
diff --git a/Testing/Code/IO/otbIOTests7.cxx b/Testing/Code/IO/otbIOTests7.cxx
index 19f4a344409e457a56e2e2f3c38003dbe04fb059..9eae62f89d3a61851951731a8bfa4e3fe9404cfb 100644
--- a/Testing/Code/IO/otbIOTests7.cxx
+++ b/Testing/Code/IO/otbIOTests7.cxx
@@ -29,6 +29,5 @@ void RegisterTests()
   REGISTER_TEST(otbImageFileReaderTest);
   REGISTER_TEST(otbImageFileReaderRGBTest);
   REGISTER_TEST(otbImageFileWriterTest);
-  REGISTER_TEST(otbImageFileReaderRGBTest);
   REGISTER_TEST(otbImageFileWriterRGBTest);
 }
diff --git a/Testing/Code/Learning/CMakeLists.txt b/Testing/Code/Learning/CMakeLists.txt
index a2b7718c99da8e1173aa556c7a5885fd344fa8dd..31c62d6df081e43e7c22394753e6ec9edc2e16aa 100644
--- a/Testing/Code/Learning/CMakeLists.txt
+++ b/Testing/Code/Learning/CMakeLists.txt
@@ -603,6 +603,34 @@ ${TEMP}/leTvConcatenateSampleListFilterOutput.txt
  0 -1
 )
 
+#ListSampleToBalancedListSampleFilterNew tests ----------
+ADD_TEST(leTuListSampleToBalancedListSampleFilterNew ${LEARNING_TESTS4}
+otbListSampleToBalancedListSampleFilterNew)
+
+ADD_TEST(leTvListSampleToBalancedListSampleFilter ${LEARNING_TESTS4}
+--compare-ascii ${NOTOL}
+${BASELINE_FILES}/leTvListSampleToBalancedListSampleFilterOutput.txt
+ ${TEMP}/leTvListSampleToBalancedListSampleFilterOutput.txt
+otbListSampleToBalancedListSampleFilter
+${TEMP}/leTvListSampleToBalancedListSampleFilterOutput.txt
+ 2 
+-1 -3  0 # The third element is the label of the SampleList
+ 1  2  1
+-2 -5  0
+-1 -3  1
+ 0 -1  1
+-3  1  1
+-5  2  1 
+ 2  1  1
+ 2  8  1 
+ 1 -4  0
+-1  5  4 
+ 2  5  1
+ 0 -5  0
+ 1 -1  2
+)
+
+
 # Testing srcs
 SET(BasicLearning_SRCS1
 otbLearningTests1.cxx
@@ -671,6 +699,7 @@ otbSVMValidation.cxx
 otbShiftScaleSampleListFilter.cxx
 otbGaussianAdditiveNoiseSampleListFilter.cxx
 otbConcatenateSampleListFilter.cxx
+otbListSampleToBalancedListSampleFilter.cxx
 )
 
 OTB_ADD_EXECUTABLE(otbLearningTests1 "${BasicLearning_SRCS1}" "OTBLearning;OTBIO;OTBTesting")
diff --git a/Testing/Code/Learning/otbLearningTests4.cxx b/Testing/Code/Learning/otbLearningTests4.cxx
index 9e6e85eb00e723db0d84cf3d9a0d7295eb9eb8f4..0ecc981927cfdfdefec21f21990246363dadcf18 100644
--- a/Testing/Code/Learning/otbLearningTests4.cxx
+++ b/Testing/Code/Learning/otbLearningTests4.cxx
@@ -43,4 +43,6 @@ void RegisterTests()
   REGISTER_TEST(otbGaussianAdditiveNoiseSampleListFilter);
   REGISTER_TEST(otbConcatenateSampleListFilterNew);
   REGISTER_TEST(otbConcatenateSampleListFilter);
+  REGISTER_TEST(otbListSampleToBalancedListSampleFilterNew);
+  REGISTER_TEST(otbListSampleToBalancedListSampleFilter);
 }
diff --git a/Testing/Code/Learning/otbListSampleToBalancedListSampleFilter.cxx b/Testing/Code/Learning/otbListSampleToBalancedListSampleFilter.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..22e221f683780f52943f1aae177026c3ee790a9b
--- /dev/null
+++ b/Testing/Code/Learning/otbListSampleToBalancedListSampleFilter.cxx
@@ -0,0 +1,107 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+
+#if defined(_MSC_VER)
+#pragma warning ( disable : 4786 )
+#endif
+
+#include "itkListSample.h"
+#include "otbListSampleToBalancedListSampleFilter.h"
+#include <fstream>
+
+typedef itk::VariableLengthVector<double>             DoubleSampleType;
+typedef itk::Statistics::ListSample<DoubleSampleType> DoubleSampleListType;
+
+typedef itk::VariableLengthVector<unsigned int>        IntegerSampleType;
+typedef itk::Statistics::ListSample<IntegerSampleType> IntegerSampleListType;
+
+typedef itk::VariableLengthVector<float>             FloatSampleType;
+typedef itk::Statistics::ListSample<FloatSampleType> FloatSampleListType;
+
+typedef otb::Statistics::ListSampleToBalancedListSampleFilter
+<FloatSampleListType,IntegerSampleListType,DoubleSampleListType> BalancingFilterType;
+
+
+int otbListSampleToBalancedListSampleFilterNew(int argc, char * argv[])
+{
+  BalancingFilterType::Pointer filter = BalancingFilterType::New();
+  return EXIT_SUCCESS;
+}
+
+int otbListSampleToBalancedListSampleFilter(int argc, char * argv[])
+{
+  // Compute the number of samples
+  const char * outfname = argv[1];
+  unsigned int sampleSize = atoi(argv[2]);
+  unsigned int nbSamples = (argc-3)/(sampleSize+1);  // +1 cause the
+                                                     // label is added
+                                                     // in the commandline
+
+  IntegerSampleListType::Pointer labelSampleList = IntegerSampleListType::New();
+  labelSampleList->SetMeasurementVectorSize(1);
+
+  FloatSampleListType::Pointer inputSampleList = FloatSampleListType::New();
+  inputSampleList->SetMeasurementVectorSize(sampleSize);
+
+  BalancingFilterType::Pointer filter = BalancingFilterType::New();
+  filter->SetInput(inputSampleList);
+  filter->SetInputLabel(labelSampleList);
+
+  // Input Sample 
+  FloatSampleType   sample(sampleSize);
+  IntegerSampleType label(1);
+
+  unsigned int index = 3;
+
+  std::ofstream ofs(outfname);
+
+  ofs<<"Sample size: "<<sampleSize<<std::endl;
+  ofs<<"Nb samples : "<<nbSamples<<std::endl;
+
+  // InputSampleList and LabelSampleList
+  for(unsigned int sampleId = 0; sampleId<nbSamples;++sampleId)
+    {
+    for(unsigned int i = 0; i<sampleSize;++i)
+      {
+      sample[i]=atof(argv[index]);
+      ++index;
+      }
+    label[0]= atof(argv[index++]);
+
+    ofs<<sample<<std::endl;
+    ofs<<label<<std::endl;
+    inputSampleList->PushBack(sample);
+    labelSampleList->PushBack(label);
+    }
+
+  filter->Update();
+
+  DoubleSampleListType::ConstIterator outIt = filter->GetOutputSampleList()->Begin();
+
+  ofs<<"Output samples: "<<std::endl;
+
+  while(outIt != filter->GetOutputSampleList()->End())
+    {
+    ofs<<outIt.GetMeasurementVector()<<std::endl;
+    ++outIt;
+    }
+
+  ofs.close();
+
+  return EXIT_SUCCESS;
+}
diff --git a/Testing/Code/ObjectDetection/CMakeLists.txt b/Testing/Code/ObjectDetection/CMakeLists.txt
index 7c52af3a14cf84a7e15347038794a907fef790b0..d426771db5eb519c78a76496d1d28076b6890219 100644
--- a/Testing/Code/ObjectDetection/CMakeLists.txt
+++ b/Testing/Code/ObjectDetection/CMakeLists.txt
@@ -36,11 +36,37 @@ ADD_TEST(odTvLabeledSampleLocalizationGenerator ${OBJECTDETECTION_TESTS1}
   ${TEMP}/TvLabeledSampleLocalizationGeneratorOutput.shp
   )
 
+ADD_TEST(odTuDescriptorsListSampleGeneratorNew ${OBJECTDETECTION_TESTS1}
+  otbDescriptorsListSampleGeneratorNew
+  )
+
+ADD_TEST(odTvDescriptorsListSampleGeneratorNoStreaming ${OBJECTDETECTION_TESTS1}
+  --compare-ascii ${NOTOL}
+  ${BASELINE_FILES}/TvDescriptorsListSampleGeneratorNoStreamingOutput.txt
+  ${TEMP}/TvDescriptorsListSampleGeneratorNoStreamingOutput.txt
+  otbDescriptorsListSampleGenerator
+  ${INPUTDATA}/ObjectReco/Boats/maur_B010202_01_amplitude.tif
+  ${INPUTDATA}/ObjectReco/Boats/maur_B010202_01LabeledPoints.shp
+  ${TEMP}/TvDescriptorsListSampleGeneratorNoStreamingOutput.txt
+  0
+  )
+
+ADD_TEST(odTvDescriptorsListSampleGeneratorStreaming ${OBJECTDETECTION_TESTS1}
+  --compare-ascii ${NOTOL}
+  ${BASELINE_FILES}/TvDescriptorsListSampleGeneratorNoStreamingOutput.txt
+  ${TEMP}/TvDescriptorsListSampleGeneratorStreamingOutput.txt
+  otbDescriptorsListSampleGenerator
+  ${INPUTDATA}/ObjectReco/Boats/maur_B010202_01_amplitude.tif
+  ${INPUTDATA}/ObjectReco/Boats/maur_B010202_01LabeledPoints.shp
+  ${TEMP}/TvDescriptorsListSampleGeneratorStreamingOutput.txt
+  50
+  )
 
 # A enrichir
 SET(ObjectDetection_SRCS1
 otbObjectDetectionTests1.cxx
 otbLabeledSampleLocalizationGenerator.cxx
+otbDescriptorsListSampleGenerator.cxx
 )
 
 
diff --git a/Testing/Code/ObjectDetection/otbDescriptorsListSampleGenerator.cxx b/Testing/Code/ObjectDetection/otbDescriptorsListSampleGenerator.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..9787d8d66921cec6b646c0591537a230fad693ec
--- /dev/null
+++ b/Testing/Code/ObjectDetection/otbDescriptorsListSampleGenerator.cxx
@@ -0,0 +1,186 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+  This software is distributed WITHOUT ANY WARRANTY; without even 
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+  PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#if defined(_MSC_VER)
+#pragma warning ( disable : 4786 )
+#endif
+
+#include <iterator>
+
+#include "otbImage.h"
+#include "otbVectorData.h"
+#include "otbRadiometricMomentsImageFunction.h"
+#include "itkListSample.h"
+#include "itkFixedArray.h"
+#include "otbDescriptorsListSampleGenerator.h"
+#include "otbImageFileReader.h"
+#include "otbVectorDataFileReader.h"
+
+const unsigned int Dimension = 2;
+typedef int        LabelType;
+typedef double     PixelType;
+typedef double     FunctionPrecisionType;
+typedef double     CoordRepType;
+
+typedef otb::Image<PixelType, Dimension>                              ImageType;
+typedef otb::VectorData<>                                             VectorDataType;
+typedef otb::RadiometricMomentsImageFunction<ImageType, CoordRepType> FunctionType;
+
+typedef FunctionType::OutputType                        SampleType;
+typedef itk::Statistics::ListSample<SampleType>         ListSampleType;
+typedef itk::FixedArray<LabelType, 1>                   LabelSampleType;
+typedef itk::Statistics::ListSample<LabelSampleType>    LabelListSampleType;
+
+typedef otb::DescriptorsListSampleGenerator
+           < ImageType,
+             VectorDataType,
+             ListSampleType,
+             LabelListSampleType,
+             FunctionPrecisionType,
+             CoordRepType > DescriptorsListSampleGeneratorType;
+
+typedef otb::ImageFileReader<ImageType>           ImageReaderType;
+typedef otb::VectorDataFileReader<VectorDataType> VectorDataReaderType;
+
+typedef FunctionType::PointType PointType;
+typedef DescriptorsListSampleGeneratorType::SamplesPositionType SamplesPositionType;
+
+
+struct SampleEntry
+{
+  PointType  position;
+  LabelType  label;
+  SampleType measurement;
+};
+
+struct CompareSampleEntry
+{
+  bool operator () (SampleEntry p, SampleEntry q)
+  {
+    // order with the y axis position
+    if (p.position[1] < q.position[1])
+      return true;
+    if (p.position[1] > q.position[1])
+      return false;
+
+    // If one the same line,
+    // order with the x axis position
+    if (p.position[0] < q.position[0])
+      return true;
+
+    return false;
+  }
+};
+
+ostream &operator<<(ostream &stream, SampleEntry entry)
+{
+  stream << "---" << std::endl
+         << "Label        : " << entry.label << std::endl
+         << "Position     : " << entry.position << std::endl
+         << "Measurements : " << entry.measurement;
+  return stream;
+}
+
+int otbDescriptorsListSampleGeneratorNew(int itkNotUsed(argc), char* itkNotUsed(argv)[])
+{
+  // instantiation
+  DescriptorsListSampleGeneratorType::Pointer generator = DescriptorsListSampleGeneratorType::New();
+
+  std::cout << generator << std::endl;
+
+  return EXIT_SUCCESS;
+}
+
+int otbDescriptorsListSampleGenerator(int argc, char* argv[])
+{
+  if (argc != 5)
+    {
+    std::cerr << "Wrong number of arguments" << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  const char* inputImageFileName = argv[1];
+  const char* inputSamplesLocation = argv[2];
+  const char* outputFileName = argv[3];
+  int streaming = atoi(argv[4]);
+
+  ImageReaderType::Pointer imageReader = ImageReaderType::New();
+  imageReader->SetFileName(inputImageFileName);
+
+  VectorDataReaderType::Pointer vectorDataReader = VectorDataReaderType::New();
+  vectorDataReader->SetFileName(inputSamplesLocation);
+
+  //imageReader->Update();
+  //vectorDataReader->Update();
+
+  FunctionType::Pointer descriptorsFunction = FunctionType::New();
+  descriptorsFunction->SetInputImage(imageReader->GetOutput());
+  descriptorsFunction->SetNeighborhoodRadius(5);
+
+  DescriptorsListSampleGeneratorType::Pointer descriptorsGenerator = DescriptorsListSampleGeneratorType::New();
+  descriptorsGenerator->SetInputImage(imageReader->GetOutput());
+  descriptorsGenerator->SetSamplesLocations(vectorDataReader->GetOutput());
+  descriptorsGenerator->SetDescriptorsFunction(descriptorsFunction.GetPointer());
+  descriptorsGenerator->SetNeighborhoodRadius(5);
+
+  if (streaming == 0)
+    {
+    descriptorsGenerator->GetStreamer()->SetNumberOfStreamDivisions(1);
+    }
+  else
+    {
+    descriptorsGenerator->GetStreamer()->SetNumberOfStreamDivisions(streaming);
+    }
+
+  descriptorsGenerator->Update();
+
+
+  ListSampleType::Pointer      samples = descriptorsGenerator->GetListSample();
+  LabelListSampleType::Pointer labels  = descriptorsGenerator->GetLabelListSample();
+  SamplesPositionType&         positions = descriptorsGenerator->GetSamplesPositions();
+
+  ListSampleType::Iterator sampleIt = samples->Begin();
+  LabelListSampleType::Iterator labelIt = labels->Begin();
+  SamplesPositionType::const_iterator posIt = positions.begin();
+
+  ListSampleType::Iterator sampleEnd = samples->End();
+  LabelListSampleType::Iterator labelEnd = labels->End();
+  SamplesPositionType::const_iterator posEnd = positions.end();
+
+  std::vector<SampleEntry> entries;
+
+  while (sampleIt != sampleEnd && labelIt != labelEnd && posIt != posEnd)
+    {
+    SampleEntry entry;
+    entry.position = *posIt;
+    entry.label = labelIt.GetMeasurementVector()[0];
+    entry.measurement = sampleIt.GetMeasurementVector();
+
+    entries.push_back(entry);
+
+    ++sampleIt;
+    ++labelIt;
+    ++posIt;
+    }
+
+  std::sort(entries.begin(), entries.end(), CompareSampleEntry());
+  std::ofstream file(outputFileName);
+  std::copy(entries.begin(), entries.end(), std::ostream_iterator<SampleEntry>(file, "\n"));
+  file.close();
+
+  return EXIT_SUCCESS;
+}
diff --git a/Testing/Code/ObjectDetection/otbObjectDetectionTests1.cxx b/Testing/Code/ObjectDetection/otbObjectDetectionTests1.cxx
index 057426962e844b851e257e97886786e570314e8e..9af78963820f77b89a91f2bf7a05e440a7f713a8 100644
--- a/Testing/Code/ObjectDetection/otbObjectDetectionTests1.cxx
+++ b/Testing/Code/ObjectDetection/otbObjectDetectionTests1.cxx
@@ -29,4 +29,6 @@ void RegisterTests()
 {
   REGISTER_TEST(otbLabeledSampleLocalizationGeneratorNew);
   REGISTER_TEST(otbLabeledSampleLocalizationGenerator);
+  REGISTER_TEST(otbDescriptorsListSampleGeneratorNew);
+  REGISTER_TEST(otbDescriptorsListSampleGenerator);
 }
diff --git a/Testing/Code/Radiometry/CMakeLists.txt b/Testing/Code/Radiometry/CMakeLists.txt
index ca69e7980dd84c11e907b4a1c089d48c781dc511..709247c0279410a6a01070f9f3497fb6801520a0 100644
--- a/Testing/Code/Radiometry/CMakeLists.txt
+++ b/Testing/Code/Radiometry/CMakeLists.txt
@@ -1438,25 +1438,11 @@ ADD_TEST(raTvTerraSarBrightnessImageComplexFilterTORONTO ${RADIOMETRY_TESTS9}
 )
 ENDIF(OTB_DATA_USE_LARGEINPUT)
 
-# -------            SarRadiometricCalibrationFunctor   ------------------------------
-ADD_TEST(raTuSarRadiometricCalibrationFunctor ${RADIOMETRY_TESTS9}
-        otbSarRadiometricCalibrationFunctor
-)
-# -------            SarRadiometricCalibrationFunction   ------------------------------
-ADD_TEST(raTvSarRadiometricCalibrationFunction ${RADIOMETRY_TESTS9}
-#--compare-ascii ${NOTOL}
-#	    ${BASELINE_FILES}/bfTvBinaryImageDensityFunctionOutputAscii.txt
-#	    ${TEMP}/bfTvBinaryImageDensityFunctionOutputAscii.txt
-        otbSarRadiometricCalibrationFunction
-	 	${INPUTDATA}/scene.png
-	 	${TEMP}/raTvSarRadiometricCalibrationFunctionOutputAscii.txt
-)
-
 # -------            SarRadiometricCalibrationFunction   ------------------------------
 ADD_TEST(raTuSarParametricMapFunction ${RADIOMETRY_TESTS9}
-#--compare-ascii ${NOTOL}
-#	    ${BASELINE_FILES}/bfTvBinaryImageDensityFunctionOutputAscii.txt
-#	    ${TEMP}/bfTvBinaryImageDensityFunctionOutputAscii.txt
+#	--compare-ascii ${NOTOL}
+#		    ${BASELINE_FILES}/raTvSarParametricMapFunctionOutputAscii.txt
+#	    	${TEMP}/raTvSarParametricMapFunctionOutputAscii.txt
         otbSarParametricMapFunctionTest
 	 	${INPUTDATA}/scene.png
 	 	${TEMP}/raTvSarParametricMapFunctionOutputAscii.txt
@@ -1470,21 +1456,70 @@ ADD_TEST(raTvSarParametricMapFunctionToImageFilter  ${RADIOMETRY_TESTS9}
 	    ${TEMP}/raTvSarParametricMapFunctionToImageFilter.tif
 )
 
-IF(OTB_DATA_USE_LARGEINPUT)
 
+# -------            SarRadiometricCalibrationFunctor   ------------------------------
+ADD_TEST(raTuSarRadiometricCalibrationFunctor ${RADIOMETRY_TESTS9}
+        otbSarRadiometricCalibrationFunctor
+)
+# -------            SarRadiometricCalibrationFunction   ------------------------------
+ADD_TEST(raTvSarRadiometricCalibrationFunction ${RADIOMETRY_TESTS9}
+	--compare-ascii ${NOTOL}
+		    ${BASELINE_FILES}/raTvSarRadiometricCalibrationFunctionOutputAscii.txt
+	    	${TEMP}/raTvSarRadiometricCalibrationFunctionOutputAscii.txt
+        otbSarRadiometricCalibrationFunction
+	 	${INPUTDATA}/scene.png
+	 	${TEMP}/raTvSarRadiometricCalibrationFunctionOutputAscii.txt
+)
+
+# -------  SarRadiometricCalibrationToImageFilter   ------------------------------
+
+IF(OTB_DATA_USE_LARGEINPUT)
 ADD_TEST(raTvSarRadiometricCalibrationToImageFilter  ${RADIOMETRY_TESTS9}
-#	--compare-image ${EPSILON_7}
-#	    ${BASELINE}/bfTvFunctionToImageFilterTest.tif
-#	    ${TEMP}/bfTvFunctionToImageFilterTest.tif
+	--compare-image ${EPSILON}
+	    	${BASELINE}/raTvSarRadiometricCalibrationToImageFilter_TSX_PANGKALANBUUN_HH.tif
+	    	${TEMP}/raTvSarRadiometricCalibrationToImageFilter_TSX_PANGKALANBUUN_HH.tif
         otbSarRadiometricCalibrationToImageFilterTest
 	    ${LARGEINPUT}/TERRASARX/PANGKALANBUUN/IMAGEDATA/IMAGE_HH_SRA_stripFar_008.cos
 	    ${TEMP}/raTvSarRadiometricCalibrationToImageFilter_TSX_PANGKALANBUUN_HH.tif
 	    1000 1000 250 250 # Extract
 )
+ENDIF(OTB_DATA_USE_LARGEINPUT)
+
+# -------            SarBrightnessFunctor   ------------------------------
+ADD_TEST(raTuSarBrightnessFunctor ${RADIOMETRY_TESTS9}
+        otbSarBrightnessFunctor
+)
+
+# -------            SarBrightnessFunction   ------------------------------
+ADD_TEST(raTvSarBrightnessFunction ${RADIOMETRY_TESTS9}
+	--compare-ascii ${NOTOL}
+	    	${BASELINE_FILES}/raTvSarBrightnessFunctionOutputAscii.txt
+	    	${TEMP}/raTvSarBrightnessFunctionOutputAscii.txt
+        otbSarBrightnessFunction
+	 	${INPUTDATA}/scene.png
+	 	${TEMP}/raTvSarBrightnessFunctionOutputAscii.txt
+)
 
+# ------- SarBrightnessToImageFilter   ------------------------------
+IF(OTB_DATA_USE_LARGEINPUT)
+ADD_TEST(raTvSarBrightnessToImageFilter  ${RADIOMETRY_TESTS9}
+	--compare-image ${EPSILON}
+	    	${BASELINE}/raTvSarBrightnessToImageFilter_TSX_PANGKALANBUUN_HH.tif
+	    	${TEMP}/raTvSarBrightnessToImageFilter_TSX_PANGKALANBUUN_HH.tif
+        otbSarBrightnessToImageFilterTest
+	    ${LARGEINPUT}/TERRASARX/PANGKALANBUUN/IMAGEDATA/IMAGE_HH_SRA_stripFar_008.cos
+	    ${TEMP}/raTvSarBrightnessToImageFilter_TSX_PANGKALANBUUN_HH.tif
+	    1000 1000 250 250 # Extract
+)
 ENDIF(OTB_DATA_USE_LARGEINPUT)
 
 
+
+
+
+
+
+
 # A enrichir
 SET(Radiometry_SRCS1
 otbRadiometryTests1.cxx
@@ -1586,11 +1621,14 @@ otbTerraSarBrightnessFunctor.cxx
 otbTerraSarBrightnessImageFilterNew.cxx
 otbTerraSarBrightnessImageFilterTest.cxx
 otbTerraSarBrightnessImageComplexFilterTest.cxx
-otbSarRadiometricCalibrationFunctor.cxx
-otbSarRadiometricCalibrationFunction.cxx
 otbSarParametricMapFunctionTest.cxx
 otbSarParametricMapFunctionToImageFilter.cxx
+otbSarRadiometricCalibrationFunctor.cxx
+otbSarRadiometricCalibrationFunction.cxx
 otbSarRadiometricCalibrationToImageFilterTest.cxx
+otbSarBrightnessFunctor.cxx
+otbSarBrightnessFunction.cxx
+otbSarBrightnessToImageFilterTest.cxx
 )
 
 
diff --git a/Testing/Code/Radiometry/otbRadiometryTests9.cxx b/Testing/Code/Radiometry/otbRadiometryTests9.cxx
index bba418d1c3f6df17be0a9371d1c3f3f64b09cf87..2ffab8e64c390898d7303f02f02f0e8d14482f49 100644
--- a/Testing/Code/Radiometry/otbRadiometryTests9.cxx
+++ b/Testing/Code/Radiometry/otbRadiometryTests9.cxx
@@ -34,9 +34,12 @@ void RegisterTests()
   REGISTER_TEST(otbTerraSarBrightnessImageFilterNew);
   REGISTER_TEST(otbTerraSarBrightnessImageFilterTest);
   REGISTER_TEST(otbTerraSarBrightnessImageComplexFilterTest);
-  REGISTER_TEST(otbSarRadiometricCalibrationFunctor);
-  REGISTER_TEST(otbSarRadiometricCalibrationFunction);
   REGISTER_TEST(otbSarParametricMapFunctionTest);
   REGISTER_TEST(otbSarParametricMapFunctionToImageFilter);
+  REGISTER_TEST(otbSarRadiometricCalibrationFunctor);
+  REGISTER_TEST(otbSarRadiometricCalibrationFunction);
   REGISTER_TEST(otbSarRadiometricCalibrationToImageFilterTest);
+  REGISTER_TEST(otbSarBrightnessFunctor);
+  REGISTER_TEST(otbSarBrightnessFunction);
+  REGISTER_TEST(otbSarBrightnessToImageFilterTest);
 }
diff --git a/Testing/Code/Radiometry/otbSarBrightnessFunction.cxx b/Testing/Code/Radiometry/otbSarBrightnessFunction.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..8fc2007a13abab22ca83e26bfc033b763a988b8d
--- /dev/null
+++ b/Testing/Code/Radiometry/otbSarBrightnessFunction.cxx
@@ -0,0 +1,71 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#include "otbSarBrightnessFunction.h"
+
+#include "otbImage.h"
+#include "otbImageFileReader.h"
+#include <iostream>
+
+int otbSarBrightnessFunction(int argc, char* argv[])
+{
+
+  const char * infname  = argv[1];
+  const char * outfname = argv[2];
+
+  const unsigned int Dimension = 2;
+  typedef float PixelType;
+
+  typedef otb::Image<PixelType, Dimension>                InputImageType;
+  typedef InputImageType::IndexType                       IndexType;
+  typedef otb::ImageFileReader<InputImageType>            ReaderType;
+  typedef otb::SarBrightnessFunction<InputImageType>      FunctionType;
+
+  /**Instantiation ofa Smart Pointer*/
+  FunctionType::Pointer filter = FunctionType::New();
+  ReaderType::Pointer   reader = ReaderType::New();
+
+  std::ofstream outfile(outfname);
+
+  /** Input Image*/
+  reader->SetFileName(infname);
+  reader->Update();
+
+  /** Computing the density around a pixel  */
+  filter->SetInputImage(reader->GetOutput());
+  
+  /** Test on some indexes and some physical coordinates*/
+  InputImageType::SizeType size = reader->GetOutput()->GetRequestedRegion().GetSize();
+  FunctionType::PointType  pDst;
+  IndexType                index;
+
+  index[0] = 0;
+  index[1] = 0;
+  outfile << "Sar Brightness value computed for the point : " << index << " is " << filter->EvaluateAtIndex(index) << std::endl;
+
+  index[0] = static_cast<unsigned int>(size[0] / 2.);
+  index[1] = static_cast<unsigned int>(size[1] / 4.);
+  outfile << "Sar Radiometric Calibration computed for the point : " << index << " is " << filter->EvaluateAtIndex(index) << std::endl;
+
+  pDst[0] = static_cast<unsigned int>(size[0] / 4.);
+  pDst[1] = static_cast<unsigned int>(size[1] / 8.);
+  outfile << "Sar Brightness computed for the point : " <<  pDst << " is " << filter->Evaluate(pDst) << std::endl;
+
+  outfile.close();
+
+  return EXIT_SUCCESS;
+}
diff --git a/Testing/Code/Radiometry/otbSarBrightnessFunctor.cxx b/Testing/Code/Radiometry/otbSarBrightnessFunctor.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..00dd7a50054b746663659a0950139032dc0e3f3b
--- /dev/null
+++ b/Testing/Code/Radiometry/otbSarBrightnessFunctor.cxx
@@ -0,0 +1,61 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#include "itkExceptionObject.h"
+
+#include "otbSarBrightnessFunctor.h"
+
+int otbSarBrightnessFunctor(int argc, char * argv[])
+{
+  typedef double                   ScalarType;
+
+  typedef otb::Functor::SarBrightnessFunctor<ScalarType, ScalarType> FunctorType;
+
+  FunctorType funct;
+
+  funct.SetNoise( 10.0);
+  if( abs(funct.GetNoise() -10.0) > 0.0)
+  {
+    return false;
+  }  
+  funct.SetScale( 10.0);
+  if( abs(funct.GetScale() -10.0) > 0.0)
+  {
+    return false;
+  }  
+  funct.SetAntennaPatternNewGain( 10.0);
+  if( abs(funct.GetAntennaPatternNewGain() -10.0) > 0.0)
+  {
+    return false;
+  }  
+  funct.SetAntennaPatternOldGain( 10.0);
+  if( abs(funct.GetAntennaPatternOldGain() -10.0) > 0.0)
+  {
+    return false;
+  }  
+
+  funct.SetRangeSpreadLoss( 10.0);
+  if( abs(funct.GetRangeSpreadLoss() -10.0) > 0.0)
+  {
+    return false;
+  }  
+  std::cout << "First  BetaNaught : " << funct.operator ()( 0.) << std::endl;
+  std::cout << "Second BetaNaught : " << funct.operator ()( 1.) << std::endl;
+
+
+  return EXIT_SUCCESS;
+}
diff --git a/Testing/Code/Radiometry/otbSarBrightnessToImageFilterTest.cxx b/Testing/Code/Radiometry/otbSarBrightnessToImageFilterTest.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..ec0d55423d2652194b65d5f1374310b98074cf11
--- /dev/null
+++ b/Testing/Code/Radiometry/otbSarBrightnessToImageFilterTest.cxx
@@ -0,0 +1,71 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "otbImage.h"
+#include "otbSarBrightnessToImageFilter.h"
+#include "otbImageFileReader.h"
+#include "otbImageFileWriter.h"
+#include "itkExtractImageFilter.h"
+
+int otbSarBrightnessToImageFilterTest(int argc, char * argv[])
+{
+  const unsigned int Dimension = 2;
+  typedef float                                                            RealType;
+  //typedef std::complex<RealType>                                         PixelType;
+  typedef RealType                                                         PixelType;
+  typedef otb::Image<PixelType, Dimension>                                 InputImageType;
+  typedef otb::Image<RealType, Dimension>                                  OutputImageType;
+  typedef otb::ImageFileReader<InputImageType>                             ReaderType;
+  typedef otb::ImageFileWriter<OutputImageType>                            WriterType;
+  typedef otb::SarBrightnessToImageFilter<InputImageType, OutputImageType> FilterType;
+  typedef itk::ExtractImageFilter<OutputImageType, OutputImageType>        ExtractorType;
+
+  // Instantiating object
+  FilterType::Pointer filter = FilterType::New();
+  ReaderType::Pointer reader = ReaderType::New();
+  WriterType::Pointer writer = WriterType::New();
+  ExtractorType::Pointer extractor = ExtractorType::New();
+
+  reader->SetFileName(argv[1]);
+  writer->SetFileName(argv[2]);
+  filter->SetInput(reader->GetOutput());
+
+  if (argc > 3)
+    {
+    // Generate an extract from the large input
+    OutputImageType::RegionType region;
+    OutputImageType::IndexType  id;
+    id[0] = atoi(argv[3]);   id[1] = atoi(argv[4]);
+    OutputImageType::SizeType size;
+    size[0] = atoi(argv[5]);   size[1] = atoi(argv[6]);
+    region.SetIndex(id);
+    region.SetSize(size);
+    extractor->SetExtractionRegion(region);
+
+    extractor->SetInput(filter->GetOutput());
+    writer->SetInput(extractor->GetOutput());
+    }
+  else
+    {
+    // Calibrate the whole image
+    writer->SetInput(filter->GetOutput());
+    }
+  writer->Update();
+
+  return EXIT_SUCCESS;
+}
diff --git a/Testing/Utilities/ijGreyLevelRunLengthMatrixTextureCoefficientsCalculatorTest.cxx b/Testing/Utilities/ijGreyLevelRunLengthMatrixTextureCoefficientsCalculatorTest.cxx
index 8376a6eb34e331a74cf36aad127e6ba4cc7860d1..57cbba8bf4a5ba9878238a7c9827a3dad8c05be5 100644
--- a/Testing/Utilities/ijGreyLevelRunLengthMatrixTextureCoefficientsCalculatorTest.cxx
+++ b/Testing/Utilities/ijGreyLevelRunLengthMatrixTextureCoefficientsCalculatorTest.cxx
@@ -18,8 +18,8 @@
 #pragma warning ( disable : 4786 )
 #endif
 
-#include "itkImage.h"
-#include "itkImageFileReader.h"
+#include "otbImage.h"
+#include "otbImageFileReader.h"
 
 #include "itkScalarImageToGreyLevelRunLengthMatrixGenerator.h"
 #include "itkGreyLevelRunLengthMatrixTextureCoefficientsCalculator.h"
@@ -35,9 +35,9 @@ int ijGreyLevelRunLengthMatrixTextureCoefficientsCalculatorTest( int argc, char*
   const unsigned int ImageDimension = 2;
   typedef float RealType;
 
-  typedef itk::Image<PixelType, ImageDimension> ImageType;
+  typedef otb::Image<PixelType, ImageDimension> ImageType;
   
-  typedef itk::ImageFileReader<ImageType> ReaderType;
+  typedef otb::ImageFileReader<ImageType> ReaderType;
   ReaderType::Pointer imageReader = ReaderType::New();
   imageReader->SetFileName( argv[1] );
   imageReader->Update();
diff --git a/Testing/Utilities/ijObjectLabelAttributeValuesTest.cxx b/Testing/Utilities/ijObjectLabelAttributeValuesTest.cxx
index 92aa4494eb3b24ff487ce3e295f9d1bf526638f3..7af81dbe72f284e0e64dbbd4c32945c000fcddfe 100644
--- a/Testing/Utilities/ijObjectLabelAttributeValuesTest.cxx
+++ b/Testing/Utilities/ijObjectLabelAttributeValuesTest.cxx
@@ -1,4 +1,5 @@
-#include "itkImageFileReader.h"
+#include "otbImage.h"
+#include "otbImageFileReader.h"
 #include "itkShapeLabelObject.h"
 #include "itkLabelMap.h"
 #include "itkLabelImageToStatisticsLabelMapFilter.h"
@@ -14,7 +15,7 @@ int ijObjectLabelAttributeValuesTest(int argc, char * argv[])
 {
   const int dim = 3;
   typedef unsigned char PixelType;
-  typedef itk::Image< PixelType, dim >    ImageType;
+  typedef otb::Image< PixelType, dim >    ImageType;
 
   if( argc != 3)
     {
@@ -23,7 +24,7 @@ int ijObjectLabelAttributeValuesTest(int argc, char * argv[])
     exit(1);
     }
 
-  typedef itk::ImageFileReader< ImageType > ReaderType;
+  typedef otb::ImageFileReader< ImageType > ReaderType;
   ReaderType::Pointer reader1 = ReaderType::New();
   reader1->SetFileName( argv[1] );
 
diff --git a/Testing/Utilities/itkScaleInvariantFeatureImageFilterTest.cxx b/Testing/Utilities/itkScaleInvariantFeatureImageFilterTest.cxx
index 765002e533fce96970b434ab818a854ff709b400..30cd042ef34806db782913ac31cb77ef2956b830 100644
--- a/Testing/Utilities/itkScaleInvariantFeatureImageFilterTest.cxx
+++ b/Testing/Utilities/itkScaleInvariantFeatureImageFilterTest.cxx
@@ -39,7 +39,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "itkImageSeriesReader.h"
 #include "itkNumericSeriesFileNames.h"
 #include "itkPointSetToImageFilter.h"
-#include "itkImageFileWriter.h"
+#include "otbImage.h"
+#include "otbImageFileReader.h"
+#include "otbImageFileWriter.h"
 #include "otbMath.h"
 
 int itk2DScaleInvariantFeatureImageFilterTest( int argc, char *argv[])
@@ -66,9 +68,9 @@ int itk2DScaleInvariantFeatureImageFilterTest( int argc, char *argv[])
   int mode = 's';
 
   typedef float PixelType;
-  typedef itk::Image<PixelType, Dimension> FixedImageType;
+  typedef otb::Image<PixelType, Dimension> FixedImageType;
   typedef itk::ScaleInvariantFeatureImageFilter<FixedImageType, Dimension> SiftFilterType;
-  typedef itk::Image<unsigned char, Dimension> OutputImageType;
+  typedef otb::Image<unsigned char, Dimension> OutputImageType;
 
   typedef itk::ImageSource<FixedImageType> ImageSourceType;
 
@@ -84,7 +86,7 @@ int itk2DScaleInvariantFeatureImageFilterTest( int argc, char *argv[])
   std::cerr << "ImageFile1 = " << inputImage1 << "\n";
   std::cerr << "SIFT Feature\n" << std::endl;
 
-  typedef itk::ImageFileReader< FixedImageType  > FixedImageReaderType;
+  typedef otb::ImageFileReader< FixedImageType  > FixedImageReaderType;
   FixedImageReaderType::Pointer tmpImageReader  = FixedImageReaderType::New();
   tmpImageReader  = FixedImageReaderType::New();
 
@@ -130,7 +132,7 @@ int itk2DScaleInvariantFeatureImageFilterTest( int argc, char *argv[])
   pointSet1->SetSize(fixedImage->GetLargestPossibleRegion().GetSize());
   pointSet1->Update();
 
-  typedef itk::ImageFileWriter<OutputImageType> WriterType;
+  typedef otb::ImageFileWriter<OutputImageType> WriterType;
 
   WriterType::Pointer writer = WriterType::New();
   writer->SetFileName(outputImageKeys1);
diff --git a/Utilities/InsightJournal/itkScaleInvariantFeatureImageFilter.h b/Utilities/InsightJournal/itkScaleInvariantFeatureImageFilter.h
index 2453e9aef53593f60532b2a875764e7d9e32f5b4..1283e46902267d539202c159c51e453608026f4b 100644
--- a/Utilities/InsightJournal/itkScaleInvariantFeatureImageFilter.h
+++ b/Utilities/InsightJournal/itkScaleInvariantFeatureImageFilter.h
@@ -75,10 +75,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "itkLinearInterpolateImageFunction.h"
 #include "itkNearestNeighborInterpolateImageFunction.h"
-#include "itkImage.h"
+#include "otbImage.h"
 
-#include "itkImageFileReader.h"
-#include "itkImageFileWriter.h"
+#include "otbImageFileWriter.h"
 
 #include "itkAffineTransform.h"
 #include "itkIdentityTransform.h"
diff --git a/Utilities/InsightJournal/itkScaleInvariantFeatureImageFilter.txx b/Utilities/InsightJournal/itkScaleInvariantFeatureImageFilter.txx
index 0723f3a202f561a27778e8365c6db68768bdbc1a..166d9fb7a5ec456f0e192051a28c37a3a6cd4324 100644
--- a/Utilities/InsightJournal/itkScaleInvariantFeatureImageFilter.txx
+++ b/Utilities/InsightJournal/itkScaleInvariantFeatureImageFilter.txx
@@ -674,7 +674,7 @@ namespace itk
     if (VDimension != 2) return;
     
     typedef itk::Image< unsigned char, VDimension >  OutImageType;
-    typedef typename itk::ImageFileWriter< OutImageType  >  FixedWriterType;
+    typedef typename otb::ImageFileWriter< OutImageType  >  FixedWriterType;
     typedef  itk::ResampleImageFilter< TFixedImageType,  OutImageType    >    
       OutResampleFilterType;
     
diff --git a/Utilities/otbliblas/CPackSourceConfig.cmake b/Utilities/otbliblas/CPackSourceConfig.cmake
old mode 100755
new mode 100644
index 45ed22c374a131335fb86ad2315987099dcbb253..6e679e324b32f4c83bb52361e4dd061b74375c51
--- a/Utilities/otbliblas/CPackSourceConfig.cmake
+++ b/Utilities/otbliblas/CPackSourceConfig.cmake
@@ -44,39 +44,39 @@ SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
 SET(CPACK_COMPONENT_UNSPECIFIED_HIDDEN "TRUE")
 SET(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "TRUE")
 SET(CPACK_GENERATOR "TGZ;ZIP;TBZ2")
-SET(CPACK_IGNORE_FILES "/test/data/TO_core_last_zoom.las;_CPack_Packages;.gz;.bz2;.zip;.hg;README;HOWTORELEASE.txt;CMakeCache.txt;CPackConfig.cmake;schemas;hobu-config.bat")
-SET(CPACK_INSTALLED_DIRECTORIES "/tmp/liblas-main;/")
+SET(CPACK_IGNORE_FILES "/test/data/TO_core_last_zoom.las;_CPack_Packages;.gz;.bz2;.zip;.hg;README;HOWTORELEASE.txt;doc;CMakeCache.txt;CPackConfig.cmake;schemas;hobu-config.bat;liblas-osgeo4w-init.bat;liblas-osgeo4w-start.bat.tmpl")
+SET(CPACK_INSTALLED_DIRECTORIES "/tmp/liblas;/")
 SET(CPACK_INSTALL_CMAKE_PROJECTS "")
 SET(CPACK_INSTALL_PREFIX "/usr/local")
-SET(CPACK_MODULE_PATH "/tmp/liblas-main/cmake/modules")
-SET(CPACK_NSIS_DISPLAY_NAME "libLAS 1.6.0b1")
+SET(CPACK_MODULE_PATH "/tmp/liblas/cmake/modules")
+SET(CPACK_NSIS_DISPLAY_NAME "libLAS 1.6.0b2")
 SET(CPACK_NSIS_INSTALLER_ICON_CODE "")
 SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
-SET(CPACK_NSIS_PACKAGE_NAME "libLAS 1.6.0b1")
-SET(CPACK_OUTPUT_CONFIG_FILE "/tmp/liblas-main/CPackConfig.cmake")
+SET(CPACK_NSIS_PACKAGE_NAME "libLAS 1.6.0b2")
+SET(CPACK_OUTPUT_CONFIG_FILE "/tmp/liblas/CPackConfig.cmake")
 SET(CPACK_PACKAGE_DEFAULT_LOCATION "/")
 SET(CPACK_PACKAGE_DESCRIPTION_FILE "/Applications/CMake 2.8-0.app/Contents/share/cmake-2.8/Templates/CPack.GenericDescription.txt")
 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libLAS built using CMake")
-SET(CPACK_PACKAGE_FILE_NAME "libLAS-1.6.0b1")
-SET(CPACK_PACKAGE_INSTALL_DIRECTORY "libLAS 1.6.0b1")
-SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "libLAS 1.6.0b1")
+SET(CPACK_PACKAGE_FILE_NAME "libLAS-1.6.0b2")
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "libLAS 1.6.0b2")
+SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "libLAS 1.6.0b2")
 SET(CPACK_PACKAGE_NAME "libLAS")
 SET(CPACK_PACKAGE_RELOCATABLE "true")
 SET(CPACK_PACKAGE_VENDOR "Humanity")
-SET(CPACK_PACKAGE_VERSION "1.6.0b1")
+SET(CPACK_PACKAGE_VERSION "1.6.0b2")
 SET(CPACK_PACKAGE_VERSION_MAJOR "1")
 SET(CPACK_PACKAGE_VERSION_MINOR "6")
-SET(CPACK_PACKAGE_VERSION_PATCH "0b1")
+SET(CPACK_PACKAGE_VERSION_PATCH "0b2")
 SET(CPACK_RESOURCE_FILE_LICENSE "/Applications/CMake 2.8-0.app/Contents/share/cmake-2.8/Templates/CPack.GenericLicense.txt")
 SET(CPACK_RESOURCE_FILE_README "/Applications/CMake 2.8-0.app/Contents/share/cmake-2.8/Templates/CPack.GenericDescription.txt")
 SET(CPACK_RESOURCE_FILE_WELCOME "/Applications/CMake 2.8-0.app/Contents/share/cmake-2.8/Templates/CPack.GenericWelcome.txt")
 SET(CPACK_SET_DESTDIR "OFF")
 SET(CPACK_SOURCE_CYGWIN "")
 SET(CPACK_SOURCE_GENERATOR "TGZ;ZIP;TBZ2")
-SET(CPACK_SOURCE_IGNORE_FILES "/test/data/TO_core_last_zoom.las;_CPack_Packages;.gz;.bz2;.zip;.hg;README;HOWTORELEASE.txt;CMakeCache.txt;CPackConfig.cmake;schemas;hobu-config.bat")
-SET(CPACK_SOURCE_INSTALLED_DIRECTORIES "/tmp/liblas-main;/")
-SET(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/tmp/liblas-main/CPackSourceConfig.cmake")
-SET(CPACK_SOURCE_PACKAGE_FILE_NAME "libLAS-1.6.0b1")
+SET(CPACK_SOURCE_IGNORE_FILES "/test/data/TO_core_last_zoom.las;_CPack_Packages;.gz;.bz2;.zip;.hg;README;HOWTORELEASE.txt;doc;CMakeCache.txt;CPackConfig.cmake;schemas;hobu-config.bat;liblas-osgeo4w-init.bat;liblas-osgeo4w-start.bat.tmpl")
+SET(CPACK_SOURCE_INSTALLED_DIRECTORIES "/tmp/liblas;/")
+SET(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/tmp/liblas/CPackSourceConfig.cmake")
+SET(CPACK_SOURCE_PACKAGE_FILE_NAME "libLAS-1.6.0b2")
 SET(CPACK_SOURCE_TBZ2 "")
 SET(CPACK_SOURCE_TGZ "")
 SET(CPACK_SOURCE_TOPLEVEL_TAG "Darwin-Source")
diff --git a/Utilities/otbliblas/CTestConfig.cmake b/Utilities/otbliblas/CTestConfig.cmake
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/CTestTestfile.cmake b/Utilities/otbliblas/CTestTestfile.cmake
old mode 100755
new mode 100644
index a2d20cbc823c61aeeeeac08d54eb66e2d925bbd3..8708911fe2b5305cc4b811688e9a8a1cb057507e
--- a/Utilities/otbliblas/CTestTestfile.cmake
+++ b/Utilities/otbliblas/CTestTestfile.cmake
@@ -1,6 +1,6 @@
 # CMake generated Testfile for 
-# Source directory: /tmp/liblas-main
-# Build directory: /tmp/liblas-main
+# Source directory: /tmp/liblas
+# Build directory: /tmp/liblas
 # 
 # This file includes the relevent testing commands required for 
 # testing this directory and lists subdirectories to be tested as well.
diff --git a/Utilities/otbliblas/Makefile b/Utilities/otbliblas/Makefile
index d58e358d37336e5dac76dac7a45ad45c1f2450e8..13ffa205606b739d898f100e1682f3dda2c26dc5 100755
--- a/Utilities/otbliblas/Makefile
+++ b/Utilities/otbliblas/Makefile
@@ -39,10 +39,10 @@ RM = "/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E remove -f
 CMAKE_EDIT_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/ccmake"
 
 # The top-level source directory on which CMake was run.
-CMAKE_SOURCE_DIR = /tmp/liblas-main
+CMAKE_SOURCE_DIR = /tmp/liblas
 
 # The top-level build directory on which CMake was run.
-CMAKE_BINARY_DIR = /tmp/liblas-main
+CMAKE_BINARY_DIR = /tmp/liblas
 
 #=============================================================================
 # Targets provided globally by CMake.
@@ -111,7 +111,7 @@ package/fast: package
 # Special rule for the target package_source
 package_source:
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..."
-	"/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackSourceConfig.cmake /tmp/liblas-main/CPackSourceConfig.cmake
+	"/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackSourceConfig.cmake /tmp/liblas/CPackSourceConfig.cmake
 .PHONY : package_source
 
 # Special rule for the target package_source
@@ -140,9 +140,9 @@ test/fast: test
 
 # The main all target
 all: cmake_check_build_system
-	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas-main/CMakeFiles /tmp/liblas-main/CMakeFiles/progress.marks
+	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas/CMakeFiles /tmp/liblas/CMakeFiles/progress.marks
 	$(MAKE) -f CMakeFiles/Makefile2 all
-	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas-main/CMakeFiles 0
+	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas/CMakeFiles 0
 .PHONY : all
 
 # The main clean target
@@ -325,6 +325,19 @@ lasmerge/fast:
 	$(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/build
 .PHONY : lasmerge/fast
 
+#=============================================================================
+# Target rules for targets named ts2las
+
+# Build rule for target.
+ts2las: cmake_check_build_system
+	$(MAKE) -f CMakeFiles/Makefile2 ts2las
+.PHONY : ts2las
+
+# fast build rule for target.
+ts2las/fast:
+	$(MAKE) -f apps/CMakeFiles/ts2las.dir/build.make apps/CMakeFiles/ts2las.dir/build
+.PHONY : ts2las/fast
+
 #=============================================================================
 # Target rules for targets named txt2las
 
@@ -378,6 +391,7 @@ help:
 	@echo "... lasinfo"
 	@echo "... lasinfo-old"
 	@echo "... lasmerge"
+	@echo "... ts2las"
 	@echo "... txt2las"
 	@echo "... liblas_test"
 .PHONY : help
diff --git a/Utilities/otbliblas/apps/CMakeLists.txt b/Utilities/otbliblas/apps/CMakeLists.txt
old mode 100755
new mode 100644
index 88a28074b89641c340ced52bce1185b0d6c53d2b..3a5bf774746b2aab5f58fbc16bc358686a427574
--- a/Utilities/otbliblas/apps/CMakeLists.txt
+++ b/Utilities/otbliblas/apps/CMakeLists.txt
@@ -21,15 +21,20 @@ set(LAS2LAS las2las)
 set(LAS2LAS_OLD las2las-old)
 set(LAS2TXT las2txt)
 set(TXT2LAS txt2las)
+set(TS2LAS ts2las)
 set(LASBLOCK lasblock )
 
 set(BIGFILE_TEST bigfile_test)
 set(LASINDEX_TEST lasindex_test)
 
+if(Boost_IOSTREAMS_FOUND)
+  set(BIGFILE_BIO_TEST bigfile_boost_iostreams_test)
+endif()
+
 # Set the build type to release if it is not explicitly set by the user and 
 # isn't in the cache yet
 if (NOT CMAKE_BUILD_TYPE )
-set(CMAKE_BUILD_TYPE "Release")
+  set(CMAKE_BUILD_TYPE "Release")
 endif()
 
 # Utilities depending on 3rd-pary libraries
@@ -43,7 +48,7 @@ endif()
 
 set(LIBLAS_UTILITIES
     ${LASINFO_OLD} ${LASINFO} ${LASMERGE} ${LAS2LAS} ${LAS2TXT} ${TXT2LAS} 
-    ${LAS2OGR}  ${LAS2OCI} ${LAS2LAS} ${LAS2LAS_OLD} ${LASBLOCK} )
+    ${LAS2OGR}  ${LAS2OCI} ${LAS2LAS} ${LAS2LAS_OLD} ${LASBLOCK} ${TS2LAS})
 
 # TODO: Experimental and requires testing --mloskot
 # Generate user-specific settings for Visual Studio project
@@ -62,12 +67,18 @@ endif()
 ###############################################################################
 # Configure build targets
 
+if(WIN32)
+    add_definitions("-DLAS_DLL_EXPORT=1")
+endif()
+
+
 set(APPS_CPP_DEPENDENCIES
     ${LIBLAS_LIB_NAME}
     ${TIFF_LIBRARY}
     ${GEOTIFF_LIBRARY}
     ${GDAL_LIBRARY}
-    ${SPATIALINDEX_LIBRARY})
+    ${SPATIALINDEX_LIBRARY}
+    ${Boost_LIBRARIES})
 
 link_directories(${Boost_LIBRARY_DIRS})
 
@@ -87,12 +98,12 @@ endif()
 
 if(LAS2LAS)
     add_executable(${LAS2LAS} las2las.cpp laskernel.cpp)
-    target_link_libraries(${LAS2LAS} ${APPS_CPP_DEPENDENCIES} ${Boost_LIBRARIES})
+    target_link_libraries(${LAS2LAS} ${APPS_CPP_DEPENDENCIES} )
 endif()
 
 if(LASINFO)
     add_executable(${LASINFO} lasinfo.cpp laskernel.cpp)
-    target_link_libraries(${LASINFO} ${APPS_CPP_DEPENDENCIES} ${Boost_LIBRARIES})
+    target_link_libraries(${LASINFO} ${APPS_CPP_DEPENDENCIES} )
 endif()
 
 # Build las2txt
@@ -109,6 +120,11 @@ if(TXT2LAS)
     target_link_libraries(${TXT2LAS} ${LIBLAS_C_LIB_NAME})
 endif()
 
+if(TS2LAS)
+    add_executable(${TS2LAS} ts2las.cpp )
+    target_link_libraries(${TS2LAS} ${APPS_CPP_DEPENDENCIES} )
+endif()
+
 # Build lasmerge
 if(LASMERGE)
     set(LASMERGE_SRC lascommon.c ${LASMERGE}.c)
@@ -120,7 +136,7 @@ endif()
 if(LASBLOCK)
     set(LASBLOCK_SRC lasblock.cpp chipper.cpp chipper.hpp)
     add_executable(${LASBLOCK} ${LASBLOCK_SRC})
-    target_link_libraries(${LASBLOCK} ${APPS_CPP_DEPENDENCIES} ${Boost_LIBRARIES})
+    target_link_libraries(${LASBLOCK} ${APPS_CPP_DEPENDENCIES} )
 endif()
 
 # Build las2ogr
@@ -132,17 +148,22 @@ endif()
 # Build las2oci
 if(LAS2OCI)
     add_executable(${LAS2OCI} las2oci.cpp oci_wrapper.cpp kdx_util.cpp oci_util.cpp laskernel.cpp chipper.cpp)
-    target_link_libraries(${LAS2OCI} ${APPS_CPP_DEPENDENCIES} ${Boost_LIBRARIES} ${ORACLE_LIBRARY})
+    target_link_libraries(${LAS2OCI} ${APPS_CPP_DEPENDENCIES} ${ORACLE_LIBRARY})
 endif()
 
 if(BIGFILE_TEST)
-    add_executable(${BIGFILE_TEST} bigtest.cpp)
+    add_executable(${BIGFILE_TEST} bigtest.c)
     target_link_libraries(${BIGFILE_TEST} ${LIBLAS_C_LIB_NAME})
 endif()
 
 if (LASINDEX_TEST)
     add_executable(${LASINDEX_TEST} lasindex_test.cpp)
-    target_link_libraries(${LASINDEX_TEST} ${APPS_CPP_DEPENDENCIES} ${Boost_LIBRARIES})    
+    target_link_libraries(${LASINDEX_TEST} ${APPS_CPP_DEPENDENCIES})    
+endif()
+
+if(BIGFILE_BIO_TEST)
+    add_executable(${BIGFILE_BIO_TEST} bigfile_boost_iostreams_test.cpp)
+    target_link_libraries(${BIGFILE_BIO_TEST} ${APPS_CPP_DEPENDENCIES} )    
 endif()
 
 ###############################################################################
diff --git a/Utilities/otbliblas/apps/Makefile b/Utilities/otbliblas/apps/Makefile
index f5ea0053ccf3bc5fc968437f8a2cc8d15b77c3f3..a8cfa8c0714f98dff501d93423a3512f31be790c 100755
--- a/Utilities/otbliblas/apps/Makefile
+++ b/Utilities/otbliblas/apps/Makefile
@@ -39,10 +39,10 @@ RM = "/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E remove -f
 CMAKE_EDIT_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/ccmake"
 
 # The top-level source directory on which CMake was run.
-CMAKE_SOURCE_DIR = /tmp/liblas-main
+CMAKE_SOURCE_DIR = /tmp/liblas
 
 # The top-level build directory on which CMake was run.
-CMAKE_BINARY_DIR = /tmp/liblas-main
+CMAKE_BINARY_DIR = /tmp/liblas
 
 #=============================================================================
 # Targets provided globally by CMake.
@@ -101,7 +101,7 @@ list_install_components/fast: list_install_components
 # Special rule for the target package
 package: preinstall
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..."
-	cd /tmp/liblas-main && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackConfig.cmake
+	cd /tmp/liblas && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackConfig.cmake
 .PHONY : package
 
 # Special rule for the target package
@@ -111,7 +111,7 @@ package/fast: package
 # Special rule for the target package_source
 package_source:
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..."
-	cd /tmp/liblas-main && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackSourceConfig.cmake /tmp/liblas-main/CPackSourceConfig.cmake
+	cd /tmp/liblas && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackSourceConfig.cmake /tmp/liblas/CPackSourceConfig.cmake
 .PHONY : package_source
 
 # Special rule for the target package_source
@@ -140,14 +140,14 @@ test/fast: test
 
 # The main all target
 all: cmake_check_build_system
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas-main/CMakeFiles /tmp/liblas-main/apps/CMakeFiles/progress.marks
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/all
-	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas-main/CMakeFiles 0
+	cd /tmp/liblas && $(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas/CMakeFiles /tmp/liblas/apps/CMakeFiles/progress.marks
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/all
+	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas/CMakeFiles 0
 .PHONY : all
 
 # The main clean target
 clean:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/clean
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/clean
 .PHONY : clean
 
 # The main clean target
@@ -156,22 +156,22 @@ clean/fast: clean
 
 # Prepare targets for installation.
 preinstall: all
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/preinstall
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/preinstall
 .PHONY : preinstall
 
 # Prepare targets for installation.
 preinstall/fast:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/preinstall
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/preinstall
 .PHONY : preinstall/fast
 
 # clear depends
 depend:
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+	cd /tmp/liblas && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
 .PHONY : depend
 
 # Convenience name for target.
 apps/CMakeFiles/bigfile_test.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/bigfile_test.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/bigfile_test.dir/rule
 .PHONY : apps/CMakeFiles/bigfile_test.dir/rule
 
 # Convenience name for target.
@@ -180,12 +180,12 @@ bigfile_test: apps/CMakeFiles/bigfile_test.dir/rule
 
 # fast build rule for target.
 bigfile_test/fast:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/bigfile_test.dir/build.make apps/CMakeFiles/bigfile_test.dir/build
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/bigfile_test.dir/build.make apps/CMakeFiles/bigfile_test.dir/build
 .PHONY : bigfile_test/fast
 
 # Convenience name for target.
 apps/CMakeFiles/las2las.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/las2las.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/las2las.dir/rule
 .PHONY : apps/CMakeFiles/las2las.dir/rule
 
 # Convenience name for target.
@@ -194,12 +194,12 @@ las2las: apps/CMakeFiles/las2las.dir/rule
 
 # fast build rule for target.
 las2las/fast:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/build
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/build
 .PHONY : las2las/fast
 
 # Convenience name for target.
 apps/CMakeFiles/las2las-old.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/las2las-old.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/las2las-old.dir/rule
 .PHONY : apps/CMakeFiles/las2las-old.dir/rule
 
 # Convenience name for target.
@@ -208,12 +208,12 @@ las2las-old: apps/CMakeFiles/las2las-old.dir/rule
 
 # fast build rule for target.
 las2las-old/fast:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/build
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/build
 .PHONY : las2las-old/fast
 
 # Convenience name for target.
 apps/CMakeFiles/las2txt.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/las2txt.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/las2txt.dir/rule
 .PHONY : apps/CMakeFiles/las2txt.dir/rule
 
 # Convenience name for target.
@@ -222,12 +222,12 @@ las2txt: apps/CMakeFiles/las2txt.dir/rule
 
 # fast build rule for target.
 las2txt/fast:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/build
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/build
 .PHONY : las2txt/fast
 
 # Convenience name for target.
 apps/CMakeFiles/lasblock.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/lasblock.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/lasblock.dir/rule
 .PHONY : apps/CMakeFiles/lasblock.dir/rule
 
 # Convenience name for target.
@@ -236,12 +236,12 @@ lasblock: apps/CMakeFiles/lasblock.dir/rule
 
 # fast build rule for target.
 lasblock/fast:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/build
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/build
 .PHONY : lasblock/fast
 
 # Convenience name for target.
 apps/CMakeFiles/lasindex_test.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/lasindex_test.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/lasindex_test.dir/rule
 .PHONY : apps/CMakeFiles/lasindex_test.dir/rule
 
 # Convenience name for target.
@@ -250,12 +250,12 @@ lasindex_test: apps/CMakeFiles/lasindex_test.dir/rule
 
 # fast build rule for target.
 lasindex_test/fast:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasindex_test.dir/build.make apps/CMakeFiles/lasindex_test.dir/build
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasindex_test.dir/build.make apps/CMakeFiles/lasindex_test.dir/build
 .PHONY : lasindex_test/fast
 
 # Convenience name for target.
 apps/CMakeFiles/lasinfo.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/lasinfo.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/lasinfo.dir/rule
 .PHONY : apps/CMakeFiles/lasinfo.dir/rule
 
 # Convenience name for target.
@@ -264,12 +264,12 @@ lasinfo: apps/CMakeFiles/lasinfo.dir/rule
 
 # fast build rule for target.
 lasinfo/fast:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/build
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/build
 .PHONY : lasinfo/fast
 
 # Convenience name for target.
 apps/CMakeFiles/lasinfo-old.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/lasinfo-old.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/lasinfo-old.dir/rule
 .PHONY : apps/CMakeFiles/lasinfo-old.dir/rule
 
 # Convenience name for target.
@@ -278,12 +278,12 @@ lasinfo-old: apps/CMakeFiles/lasinfo-old.dir/rule
 
 # fast build rule for target.
 lasinfo-old/fast:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/build
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/build
 .PHONY : lasinfo-old/fast
 
 # Convenience name for target.
 apps/CMakeFiles/lasmerge.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/lasmerge.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/lasmerge.dir/rule
 .PHONY : apps/CMakeFiles/lasmerge.dir/rule
 
 # Convenience name for target.
@@ -292,12 +292,26 @@ lasmerge: apps/CMakeFiles/lasmerge.dir/rule
 
 # fast build rule for target.
 lasmerge/fast:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/build
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/build
 .PHONY : lasmerge/fast
 
+# Convenience name for target.
+apps/CMakeFiles/ts2las.dir/rule:
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/ts2las.dir/rule
+.PHONY : apps/CMakeFiles/ts2las.dir/rule
+
+# Convenience name for target.
+ts2las: apps/CMakeFiles/ts2las.dir/rule
+.PHONY : ts2las
+
+# fast build rule for target.
+ts2las/fast:
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/ts2las.dir/build.make apps/CMakeFiles/ts2las.dir/build
+.PHONY : ts2las/fast
+
 # Convenience name for target.
 apps/CMakeFiles/txt2las.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/txt2las.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 apps/CMakeFiles/txt2las.dir/rule
 .PHONY : apps/CMakeFiles/txt2las.dir/rule
 
 # Convenience name for target.
@@ -306,39 +320,39 @@ txt2las: apps/CMakeFiles/txt2las.dir/rule
 
 # fast build rule for target.
 txt2las/fast:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/build
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/build
 .PHONY : txt2las/fast
 
-bigtest.o: bigtest.cpp.o
+bigtest.o: bigtest.c.o
 .PHONY : bigtest.o
 
 # target to build an object file
-bigtest.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/bigfile_test.dir/build.make apps/CMakeFiles/bigfile_test.dir/bigtest.cpp.o
-.PHONY : bigtest.cpp.o
+bigtest.c.o:
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/bigfile_test.dir/build.make apps/CMakeFiles/bigfile_test.dir/bigtest.c.o
+.PHONY : bigtest.c.o
 
-bigtest.i: bigtest.cpp.i
+bigtest.i: bigtest.c.i
 .PHONY : bigtest.i
 
 # target to preprocess a source file
-bigtest.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/bigfile_test.dir/build.make apps/CMakeFiles/bigfile_test.dir/bigtest.cpp.i
-.PHONY : bigtest.cpp.i
+bigtest.c.i:
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/bigfile_test.dir/build.make apps/CMakeFiles/bigfile_test.dir/bigtest.c.i
+.PHONY : bigtest.c.i
 
-bigtest.s: bigtest.cpp.s
+bigtest.s: bigtest.c.s
 .PHONY : bigtest.s
 
 # target to generate assembly for a file
-bigtest.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/bigfile_test.dir/build.make apps/CMakeFiles/bigfile_test.dir/bigtest.cpp.s
-.PHONY : bigtest.cpp.s
+bigtest.c.s:
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/bigfile_test.dir/build.make apps/CMakeFiles/bigfile_test.dir/bigtest.c.s
+.PHONY : bigtest.c.s
 
 chipper.o: chipper.cpp.o
 .PHONY : chipper.o
 
 # target to build an object file
 chipper.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/chipper.cpp.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/chipper.cpp.o
 .PHONY : chipper.cpp.o
 
 chipper.i: chipper.cpp.i
@@ -346,7 +360,7 @@ chipper.i: chipper.cpp.i
 
 # target to preprocess a source file
 chipper.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/chipper.cpp.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/chipper.cpp.i
 .PHONY : chipper.cpp.i
 
 chipper.s: chipper.cpp.s
@@ -354,7 +368,7 @@ chipper.s: chipper.cpp.s
 
 # target to generate assembly for a file
 chipper.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/chipper.cpp.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/chipper.cpp.s
 .PHONY : chipper.cpp.s
 
 las2las-old.o: las2las-old.c.o
@@ -362,7 +376,7 @@ las2las-old.o: las2las-old.c.o
 
 # target to build an object file
 las2las-old.c.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/las2las-old.c.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/las2las-old.c.o
 .PHONY : las2las-old.c.o
 
 las2las-old.i: las2las-old.c.i
@@ -370,7 +384,7 @@ las2las-old.i: las2las-old.c.i
 
 # target to preprocess a source file
 las2las-old.c.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/las2las-old.c.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/las2las-old.c.i
 .PHONY : las2las-old.c.i
 
 las2las-old.s: las2las-old.c.s
@@ -378,7 +392,7 @@ las2las-old.s: las2las-old.c.s
 
 # target to generate assembly for a file
 las2las-old.c.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/las2las-old.c.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/las2las-old.c.s
 .PHONY : las2las-old.c.s
 
 las2las.o: las2las.cpp.o
@@ -386,7 +400,7 @@ las2las.o: las2las.cpp.o
 
 # target to build an object file
 las2las.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/las2las.cpp.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/las2las.cpp.o
 .PHONY : las2las.cpp.o
 
 las2las.i: las2las.cpp.i
@@ -394,7 +408,7 @@ las2las.i: las2las.cpp.i
 
 # target to preprocess a source file
 las2las.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/las2las.cpp.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/las2las.cpp.i
 .PHONY : las2las.cpp.i
 
 las2las.s: las2las.cpp.s
@@ -402,7 +416,7 @@ las2las.s: las2las.cpp.s
 
 # target to generate assembly for a file
 las2las.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/las2las.cpp.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/las2las.cpp.s
 .PHONY : las2las.cpp.s
 
 las2txt.o: las2txt.c.o
@@ -410,7 +424,7 @@ las2txt.o: las2txt.c.o
 
 # target to build an object file
 las2txt.c.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/las2txt.c.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/las2txt.c.o
 .PHONY : las2txt.c.o
 
 las2txt.i: las2txt.c.i
@@ -418,7 +432,7 @@ las2txt.i: las2txt.c.i
 
 # target to preprocess a source file
 las2txt.c.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/las2txt.c.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/las2txt.c.i
 .PHONY : las2txt.c.i
 
 las2txt.s: las2txt.c.s
@@ -426,7 +440,7 @@ las2txt.s: las2txt.c.s
 
 # target to generate assembly for a file
 las2txt.c.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/las2txt.c.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/las2txt.c.s
 .PHONY : las2txt.c.s
 
 lasblock.o: lasblock.cpp.o
@@ -434,7 +448,7 @@ lasblock.o: lasblock.cpp.o
 
 # target to build an object file
 lasblock.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/lasblock.cpp.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/lasblock.cpp.o
 .PHONY : lasblock.cpp.o
 
 lasblock.i: lasblock.cpp.i
@@ -442,7 +456,7 @@ lasblock.i: lasblock.cpp.i
 
 # target to preprocess a source file
 lasblock.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/lasblock.cpp.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/lasblock.cpp.i
 .PHONY : lasblock.cpp.i
 
 lasblock.s: lasblock.cpp.s
@@ -450,7 +464,7 @@ lasblock.s: lasblock.cpp.s
 
 # target to generate assembly for a file
 lasblock.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/lasblock.cpp.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasblock.dir/build.make apps/CMakeFiles/lasblock.dir/lasblock.cpp.s
 .PHONY : lasblock.cpp.s
 
 lascommon.o: lascommon.c.o
@@ -458,11 +472,11 @@ lascommon.o: lascommon.c.o
 
 # target to build an object file
 lascommon.c.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/lascommon.c.o
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/lascommon.c.o
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lascommon.c.o
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lascommon.c.o
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/lascommon.c.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/lascommon.c.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/lascommon.c.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lascommon.c.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lascommon.c.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/lascommon.c.o
 .PHONY : lascommon.c.o
 
 lascommon.i: lascommon.c.i
@@ -470,11 +484,11 @@ lascommon.i: lascommon.c.i
 
 # target to preprocess a source file
 lascommon.c.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/lascommon.c.i
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/lascommon.c.i
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lascommon.c.i
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lascommon.c.i
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/lascommon.c.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/lascommon.c.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/lascommon.c.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lascommon.c.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lascommon.c.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/lascommon.c.i
 .PHONY : lascommon.c.i
 
 lascommon.s: lascommon.c.s
@@ -482,11 +496,11 @@ lascommon.s: lascommon.c.s
 
 # target to generate assembly for a file
 lascommon.c.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/lascommon.c.s
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/lascommon.c.s
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lascommon.c.s
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lascommon.c.s
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/lascommon.c.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las-old.dir/build.make apps/CMakeFiles/las2las-old.dir/lascommon.c.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2txt.dir/build.make apps/CMakeFiles/las2txt.dir/lascommon.c.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lascommon.c.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lascommon.c.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/lascommon.c.s
 .PHONY : lascommon.c.s
 
 lasindex_test.o: lasindex_test.cpp.o
@@ -494,7 +508,7 @@ lasindex_test.o: lasindex_test.cpp.o
 
 # target to build an object file
 lasindex_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasindex_test.dir/build.make apps/CMakeFiles/lasindex_test.dir/lasindex_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasindex_test.dir/build.make apps/CMakeFiles/lasindex_test.dir/lasindex_test.cpp.o
 .PHONY : lasindex_test.cpp.o
 
 lasindex_test.i: lasindex_test.cpp.i
@@ -502,7 +516,7 @@ lasindex_test.i: lasindex_test.cpp.i
 
 # target to preprocess a source file
 lasindex_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasindex_test.dir/build.make apps/CMakeFiles/lasindex_test.dir/lasindex_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasindex_test.dir/build.make apps/CMakeFiles/lasindex_test.dir/lasindex_test.cpp.i
 .PHONY : lasindex_test.cpp.i
 
 lasindex_test.s: lasindex_test.cpp.s
@@ -510,7 +524,7 @@ lasindex_test.s: lasindex_test.cpp.s
 
 # target to generate assembly for a file
 lasindex_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasindex_test.dir/build.make apps/CMakeFiles/lasindex_test.dir/lasindex_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasindex_test.dir/build.make apps/CMakeFiles/lasindex_test.dir/lasindex_test.cpp.s
 .PHONY : lasindex_test.cpp.s
 
 lasinfo-old.o: lasinfo-old.c.o
@@ -518,7 +532,7 @@ lasinfo-old.o: lasinfo-old.c.o
 
 # target to build an object file
 lasinfo-old.c.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lasinfo-old.c.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lasinfo-old.c.o
 .PHONY : lasinfo-old.c.o
 
 lasinfo-old.i: lasinfo-old.c.i
@@ -526,7 +540,7 @@ lasinfo-old.i: lasinfo-old.c.i
 
 # target to preprocess a source file
 lasinfo-old.c.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lasinfo-old.c.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lasinfo-old.c.i
 .PHONY : lasinfo-old.c.i
 
 lasinfo-old.s: lasinfo-old.c.s
@@ -534,7 +548,7 @@ lasinfo-old.s: lasinfo-old.c.s
 
 # target to generate assembly for a file
 lasinfo-old.c.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lasinfo-old.c.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo-old.dir/build.make apps/CMakeFiles/lasinfo-old.dir/lasinfo-old.c.s
 .PHONY : lasinfo-old.c.s
 
 lasinfo.o: lasinfo.cpp.o
@@ -542,7 +556,7 @@ lasinfo.o: lasinfo.cpp.o
 
 # target to build an object file
 lasinfo.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/lasinfo.cpp.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/lasinfo.cpp.o
 .PHONY : lasinfo.cpp.o
 
 lasinfo.i: lasinfo.cpp.i
@@ -550,7 +564,7 @@ lasinfo.i: lasinfo.cpp.i
 
 # target to preprocess a source file
 lasinfo.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/lasinfo.cpp.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/lasinfo.cpp.i
 .PHONY : lasinfo.cpp.i
 
 lasinfo.s: lasinfo.cpp.s
@@ -558,7 +572,7 @@ lasinfo.s: lasinfo.cpp.s
 
 # target to generate assembly for a file
 lasinfo.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/lasinfo.cpp.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/lasinfo.cpp.s
 .PHONY : lasinfo.cpp.s
 
 laskernel.o: laskernel.cpp.o
@@ -566,8 +580,8 @@ laskernel.o: laskernel.cpp.o
 
 # target to build an object file
 laskernel.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/laskernel.cpp.o
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/laskernel.cpp.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/laskernel.cpp.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/laskernel.cpp.o
 .PHONY : laskernel.cpp.o
 
 laskernel.i: laskernel.cpp.i
@@ -575,8 +589,8 @@ laskernel.i: laskernel.cpp.i
 
 # target to preprocess a source file
 laskernel.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/laskernel.cpp.i
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/laskernel.cpp.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/laskernel.cpp.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/laskernel.cpp.i
 .PHONY : laskernel.cpp.i
 
 laskernel.s: laskernel.cpp.s
@@ -584,8 +598,8 @@ laskernel.s: laskernel.cpp.s
 
 # target to generate assembly for a file
 laskernel.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/laskernel.cpp.s
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/laskernel.cpp.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/las2las.dir/build.make apps/CMakeFiles/las2las.dir/laskernel.cpp.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasinfo.dir/build.make apps/CMakeFiles/lasinfo.dir/laskernel.cpp.s
 .PHONY : laskernel.cpp.s
 
 lasmerge.o: lasmerge.c.o
@@ -593,7 +607,7 @@ lasmerge.o: lasmerge.c.o
 
 # target to build an object file
 lasmerge.c.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lasmerge.c.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lasmerge.c.o
 .PHONY : lasmerge.c.o
 
 lasmerge.i: lasmerge.c.i
@@ -601,7 +615,7 @@ lasmerge.i: lasmerge.c.i
 
 # target to preprocess a source file
 lasmerge.c.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lasmerge.c.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lasmerge.c.i
 .PHONY : lasmerge.c.i
 
 lasmerge.s: lasmerge.c.s
@@ -609,15 +623,39 @@ lasmerge.s: lasmerge.c.s
 
 # target to generate assembly for a file
 lasmerge.c.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lasmerge.c.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/lasmerge.dir/build.make apps/CMakeFiles/lasmerge.dir/lasmerge.c.s
 .PHONY : lasmerge.c.s
 
+ts2las.o: ts2las.cpp.o
+.PHONY : ts2las.o
+
+# target to build an object file
+ts2las.cpp.o:
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/ts2las.dir/build.make apps/CMakeFiles/ts2las.dir/ts2las.cpp.o
+.PHONY : ts2las.cpp.o
+
+ts2las.i: ts2las.cpp.i
+.PHONY : ts2las.i
+
+# target to preprocess a source file
+ts2las.cpp.i:
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/ts2las.dir/build.make apps/CMakeFiles/ts2las.dir/ts2las.cpp.i
+.PHONY : ts2las.cpp.i
+
+ts2las.s: ts2las.cpp.s
+.PHONY : ts2las.s
+
+# target to generate assembly for a file
+ts2las.cpp.s:
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/ts2las.dir/build.make apps/CMakeFiles/ts2las.dir/ts2las.cpp.s
+.PHONY : ts2las.cpp.s
+
 txt2las.o: txt2las.c.o
 .PHONY : txt2las.o
 
 # target to build an object file
 txt2las.c.o:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/txt2las.c.o
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/txt2las.c.o
 .PHONY : txt2las.c.o
 
 txt2las.i: txt2las.c.i
@@ -625,7 +663,7 @@ txt2las.i: txt2las.c.i
 
 # target to preprocess a source file
 txt2las.c.i:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/txt2las.c.i
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/txt2las.c.i
 .PHONY : txt2las.c.i
 
 txt2las.s: txt2las.c.s
@@ -633,7 +671,7 @@ txt2las.s: txt2las.c.s
 
 # target to generate assembly for a file
 txt2las.c.s:
-	cd /tmp/liblas-main && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/txt2las.c.s
+	cd /tmp/liblas && $(MAKE) -f apps/CMakeFiles/txt2las.dir/build.make apps/CMakeFiles/txt2las.dir/txt2las.c.s
 .PHONY : txt2las.c.s
 
 # Help Target
@@ -660,6 +698,7 @@ help:
 	@echo "... package_source"
 	@echo "... rebuild_cache"
 	@echo "... test"
+	@echo "... ts2las"
 	@echo "... txt2las"
 	@echo "... bigtest.o"
 	@echo "... bigtest.i"
@@ -697,6 +736,9 @@ help:
 	@echo "... lasmerge.o"
 	@echo "... lasmerge.i"
 	@echo "... lasmerge.s"
+	@echo "... ts2las.o"
+	@echo "... ts2las.i"
+	@echo "... ts2las.s"
 	@echo "... txt2las.o"
 	@echo "... txt2las.i"
 	@echo "... txt2las.s"
@@ -711,6 +753,6 @@ help:
 # No rule that depends on this can have commands that come from listfiles
 # because they might be regenerated.
 cmake_check_build_system:
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+	cd /tmp/liblas && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
 .PHONY : cmake_check_build_system
 
diff --git a/Utilities/otbliblas/apps/bigfile_boost_iostreams_test.cpp b/Utilities/otbliblas/apps/bigfile_boost_iostreams_test.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e17b6e1cf214f9eb7ec59b533c02cb0db17dc412
--- /dev/null
+++ b/Utilities/otbliblas/apps/bigfile_boost_iostreams_test.cpp
@@ -0,0 +1,141 @@
+/******************************************************************************
+ *
+ * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose:  Test reading and writing of large LAS files (>4GB)
+ *           using portable Boost.IOStreams library.
+ * Author:   Mateusz Loskot, mateusz@loskot.net
+ *
+ ******************************************************************************
+ * Copyright (c) 2010, Mateusz Loskot
+ *
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following 
+ * conditions are met:
+ * 
+ *     * Redistributions of source code must retain the above copyright 
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright 
+ *       notice, this list of conditions and the following disclaimer in 
+ *       the documentation and/or other materials provided 
+ *       with the distribution.
+ *     * Neither the name of the Martin Isenburg or Iowa Department 
+ *       of Natural Resources nor the names of its contributors may be 
+ *       used to endorse or promote products derived from this software 
+ *       without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE.
+ ****************************************************************************/
+#include <liblas/laspoint.hpp>
+#include <liblas/lasreader.hpp>
+#include <liblas/laswriter.hpp>
+#ifdef _MSC_VER
+#  pragma warning(push)
+#  pragma warning(disable: 4702)
+#endif
+#include <boost/iostreams/device/file_descriptor.hpp>
+#include <boost/iostreams/positioning.hpp>
+#include <boost/iostreams/stream.hpp>
+#ifdef _MSC_VER
+#  pragma warning(pop)
+#endif()
+#include <cassert>
+#include <exception>
+#include <iostream>
+#include <sstream>
+#include <stdexcept>
+
+namespace bio = boost::iostreams;
+namespace las = liblas;
+
+int main()
+{
+    try
+    {
+        // name of generated file
+        std::string filename("bigfile_bio_test.las");
+        // test writing mor than 204 million points
+        bio::stream_offset const n_million_points = 210;
+        bio::stream_offset const point_count = 1024 * 1024 * n_million_points;
+
+        std::cout.setf(std::ios::fixed, std::ios::floatfield);
+        std::cout.setf(std::ios::showpoint);
+        std::cout.precision(2);
+
+        std::cout << "LAS file: " << filename << std::endl;
+        std::cout << "Writing " << point_count << " points" << std::endl;
+        {
+            typedef bio::stream<bio::file_descriptor_sink> bio_ostream;
+            bio_ostream bigofs(filename);
+            las::Header header;
+            las::Writer writer(bigofs, header);
+
+            las::Point empty_point;
+            bio::stream_offset i = 0;
+            for (i = 0; i < point_count; ++i)
+            {
+                if (!writer.WritePoint(empty_point))
+                {
+                    std::ostringstream oss;
+                    oss << "failed to write point #" << i;
+                    throw std::runtime_error(oss.str());
+                }
+
+                if (i % 1000 == 0)
+                {
+                    std::cout << "\b\b\b\b\b\b\b\b" << double(i)/point_count * 100.0;
+                }
+            }
+            assert(i == point_count);
+        }
+
+        std::cout << std::endl << "Reading " << point_count << " points" << std::endl;
+        {
+            typedef bio::stream<bio::file_descriptor_source> bio_istream;
+            bio_istream bigifs(filename); 
+            las::Reader reader(bigifs);
+    
+            bio::stream_offset i = 0;
+            while (reader.ReadNextPoint())
+            {
+                las::Point const& p = reader.GetPoint();
+
+                if (!p.Validate())
+                {
+                    std::ostringstream oss;
+                    oss << "invalid point around #" << i;
+                    throw std::runtime_error(oss.str());
+                }
+
+                if (i % 1000 == 0)
+                {
+                    std::cout << "\b\b\b\b\b\b\b\b" << double(i)/point_count * 100.0;
+                }
+                ++i;
+            }
+            assert(i == point_count);
+        }
+
+        std::cout << std::endl << "Done." << std::endl;
+
+        return EXIT_SUCCESS;
+    }
+    catch (std::exception const& e)
+    {
+        std::cerr << e.what() << std::endl;
+    }
+ 
+    return EXIT_FAILURE;
+}
diff --git a/Utilities/otbliblas/apps/bigtest.c b/Utilities/otbliblas/apps/bigtest.c
new file mode 100755
index 0000000000000000000000000000000000000000..7a0ab00a1745dbd090449d654984f3302ac3dcf1
--- /dev/null
+++ b/Utilities/otbliblas/apps/bigtest.c
@@ -0,0 +1,58 @@
+#include <liblas.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+void dumperror (const char * appmsg)
+{
+   printf("\n%s.\n\tMessage:  %s\n\tMethod: %s",appmsg, LASError_GetLastErrorMsg(), LASError_GetLastErrorMethod());
+}
+int main()
+{
+
+    LASHeaderH header = NULL;
+    LASWriterH writer = NULL;
+    LASReaderH reader = NULL;
+    LASPointH pt = NULL;
+    LASError err;
+    // Limitation about seeking past 4GB output size.  At 20 bytes / record, we
+    // can successfully write 204 million records, but not 205.
+    const unsigned long nMillionPoints = 205;
+    const unsigned long NPOINTS = 1024*1024*nMillionPoints ;
+    const char * OutputName = "Issue147.las";
+    unsigned long i = 0;
+    unsigned long npoints = 0;
+
+    // Write a LAS file and after the points are in, update the header.
+    header = LASHeader_Create();
+    writer = LASWriter_Create(OutputName, header, LAS_MODE_WRITE);
+    
+    for (i = 0; i < NPOINTS; i++)
+    {
+      if (i % 1000 == 0)
+         printf("\b\b\b\b\b\b\b%6.2f%%", ((double)i)/NPOINTS * 100.0);
+      
+      pt = LASPoint_Create();
+      err = LASPoint_SetX(pt, 0);
+      if (err) printf ("For point %lu, failed to set point value X\n", i);
+      err = LASPoint_SetY(pt, 0);
+      if (err) printf ("For point %lu, failed to set point value Y\n", i);
+      err = LASPoint_SetZ(pt, 0);
+      if (err) printf ("For point %lu, failed to set point value Z\n", i);
+      err = LASWriter_WritePoint(writer, pt);  
+      if (err) printf ("For point %lu, failed to WritePoint\n", i);
+      LASPoint_Destroy(pt);
+    }
+   err = LASHeader_SetPointRecordsCount(header, NPOINTS);
+   if (err) dumperror ("Failed to LASHeader_SetPointRecordsCount\n");
+   err = LASWriter_WriteHeader(writer, header);
+   if (err) dumperror ("Failed to LASWriter_WriteHeader");
+   LASWriter_Destroy(writer);
+   LASHeader_Destroy(header);
+   
+   // Read the file we just wrote and check the header data.
+    reader = LASReader_Create(OutputName);
+    header = LASReader_GetHeader(reader);
+    npoints = LASHeader_GetPointRecordsCount(header);
+    printf ("\n\nWrote %lu, Read %lu (testing %lu Million (1024 x 1024) Points)\n", NPOINTS, npoints, nMillionPoints);
+}
diff --git a/Utilities/otbliblas/apps/cmake_install.cmake b/Utilities/otbliblas/apps/cmake_install.cmake
old mode 100755
new mode 100644
index e31a9367bc72c5fa8bf3c31eadf9dbb921c5ea71..b7f9f2a72c77a01c2c7cf10e8317e122134be293
--- a/Utilities/otbliblas/apps/cmake_install.cmake
+++ b/Utilities/otbliblas/apps/cmake_install.cmake
@@ -1,4 +1,4 @@
-# Install script for directory: /tmp/liblas-main/apps
+# Install script for directory: /tmp/liblas/apps
 
 # Set the install prefix
 IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
@@ -28,10 +28,11 @@ IF(NOT CMAKE_INSTALL_COMPONENT)
 ENDIF(NOT CMAKE_INSTALL_COMPONENT)
 
 IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
-  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas-main/bin/lasinfo-old")
+  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas/bin/lasinfo-old")
   IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasinfo-old")
     EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
-      -change "/tmp/liblas-main/bin/liblas_c.dylib" "/usr/local/lib/liblas_c.dylib"
+      -change "/tmp/liblas/bin/liblas.dylib" "liblas.dylib"
+      -change "/tmp/liblas/bin/liblas_c.dylib" "/usr/local/lib/liblas_c.dylib"
       "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasinfo-old")
     IF(CMAKE_INSTALL_DO_STRIP)
       EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasinfo-old")
@@ -40,8 +41,11 @@ IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspeci
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
 
 IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
-  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas-main/bin/lasinfo")
+  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas/bin/lasinfo")
   IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasinfo")
+    EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
+      -change "/tmp/liblas/bin/liblas.dylib" "liblas.dylib"
+      "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasinfo")
     IF(CMAKE_INSTALL_DO_STRIP)
       EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasinfo")
     ENDIF(CMAKE_INSTALL_DO_STRIP)
@@ -49,10 +53,11 @@ IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspeci
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
 
 IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
-  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas-main/bin/lasmerge")
+  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas/bin/lasmerge")
   IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasmerge")
     EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
-      -change "/tmp/liblas-main/bin/liblas_c.dylib" "/usr/local/lib/liblas_c.dylib"
+      -change "/tmp/liblas/bin/liblas.dylib" "liblas.dylib"
+      -change "/tmp/liblas/bin/liblas_c.dylib" "/usr/local/lib/liblas_c.dylib"
       "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasmerge")
     IF(CMAKE_INSTALL_DO_STRIP)
       EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasmerge")
@@ -61,8 +66,11 @@ IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspeci
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
 
 IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
-  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas-main/bin/las2las")
+  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas/bin/las2las")
   IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2las")
+    EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
+      -change "/tmp/liblas/bin/liblas.dylib" "liblas.dylib"
+      "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2las")
     IF(CMAKE_INSTALL_DO_STRIP)
       EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2las")
     ENDIF(CMAKE_INSTALL_DO_STRIP)
@@ -70,10 +78,11 @@ IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspeci
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
 
 IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
-  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas-main/bin/las2txt")
+  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas/bin/las2txt")
   IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2txt")
     EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
-      -change "/tmp/liblas-main/bin/liblas_c.dylib" "/usr/local/lib/liblas_c.dylib"
+      -change "/tmp/liblas/bin/liblas.dylib" "liblas.dylib"
+      -change "/tmp/liblas/bin/liblas_c.dylib" "/usr/local/lib/liblas_c.dylib"
       "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2txt")
     IF(CMAKE_INSTALL_DO_STRIP)
       EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2txt")
@@ -82,10 +91,11 @@ IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspeci
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
 
 IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
-  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas-main/bin/txt2las")
+  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas/bin/txt2las")
   IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/txt2las")
     EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
-      -change "/tmp/liblas-main/bin/liblas_c.dylib" "/usr/local/lib/liblas_c.dylib"
+      -change "/tmp/liblas/bin/liblas.dylib" "liblas.dylib"
+      -change "/tmp/liblas/bin/liblas_c.dylib" "/usr/local/lib/liblas_c.dylib"
       "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/txt2las")
     IF(CMAKE_INSTALL_DO_STRIP)
       EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/txt2las")
@@ -94,8 +104,11 @@ IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspeci
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
 
 IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
-  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas-main/bin/las2las")
+  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas/bin/las2las")
   IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2las")
+    EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
+      -change "/tmp/liblas/bin/liblas.dylib" "liblas.dylib"
+      "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2las")
     IF(CMAKE_INSTALL_DO_STRIP)
       EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2las")
     ENDIF(CMAKE_INSTALL_DO_STRIP)
@@ -103,10 +116,11 @@ IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspeci
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
 
 IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
-  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas-main/bin/las2las-old")
+  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas/bin/las2las-old")
   IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2las-old")
     EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
-      -change "/tmp/liblas-main/bin/liblas_c.dylib" "/usr/local/lib/liblas_c.dylib"
+      -change "/tmp/liblas/bin/liblas.dylib" "liblas.dylib"
+      -change "/tmp/liblas/bin/liblas_c.dylib" "/usr/local/lib/liblas_c.dylib"
       "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2las-old")
     IF(CMAKE_INSTALL_DO_STRIP)
       EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/las2las-old")
@@ -115,11 +129,26 @@ IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspeci
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
 
 IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
-  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas-main/bin/lasblock")
+  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas/bin/lasblock")
   IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasblock")
+    EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
+      -change "/tmp/liblas/bin/liblas.dylib" "liblas.dylib"
+      "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasblock")
     IF(CMAKE_INSTALL_DO_STRIP)
       EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasblock")
     ENDIF(CMAKE_INSTALL_DO_STRIP)
   ENDIF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/lasblock")
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
 
+IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
+  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/tmp/liblas/bin/ts2las")
+  IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/ts2las")
+    EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
+      -change "/tmp/liblas/bin/liblas.dylib" "liblas.dylib"
+      "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/ts2las")
+    IF(CMAKE_INSTALL_DO_STRIP)
+      EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/ts2las")
+    ENDIF(CMAKE_INSTALL_DO_STRIP)
+  ENDIF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/ts2las")
+ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
+
diff --git a/Utilities/otbliblas/apps/las2las-old.c b/Utilities/otbliblas/apps/las2las-old.c
old mode 100755
new mode 100644
index d5ca7feb1af6e756aaa2c83c7d6947547e946e1a..208a79cdffa1336df551d701da9bdc64320fdc8f
--- a/Utilities/otbliblas/apps/las2las-old.c
+++ b/Utilities/otbliblas/apps/las2las-old.c
@@ -880,7 +880,7 @@ int main(int argc, char *argv[])
         } else {
             if (verbose) {
                 fprintf(stderr, 
-                    "Setting xyz offset to commandline-assigned values...\n");
+                    "Setting xyz offset to %.8f %.8f %.8f...\n", xyz_offset[0], xyz_offset[1], xyz_offset[2]);
             }
             LASHeader_SetOffset(surviving_header,
                                 xyz_offset[0],
@@ -892,7 +892,7 @@ int main(int argc, char *argv[])
     if (do_set_scale) {
         if (verbose) {
             fprintf(stderr, 
-                "Setting xyz scale...\n");
+                "Setting xyz scale to %.8f %.8f %.8f...\n", xyz_scale[0], xyz_scale[1], xyz_scale[2]);
         }
         LASHeader_SetScale( surviving_header, 
                             xyz_scale[0],
diff --git a/Utilities/otbliblas/apps/las2las.cpp b/Utilities/otbliblas/apps/las2las.cpp
index ddb25fe366209c0d5947f466db025aee46aeda49..b12298042bed15b2d7c9480302da94a1b15a80e9 100755
--- a/Utilities/otbliblas/apps/las2las.cpp
+++ b/Utilities/otbliblas/apps/las2las.cpp
@@ -20,6 +20,50 @@ namespace po = boost::program_options;
 using namespace liblas;
 using namespace std;
 
+// 0, 4, 16, 64, 256
+//std::size_t const default_buffer_size = 0;
+//std::size_t const default_buffer_size = 4 * 1024;
+//std::size_t const default_buffer_size = 16 * 1024;
+//std::size_t const default_buffer_size = 64 * 1024;
+//std::size_t const default_buffer_size = 256 * 1024;
+std::size_t const default_buffer_size = 1024 * 1024;
+std::vector<char> ofs_buffer;
+std::vector<char> ifs_buffer;
+
+std::ofstream& set_ofstream_buffer(std::ofstream& ofs, std::size_t buffer_size)
+{
+    char* buffer = 0; // unbuffered;
+    if (buffer_size > 0)
+    {
+        std::vector<char>(buffer_size).swap(ofs_buffer);
+        buffer = &ofs_buffer[0];
+    }
+
+    std::streambuf* sb = ofs.rdbuf()->pubsetbuf(buffer, buffer_size);
+    if (0 != buffer && 0 == sb)
+    {
+        throw std::runtime_error("failed to attach non-null buffer to input file stream");
+    }
+    return ofs;
+}
+
+std::ifstream& set_ifstream_buffer(std::ifstream& ifs, std::size_t buffer_size)
+{
+    char* buffer = 0; // unbuffered;
+    if (buffer_size > 0)
+    {
+        std::vector<char>(buffer_size).swap(ifs_buffer);
+        buffer = &ifs_buffer[0];
+    }
+
+    std::streambuf* sb = ifs.rdbuf()->pubsetbuf(buffer, buffer_size);
+    if (0 != buffer && 0 == sb)
+    {
+        throw std::runtime_error("failed to attach non-null buffer to input file stream");
+    }
+    return ifs;
+}
+
 liblas::Writer* start_writer(   std::ofstream* strm, 
                                 std::string const& output, 
                                 liblas::Header const& header)
@@ -30,13 +74,15 @@ liblas::Writer* start_writer(   std::ofstream* strm,
         std::ostringstream oss;
         oss << "Cannot create " << output << "for write.  Exiting...";
         throw std::runtime_error(oss.str());
-    }        
+    }
+
+    // set_ofstream_buffer(*strm, default_buffer_size);
+
     liblas::Writer* writer = new liblas::Writer(*strm, header);
     return writer;
     
 }
 
-
 bool process(   std::string const& input,
                 std::string const& output,
                 liblas::Header & header,
@@ -48,35 +94,36 @@ bool process(   std::string const& input,
                 bool min_offset)
 {
 
-
-    
     std::ifstream ifs;
     if (!liblas::Open(ifs, input.c_str()))
     {
         std::cerr << "Cannot open " << input << "for read.  Exiting...";
         return false;
     }
+    // set_ifstream_buffer(ifs, default_buffer_size);
+
     liblas::Reader reader(ifs);
     liblas::Summary* summary = new liblas::Summary;
     
     reader.SetFilters(filters);
-    reader.SetTransforms(transforms);
-
+    reader.SetTransforms(transforms);    
+    
     if (min_offset) 
     {
         
         liblas::property_tree::ptree tree = reader.Summarize();
-    
         try
         {
-            header.SetOffset(tree.get<double>("minimum.x"),
-                             tree.get<double>("minimum.y"),
-                             tree.get<double>("minimum.z"));
+            header.SetOffset(tree.get<double>("summary.points.minimum.x"),
+                             tree.get<double>("summary.points.minimum.y"),
+                             tree.get<double>("summary.points.minimum.z"));
     
                               
-        }     catch (liblas::property_tree::ptree_bad_path const& e) 
+        }
+        catch (liblas::property_tree::ptree_bad_path const& e) 
         {
             std::cerr << "Unable to write minimum header info.  Does the outputted file have any points?";
+            std::cerr << e.what() << std::endl;
             return false;
         }
         if (verbose) 
@@ -287,14 +334,18 @@ int main(int argc, char* argv[])
         if (vm.count("input")) 
         {
             input = vm["input"].as< string >();
-            std::ifstream ifs;
+            
             if (verbose)
                 std::cout << "Opening " << input << " to fetch Header" << std::endl;
+
+            std::ifstream ifs;
             if (!liblas::Open(ifs, input.c_str()))
             {
                 std::cerr << "Cannot open " << input << "for read.  Exiting...";
                 return 1;
             }
+            // set_ifstream_buffer(ifs, default_buffer_size);
+
             liblas::Reader reader(ifs);
             header = reader.GetHeader();
         } else {
@@ -332,11 +383,13 @@ int main(int argc, char* argv[])
         }
         
     }
-    catch(std::exception& e) {
+    catch(std::exception& e)
+    {
         std::cerr << "error: " << e.what() << "\n";
         return 1;
     }
-    catch(...) {
+    catch(...)
+    {
         std::cerr << "Exception of unknown type!\n";
     }
     
diff --git a/Utilities/otbliblas/apps/las2oci.cpp b/Utilities/otbliblas/apps/las2oci.cpp
index 92f007d3c66bf72624d582a2eb6e3b52f01798bf..4bcf2e02c605a55102cd24f6754dbc933cd6f15a 100755
--- a/Utilities/otbliblas/apps/las2oci.cpp
+++ b/Utilities/otbliblas/apps/las2oci.cpp
@@ -10,7 +10,7 @@ namespace po = boost::program_options;
 using namespace liblas;
 using namespace std;
 
-void OCIGDALDebugErrorHandler(CPLErr eErrClass, int err_no, const char *msg)
+ void CPL_STDCALL OCIGDALDebugErrorHandler(CPLErr eErrClass, int err_no, const char *msg)
 {
     ostringstream oss;
     
@@ -24,7 +24,7 @@ void OCIGDALDebugErrorHandler(CPLErr eErrClass, int err_no, const char *msg)
     }
 }
 
-void OCIGDALErrorHandler(CPLErr eErrClass, int err_no, const char *msg)
+ void CPL_STDCALL OCIGDALErrorHandler(CPLErr eErrClass, int err_no, const char *msg)
 {
     ostringstream oss;
     
@@ -666,7 +666,7 @@ file_options.add_options()
     ("base-table-aux-values", po::value< string >(), "Quoted, comma-separated list of values to add to the SQL that gets executed as part of the point cloud insertion into the base-table-name")
     ("solid", po::value<bool>()->zero_tokens(), "Define the point cloud's PC_EXTENT geometry gtype as (1,1007,3) instead of the normal (1,1003,3), and use gtype 3008/2008 vs 3003/2003 for BLK_EXTENT geometry values.")
     ("3d", po::value<bool>()->zero_tokens(), "Use Z values for insertion of all extent (PC_EXTENT, BLK_EXTENT, USER_SDO_GEOM_METADATA) entries")
-    ("global-extent", po::value< std::vector<double> >(), "Extent window to define for the PC_EXTENT.\nUse a list, for example, \n  --global-extent minx miny maxx maxy\n  or \n  --global-extent minx miny minz maxx maxy maxz")
+    ("global-extent", po::value< std::vector<double> >(), "Extent window to define for the PC_EXTENT.\nUse a comma-separated or quoted, space-separated list, for example, \n -e minx, miny, maxx, maxy\n or \n -e minx, miny, minz, maxx, maxy, maxz\n -e \"minx miny minz maxx maxy maxz\"")
     ("cached", po::value<bool>()->zero_tokens(), "Cache the entire file on the first read")
 
 
@@ -800,6 +800,7 @@ int main(int argc, char* argv[])
             header = reader.GetHeader();
         } else {
             std::cerr << "Input LAS file not specified!\n";
+            std::cout << GetInvocationHeader()<<file_options<<transform_options<<filtering_options<<"\n";
             return 1;
         }
 
@@ -934,7 +935,7 @@ int main(int argc, char* argv[])
             }
             if (verbose)
                 if (!used_file)
-                    std::cout << "Setting output post-sql to: " << pre_sql << std::endl;
+                    std::cout << "Setting output post-sql to: " << post_sql << std::endl;
                 else
                     std::cout << "Setting output post-sql to: " << sql << std::endl; // Tell filename instead
         }
@@ -971,20 +972,14 @@ int main(int argc, char* argv[])
         }
         if (vm.count("global-extent")) 
         {
-            std::vector<double> vbounds = vm["global-extent"].as< std::vector<double> >();
+            std::string bounds_string = vm["global-extent"].as< string >();
 
-            liblas::Bounds<double> bounds;
-            
-            if (verbose)
-            {
-                std::cout << "Setting global bounds to : ";
-
-                for (std::vector<double>::const_iterator t = vbounds.begin(); 
-                     t != vbounds.end(); 
-                     ++t) {
-                    std::cout << *t;
-                }
-                std::cout << std::endl;
+            boost::char_separator<char> sep(SEPARATORS);
+
+            std::vector<double> vbounds;
+            tokenizer tokens(bounds_string, sep);
+            for (tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t) {
+                vbounds.push_back(atof((*t).c_str()));
             }
             if (vbounds.size() == 4) 
             {
@@ -1004,10 +999,8 @@ int main(int argc, char* argv[])
                 ostringstream oss;
                 oss << "Bounds must be specified as a 4-tuple or "
                        "6-tuple, not a "<< vbounds.size()<<"-tuple" << "\n";
-                std::cerr << oss.str();
-            }            
-            if (verbose)
-                std::cout << "Storing 3D geometries... " << std::endl;
+                throw std::runtime_error(oss.str());
+            }
         }
 
         if (vm.count("xmin")) 
diff --git a/Utilities/otbliblas/apps/lascommon.c b/Utilities/otbliblas/apps/lascommon.c
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/apps/lasindex_test.cpp b/Utilities/otbliblas/apps/lasindex_test.cpp
old mode 100755
new mode 100644
index 1f9513248c85cfa9e3560138369fc7ce4383f070..759f8c634ed88858cce777e450fa4a7003f9b368
--- a/Utilities/otbliblas/apps/lasindex_test.cpp
+++ b/Utilities/otbliblas/apps/lasindex_test.cpp
@@ -99,6 +99,10 @@ void usage(FILE *debugger)
     fprintf(debugger,"  follow with low and high values for Z filter\n");
     fprintf(debugger,"\n");
     
+    fprintf(debugger,"-it (use iterator for filtering):\n");
+    fprintf(debugger,"  follow with number of points to be returned in each iteration\n");
+    fprintf(debugger,"\n");
+    
     fprintf(debugger, "\nFor more information, see the full documentation for lasindex_test at:\n"
                     " http://liblas.org/browser/trunk/doc/lasindex_test.txt\n");
     fprintf(debugger,"----------------------------------------------------------\n");
@@ -121,6 +125,7 @@ std::istream* OpenInput(std::string filename)
     if (!istrm->good())
     {
         delete istrm;
+        istrm = 0;
         throw std::runtime_error("Reading stream was not able to be created.");
     }
     return istrm;
@@ -142,6 +147,7 @@ std::ostream* OpenOutput(std::string filename)
     if (!ostrm->good())
     {
         delete ostrm;
+        ostrm = 0;
         throw std::runtime_error("Writing stream was not able to be created.");
     }
     return ostrm;
@@ -162,6 +168,26 @@ void IndexFilterInitError(FILE *debugger)
     fprintf(debugger, "Unable to initialize index filter. Invalid values.\n");
 }
 
+bool ReportIteratorResults(FILE *debugger, uint32_t resultSize, uint32_t pointCount, uint32_t step)
+{
+	if (resultSize)
+	{
+		// do something with the list of points
+		#ifdef VISUAL_8
+		fprintf(debugger, "Points within filter area %d of %d, step %d, %s\n", resultSize, 
+			pointCount, step, "Using iterator");
+		#else // VISUAL_8
+		fprintf(debugger, "Points within filter area %d of %d, step %d, %s\n", resultSize, 
+			pointCount, step, "Using iterator");
+		#endif // VISUAL_8
+		return true;
+	}
+	else
+	{
+		IndexFilterNoPoints(debugger);
+		return false;
+	} // else
+} // ReportIteratorResults
 
 int main(int argc, char* argv[])
 {
@@ -174,12 +200,14 @@ int main(int argc, char* argv[])
 	char *datefield = 0;
 	double zbinheight = 0.0;
 	double oLowFilterX = 0.0, oHighFilterX = 0.0, oLowFilterY = 0.0, oHighFilterY = 0.0, oLowFilterZ = 0.0, oHighFilterZ = 0.0;
-	uint32_t maxmem = 0;
+	boost::uint32_t maxmem = 0;
+	boost::uint32_t chunkSize = 100;
 	int debuglevel = 3;
 	bool readonly = 0;
 	bool forcenewindex = 0;
 	bool boundssetbyuser = 0;
 	bool writestandaloneindex = 0;
+	bool useiterator = 0;
 	FILE *debugger = stderr;
 	
 	// temporary until argv[] starts to work
@@ -207,13 +235,18 @@ int main(int argc, char* argv[])
 		 "-n", "C:\\LibLAS\\Samples\\N1440375_idx.ldx", "-r"};
 	argc = 6;
 	*/
-	/*-----------------build embedded index, filter with user bounds------------
+	/*-----------------build embedded index, filter with user bounds------------ */
 	const char* arggv[] = {"foo", "-t", "C:\\LibLAS\\Samples\\N1440375.tmp",
 		 "-i", "C:\\LibLAS\\Samples\\N1440375.las", "-a", SAMPLE_AUTHOR, "-c", SAMPLE_COMMENT, "-d", SAMPLE_DATE,
 		 "-o", "C:\\LibLAS\\Samples\\N1440375_idx.las",
 		 "-x", "1443000.00", "1444000.00", "-y", "376000.02", "379000.00", "-z", "850.00", "950.00"};
 	argc = 22;
-	*/	
+
+	/*------------filter with embedded index using iterator---------------------
+	const char* arggv[] = {"foo",
+		 "-i", "C:\\LibLAS\\Samples\\N1440375_idx.las", "-r", "-it", "20000"};
+	argc = 6;
+	*/
 	/*---------------------Serpent Mound Model LAS Data-----------------------*/
 	/*----------------------------build index-----------------------------------
 	const char* arggv[] = {"foo", "-t", "C:\\LibLAS\\Samples\\Serpent Mound Model LAS Data.tmp",
@@ -230,8 +263,8 @@ int main(int argc, char* argv[])
 	/*----------------------------build index-----------------------------------
 	const char* arggv[] = {"foo", "-t", "C:\\LibLAS\\Mount St Helens Oct 4 2004.tmp",
 		 "-i", "C:\\LibLAS\\Samples\\Mount St Helens Oct 4 2004.las", "-a", SAMPLE_AUTHOR, "-c", SAMPLE_COMMENT, "-d", SAMPLE_DATE,
-		 "-o", "C:\\LibLAS\\Samples\\Mount St Helens Oct 4 2004_idx.las"};
-	argc = 13;
+		 "-o", "C:\\LibLAS\\Samples\\Mount St Helens Oct 4 2004_idx.las", "-b", "100"};
+	argc = 15;
 	*/
 	/*------------------filter with embedded index------------------------------
 	const char* arggv[] = {"foo",
@@ -251,18 +284,34 @@ int main(int argc, char* argv[])
 	argc = 4;
 	*/
 	/*------------------------------flatDataset-------------------------------*/
-	///*------------------------------build index---------------------------------
+	/*------------------------------build index---------------------------------
 	const char* arggv[] = {"foo", "-t", "C:\\LibLAS\\flatDataset.tmp",
 		 "-i", "C:\\LibLAS\\Samples\\flatDataset.las", "-a", SAMPLE_AUTHOR, "-c", SAMPLE_COMMENT, "-d", SAMPLE_DATE,
 		 "-o", "C:\\LibLAS\\Samples\\flatDataset_idx.las"};
 	argc = 13;
-	//*/
+	*/
 	/*------------------filter with embedded index------------------------------
 	const char* arggv[] = {"foo",
 		 "-i", "C:\\LibLAS\\Samples\\flatDataset_idx.las", "-r"};
 	argc = 4;
 	*/
-	/*------------------------------------------------------------------------*/
+	/*------------filter with embedded index using iterator---------------------
+	const char* arggv[] = {"foo",
+		 "-i", "C:\\LibLAS\\Samples\\flatDataset_idx.las", "-r", "-it", "25"};
+	argc = 6;
+	*/
+	/*---------------------------billion_points-------------------------------*/
+	/*-----------------build index in standalone file---------------------------
+	const char* arggv[] = {"foo", "-t", "K:\\FME\\billion_points.tmp",
+		 "-i", "D:\\Zips\\FME\\billion_points.las", "-a", SAMPLE_AUTHOR, "-c", SAMPLE_COMMENT, "-d", SAMPLE_DATE,
+		 "-o", "K:\\FME\\billion_points_idx.ldx", "-s", "-it", "5000000"};
+	argc = 16;
+	*/
+	/*-------------------filter from standalone file using iterator---------------
+	const char* arggv[] = {"foo", "-i", "D:\\Zips\\FME\\billion_points.las",
+		 "-n", "K:\\FME\\billion_points_idx.ldx", "-r", "-it", "5000000"};
+	argc = 8;
+	*/
 	
 	for (int i = 1; i < argc; i++)
     {
@@ -375,11 +424,19 @@ int main(int argc, char* argv[])
             oHighFilterZ = atof((const char *)arggv[i]);
             boundssetbyuser = true;
         }
+        else if (   strcmp((const char *)arggv[i],"-it") == 0
+            )
+        {
+            i++;
+            chunkSize = atoi((const char *)arggv[i]);
+            useiterator = true;
+        }
 	} // for
 
 	fprintf(debugger, "%s\n", lasinfilenme);
 	
 	IndexData ParamSrc;
+	IndexData ParamSrc2;
 	
 	if (lasinfilenme)
 	{
@@ -419,7 +476,80 @@ int main(int argc, char* argv[])
 							if (index.IndexReady())
 							{
 								// for testing filter bounds set by user
-								if (boundssetbyuser)
+								if (useiterator)
+								{
+									ParamSrc = IndexData(index);
+									ParamSrc2 = IndexData(index);
+									if (ParamSrc.SetFilterValues(index.GetBounds(), index)
+										&& ParamSrc2.SetFilterValues((index.GetMinX() + index.GetMaxX()) * .5, index.GetMaxX(), 
+										(index.GetMinY() + index.GetMaxY()) * .5, index.GetMaxY(), index.GetMinZ(), index.GetMaxZ(), index))
+									{
+										// two iterators with different filter bounds
+										IndexIterator *indexIt = index.Filter(ParamSrc, chunkSize);
+										IndexIterator *indexIt2 = index.Filter(ParamSrc2, chunkSize);
+										if (indexIt && indexIt2)
+										{
+											for (boost::uint32_t step = 0; step < 1000; ++step)
+											{
+												// use any of these to begin the vector with the next point that fits the filter criteria 
+												// that hasn't been scanned yet.
+												// ex: indexIt->advance(1) starts the vector on the first point that fits the criteria if no points have 
+												// been scanned previously. If there have been previous points scanned then the vector returned
+												// will start with the next point that fits the criteria beyond those previously scanned.
+												// ex: indexIt->advance(5) starts the vector on the fifth point that fits the criteria if no points have 
+												// been scanned previously. If there have been previous points scanned then the vector returned
+												// will start with the fifth point that fits the criteria beyond those previously scanned.
+												// The following three methods may be used to advance by any positive number X.
+												//const std::vector<boost::uint32_t>& FilterResult = indexIt->advance(X);
+												//const std::vector<boost::uint32_t>& FilterResult = (*indexIt)+=X;
+												//const std::vector<boost::uint32_t>& FilterResult = (*indexIt)+X;
+												// The following two methods may be used to advance as though X were 1.
+												// There is no functional difference between pre and post increment;
+												//const std::vector<boost::uint32_t>& FilterResult = ++(*indexIt);
+												//const std::vector<boost::uint32_t>& FilterResult = (*indexIt)++;
+												// Random access to any number point in the file that fits the filter criteria is 
+												// provided with the overloaded [] operator or () operator.
+												// ex: (*indexIt)[32] would start the array at the 32nd point in the file that fits the criteria
+												// Any number of non-conforming points may have been skipped to get to the start point
+												//const std::vector<boost::uint32_t>& FilterResult = (*indexIt)[32];
+												//const std::vector<boost::uint32_t>& FilterResult = (*indexIt)(0);
+												
+												// get first or next consecutive range on first iterator
+												const std::vector<boost::uint32_t>& FilterResult = (*indexIt)++;
+												if (!ReportIteratorResults(debugger, FilterResult.size(), index.GetPointRecordsCount(), step))
+													break;
+
+												// get first or next consecutive range on 2nd iterator
+												const std::vector<boost::uint32_t>& FilterResult2 = (*indexIt2)++;
+												if (!ReportIteratorResults(debugger, FilterResult2.size(), index.GetPointRecordsCount(), step))
+													break;
+
+												// get next range on first iterator
+												const std::vector<boost::uint32_t>& FilterResult3 = (*indexIt)++;
+												if (!ReportIteratorResults(debugger, FilterResult3.size(), index.GetPointRecordsCount(), step))
+													break;
+												
+												// get a range beginning with the 5th compliant point on 2nd iterator
+												const std::vector<boost::uint32_t>& FilterResult4 = (*indexIt2)[5];
+												if (!ReportIteratorResults(debugger, FilterResult4.size(), index.GetPointRecordsCount(), step))
+													break;
+
+												// get a range on first iterator beginning 6 compliant pts beyond last range (skipping 5)
+												const std::vector<boost::uint32_t>& FilterResult5 = (*indexIt)+6;
+												if (!ReportIteratorResults(debugger, FilterResult5.size(), index.GetPointRecordsCount(), step))
+													break;
+											
+											} // for
+										} // if
+										else
+											IndexFilterInitError(debugger);
+										delete indexIt;
+										delete indexIt2;
+									}
+									else
+										IndexFilterInitError(debugger);
+								} // if useiterator
+								else if (boundssetbyuser)
 								{
 									Bounds<double> filterBounds(oLowFilterX, oLowFilterY, oLowFilterZ,
 										oHighFilterX, oHighFilterY, oHighFilterZ);
@@ -429,8 +559,11 @@ int main(int argc, char* argv[])
 										if (FilterResult.size())
 										{
 											// do something with the list of points
-											fprintf(debugger, "Points within filter area %zu of %d, %s\n", FilterResult.size(), 
-												index.GetPointRecordsCount(), "User-defined gilter bounds");
+											std::ostringstream oss;
+											oss << "Points within filter area " << FilterResult.size() 
+												<< " of " << index.GetPointRecordsCount()
+												<< ",\nUser-defined filter bounds" << std::endl;
+											fprintf(debugger, "%s", oss.str().c_str());
 										}
 										else
 											IndexFilterNoPoints(debugger);
@@ -518,20 +651,24 @@ int main(int argc, char* argv[])
 													indexBounds.max(2));
 												break;
 											} // 5
+                                            default:
+                                            {
+                                                CovgStr = "";
+                                                break;
+                                            }
 										} // switch
+
 										if (ParamSrc.SetFilterValues(filterBounds, index))
 										{
 											const std::vector<uint32_t>& FilterResult = index.Filter(ParamSrc);
 											if (FilterResult.size())
 											{
 												// do something with the list of points
-												#ifdef VISUAL_8
-												fprintf(debugger, "Points within filter area %d of %d, %s\n", FilterResult.size(), 
-													index.GetPointRecordsCount(), CovgStr);
-												#else // VISUAL_8
-												fprintf(debugger, "Points within filter area %zu of %d, %s\n", FilterResult.size(), 
-													index.GetPointRecordsCount(), CovgStr);
-												#endif // VISUAL_8
+												std::ostringstream oss;
+												oss << "Points within filter area " << FilterResult.size() 
+													<< " of " << index.GetPointRecordsCount() 
+													<< ", " << CovgStr << std::endl;
+												fprintf(debugger, "%s", oss.str().c_str());
 											}
 											else
 												IndexFilterNoPoints(debugger);
@@ -558,8 +695,8 @@ int main(int argc, char* argv[])
 					if (static_cast<std::ifstream&>(*idxstrm))
 						static_cast<std::ifstream&>(*idxstrm).close();
 				} // if
-				if (idxreader)
-					delete idxreader;
+
+				delete idxreader;
 				delete reader;
 			} // if reader
 		
diff --git a/Utilities/otbliblas/apps/lasinfo-old.c b/Utilities/otbliblas/apps/lasinfo-old.c
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/apps/lasinfo.cpp b/Utilities/otbliblas/apps/lasinfo.cpp
index a1d699fa23515989b984eaa8a3cae974cecdf64a..63e24893d0a6baca23a5a814e251707591179c15 100755
--- a/Utilities/otbliblas/apps/lasinfo.cpp
+++ b/Utilities/otbliblas/apps/lasinfo.cpp
@@ -69,9 +69,9 @@ void OutputHelp( std::ostream & oss, po::options_description const& options)
 
     oss << options;
 
-    oss <<"\nFor more information, see the full documentation for lasinfo2 at:\n";
+    oss <<"\nFor more information, see the full documentation for lasinfo at:\n";
     
-    oss << " http://liblas.org/utilities/lasinfo2.html\n";
+    oss << " http://liblas.org/utilities/lasinfo.html\n";
     oss << "----------------------------------------------------------\n";
 
 }
@@ -105,6 +105,8 @@ int main(int argc, char* argv[])
     bool show_schema = true;
     bool output_xml = false;
     bool output_json = false;
+    bool show_point = false;
+    boost::uint32_t point = 0;
     
     std::vector<liblas::FilterPtr> filters;
     std::vector<liblas::TransformPtr> transforms;
@@ -113,7 +115,7 @@ int main(int argc, char* argv[])
 
     try {
 
-        po::options_description file_options("lasinfo2 options");
+        po::options_description file_options("lasinfo options");
         po::options_description filtering_options = GetFilteringOptions();
         po::options_description header_options = GetHeaderOptions();
 
@@ -129,7 +131,9 @@ int main(int argc, char* argv[])
             ("no-vlrs", po::value<bool>(&show_vlrs)->zero_tokens()->implicit_value(false), "Don't show VLRs")
             ("no-schema", po::value<bool>(&show_schema)->zero_tokens()->implicit_value(false), "Don't show schema")
             ("no-check", po::value<bool>(&check)->zero_tokens()->implicit_value(false), "Don't scan points")
-            ("xml", po::value<bool>(&output_xml)->zero_tokens()->implicit_value(true), "Output summary as XML")
+            ("xml", po::value<bool>(&output_xml)->zero_tokens()->implicit_value(true), "Output as XML")
+            ("point,p", po::value<boost::uint32_t>(&point), "Display a point with a given id.  --point 44")
+
             // ("json", po::value<bool>(&output_json)->zero_tokens()->implicit_value(true), "Output summary as JSON")
 
 // --xml
@@ -151,6 +155,10 @@ int main(int argc, char* argv[])
             return 1;
         }
 
+        if (vm.count("point")) 
+        {
+            show_point = true;
+        }
 
         if (vm.count("input")) 
         {
@@ -183,7 +191,33 @@ int main(int argc, char* argv[])
     
 
         liblas::Reader reader(ifs);
-        
+        if (show_point)
+        {
+            try 
+            {
+                reader.ReadPointAt(point);
+                liblas::Point const& p = reader.GetPoint();
+                if (output_xml) {
+                    liblas::property_tree::ptree tree;
+                    tree = p.GetPTree();
+                    liblas::property_tree::write_xml(std::cout, tree);
+                    exit(0);
+                } 
+                else 
+                {
+                    std::cout <<  p << std::endl;
+                    exit(0);    
+                }
+                
+            } catch (std::out_of_range const& e)
+            {
+                std::cerr << "Unable to read point at index " << point << ": " << e.what() << std::endl;
+                exit(1);
+                
+            }
+
+        }
+
         liblas::Summary summary;
         if (check)
             summary = check_points(  reader, 
diff --git a/Utilities/otbliblas/apps/laskernel.cpp b/Utilities/otbliblas/apps/laskernel.cpp
old mode 100755
new mode 100644
index 3fa52470e05edaaeb960c589a9b22752023dcc5e..b280001a98b34b0151ebea88c2cead8b6794f12a
--- a/Utilities/otbliblas/apps/laskernel.cpp
+++ b/Utilities/otbliblas/apps/laskernel.cpp
@@ -1,7 +1,7 @@
 
 #include "laskernel.hpp"
 
-std::istream* OpenInput(std::string filename, bool bEnd) 
+std::istream* OpenInput(std::string const& filename, bool bEnd) 
 {
     std::ios::openmode mode = std::ios::in | std::ios::binary;
     if (bEnd == true) {
@@ -30,10 +30,10 @@ std::string TryReadFileData(std::string const& filename)
     std::vector<char> data = TryReadRawFileData(filename);
 
     // FIXME: What is this construction supposed to grab? --mloskot
-    return std::string(data.front(), (std::size_t) data.size());
+    return std::string(&data[0], data.size());
 }
 
-std::vector<char> TryReadRawFileData(std::string filename)
+std::vector<char> TryReadRawFileData(std::string const& filename)
 {
     std::istream* infile = OpenInput(filename.c_str(), true);
     std::ifstream::pos_type size;
@@ -63,7 +63,7 @@ bool term_progress(std::ostream& os, double complete)
     static int lastTick = -1;
     int tick = static_cast<int>(complete * 40.0);
 
-    tick = std::min(40, std::max(0, tick));
+    tick = (std::min)(40, std::max(0, tick));
 
     // Have we started a new progress run?  
     if (tick < lastTick && lastTick >= 39)
@@ -153,7 +153,7 @@ void RepairHeader(liblas::Summary const& summary, liblas::Header& header)
                       tree.get<double>("summary.points.maximum.y"),
                       tree.get<double>("summary.points.maximum.z"));
         
-    }     catch (liblas::property_tree::ptree_bad_path const& e) 
+    }     catch (liblas::property_tree::ptree_bad_path const& ) 
     {
         std::cerr << "Unable to write header bounds info.  Does the outputted file have any points?";
         return;
@@ -175,7 +175,7 @@ void RepairHeader(liblas::Summary const& summary, liblas::Header& header)
             header.SetPointRecordsByReturnCount(i-1, count);        
         } 
         
-    }     catch (liblas::property_tree::ptree_bad_path const& e) 
+    }     catch (liblas::property_tree::ptree_bad_path const& ) 
     {
         std::cerr << "Unable to write header point return count info.  Does the outputted file have any points?";
         return;
@@ -255,7 +255,13 @@ po::options_description GetFilteringOptions()
 po::options_description filtering_options("Filtering options");
 
 filtering_options.add_options()
-    ("extent,e", po::value< std::vector<double> >()->multitoken(), "Extent window that points must fall within to keep.\nFor example, \n  -e minx miny maxx maxy\n  or \n  -e minx miny minz maxx maxy maxz")
+    ("extent,e", po::value< string >(), "Extent window that points must fall within to keep.\nUse a comma-separated or quoted, space-separated list, for example, \n -e minx, miny, maxx, maxy\n or \n -e minx, miny, minz, maxx, maxy, maxz\n -e \"minx miny minz maxx maxy maxz\"")     
+    ("minx", po::value< double >(), "Extent must be greater than or equal to minx to be kept. \n --minx 1234.0")
+    ("miny", po::value< double >(), "Extent must be greater than or equal to miny to be kept. \n --miny 5678.0")
+    ("minz", po::value< double >(), "Extent must be greater than or equal to minz to be kept. If maxx and maxy are set but not minz *and maxz, all z values are kept. \n --minz 0.0")
+    ("maxx", po::value< double >(), "Extent must be less than or equal to maxx to be kept. \n --maxx 1234.0")
+    ("maxy", po::value< double >(), "Extent must be less than or equal to maxy to be kept. \n --maxy 5678.0")
+    ("maxz", po::value< double >(), "Extent must be less than or equal to maxz to be kept. If maxx and maxy are set but not maxz *and minz, all z values are kept. \n --maxz 10.0")
     ("thin,t", po::value<boost::uint32_t>()->default_value(0), "Simple decimation-style thinning.\nThin the file by removing every t'th point from the file.")
     ("last_return_only", po::value<bool>()->zero_tokens(), "Keep last returns (cannot be used with --first_return_only)")
     ("first_return_only", po::value<bool>()->zero_tokens(), "Keep first returns (cannot be used with --last_return_only")
@@ -294,8 +300,8 @@ po::options_description GetHeaderOptions()
     transform_options.add_options()
         ("a_srs", po::value< string >(), "Coordinate system to assign to input LAS file")
         ("a_vertcs", po::value< std::vector<string> >()->multitoken(), "Override vertical coordinate system information.  Use --a_vertcs \"verticalCSType [citation [verticalDatum [verticalUnits]]]\"\nFor example: --a_vertcs 5703 \"North American Vertical Datum of 1988 (NAVD88)\" 5103 9001")   
-        ("offset", po::value< std::vector<double> >()->multitoken(), "A list of offsets to set on the output file: \n--offset 0 0 0")
-        ("scale", po::value< std::vector<double> >()->multitoken(), "A list of scales to set on the output file: \n--scale 0.1 0.1 0.00001")
+        ("offset", po::value< string >(), "A comma-separated or quoted, space-separated list of offsets to set on the output file: \n--offset 0,0,0\n--offset \"1234 5678 91011\"")
+        ("scale", po::value< std::vector<double> >()->multitoken(), "A list of scales to set on the output file. Scales *cannot* be negative, and should always be a negative power of 10 \n--scale 0.1 0.1 0.00001")
         ("format,f", po::value< string >(), "Set the LAS format of the new file (only 1.0-1.2 supported at this time): \n--format 1.2\n-f 1.1")
         ("pad-header", po::value< string >(), "Add extra bytes to the existing header")
         ("min-offset", po::value<bool>()->zero_tokens(), "Set the offset of the header to the minimums of all values in the file.  Note that this requires multiple read passes through the file to achieve.")
@@ -305,6 +311,7 @@ po::options_description GetHeaderOptions()
         ("add-vlr", po::value<std::vector<std::string> >()->multitoken(), "Add VLRs with the given name and id combination. --add-vlr hobu 1234 \"Description of the VLR\" \"filename.ext\"")
         ("system-identifier", po::value<std::string>(), "Set the SystemID for the file. --system_identifier \"MODIFICATION\"")
         ("generating-software", po::value<std::string>(), "Set the SoftwareID for the file. --generating_software \"liblas.org\"")
+        ("point-translate", po::value<std::string>(), "An expression to translate the X, Y, Z values of the point. For example, converting Z units that are in meters to feet: --point-translate \"x*1.0 y*1.0 z*3.2808399\"")
 
     ;
     
@@ -313,6 +320,8 @@ po::options_description GetHeaderOptions()
 std::vector<liblas::FilterPtr> GetFilters(po::variables_map vm, bool verbose)
 {
     std::vector<liblas::FilterPtr> filters;
+    liblas::Bounds<double> extent;
+    bool bSetExtent = false;
     
     if (vm.count("keep-classes")) 
     {
@@ -408,14 +417,73 @@ std::vector<liblas::FilterPtr> GetFilters(po::variables_map vm, bool verbose)
                                                             liblas::FilterI::eExclusion);
         filters.push_back(return_filter); 
     }
-            
+
+    if (vm.count("minx")) 
+    {
+        double minx = vm["minx"].as< double >();
+        extent.min(0, minx);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting minx to: " << minx << std::endl;
+    }
+
+    if (vm.count("maxx")) 
+    {
+        double maxx = vm["maxx"].as< double >();
+        extent.max(0, maxx);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting maxx to: " << maxx << std::endl;
+    }
+
+    if (vm.count("miny")) 
+    {
+        double miny = vm["miny"].as< double >();
+        extent.min(1, miny);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting miny to: " << miny << std::endl;
+    }
+
+    if (vm.count("maxx")) 
+    {
+        double maxy = vm["maxy"].as< double >();
+        extent.max(1, maxy);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting maxy to: " << maxy << std::endl;
+    }
+
+    if (vm.count("minz")) 
+    {
+        double minz = vm["minz"].as< double >();
+        extent.min(2, minz);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting minz to: " << minz << std::endl;
+    }
+
+    if (vm.count("maxz")) 
+    {
+        double maxz = vm["maxz"].as< double >();
+        extent.max(2, maxz);
+        bSetExtent = true;
+        if (verbose)
+            std::cout << "Setting maxz to: " << maxz << std::endl;
+    }
+    
     if (vm.count("extent")) 
     {
+        std::string bounds_string = vm["extent"].as< string >();
 
-        std::vector<double> vbounds = vm["extent"].as< std::vector<double> >();
+        boost::char_separator<char> sep(SEPARATORS);
 
+        std::vector<double> vbounds;
+        tokenizer tokens(bounds_string, sep);
         liblas::Bounds<double> bounds;
-
+        for (tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t) {
+            vbounds.push_back(atof((*t).c_str()));
+        }
         if (vbounds.size() == 4) 
         {
             bounds = liblas::Bounds<double>(vbounds[0], 
@@ -436,6 +504,15 @@ std::vector<liblas::FilterPtr> GetFilters(po::variables_map vm, bool verbose)
                    "6-tuple, not a "<< vbounds.size()<<"-tuple" << "\n";
             throw std::runtime_error(oss.str());
         }
+        
+        if ( bSetExtent ) 
+        {
+            if (verbose) 
+            {
+                std::cout << " Growing --extent bounds with those that were set via --[x|y|z][min|max]" << std::endl;
+            }
+            bounds.grow(extent);
+        }
     
         if (verbose)
         {
@@ -458,6 +535,11 @@ std::vector<liblas::FilterPtr> GetFilters(po::variables_map vm, bool verbose)
         }
 
         liblas::FilterPtr bounds_filter = MakeBoundsFilter(bounds, liblas::FilterI::eInclusion);
+        // Set to false because we are using this opportunity to set the filter
+        // If it were still true after this point, *another* BoundsFilter would be 
+        // added to the filters list at the end of this function
+        if (bSetExtent)
+            bSetExtent = false; 
         filters.push_back(bounds_filter);
         
     }
@@ -585,7 +667,16 @@ std::vector<liblas::FilterPtr> GetFilters(po::variables_map vm, bool verbose)
             std::vector<liblas::Color::value_type> rgb;
             for(tokenizer::iterator c = rgbs.begin(); c != rgbs.end(); ++c)
             {
-                rgb.push_back(atoi((*c).c_str()));
+                int color_val = atoi((*c).c_str());
+                if (color_val < std::numeric_limits<boost::uint16_t>::min() || 
+                    color_val > std::numeric_limits<boost::uint16_t>::max()) 
+                {
+                    ostringstream oss;
+                    oss << "Color value must be between 0-65536, not " << color_val;
+                    throw std::runtime_error( oss.str() );
+                    
+                }
+                rgb.push_back(static_cast<boost::uint16_t>(color_val));
             }
             liblas::Color color(rgb[0], rgb[1], rgb[2]);
             colors.push_back(color);
@@ -611,7 +702,16 @@ std::vector<liblas::FilterPtr> GetFilters(po::variables_map vm, bool verbose)
             std::vector<liblas::Color::value_type> rgb;
             for(tokenizer::iterator c = rgbs.begin(); c != rgbs.end(); ++c)
             {
-                rgb.push_back(atoi((*c).c_str()));
+                int color_val = atoi((*c).c_str());
+                if (color_val < std::numeric_limits<boost::uint16_t>::min() || 
+                    color_val > std::numeric_limits<boost::uint16_t>::max()) 
+                {
+                    ostringstream oss;
+                    oss << "Color value must be between 0-65536, not " << color_val;
+                    throw std::runtime_error( oss.str() );
+                    
+                }
+                rgb.push_back(static_cast<boost::uint16_t>(color_val));
             }
             liblas::Color color(rgb[0], rgb[1], rgb[2]);
             colors.push_back(color);
@@ -664,6 +764,15 @@ std::vector<liblas::FilterPtr> GetFilters(po::variables_map vm, bool verbose)
         filters.push_back(valid_filter);            
     }
 
+
+    // If we have bSetExtent and we haven't turned it off by merging with a --extent 
+    // BoundsFilter, make a filter
+    if (bSetExtent)
+    {
+        liblas::FilterPtr bounds_filter = MakeBoundsFilter(extent, liblas::FilterI::eInclusion);
+        filters.push_back(bounds_filter);
+    }
+    
     return filters;
 }
 
@@ -671,143 +780,39 @@ std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbo
 {
     std::vector<liblas::TransformPtr> transforms;
 
-    if (vm.count("a_srs")) 
-    {
-        liblas::SpatialReference in_ref;
-        
-        std::string input_srs = vm["a_srs"].as< string >();
-        if (verbose)
-            std::cout << "Setting input SRS to " << input_srs << std::endl;
-        in_ref.SetFromUserInput(input_srs);
-        header.SetSRS(in_ref);
-    }
-
-    if (vm.count("a_vertcs"))
-    {
-        liblas::SpatialReference vert_ref = header.GetSRS();
-
-        std::vector<std::string> vertical_vec = vm["a_vertcs"].as< std::vector<std::string> >();
-        if (vertical_vec.size() > 4) {
-            ostringstream oss;
-            oss << "Too many arguments were given to a_vertcs. "
-                << "--a_vertcs verticalCSType citation verticalDatum verticalUnits  "
-                << "All except verticalCSType are optional, but they are "
-                << "applied in order, so if you want to set verticalUnits, "
-                << "you must set all the others";
-
-            throw std::runtime_error(oss.str());
-        }
-        if (vertical_vec.size() < 1) {
-            ostringstream oss;
-            oss << "At least verticalCSType must be given to a_vertcs. "
-                << "--a_vertcs verticalCSType citation verticalDatum verticalUnits  "
-                << "All except verticalCSType are optional, but they are "
-                << "applied in order, so if you want to set verticalUnits, "
-                << "you must set all the others";
-
-            throw std::runtime_error(oss.str());
-        }
-        
-        if (verbose)
-        {
-            ostringstream oss;
-            for (std::vector<std::string>::const_iterator i = vertical_vec.begin();
-                 i != vertical_vec.end();
-                 i++) 
-                {
-                    oss << *i << " ";
-                }
-                std::cout << "Setting vertical info to: " << oss.str() << std::endl;
-        }
-            
-        boost::int32_t verticalCSType = boost::lexical_cast<boost::int32_t>(vertical_vec[0]);
-        
-        std::string citation;
-        int verticalDatum = -1;
-        int verticalUnits = 9001;
-        
-        if (vertical_vec.size() > 1) {
-            citation = boost::lexical_cast<std::string>(vertical_vec[1]);
-        }
-        
-        if (vertical_vec.size() > 2) {
-            verticalDatum = boost::lexical_cast<boost::int32_t>(vertical_vec[2]);
-        }
-
-        if (vertical_vec.size() > 3) {
-            verticalUnits = boost::lexical_cast<boost::int32_t>(vertical_vec[3]);
-        }
-        
-        vert_ref.SetVerticalCS(verticalCSType, citation, verticalDatum, verticalUnits);
-        header.SetSRS(vert_ref);      
-    }
-    
-    if (vm.count("t_srs")) 
+    if (vm.count("offset")) 
     {
-        liblas::SpatialReference in_ref;
-        liblas::SpatialReference out_ref;
-        
-        std::string output_srs = vm["t_srs"].as< string >();
+        std::string offset_string = vm["offset"].as< string >();
         if (verbose)
-            std::cout << "Setting output SRS to " << output_srs << std::endl;
-        out_ref.SetFromUserInput(output_srs);
-
-        if (vm.count("a_srs")){
-            std::string input_srs = vm["a_srs"].as< string >();
-            in_ref.SetFromUserInput(input_srs);
-        } else {
-            // If the user didn't assign an input SRS, we'll try to take 
-            // it from our existing header.
-            in_ref = header.GetSRS();
-            if (in_ref.GetVLRs().size() == 0)
+            std::cout << "Setting offsets to: " << offset_string << std::endl;
+        boost::char_separator<char> sep(SEPARATORS);
+        std::vector<double> offsets;
+        tokenizer tokens(offset_string, sep);
+        bool mins = false;
+        std::string m("min");
+        for (tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t) {
+            // Check if the user set --offset min,min,min
+            // FIXME: make this so the user could do --offset min,min,20.00
+            if (!(*t).compare(m))
+            {   
+                mins = true;
+                continue;
+            }
+            else
             {
-                throw std::runtime_error("No input SRS is available on the file you have specified.  Please use --a_srs to assign one");
+                mins = false;
+                offsets.push_back(atof((*t).c_str()));
             }
-            
         }
-        // Set the header's SRS to the output SRS now.  We've already 
-        // made the transformation, and this SRS will be used to 
-        // write the new file(s)
-        header.SetSRS(out_ref);
-        
-        liblas::Bounds<double> b = header.GetExtent();
-        b.project(in_ref, out_ref);
-        header.SetExtent(b);
-        liblas::TransformPtr srs_transform = liblas::TransformPtr(new liblas::ReprojectionTransform(in_ref, out_ref));
-        transforms.push_back(srs_transform);
-    }
-
-
-
-
-    if (vm.count("offset")) 
-    {
-
-        std::vector<double> offsets = vm["offset"].as< std::vector<double> >();
-        if (offsets.size() != 3) {
-            ostringstream oss;
-            oss << "Three arguments must be given to offset. "
-                << "--offset x y z";
-
-            throw std::runtime_error(oss.str());
-        }
-
-        
-        if (verbose)
+        if (offsets.size() != 3) 
         {
-            ostringstream oss;
-            for (std::vector<double>::const_iterator i = offsets.begin();
-                 i != offsets.end();
-                 i++) 
-                {
-                    oss << *i << " ";
-                }
-                std::cout << "Setting offsets to: " << oss.str() << std::endl;
-        }
+            throw std::runtime_error("All three values for setting the offset must be floats, and there must be three values");
 
+        }
         header.SetOffset(offsets[0], offsets[1], offsets[2]);
     }
 
+
     if (vm.count("scale")) 
     {
         std::vector<double> scales = vm["scale"].as< std::vector<double> >();
@@ -908,14 +913,27 @@ std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbo
             }            
         }
         
-        boost::uint32_t day = 0;
-        boost::uint32_t year = 0;
+        boost::int32_t day = 0;
+        boost::int32_t year = 0;
         
         
         if (creation.size() == 2) 
         {
             day = atoi(creation[0].c_str());
             year = atoi(creation[1].c_str());
+            
+            if (day < 0 || day > 366) {
+                ostringstream oss;
+                oss << "Day must be between 1-366, not " << day;
+                throw std::runtime_error(oss.str());
+            }
+            if (year < 0)
+            {
+                ostringstream oss;
+                oss << "Year must be greater than 0, not " << year;
+                throw std::runtime_error(oss.str());
+            }
+            
         }
         
         if (now == true) 
@@ -924,8 +942,8 @@ std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbo
             header.SetCreationDOY(h.GetCreationDOY());
             header.SetCreationYear(h.GetCreationYear());
         } else {
-            header.SetCreationDOY(day);
-            header.SetCreationYear(year);
+            header.SetCreationDOY(static_cast<boost::uint16_t>(day));
+            header.SetCreationYear(static_cast<boost::uint16_t>(year));
             
         }
     }
@@ -943,7 +961,7 @@ std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbo
         
         if (vlrs.size() % 2 != 0) {
             ostringstream err;
-            err << "VLR descriptions must be in pairs of 2";
+            err << "VLR descriptions must be in pairs of 2 -- A name and an ID";
             throw std::runtime_error(err.str());
         }
         ostringstream oss;
@@ -962,7 +980,17 @@ std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbo
         
         for (std::vector<std::string>::size_type i = 0; i < vlrs.size(); i=i+2)
         {
-            header.DeleteVLRs(vlrs[i], atoi(vlrs[i+1].c_str()));
+            boost::int32_t id = atoi(vlrs[i+1].c_str());
+            if (id < 0)
+            {
+                throw std::runtime_error("VLR ID must be > 0");
+            }
+            if (id > std::numeric_limits<boost::uint16_t>::max()) {
+                ostringstream oss;
+                oss << "ID must be less than "<< std::numeric_limits<boost::uint16_t>::max() <<", not " << id;
+                throw std::runtime_error(oss.str());
+            }
+            header.DeleteVLRs(vlrs[i], static_cast<boost::uint16_t>(id));
         }
     }
 
@@ -991,7 +1019,19 @@ std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbo
         
         liblas::VariableRecord v;
         v.SetUserId(vlrs[0]);
-        v.SetRecordId(atoi(vlrs[1].c_str()));
+
+        boost::int32_t id = atoi(vlrs[1].c_str());
+        if (id < 0)
+        {
+            throw std::runtime_error("VLR ID must be > 0");
+        }
+        if (id > std::numeric_limits<boost::uint16_t>::max()) {
+            ostringstream oss;
+            oss << "ID must be less than "<< std::numeric_limits<boost::uint16_t>::max() <<", not " << id;
+            throw std::runtime_error(oss.str());
+        }
+
+        v.SetRecordId(static_cast<boost::uint16_t>(id));
         
         std::vector<boost::uint8_t> data;
         
@@ -1036,7 +1076,7 @@ std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbo
 
 
         v.SetData(data);
-        v.SetRecordLength(data.size());
+        v.SetRecordLength(static_cast<boost::uint16_t>(data.size()));
         header.AddVLR(v);
     }
 
@@ -1064,6 +1104,125 @@ std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbo
         
         header.SetSystemId(id);
     }
+    
+
+    if (vm.count("a_srs")) 
+    {
+        liblas::SpatialReference in_ref;
+        
+        std::string input_srs = vm["a_srs"].as< string >();
+        if (verbose)
+            std::cout << "Setting input SRS to " << input_srs << std::endl;
+        in_ref.SetFromUserInput(input_srs);
+        header.SetSRS(in_ref);
+    }
+
+    if (vm.count("a_vertcs"))
+    {
+        liblas::SpatialReference vert_ref = header.GetSRS();
+
+        std::vector<std::string> vertical_vec = vm["a_vertcs"].as< std::vector<std::string> >();
+        if (vertical_vec.size() > 4) {
+            ostringstream oss;
+            oss << "Too many arguments were given to a_vertcs. "
+                << "--a_vertcs verticalCSType citation verticalDatum verticalUnits  "
+                << "All except verticalCSType are optional, but they are "
+                << "applied in order, so if you want to set verticalUnits, "
+                << "you must set all the others";
+
+            throw std::runtime_error(oss.str());
+        }
+        if (vertical_vec.size() < 1) {
+            ostringstream oss;
+            oss << "At least verticalCSType must be given to a_vertcs. "
+                << "--a_vertcs verticalCSType citation verticalDatum verticalUnits  "
+                << "All except verticalCSType are optional, but they are "
+                << "applied in order, so if you want to set verticalUnits, "
+                << "you must set all the others";
+
+            throw std::runtime_error(oss.str());
+        }
+        
+        if (verbose)
+        {
+            ostringstream oss;
+            for (std::vector<std::string>::const_iterator i = vertical_vec.begin();
+                 i != vertical_vec.end();
+                 i++) 
+                {
+                    oss << *i << " ";
+                }
+                std::cout << "Setting vertical info to: " << oss.str() << std::endl;
+        }
+            
+        boost::int32_t verticalCSType = boost::lexical_cast<boost::int32_t>(vertical_vec[0]);
+        
+        std::string citation;
+        int verticalDatum = -1;
+        int verticalUnits = 9001;
+        
+        if (vertical_vec.size() > 1) {
+            citation = boost::lexical_cast<std::string>(vertical_vec[1]);
+        }
+        
+        if (vertical_vec.size() > 2) {
+            verticalDatum = boost::lexical_cast<boost::int32_t>(vertical_vec[2]);
+        }
+
+        if (vertical_vec.size() > 3) {
+            verticalUnits = boost::lexical_cast<boost::int32_t>(vertical_vec[3]);
+        }
+        
+        vert_ref.SetVerticalCS(verticalCSType, citation, verticalDatum, verticalUnits);
+        header.SetSRS(vert_ref);      
+    }
+    
+    if (vm.count("t_srs")) 
+    {
+        liblas::SpatialReference in_ref;
+        liblas::SpatialReference out_ref;
+        
+        std::string output_srs = vm["t_srs"].as< string >();
+        if (verbose)
+            std::cout << "Setting output SRS to " << output_srs << std::endl;
+        out_ref.SetFromUserInput(output_srs);
+
+        if (vm.count("a_srs")){
+            std::string input_srs = vm["a_srs"].as< string >();
+            in_ref.SetFromUserInput(input_srs);
+        } else {
+            // If the user didn't assign an input SRS, we'll try to take 
+            // it from our existing header.
+            in_ref = header.GetSRS();
+            if (in_ref.GetVLRs().size() == 0)
+            {
+                throw std::runtime_error("No input SRS is available on the file you have specified.  Please use --a_srs to assign one");
+            }
+            
+        }
+        // Set the header's SRS to the output SRS now.  We've already 
+        // made the transformation, and this SRS will be used to 
+        // write the new file(s)
+        header.SetSRS(out_ref);
+        
+        liblas::Bounds<double> b = header.GetExtent();
+        b.project(in_ref, out_ref);
+        header.SetExtent(b);
+        liblas::TransformPtr srs_transform = liblas::TransformPtr(new liblas::ReprojectionTransform(in_ref, out_ref, liblas::HeaderPtr(new liblas::Header(header))));
+        transforms.push_back(srs_transform);
+    }
+
+    if (vm.count("point-translate")) 
+    {
+        std::string translate = vm["point-translate"].as< std::string >();
+        if (verbose)
+        {
+
+                std::cout << "Translating points with expression: " << translate << std::endl;
+        }
+        liblas::TransformPtr trans_trans = liblas::TransformPtr(new liblas::TranslationTransform(translate));
+        transforms.push_back(trans_trans);
+    }
     return transforms;
 }
 
diff --git a/Utilities/otbliblas/apps/laskernel.hpp b/Utilities/otbliblas/apps/laskernel.hpp
old mode 100755
new mode 100644
index 5cd6aa09d654c04fae1a1ad0314218114daac760..e204fb662d57ddacb7d5a46f26cb3f76ad56841d
--- a/Utilities/otbliblas/apps/laskernel.hpp
+++ b/Utilities/otbliblas/apps/laskernel.hpp
@@ -65,7 +65,7 @@
 using namespace std;
 namespace po = boost::program_options;
 
-#define SEPARATORS ",|"
+#define SEPARATORS ",| "
 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
 
 bool IsDualRangeFilter(std::string parse_string) ;
@@ -92,9 +92,9 @@ std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbo
 #define compare_no_case(a,b,n)  strncasecmp( (a), (b), (n) )
 #endif
 
-std::istream* OpenInput(std::string filename, bool bEnd);
-std::string TryReadFileData(std::string filename);
-std::vector<char> TryReadRawFileData(std::string filename);
+// std::istream* OpenInput(std::string const& filename, bool bEnd);
+std::string TryReadFileData(std::string const& filename);
+std::vector<char> TryReadRawFileData(std::string const& filename);
 bool term_progress(std::ostream& os, double complete);
 void SetStreamPrecision(std::ostream& os, double scale);
 
diff --git a/Utilities/otbliblas/apps/liblas-config.in b/Utilities/otbliblas/apps/liblas-config.in
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/apps/oci_util.cpp b/Utilities/otbliblas/apps/oci_util.cpp
index cb9584eb188a639dc28c7e1656c1d999a817b82a..8ff230965e9e8df7e28b789b1465a03afd714594 100755
--- a/Utilities/otbliblas/apps/oci_util.cpp
+++ b/Utilities/otbliblas/apps/oci_util.cpp
@@ -1,7 +1,6 @@
 #include "oci_util.hpp"
 
 
-
 std::string ReadSQLData(std::string filename)
 {
     std::istream* infile = OpenInput(filename.c_str(), true);
@@ -166,12 +165,17 @@ bool BlockTableExists(OWConnection* connection, std::string tableName)
     
     try {
         statement->Execute();
-    } catch (std::runtime_error const& e) {
-        delete statement;
-        std::ostringstream oss;
-        oss << "Failed select if block table "<< tableName << " exists.  Do you have rights to select?"  
-            << std::endl << e.what() << std::endl;
-        throw std::runtime_error(oss.str());
+    } catch (std::runtime_error const& ) {
+        // Assume for now that an error returned here is OCI_NODATA, which means 
+        // the table doesn't exist.  If this really isn't the case, we're going 
+        // to get more legit message further down the line.
+
+        return false;
+        // delete statement;
+        // std::ostringstream oss;
+        // oss << "Failed select if block table "<< tableName << " exists.  Do you have rights to select?"  
+        //     << std::endl << e.what() << std::endl;
+        // throw std::runtime_error(oss.str());
     }  
     
     return true;
diff --git a/Utilities/otbliblas/apps/oci_util.hpp b/Utilities/otbliblas/apps/oci_util.hpp
index f73ab3223241654ffc6f918abf1e31c1edd16ce6..3c42eae090aa144bf4737a49bb3501873bde80aa 100755
--- a/Utilities/otbliblas/apps/oci_util.hpp
+++ b/Utilities/otbliblas/apps/oci_util.hpp
@@ -33,7 +33,7 @@ bool WipeBlockTable(   OWConnection* connection,
                     std::string cloudColumnName);
 std::string to_upper(const std::string&);
 std::string ReadSQLData(std::string filename);
-std::istream* OpenInput(std::string filename, bool bEnd) ;
+std::istream* OpenInput(std::string const& filename, bool bEnd) ;
 
 #ifdef _WIN32
 #define compare_no_case(a,b,n)  _strnicmp( (a), (b), (n) )
diff --git a/Utilities/otbliblas/apps/oci_wrapper.cpp b/Utilities/otbliblas/apps/oci_wrapper.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/apps/oci_wrapper.h b/Utilities/otbliblas/apps/oci_wrapper.h
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/apps/ts2las.cpp b/Utilities/otbliblas/apps/ts2las.cpp
index 8bb08e145b4f7c989ab532da4355a556d28397a3..3692a056a5df244320f99eceb01825d27dad8e84 100755
--- a/Utilities/otbliblas/apps/ts2las.cpp
+++ b/Utilities/otbliblas/apps/ts2las.cpp
@@ -120,7 +120,6 @@ bool ReadHeader(ScanHdr* hdr, std::istream* istrm)
         return false;
     }    
 
-    return true;
 }
 
 bool WritePoints(liblas::Writer* writer, std::istream* strm, ScanHdr* hdr) 
@@ -136,9 +135,9 @@ bool WritePoints(liblas::Writer* writer, std::istream* strm, ScanHdr* hdr)
             {
                 // std::cout << "stream position is: " << strm->tellg() << std::endl;
                 if (hdr->HdrVersion == 20020715) {
-                    detail::read_n(*point, *strm, sizeof(ScanPnt));
+                    liblas::detail::read_n(*point, *strm, sizeof(ScanPnt));
                 } else{
-                    detail::read_n(*row, *strm, sizeof(ScanRow));
+                    liblas::detail::read_n(*row, *strm, sizeof(ScanRow));
                     point->Pnt.x = row->x;
                     point->Pnt.y = row->y;
                     point->Pnt.z = row->z;
@@ -149,8 +148,7 @@ bool WritePoints(liblas::Writer* writer, std::istream* strm, ScanHdr* hdr)
                 }
                 Point p;
 
-                p.SetCoordinates(writer->GetHeader(),
-                                    point->Pnt.x,
+                p.SetCoordinates( point->Pnt.x,
                                     point->Pnt.y,
                                     point->Pnt.z);
 
@@ -160,8 +158,8 @@ bool WritePoints(liblas::Writer* writer, std::istream* strm, ScanHdr* hdr)
                 p.SetClassification(point->Code);
                 p.SetIntensity(point->Intensity);
                 if (hdr->Time) {
-                    liblas::uint32_t t = 0xFFFFFFFF;
-                    detail::read_n(t, *strm, sizeof(t));
+                    boost::uint32_t t = 0xFFFFFFFF;
+                    liblas::detail::read_n(t, *strm, sizeof(t));
 
                     // Time stamps are assumed to be GPS week seconds. The 
                     // storage format is a 32 bit unsigned integer where 
@@ -170,15 +168,15 @@ bool WritePoints(liblas::Writer* writer, std::istream* strm, ScanHdr* hdr)
                     p.SetTime(t*0.0002);
                 }
                 if (hdr->Color) {
-                    liblas::uint8_t r, g, b, a = 0;
+                    boost::uint8_t r, g, b, a = 0;
                     liblas::Color color;
-                    detail::read_n(r, *strm, sizeof(r));
-                    detail::read_n(b, *strm, sizeof(b));
-                    detail::read_n(g, *strm, sizeof(g));
+                    liblas::detail::read_n(r, *strm, sizeof(r));
+                    liblas::detail::read_n(b, *strm, sizeof(b));
+                    liblas::detail::read_n(g, *strm, sizeof(g));
                     
                     // TS .bin says to read 4 bytes here for some reason.  Maybe 
                     // this is an alpha value or something
-                    detail::read_n(a, *strm, sizeof(a));
+                    liblas::detail::read_n(a, *strm, sizeof(a));
                     
                     color.SetGreen(g);
                     color.SetBlue(b);
diff --git a/Utilities/otbliblas/apps/ts2las.hpp b/Utilities/otbliblas/apps/ts2las.hpp
index 4b44c5aaf319f2d525e5a1b16f83545400e247c9..dccc1bb10ca3814daacd9f320edeb968cd2f59a5 100755
--- a/Utilities/otbliblas/apps/ts2las.hpp
+++ b/Utilities/otbliblas/apps/ts2las.hpp
@@ -2,9 +2,8 @@
 
 #include <liblas/detail/private_utility.hpp>
 
-#include <liblas/laswriter.hpp>
-#include <liblas/laspoint.hpp>
-#include <liblas/lascolor.hpp>
+#include <liblas/liblas.hpp>
+
 #include <iostream>
 #ifdef _WIN32
 #define compare_no_case(a,b,n)  _strnicmp( (a), (b), (n) )
@@ -25,13 +24,13 @@ struct ScanRow
         z(0)
     {}
 
-    liblas::uint8_t Code;
-    liblas::uint8_t Line;
-    liblas::uint16_t EchoInt;
+    boost::uint8_t Code;
+    boost::uint8_t Line;
+    boost::uint16_t EchoInt;
 
-    liblas::int32_t x;
-    liblas::int32_t y;
-    liblas::int32_t z;
+    boost::int32_t x;
+    boost::int32_t y;
+    boost::int32_t z;
 
 };
 
@@ -44,9 +43,9 @@ struct Point3d
         z(0)
     {}
 
-    liblas::int32_t x;
-    liblas::int32_t y;
-    liblas::int32_t z;
+    boost::int32_t x;
+    boost::int32_t y;
+    boost::int32_t z;
 
 };
 
@@ -62,12 +61,12 @@ struct ScanPnt
     {}
 
     Point3d Pnt;
-    liblas::uint8_t Code;
-    liblas::uint8_t Echo;
-    liblas::uint8_t Flag;
-    liblas::uint8_t Mark;
-    liblas::uint16_t Line;
-    liblas::uint16_t Intensity;
+    boost::uint8_t Code;
+    boost::uint8_t Echo;
+    boost::uint8_t Flag;
+    boost::uint8_t Mark;
+    boost::uint16_t Line;
+    boost::uint16_t Intensity;
 
 };
 
@@ -87,17 +86,17 @@ struct ScanHdr
         Color(0)
     {}
 
-    liblas::int32_t HdrSize;
-    liblas::int32_t HdrVersion;
-    liblas::int32_t Tunniste;
+    boost::int32_t HdrSize;
+    boost::int32_t HdrVersion;
+    boost::int32_t Tunniste;
     char Magic[4];
-    liblas::int32_t PntCnt;
-    liblas::int32_t Units;
+    boost::int32_t PntCnt;
+    boost::int32_t Units;
     double OrgX;
     double OrgY;
     double OrgZ;
-    liblas::int32_t Time;
-    liblas::int32_t Color;
+    boost::int32_t Time;
+    boost::int32_t Color;
 
     // 
     // int HdrSize;
diff --git a/Utilities/otbliblas/buildout/bootstrap.py b/Utilities/otbliblas/buildout/bootstrap.py
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/cmake/modules/BuildOSGeo4W.cmake b/Utilities/otbliblas/cmake/modules/BuildOSGeo4W.cmake
old mode 100755
new mode 100644
index bd609ac97c9cd77e63cb862cfb07fc7274fe701c..53c86b2ae0527f753a9abab30b0abd9bd7a6f563
--- a/Utilities/otbliblas/cmake/modules/BuildOSGeo4W.cmake
+++ b/Utilities/otbliblas/cmake/modules/BuildOSGeo4W.cmake
@@ -7,7 +7,11 @@
 MESSAGE(STATUS "Building osgeo4w binaries")
 set(OSGEO4W_DIR osgeo4w)
 set(OSGEO4W_LIB_DIR ${OSGEO4W_DIR}/lib)
+set(OSGEO4W_ETC_DIR ${OSGEO4W_DIR}/etc)
+set(OSGEO4W_ETC_INI_DIR ${OSGEO4W_DIR}/etc/ini)
+set(OSGEO4W_ETC_POSTINSTALL_DIR ${OSGEO4W_DIR}/etc/postinstall)
 set(OSGEO4W_LIB_BIN_DIR ${OSGEO4W_DIR}/lib/bin)
+set(OSGEO4W_BIN_DIR ${OSGEO4W_DIR}/bin)
 set(OSGEO4W_DEVEL_DIR ${OSGEO4W_DIR}/devel)
 set(OSGEO4W_DEVEL_INCLUDE_DIR ${OSGEO4W_DEVEL_DIR}/include)
 set(OSGEO4W_DEVEL_INCLUDE_LIBLAS_DIR ${OSGEO4W_DEVEL_INCLUDE_DIR}/liblas)
@@ -20,6 +24,9 @@ set(OSGEO4W_PACKAGES ${OSGEO4W_DIR}/packages)
 
 set(OSGEO4W_DIRECTORIES
     ${OSGEO4W_DIR}
+    ${OSGEO4W_ETC_DIR}
+    ${OSGEO4W_ETC_INI_DIR}
+    ${OSGEO4W_ETC_POSTINSTALL_DIR}
     ${OSGEO4W_LIB_DIR}
     ${OSGEO4W_LIB_BIN_DIR}
     ${OSGEO4W_DEVEL_DIR}
@@ -28,14 +35,15 @@ set(OSGEO4W_DIRECTORIES
     ${OSGEO4W_DEVEL_LIB_DIR}
     ${OSGEO4W_PYTHON_DIR}
     ${OSGEO4W_DEVEL_BIN_DIR}
-    ${OSGEO4W_PACKAGES})
+    ${OSGEO4W_PACKAGES}
+    ${OSGEO4W_BIN_DIR})
 
 
 
 add_custom_target(make_osgeo4w_directories
   COMMAND ${CMAKE_COMMAND} -E echo "Building OSGeo4W install directories")
 
-add_dependencies(  make_osgeo4w_directories las2las2  )
+add_dependencies(  make_osgeo4w_directories las2las )
 
 macro (make_directories)
     add_custom_command(
@@ -78,34 +86,62 @@ macro(copy_files GLOBPAT DESTINATION  )
 endmacro(copy_files)
 
 
+macro(copy_directory SOURCE DESTINATION  )
+    
+    MESSAGE(STATUS "   Copying ${SOURCE} to ${DESTINATION}")
+        add_custom_command(
+            TARGET copy
+            COMMAND ${CMAKE_COMMAND} -E copy_directory ${SOURCE} ${DESTINATION}
+        )
+endmacro(copy_directory)
+
+
 add_custom_target(tar
   COMMAND ${CMAKE_COMMAND} -E echo "Tarring OSGeo4W install")
 add_dependencies( tar copy  )
 
-macro (tar_directories source destination base_path)
+macro (tar_directories source destination base_paths)
 
     MESSAGE(STATUS "   Tarring ${source} to ${destination}")
+    
     add_custom_command(
         TARGET tar
-        COMMAND ${CMAKE_COMMAND} -E chdir ${source} cmake -E tar czf  ${destination} ${base_path}/
+        COMMAND ${CMAKE_COMMAND} -E chdir ${source} cmake -E tar cjf  ${destination} ${base_paths}
     )
 
 
 endmacro(tar_directories)
 
 make_directories()
-copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/las* ${OSGEO4W_DEVEL_BIN_DIR}/  )
-copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/*[.${SO_EXT}] ${OSGEO4W_DEVEL_BIN_DIR}/  )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/lasinfo.exe ${OSGEO4W_BIN_DIR}/lasinfo.exe  )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/lasinfo-old.exe ${OSGEO4W_BIN_DIR}/lasinfo-old.exe   )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/las2las.exe ${OSGEO4W_BIN_DIR}/las2las.exe  )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/las2las-old.exe ${OSGEO4W_BIN_DIR}/las2las-old.exe  )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/las2ogr.exe ${OSGEO4W_BIN_DIR}/las2ogr.exe   )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/las2oci.exe ${OSGEO4W_BIN_DIR}/las2oci.exe  )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/las2txt.exe ${OSGEO4W_BIN_DIR}/las2txt.exe  )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/lasblock.exe ${OSGEO4W_BIN_DIR}/lasblock.exe   )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/lasmerge.exe ${OSGEO4W_BIN_DIR}/lasmerge.exe  )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/txt2las.exe ${OSGEO4W_BIN_DIR}/txt2las.exe  )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/ts2las.exe ${OSGEO4W_BIN_DIR}/ts2las.exe  )
+
+
+
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/liblas_c.dll ${OSGEO4W_BIN_DIR}/  )
+copy_files(${libLAS_SOURCE_DIR}/liblas-osgeo4w-start.bat.tmpl ${OSGEO4W_BIN_DIR}/liblas.bat.tmpl )
+copy_files(${libLAS_SOURCE_DIR}/liblas-osgeo4w-init.bat ${OSGEO4W_ETC_INI_DIR}/liblas.bat )
+copy_files(${libLAS_SOURCE_DIR}/liblas-osgeo4w-postinstall.bat ${OSGEO4W_ETC_POSTINSTALL_DIR}/liblas.bat )
+
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/liblas.lib ${OSGEO4W_DEVEL_LIB_DIR}/  )
+copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/liblas_c.lib ${OSGEO4W_DEVEL_LIB_DIR}/  )
 
-copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/*.lib ${OSGEO4W_DEVEL_LIB_DIR}/  )
-copy_files(${LIBLAS_BUILD_OUTPUT_DIRECTORY}/*.a ${OSGEO4W_DEVEL_LIB_DIR}/  )
 
-copy_files(./include/liblas/* ${OSGEO4W_DEVEL_INCLUDE_LIBLAS_DIR}/  )
+copy_directory(./include/liblas/ ${OSGEO4W_DEVEL_INCLUDE_LIBLAS_DIR}/  )
 copy_files(./python/liblas/*.py ${OSGEO4W_PYTHON_DIR}/  )
 
-tar_directories(${OSGEO4W_DEVEL_DIR} ${libLAS_SOURCE_DIR}/${OSGEO4W_PACKAGES}/liblas-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.tar.gz bin)
-tar_directories(${OSGEO4W_DIR} ${libLAS_SOURCE_DIR}/${OSGEO4W_PACKAGES}/liblas-python-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.tar.gz apps)
-tar_directories(${OSGEO4W_DIR} ${libLAS_SOURCE_DIR}/${OSGEO4W_PACKAGES}/liblas-devel-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.tar.gz devel)
+tar_directories(${OSGEO4W_DIR} ${libLAS_SOURCE_DIR}/${OSGEO4W_PACKAGES}/liblas-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${OSGEO4W_UPSTREAM_RELEASE}.tar.bz2 "bin/;etc/")
+tar_directories(${OSGEO4W_DIR} ${libLAS_SOURCE_DIR}/${OSGEO4W_PACKAGES}/liblas-python-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${OSGEO4W_UPSTREAM_RELEASE}.tar.bz2 apps)
+tar_directories(${OSGEO4W_DIR}/devel ${libLAS_SOURCE_DIR}/${OSGEO4W_PACKAGES}/liblas-devel-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${OSGEO4W_UPSTREAM_RELEASE}.tar.bz2 "lib/;include")
 
 
 add_custom_target(osgeo4w
diff --git a/Utilities/otbliblas/cmake/modules/FindGDAL.cmake b/Utilities/otbliblas/cmake/modules/FindGDAL.cmake
old mode 100755
new mode 100644
index a6a54c6a6eefa5a6e997e813aefe7df131b9fa4c..3760894f1ba92da4f57851cfa8eff2556ec70875
--- a/Utilities/otbliblas/cmake/modules/FindGDAL.cmake
+++ b/Utilities/otbliblas/cmake/modules/FindGDAL.cmake
@@ -55,6 +55,7 @@ IF(WIN32)
             NAMES gdal.h 
             PATH_PREFIXES gdal gdal-1.6
             PATHS
+            "${OSGEO4W_ROOT_DIR}/apps/gdal-dev/include"
             "$ENV{LIB_DIR}/include/gdal"
             ${OSGEO4W_ROOT_DIR}/include)
 
@@ -66,6 +67,7 @@ IF(WIN32)
             "$ENV{LIB_DIR}/lib"
             /usr/lib
             c:/msys/local/lib
+            "${OSGEO4W_ROOT_DIR}/apps/gdal-dev/lib"            
             ${OSGEO4W_ROOT_DIR}/lib)
         
         IF(GDAL_LIBRARY)
diff --git a/Utilities/otbliblas/cmake/modules/FindGeoTIFF.cmake b/Utilities/otbliblas/cmake/modules/FindGeoTIFF.cmake
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/cmake/modules/FindOracle.cmake b/Utilities/otbliblas/cmake/modules/FindOracle.cmake
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/cmake/modules/FindSpatialIndex.cmake b/Utilities/otbliblas/cmake/modules/FindSpatialIndex.cmake
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/cmake_install.cmake b/Utilities/otbliblas/cmake_install.cmake
old mode 100755
new mode 100644
index 2bd7bb7aa3064f0f49f95d51a0c0038029868718..3c09b670176b7799830d26be0a9f9dd66251f6ae
--- a/Utilities/otbliblas/cmake_install.cmake
+++ b/Utilities/otbliblas/cmake_install.cmake
@@ -1,4 +1,4 @@
-# Install script for directory: /tmp/liblas-main
+# Install script for directory: /tmp/liblas
 
 # Set the install prefix
 IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
@@ -29,19 +29,19 @@ ENDIF(NOT CMAKE_INSTALL_COMPONENT)
 
 IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
   FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/share/liblas/doc" TYPE FILE FILES
-    "/tmp/liblas-main/AUTHORS"
-    "/tmp/liblas-main/COPYING"
-    "/tmp/liblas-main/INSTALL"
-    "/tmp/liblas-main/LICENSE.txt"
-    "/tmp/liblas-main/README.txt"
+    "/tmp/liblas/AUTHORS"
+    "/tmp/liblas/COPYING"
+    "/tmp/liblas/INSTALL"
+    "/tmp/liblas/LICENSE.txt"
+    "/tmp/liblas/README.txt"
     )
 ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
 
 IF(NOT CMAKE_INSTALL_LOCAL_ONLY)
   # Include the install script for each subdirectory.
-  INCLUDE("/tmp/liblas-main/src/cmake_install.cmake")
-  INCLUDE("/tmp/liblas-main/apps/cmake_install.cmake")
-  INCLUDE("/tmp/liblas-main/test/cmake_install.cmake")
+  INCLUDE("/tmp/liblas/src/cmake_install.cmake")
+  INCLUDE("/tmp/liblas/apps/cmake_install.cmake")
+  INCLUDE("/tmp/liblas/test/cmake_install.cmake")
 
 ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)
 
@@ -51,7 +51,7 @@ ELSE(CMAKE_INSTALL_COMPONENT)
   SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
 ENDIF(CMAKE_INSTALL_COMPONENT)
 
-FILE(WRITE "/tmp/liblas-main/${CMAKE_INSTALL_MANIFEST}" "")
+FILE(WRITE "/tmp/liblas/${CMAKE_INSTALL_MANIFEST}" "")
 FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})
-  FILE(APPEND "/tmp/liblas-main/${CMAKE_INSTALL_MANIFEST}" "${file}\n")
+  FILE(APPEND "/tmp/liblas/${CMAKE_INSTALL_MANIFEST}" "${file}\n")
 ENDFOREACH(file)
diff --git a/Utilities/otbliblas/csharp/HelloWorldLAS/HelloWorldLAS.csproj b/Utilities/otbliblas/csharp/HelloWorldLAS/HelloWorldLAS.csproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/HelloWorldLAS/HelloWorldLAS_Express.csproj b/Utilities/otbliblas/csharp/HelloWorldLAS/HelloWorldLAS_Express.csproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/HelloWorldLAS/Program.cs b/Utilities/otbliblas/csharp/HelloWorldLAS/Program.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/HelloWorldLAS/Properties/AssemblyInfo.cs b/Utilities/otbliblas/csharp/HelloWorldLAS/Properties/AssemblyInfo.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/NUnitTest/LASFilesClass.cs b/Utilities/otbliblas/csharp/NUnitTest/LASFilesClass.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/NUnitTest/LASGuidTest.cs b/Utilities/otbliblas/csharp/NUnitTest/LASGuidTest.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/NUnitTest/LASHeaderTest.cs b/Utilities/otbliblas/csharp/NUnitTest/LASHeaderTest.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/NUnitTest/LASPointTest.cs b/Utilities/otbliblas/csharp/NUnitTest/LASPointTest.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/NUnitTest/LASReaderTest.cs b/Utilities/otbliblas/csharp/NUnitTest/LASReaderTest.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/NUnitTest/LASVariableLengthRecordTest.cs b/Utilities/otbliblas/csharp/NUnitTest/LASVariableLengthRecordTest.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/NUnitTest/LASWriterTest.cs b/Utilities/otbliblas/csharp/NUnitTest/LASWriterTest.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/NUnitTest/NUnitTest.csproj b/Utilities/otbliblas/csharp/NUnitTest/NUnitTest.csproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/NUnitTest/NUnitTest_Express.csproj b/Utilities/otbliblas/csharp/NUnitTest/NUnitTest_Express.csproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/NUnitTest/Properties/AssemblyInfo.cs b/Utilities/otbliblas/csharp/NUnitTest/Properties/AssemblyInfo.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/Samples/Read_Express/ReadLAS.cs b/Utilities/otbliblas/csharp/Samples/Read_Express/ReadLAS.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/Samples/Read_Express/Read_Express.csproj b/Utilities/otbliblas/csharp/Samples/Read_Express/Read_Express.csproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/Samples/WriteLAS/Properties/AssemblyInfo.cs b/Utilities/otbliblas/csharp/Samples/WriteLAS/Properties/AssemblyInfo.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/Samples/WriteLAS/Write_Express.csproj b/Utilities/otbliblas/csharp/Samples/WriteLAS/Write_Express.csproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/AssemblyInfo.cs b/Utilities/otbliblas/csharp/dotnetLibLAS/AssemblyInfo.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/LASException.cs b/Utilities/otbliblas/csharp/dotnetLibLAS/LASException.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/LASGuid.cs b/Utilities/otbliblas/csharp/dotnetLibLAS/LASGuid.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/LASHeader.cs b/Utilities/otbliblas/csharp/dotnetLibLAS/LASHeader.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/LASPoint.cs b/Utilities/otbliblas/csharp/dotnetLibLAS/LASPoint.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/LASReader.cs b/Utilities/otbliblas/csharp/dotnetLibLAS/LASReader.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/LASVariableLengthRecord.cs b/Utilities/otbliblas/csharp/dotnetLibLAS/LASVariableLengthRecord.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/LASWriter.cs b/Utilities/otbliblas/csharp/dotnetLibLAS/LASWriter.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/LibLASCAPI.cs b/Utilities/otbliblas/csharp/dotnetLibLAS/LibLASCAPI.cs
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/dotnetLibLAS.csproj b/Utilities/otbliblas/csharp/dotnetLibLAS/dotnetLibLAS.csproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/dotnetLibLAS.dll.config b/Utilities/otbliblas/csharp/dotnetLibLAS/dotnetLibLAS.dll.config
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/dotnetLibLAS_Express.csproj b/Utilities/otbliblas/csharp/dotnetLibLAS/dotnetLibLAS_Express.csproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/dotnetLibLas.xml b/Utilities/otbliblas/csharp/dotnetLibLAS/dotnetLibLas.xml
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/csharp/dotnetLibLAS/liblas.snk b/Utilities/otbliblas/csharp/dotnetLibLAS/liblas.snk
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/CMakeLists.txt b/Utilities/otbliblas/include/CMakeLists.txt
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/capi/las_config.h b/Utilities/otbliblas/include/liblas/capi/las_config.h
old mode 100755
new mode 100644
index 695878ad0e57bac6dad2e5722699e30e2fdbb27c..f84e15254eb1c84020dc5cea52ad04a91127e46a
--- a/Utilities/otbliblas/include/liblas/capi/las_config.h
+++ b/Utilities/otbliblas/include/liblas/capi/las_config.h
@@ -55,17 +55,9 @@
 #  define LAS_C_END
 #endif
 
-#ifndef LAS_DLL
-#if defined(_MSC_VER) && !defined(LAS_DISABLE_DLL)
-#  define LAS_DLL     __declspec(dllexport)
-#else
-#  if defined(USE_GCC_VISIBILITY_FLAG)
-#    define LAS_DLL     __attribute__ ((visibility("default")))
-#  else
-#    define LAS_DLL
-#  endif
-#endif
-#endif
+LAS_C_START
+#include <liblas/export.hpp>
+LAS_C_END
 
 #ifndef NULL
 #define NULL 0
diff --git a/Utilities/otbliblas/include/liblas/capi/las_version.h b/Utilities/otbliblas/include/liblas/capi/las_version.h
old mode 100755
new mode 100644
index c86d0d126861179be1d75f46938806c6a0d774e2..d67015e3c3d04bc0b61774619ba5dd3093a2160a
--- a/Utilities/otbliblas/include/liblas/capi/las_version.h
+++ b/Utilities/otbliblas/include/liblas/capi/las_version.h
@@ -45,7 +45,7 @@
 #ifndef LIBLAS_VERSION_MAJOR
 #define LIBLAS_VERSION_MAJOR    1
 #define LIBLAS_VERSION_MINOR    6
-#define LIBLAS_VERSION_REV      0b1
+#define LIBLAS_VERSION_REV      0b2
 #define LIBLAS_VERSION_BUILD    0
 #endif
 
@@ -54,11 +54,11 @@
 #endif
 
 #ifndef LIBLAS_RELEASE_DATE
-#define LIBLAS_RELEASE_DATE     20101012
+#define LIBLAS_RELEASE_DATE     20101105
 #endif
 
 #ifndef LIBLAS_RELEASE_NAME
-#define LIBLAS_RELEASE_NAME     "1.6.0b1"
+#define LIBLAS_RELEASE_NAME     "1.6.0b2"
 #endif
 
 #endif /* LAS_VERSION_H_INCLUDED */
diff --git a/Utilities/otbliblas/include/liblas/capi/liblas.h b/Utilities/otbliblas/include/liblas/capi/liblas.h
index c9a5f5923cfe0f032491e39c5838f3e625ed2041..31e178cdfb7471f6ad74266a3a2c4b3a74f2348c 100755
--- a/Utilities/otbliblas/include/liblas/capi/liblas.h
+++ b/Utilities/otbliblas/include/liblas/capi/liblas.h
@@ -46,6 +46,7 @@
 
 #include "las_version.h"
 #include "las_config.h"
+#include <liblas/export.hpp>
 
 typedef struct LASWriterHS *LASWriterH;
 typedef struct LASReaderHS *LASReaderH;
@@ -1154,8 +1155,8 @@ LAS_DLL unsigned int LASSRS_GetVLRCount(const LASSRSH hSRS);
 */
 LAS_DLL void LASString_Free(char* string);
 
-LAS_DLL unsigned short LASSchema_GetByteSize( LASSchemaH hFormat);
-LAS_DLL unsigned short LASSchema_GetBaseByteSize( LASSchemaH hFormat);
+LAS_DLL unsigned int LASSchema_GetByteSize( LASSchemaH hFormat);
+LAS_DLL unsigned int LASSchema_GetBaseByteSize( LASSchemaH hFormat);
 
 
 
diff --git a/Utilities/otbliblas/include/liblas/compatibility.hpp b/Utilities/otbliblas/include/liblas/compatibility.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/detail/file_ptr_stream.hpp b/Utilities/otbliblas/include/liblas/detail/file_ptr_stream.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/detail/index/indexcell.hpp b/Utilities/otbliblas/include/liblas/detail/index/indexcell.hpp
old mode 100755
new mode 100644
index 2b9a16e945706b1a311677e867f39fe26b58b86f..3c0b53282078ca8d6070df2d5ef25e7d78a60c84
--- a/Utilities/otbliblas/include/liblas/detail/index/indexcell.hpp
+++ b/Utilities/otbliblas/include/liblas/detail/index/indexcell.hpp
@@ -55,6 +55,7 @@ typedef boost::uint32_t ElevRange;
 typedef boost::uint8_t	ConsecPtAccumulator;
 typedef std::map<boost::uint32_t, ConsecPtAccumulator> IndexCellData;
 typedef std::map<boost::uint32_t, IndexCellData> IndexSubCellData;
+typedef boost::uint64_t	TempFileOffsetType;
 
 class IndexCell
 {
@@ -62,7 +63,7 @@ public:
 	IndexCell();
 	
 private:
-	boost::uint32_t m_FileOffset;
+	TempFileOffsetType m_FileOffset;
 	boost::uint32_t m_NumPoints;
 	ElevExtrema m_MinZ, m_MaxZ;
 	IndexCellData m_PtRecords;
@@ -70,15 +71,15 @@ private:
 	IndexSubCellData m_SubCellRecords;
 
 public:
-	void SetFileOffset(boost::uint32_t fos);
+	void SetFileOffset(TempFileOffsetType fos);
 	void SetNumPoints(boost::uint32_t nmp);
-	boost::uint32_t GetFileOffset(void) const;
+	TempFileOffsetType GetFileOffset(void) const;
 	boost::uint32_t GetNumRecords(void) const;
 	boost::uint32_t GetNumPoints(void) const;
 	boost::uint32_t GetNumSubCellRecords(void) const;
 	boost::uint32_t GetNumZCellRecords(void) const;
-	ElevExtrema GetMinZ(void) const {return m_MinZ;};
-	ElevExtrema GetMaxZ(void) const {return m_MaxZ;};
+	ElevExtrema GetMinZ(void) const {return m_MinZ;}
+	ElevExtrema GetMaxZ(void) const {return m_MaxZ;}
 	bool RoomToAdd(boost::uint32_t a);
 	void AddPointRecord(boost::uint32_t a);
 	void AddPointRecord(boost::uint32_t a, boost::uint8_t b);
@@ -98,8 +99,6 @@ public:
 	const IndexSubCellData::iterator GetEndSubCell(void);
 	const IndexSubCellData::iterator GetFirstZCellRecord(void);
 	const IndexSubCellData::iterator GetEndZCell(void);
-
-	
 };
 
 }} // namespace liblas::detail
diff --git a/Utilities/otbliblas/include/liblas/detail/index/indexoutput.hpp b/Utilities/otbliblas/include/liblas/detail/index/indexoutput.hpp
old mode 100755
new mode 100644
index 8d13ffc9f878d3cff60432bff2107d7901ed32ff..cd98529d6627b1f74e395e9516dfe27b99a6d511
--- a/Utilities/otbliblas/include/liblas/detail/index/indexoutput.hpp
+++ b/Utilities/otbliblas/include/liblas/detail/index/indexoutput.hpp
@@ -58,8 +58,8 @@ private:
 	liblas::Index *m_index;
 	liblas::VariableRecord m_indexVLRHeaderRecord, m_indexVLRCellRecord;
 	IndexVLRData m_indexVLRHeaderData, m_indexVLRCellPointData, m_indexVLRTempData;
-	boost::uint32_t m_VLRCommonDataSize, m_VLRDataSizeLocation, m_FirstCellLocation, m_LastCellLocation;
-	boost::uint32_t  m_DataRecordSize, m_TempWritePos;
+	boost::uint32_t m_VLRCommonDataSize, m_VLRDataSizeLocation, m_FirstCellLocation, m_LastCellLocation, m_VLRPointCountLocation;
+	boost::uint32_t  m_DataRecordSize, m_TempWritePos, m_DataPointsThisVLR;
 	bool m_FirstCellInVLR, m_SomeDataReadyToWrite;
 	
 protected:
diff --git a/Utilities/otbliblas/include/liblas/detail/pointrecord.hpp b/Utilities/otbliblas/include/liblas/detail/pointrecord.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/detail/private_utility.hpp b/Utilities/otbliblas/include/liblas/detail/private_utility.hpp
old mode 100755
new mode 100644
index 75e63c274b2a94cf474811dae9be7514d8594e2b..fa3ab3491eb3c57778132c9fdf8131b5154fa3a4
--- a/Utilities/otbliblas/include/liblas/detail/private_utility.hpp
+++ b/Utilities/otbliblas/include/liblas/detail/private_utility.hpp
@@ -223,19 +223,6 @@ bool operator!=(Point<T> const& lhs, Point<T> const& rhs)
 //     return (!lhs.equal(rhs));
 // }
 
-template <typename T>
-inline T generate_random_byte()
-{
-    // Requires pseudo-random numbers generator to be initialized
-    // in create_random_based() function - a poor man solution.
-    T const rmin = (std::numeric_limits<T>::min)();
-    T const rmax = (std::numeric_limits<T>::max)();
-    unsigned int const rnd = std::rand() % rmax + rmin;
-
-    assert(rnd <= 255);
-    return static_cast<T>(rnd);
-}
-
 template <typename T> 
 bool compare_distance(const T& actual, const T& expected) 
 { 
diff --git a/Utilities/otbliblas/include/liblas/detail/reader/cachedreader.hpp b/Utilities/otbliblas/include/liblas/detail/reader/cachedreader.hpp
old mode 100755
new mode 100644
index 9861a434ede256de0e7fe36ef0ae21b6ba83b64e..42ac3a2fba375ece7b1326525befc7c81e889dcb
--- a/Utilities/otbliblas/include/liblas/detail/reader/cachedreader.hpp
+++ b/Utilities/otbliblas/include/liblas/detail/reader/cachedreader.hpp
@@ -89,6 +89,7 @@ private:
 
     typedef std::vector<liblas::Point> cache_type;
     cache_type m_cache;
+    bool m_cache_initialized;
 };
 
 
diff --git a/Utilities/otbliblas/include/liblas/detail/reader/point.hpp b/Utilities/otbliblas/include/liblas/detail/reader/point.hpp
index adedad5d6ea2cf93cd9885d5b75255b1ee26805b..8f053fa97d5f380a284b184fab983ca2eb0dad19 100755
--- a/Utilities/otbliblas/include/liblas/detail/reader/point.hpp
+++ b/Utilities/otbliblas/include/liblas/detail/reader/point.hpp
@@ -81,9 +81,6 @@ private:
     HeaderPtr m_header;
     liblas::Point m_point;
     std::vector<boost::uint8_t> m_raw_data;
-    
-    void setup();
-
 };
 
 
diff --git a/Utilities/otbliblas/include/liblas/exception.hpp b/Utilities/otbliblas/include/liblas/exception.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/export.hpp b/Utilities/otbliblas/include/liblas/export.hpp
new file mode 100755
index 0000000000000000000000000000000000000000..11f52af3b4a2c76f2a23ece52a6f95ad49533ed2
--- /dev/null
+++ b/Utilities/otbliblas/include/liblas/export.hpp
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * $Id$
+ *
+ * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose:  LAS DLL export macros file
+ * Author:   Howard Butler, hobu@hobu.net
+ *
+ ******************************************************************************
+ * Copyright (c) 2010, Howard Butler
+ *
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following 
+ * conditions are met:
+ * 
+ *     * Redistributions of source code must retain the above copyright 
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright 
+ *       notice, this list of conditions and the following disclaimer in 
+ *       the documentation and/or other materials provided 
+ *       with the distribution.
+ *     * Neither the name of the Martin Isenburg or Iowa Department 
+ *       of Natural Resources nor the names of its contributors may be 
+ *       used to endorse or promote products derived from this software 
+ *       without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE.
+ ****************************************************************************/
+
+#ifndef LASEXPORT_HPP_INCLUDED
+#define LASEXPORT_HPP_INCLUDED
+
+#ifndef LAS_DLL
+#if defined(_MSC_VER) && !defined(LAS_DISABLE_DLL)
+#if defined(LAS_DLL_EXPORT)
+#   define LAS_DLL   __declspec(dllexport)
+#elif defined(LAS_DLL_IMPORT)
+#   define LAS_DLL   __declspec(dllimport)
+#endif
+#else
+#  if defined(USE_GCC_VISIBILITY_FLAG)
+#    define LAS_DLL     __attribute__ ((visibility("default")))
+#  else
+#    define LAS_DLL
+#  endif
+#endif
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable:4251 4275)
+#endif // _MSC_VER
+
+#endif // LIBLAS_HPP_INCLUDED
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/exception_implementation.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/exception_implementation.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/file_parser_error.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/file_parser_error.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/info_parser_error.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/info_parser_error.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/info_parser_read.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/info_parser_read.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/info_parser_utils.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/info_parser_utils.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/info_parser_write.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/info_parser_write.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/info_parser_writer_settings.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/info_parser_writer_settings.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/json_parser_error.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/json_parser_error.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/json_parser_read.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/json_parser_read.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/json_parser_write.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/json_parser_write.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/ptree_implementation.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/ptree_implementation.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/ptree_utils.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/ptree_utils.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/rapidxml.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/rapidxml.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_error.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_error.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_flags.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_flags.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_read_rapidxml.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_read_rapidxml.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_utils.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_utils.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_write.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_write.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_writer_settings.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/detail/xml_parser_writer_settings.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/exceptions.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/exceptions.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/id_translator.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/id_translator.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/info_parser.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/info_parser.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/ini_parser.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/ini_parser.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/json_parser.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/json_parser.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/ptree.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/ptree.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/ptree_fwd.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/ptree_fwd.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/ptree_serialization.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/ptree_serialization.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/stream_translator.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/stream_translator.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/string_path.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/string_path.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/external/property_tree/xml_parser.hpp b/Utilities/otbliblas/include/liblas/external/property_tree/xml_parser.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/guid.hpp b/Utilities/otbliblas/include/liblas/guid.hpp
index 9cf2d3e950e30033d016d9ee523bc217f1d2faaf..b54d211d2e38553c5353fb681fb70a0925ded7c5 100755
--- a/Utilities/otbliblas/include/liblas/guid.hpp
+++ b/Utilities/otbliblas/include/liblas/guid.hpp
@@ -61,9 +61,11 @@
 
 #include <liblas/detail/sha1.hpp>
 #include <liblas/detail/private_utility.hpp>
+#include <liblas/export.hpp>
 // boost
 #include <boost/array.hpp>
 #include <boost/cstdint.hpp>
+#include <boost/random.hpp>
 // std
 #include <iosfwd>
 #include <iomanip>
@@ -79,6 +81,28 @@
 
 namespace liblas {
 
+namespace detail {
+
+	inline boost::uint8_t random_byte()
+    {
+        // Change seed to something better?
+
+        typedef boost::mt19937 engine_t;
+        typedef boost::uniform_int<unsigned long> distribution_t;
+        typedef boost::variate_generator<engine_t, distribution_t> generator_t;
+
+        static generator_t generator(
+            engine_t(static_cast<engine_t::result_type>( std::time(0) )),
+            // this line should work and does, but it produces lots of warnings
+            // thus we will use unsigned long and cast it to a uint8_t
+            //distribution_t((std::numeric_limits<uint8_t>::min)(), (std::numeric_limits<uint8_t>::max)()));
+            distribution_t((std::numeric_limits<unsigned long>::min)(), (std::numeric_limits<unsigned long>::max)()));
+
+		return static_cast<boost::uint8_t>(generator() & 0xFF);
+    }
+
+} // namespace detail
+
 /// Definition of Globally Unique Identifier type.
 /// The GUID is a 16-byte (128-bit) number.
 /// This class is used to represent value stored as Project Identifier
@@ -88,7 +112,7 @@ namespace liblas {
 /// uniquely identify every LAS, globally.
 ///
 /// \see About GUID in Wikipedia http://en.wikipedia.org/wiki/Globally_Unique_Identifier 
-class guid
+class LAS_DLL guid
 {
 public:
 
@@ -418,7 +442,7 @@ private:
         
         for (size_t i = 0; i < result.data_.size(); i++)
         {
-            result.data_[i] = detail::generate_random_byte<boost::uint8_t>();
+            result.data_[i] = detail::random_byte();
         }
     
         // set variant
diff --git a/Utilities/otbliblas/include/liblas/iterator.hpp b/Utilities/otbliblas/include/liblas/iterator.hpp
index 05e3f91774d7def8cd1704c293f21250247275a8..def1aa478c6a1869b1809398d3f572bb5a9f684d 100755
--- a/Utilities/otbliblas/include/liblas/iterator.hpp
+++ b/Utilities/otbliblas/include/liblas/iterator.hpp
@@ -45,6 +45,7 @@
 #include <liblas/lasreader.hpp>
 #include <liblas/laswriter.hpp>
 #include <liblas/lasindex.hpp>
+#include <liblas/export.hpp>
 #include <iterator>
 #include <cassert>
 
@@ -56,7 +57,7 @@ namespace liblas {
 /// \sa About Input Iterator at http://www.sgi.com/tech/stl/InputIterator.html
 ///
 template <typename T>
-class reader_iterator
+class LAS_DLL reader_iterator
 {
 public:
 
@@ -157,7 +158,7 @@ bool operator!=(reader_iterator<T> const& lhs, reader_iterator<T> const& rhs)
 /// \sa About Output Iterator at http://www.sgi.com/tech/stl/OutputIterator.html
 ///
 template <typename T>
-class writer_iterator
+class LAS_DLL writer_iterator
 {
 public:
 
@@ -182,8 +183,9 @@ public:
     {
         assert(0 != m_writer);
 
-        bool const ret = m_writer->WritePoint(value);
-        assert(ret); // TODO: Low-level debugging
+        bool ret = false;
+        ret = m_writer->WritePoint(value);
+        assert(ret);
 
         return (*this);
     }
@@ -305,6 +307,12 @@ typedef reader_iterator<Point> lasreader_iterator;
 /// Public specialization of LASWriter output iterator for liblas::LASPoint type.
 typedef writer_iterator<Point> laswriter_iterator;
 
+// Needed for C++ DLL exports
+#ifdef _MSC_VER
+template class LAS_DLL reader_iterator<Point>;
+template class LAS_DLL writer_iterator<Point>;
+#endif
+
 } // namespace liblas
 
 #endif // LIBLAS_ITERATOR_HPP_INCLUDED
diff --git a/Utilities/otbliblas/include/liblas/lasbounds.hpp b/Utilities/otbliblas/include/liblas/lasbounds.hpp
old mode 100755
new mode 100644
index 982cd0ed2ec1e70f46750041e65b88f4c0d8a610..19335c817719dc3cd964074498ab7591e58df6f2
--- a/Utilities/otbliblas/include/liblas/lasbounds.hpp
+++ b/Utilities/otbliblas/include/liblas/lasbounds.hpp
@@ -46,7 +46,7 @@
 #include <liblas/laspoint.hpp>
 #include <liblas/lastransform.hpp>
 #include <liblas/detail/private_utility.hpp>
-
+#include <liblas/export.hpp>
 // boost
 #include <boost/cstdint.hpp>
 
@@ -62,14 +62,16 @@
 namespace liblas {
 
 template <typename T>
-class Range
+class LAS_DLL Range
 {
 public:
     T min;
     T max;
-    
+
+	typedef T value_type;
+
     Range(T mmin=std::numeric_limits<T>::max(), T mmax=std::numeric_limits<T>::min())
-        : min(mmin), max(mmax) {};
+        : min(mmin), max(mmax) {}
     
 
     Range(Range const& other)
@@ -127,7 +129,7 @@ public:
     
     bool empty(void) const 
     {
-        return min==std::numeric_limits<T>::max() && max==std::numeric_limits<T>::min();
+        return detail::compare_distance(min, std::numeric_limits<T>::max()) && detail::compare_distance(max, std::numeric_limits<T>::min());
     }
     
     void shift(T v) 
@@ -157,6 +159,13 @@ public:
         if (v > max)
             max = v;
     }
+
+    void grow(Range const& r) 
+    {
+        grow(r.min);
+        grow(r.max);
+    }
+
     T length() const
     {
         return max - min;
@@ -168,7 +177,7 @@ class Bounds
 {
 public:
 
-
+	typedef T value_type;
     typedef typename std::vector< Range<T> >::size_type size_type;
     
     typedef typename std::vector< Range<T> > RangeVec;
@@ -426,6 +435,8 @@ bool contains(Bounds const& other) const
     for (size_type i = 0; i < dimension(); i++) {
         if ( ranges[i].contains(other.ranges[i]) )
             return true;
+        else // As soon as it is not contains, we're false
+            return false;
     }
     return true;
 }
@@ -524,7 +535,7 @@ void grow(Point const& p)
 
 T volume() const
 {
-    T output;
+    T output = T();
     for (size_type i = 0; i < dimension(); i++) {
         output = output * ranges[i].length();
     }
@@ -576,6 +587,13 @@ Bounds<T> project(liblas::SpatialReference const& in_ref, liblas::SpatialReferen
 };
 
 
+
 } // namespace liblas
 
+// Needed for C++ DLL exports
+#ifdef _MSC_VER
+template class LAS_DLL liblas::Range<double>;
+template class LAS_DLL liblas::Bounds<double>;
+#endif
+
 #endif // ndef LIBLAS_LASBOUNDS_HPP_INCLUDED
diff --git a/Utilities/otbliblas/include/liblas/lasclassification.hpp b/Utilities/otbliblas/include/liblas/lasclassification.hpp
old mode 100755
new mode 100644
index c80bdf21105ef23f476f738d642df3a3550b4e02..635fdc1f1478b5461602060ab4bdf587bacc4a1f
--- a/Utilities/otbliblas/include/liblas/lasclassification.hpp
+++ b/Utilities/otbliblas/include/liblas/lasclassification.hpp
@@ -44,6 +44,7 @@
 
 // boost
 #include <boost/cstdint.hpp>
+#include <liblas/export.hpp>
 // std
 #include <cassert>
 #include <cstddef>
@@ -56,7 +57,7 @@ namespace liblas {
 
 /// Class definition to manipulate properties of point record classification.
 ///
-class Classification
+class LAS_DLL Classification
 {
 public:
 
diff --git a/Utilities/otbliblas/include/liblas/lascolor.hpp b/Utilities/otbliblas/include/liblas/lascolor.hpp
index c894e38c47b96de011b9112fddfb84611120ab61..02e47a91956c6fb984443db61c181462ac106ff7 100755
--- a/Utilities/otbliblas/include/liblas/lascolor.hpp
+++ b/Utilities/otbliblas/include/liblas/lascolor.hpp
@@ -41,6 +41,8 @@
 #ifndef LIBLAS_LASCOLOR_HPP_INCLUDED
 #define LIBLAS_LASCOLOR_HPP_INCLUDED
 
+#include <liblas/export.hpp>
+
 // boost
 #include <boost/array.hpp>
 #include <boost/cstdint.hpp>
@@ -50,7 +52,7 @@
 namespace liblas {
 
 /// RGB color container
-class Color
+class LAS_DLL Color
 {
 public:
 
diff --git a/Utilities/otbliblas/include/liblas/lasdimension.hpp b/Utilities/otbliblas/include/liblas/lasdimension.hpp
old mode 100755
new mode 100644
index a00598c194889f08fee41b5708ab032e731c04b7..97c1e69c80bf525434305186368a22aef9fe6912
--- a/Utilities/otbliblas/include/liblas/lasdimension.hpp
+++ b/Utilities/otbliblas/include/liblas/lasdimension.hpp
@@ -46,6 +46,7 @@
 #include <liblas/external/property_tree/ptree.hpp>
 #include <liblas/lasvariablerecord.hpp>
 #include <liblas/lasversion.hpp>
+#include <liblas/export.hpp>
 // boost
 #include <boost/cstdint.hpp>
 #include <boost/any.hpp>
@@ -59,7 +60,6 @@
 #include <boost/multi_index/hashed_index.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
 
-
 // std
 #include <iosfwd>
 #include <limits>
@@ -71,14 +71,14 @@
 namespace liblas {  
 
 /// Dimension definition
-class Dimension
+class LAS_DLL Dimension
 {
 public:
     Dimension(std::string const& name, std::size_t size_in_bits);
     Dimension& operator=(Dimension const& rhs);
     Dimension(Dimension const& other);
         
-    virtual ~Dimension() {};
+    virtual ~Dimension() {}
         
     inline std::string const& GetName() const { return m_name; }
     
diff --git a/Utilities/otbliblas/include/liblas/laserror.hpp b/Utilities/otbliblas/include/liblas/laserror.hpp
index d7b9aa44d7a5fd8a8b909f0be059cd5de66d49b4..0e3ef0c32a1fe76132d254e4953e89f5eb5fe582 100755
--- a/Utilities/otbliblas/include/liblas/laserror.hpp
+++ b/Utilities/otbliblas/include/liblas/laserror.hpp
@@ -44,6 +44,7 @@
 #ifndef LIBLAS_LASERROR_HPP_INCLUDED
 #define LIBLAS_LASERROR_HPP_INCLUDED
 
+#include <liblas/export.hpp>
 //std
 #include <iosfwd>
 #include <string>
@@ -54,7 +55,7 @@ namespace liblas {
 /// This class describes details of error condition occured in
 /// libLAS core. All errors are stacked by C API layer, so it's
 /// possible to track problem down to its source.
-class Error
+class LAS_DLL Error
 {
 public:
 
@@ -73,9 +74,9 @@ public:
     // TODO - mloskot: What about replacing string return by copy with const char* ?
     //        char const* GetMethod() const { return m_method.c_str(); }, etc.
 
-    int GetCode() const { return m_code; };
-    std::string GetMessage() const { return m_message; };
-    std::string GetMethod() const { return m_method; };    
+    int GetCode() const { return m_code; }
+    std::string GetMessage() const { return m_message; }
+    std::string GetMethod() const { return m_method; }   
 
 private:
 
diff --git a/Utilities/otbliblas/include/liblas/lasfilter.hpp b/Utilities/otbliblas/include/liblas/lasfilter.hpp
old mode 100755
new mode 100644
index 099c13c26e6f65a3340bbb1acb07e4f7e0537460..8d0684adf92eeba9953fb05906a7d608b11d2ea3
--- a/Utilities/otbliblas/include/liblas/lasfilter.hpp
+++ b/Utilities/otbliblas/include/liblas/lasfilter.hpp
@@ -46,6 +46,7 @@
 #include <liblas/lasheader.hpp>
 #include <liblas/laspoint.hpp>
 #include <liblas/detail/fwd.hpp>
+#include <liblas/export.hpp>
 // boost
 #include <boost/cstdint.hpp>
 #include <boost/function.hpp>
@@ -59,7 +60,7 @@
 namespace liblas {
 
 /// Defines public interface to LAS filter implementation.
-class FilterI
+class LAS_DLL FilterI
 {
 public:
     
@@ -83,7 +84,7 @@ public:
     /// Gets the type of filter.
     FilterType GetType() const {return m_type; }
 
-    virtual ~FilterI() {};
+    virtual ~FilterI() {}
 
     /// Base constructor.  Initializes the FilterType
     FilterI(FilterType t) : m_type(t) {}
@@ -100,7 +101,7 @@ typedef boost::shared_ptr<FilterI> FilterPtr;
 
 /// A filter for keeping or rejecting points that fall within a 
 /// specified bounds.
-class BoundsFilter: public FilterI
+class LAS_DLL BoundsFilter: public FilterI
 {
 public:
     
@@ -118,7 +119,7 @@ private:
 };
 
 /// A filter for keeping or rejecting a list of classification ids
-class ClassificationFilter: public FilterI
+class LAS_DLL ClassificationFilter: public FilterI
 {
 public:
     
@@ -136,7 +137,7 @@ private:
 };
 
 /// A filter simple decimation
-class ThinFilter: public liblas::FilterI
+class LAS_DLL ThinFilter: public liblas::FilterI
 {
 public:
     
@@ -156,7 +157,7 @@ private:
 
 
 /// A filter for keeping or rejecting a list of return ids.
-class ReturnFilter: public FilterI
+class LAS_DLL ReturnFilter: public FilterI
 {
 public:
     
@@ -175,7 +176,7 @@ private:
 };
 
 
-class ValidationFilter: public FilterI
+class LAS_DLL ValidationFilter: public FilterI
 {
 public:
 
@@ -194,7 +195,7 @@ private:
 /// from the liblas::Point class.  See laskernel.cpp for examples 
 /// how to use it for filtering intensity and time values.  
 template <typename T>
-class ContinuousValueFilter: public FilterI
+class LAS_DLL ContinuousValueFilter: public FilterI
 {
     
 
@@ -225,10 +226,9 @@ public:
     /// liblas::ContinuousValueFilter<uint16_t>::filter_func f = &liblas::Point::GetIntensity;
     /// liblas::ContinuousValueFilter<uint16_t>* intensity_filter = new liblas::ContinuousValueFilter<uint16_t>(f, 100, c);
     /// intensity_filter->SetType(liblas::FilterI::eInclusion);
-    ContinuousValueFilter(filter_func f, T value, compare_func c) :
-        liblas::FilterI(eInclusion), f(f), c(c),value(value)
-            {};
-
+    ContinuousValueFilter(filter_func f, T value, compare_func c)
+        : liblas::FilterI(eInclusion), f(f), c(c),value(value)
+    {}
 
         
     /// Construct the filter with a filter_func and a simple 
@@ -258,8 +258,8 @@ public:
     /// liblas::ContinuousValueFilter<uint16_t>* intensity_filter = new liblas::ContinuousValueFilter<uint16_t>(f, intensities);
     /// intensity_filter->SetType(liblas::FilterI::eInclusion);
     
-    ContinuousValueFilter(filter_func f, std::string const& filter_string) :
-        liblas::FilterI(eInclusion), f(f) 
+    ContinuousValueFilter(filter_func f, std::string const& filter_string)
+        : liblas::FilterI(eInclusion), f(f)
     {
         compare_func compare;
 
@@ -308,13 +308,10 @@ public:
         
         value =  boost::lexical_cast<T>(out);
         // std::cout << "Value is: " << value << " pos " << pos << " out " << out << std::endl;
-
-
-    };
+    }
             
     bool filter(const liblas::Point& p)
     {
-
         bool output = false;
 
         T v = f(&p);
@@ -369,7 +366,7 @@ private:
 };
 
 /// A filter for color ranges
-class ColorFilter: public FilterI
+class LAS_DLL ColorFilter: public FilterI
 {
 public:
 
diff --git a/Utilities/otbliblas/include/liblas/lasheader.hpp b/Utilities/otbliblas/include/liblas/lasheader.hpp
old mode 100755
new mode 100644
index bcc5e8b39c722141b6cc6af4fbeddc667bd13d60..1ee9f6c5645514ad1f33439a63c70c9a3ba63d41
--- a/Utilities/otbliblas/include/liblas/lasheader.hpp
+++ b/Utilities/otbliblas/include/liblas/lasheader.hpp
@@ -50,6 +50,7 @@
 #include <liblas/lasvariablerecord.hpp>
 #include <liblas/lasversion.hpp>
 #include <liblas/external/property_tree/ptree.hpp>
+#include <liblas/export.hpp>
 // boost
 #include <boost/cstdint.hpp>
 #include <boost/foreach.hpp>
@@ -71,7 +72,7 @@ namespace liblas {
 /// \todo  TODO (low-priority): replace static-size char arrays as data members
 ///        with std::string and return const-reference to string object.
 ///
-class Header
+class LAS_DLL Header
 {
 public:
 
@@ -406,22 +407,23 @@ private:
     Schema m_schema;
 };
 
-std::ostream& operator<<(std::ostream& os, liblas::Header const&);
+LAS_DLL std::ostream& operator<<(std::ostream& os, liblas::Header const&);
 
 /// Singleton used for all empty points upon construction.  If 
 /// a reader creates the point, the HeaderPtr from the file that was 
 /// read will be used, but all stand-alone points will have EmptyHeader 
 /// as their base.
-class DefaultHeader
+class LAS_DLL DefaultHeader
 {
 public:
-    virtual ~DefaultHeader() {};
+    virtual ~DefaultHeader() {}
     
     static Header const& get() 
     {
         static Header object;
         return object;
     }
+
 protected:
     DefaultHeader();
     DefaultHeader( DefaultHeader const&);
@@ -430,8 +432,6 @@ protected:
 };
 
 
-
-
 } // namespace liblas
 
 #endif // LIBLAS_LASHEADER_HPP_INCLUDED
diff --git a/Utilities/otbliblas/include/liblas/lasindex.hpp b/Utilities/otbliblas/include/liblas/lasindex.hpp
index c02457922817916775329aa04d1f19b39642dec8..9ff339e914097305a2097a0ae790a7b87730168d 100755
--- a/Utilities/otbliblas/include/liblas/lasindex.hpp
+++ b/Utilities/otbliblas/include/liblas/lasindex.hpp
@@ -47,6 +47,7 @@
 #include <liblas/lasbounds.hpp>
 #include <liblas/lasvariablerecord.hpp>
 #include <liblas/detail/index/indexcell.hpp>
+#include <liblas/export.hpp>
 
 // std
 #include <stdexcept> // std::out_of_range
@@ -58,13 +59,14 @@
 namespace liblas {
 
 #define LIBLAS_INDEX_MAXMEMDEFAULT	10000000	// 10 megs default
-#define LIBLAS_INDEX_MINMEMDEFAULT	100000	// 1 meg at least has to be allowed
+#define LIBLAS_INDEX_MINMEMDEFAULT	1000000	// 1 meg at least has to be allowed
 #define LIBLAS_INDEX_VERSIONMAJOR	1
-#define LIBLAS_INDEX_VERSIONMINOR	0
+#define LIBLAS_INDEX_VERSIONMINOR	1	// minor version 1 begins 10/12/10
 #define LIBLAS_INDEX_MAXSTRLEN	512
 #define LIBLAS_INDEX_MAXCELLS	250000
 #define LIBLAS_INDEX_OPTPTSPERCELL	100
 #define LIBLAS_INDEX_MAXPTSPERCELL	1000
+#define LIBLAS_INDEX_RESERVEFILTERDEFAULT	1000000	// 1 million points will be reserved on large files for filter result
 
 // define this in order to fix problem with last bytes of last VLR getting corrupted
 // when saved and reloaded from index or las file.
@@ -74,8 +76,8 @@ typedef std::vector<boost::uint8_t> IndexVLRData;
 typedef std::vector<liblas::detail::IndexCell> IndexCellRow;
 typedef std::vector<IndexCellRow>	IndexCellDataBlock;
 
-class liblas::detail::IndexCell;
-class IndexData;
+class LAS_DLL IndexData;
+class LAS_DLL IndexIterator;
 
 // Index class is the fundamental object for building and filtering a spatial index of points in an LAS file.
 // An Index class doesn't do anything until it is configured with an IndexData object (see below).
@@ -114,7 +116,7 @@ class IndexData;
 // Currently only one, two or three dimensional spatial window filters are supported. See IndexData below for 
 //		more info on filtering.
 
-class Index
+class LAS_DLL Index
 {
 public:
 	Index();
@@ -136,15 +138,11 @@ private:
 	Bounds<double> m_bounds;
 	bool m_indexBuilt, m_tempFileStarted, m_readerCreated, m_readOnly, m_writestandaloneindex, m_forceNewIndex;
 	int m_debugOutputLevel;
+	boost::uint8_t m_versionMajor, m_versionMinor;
     boost::uint32_t m_pointRecordsCount, m_maxMemoryUsage, m_cellsX, m_cellsY, m_cellsZ, m_totalCells, 
-		m_tempFileWrittenBytes, m_DataVLR_ID;
-    boost::int32_t m_LowXCellCompletelyIn, m_HighXCellCompletelyIn, m_LowYCellCompletelyIn, m_HighYCellCompletelyIn,
-		m_LowZCellCompletelyIn, m_HighZCellCompletelyIn;
-    boost::int32_t m_LowXBorderCell, m_HighXBorderCell, m_LowYBorderCell, m_HighYBorderCell,
-		m_LowZBorderCell, m_HighZBorderCell;
+		m_DataVLR_ID;
+    liblas::detail::TempFileOffsetType m_tempFileWrittenBytes;
     double m_rangeX, m_rangeY, m_rangeZ, m_cellSizeZ, m_cellSizeX, m_cellSizeY;
-	double m_filterMinXCell, m_filterMaxXCell, m_filterMinYCell, m_filterMaxYCell, m_filterMinZCell, m_filterMaxZCell,
-		m_LowXBorderPartCell, m_HighXBorderPartCell, m_LowYBorderPartCell, m_HighYBorderPartCell;
 	std::string m_tempFileName;	
 	std::string m_indexAuthor;
 	std::string m_indexComment;
@@ -159,9 +157,14 @@ private:
     void ClearOldIndex(void);
 	bool BuildIndex(void);
 	bool Validate(void);
+	boost::uint32_t GetDefaultReserve(void);
 	bool LoadIndexVLR(VariableRecord const& vlr);
-	void SetCellFilterBounds(IndexData const& ParamSrc);
-	bool FilterOneVLR(VariableRecord const& vlr, boost::uint32_t& i, IndexData const& ParamSrc);
+	void SetCellFilterBounds(IndexData & ParamSrc);
+	bool FilterOneVLR(VariableRecord const& vlr, boost::uint32_t& i, IndexData & ParamSrc, bool & VLRDone);
+	bool FilterPointSeries(boost::uint32_t & PointID, boost::uint32_t & PointsScanned, 
+		boost::uint32_t const PointsToIgnore, boost::uint32_t const x, boost::uint32_t const y, boost::uint32_t const z, 
+		liblas::detail::ConsecPtAccumulator const ConsecutivePts, IndexIterator *Iterator, 
+		IndexData const& ParamSrc);
 	bool VLRInteresting(boost::int32_t MinCellX, boost::int32_t MinCellY, boost::int32_t MaxCellX, boost::int32_t MaxCellY, 
 		IndexData const& ParamSrc);
 	bool CellInteresting(boost::int32_t x, boost::int32_t y, IndexData const& ParamSrc);
@@ -190,9 +193,9 @@ private:
 	// Creates a Writer from m_ofs and re-saves LAS header with new index, but not with data point records
 	bool SaveIndexInStandAloneFile(void);
 	// Calculate index bounds dimensions
-	void CalcRangeX(void)	{m_rangeX = m_bounds.max(0) - m_bounds.min(0);};
-	void CalcRangeY(void)	{m_rangeY = m_bounds.max(1) - m_bounds.min(1);};
-	void CalcRangeZ(void)	{m_rangeZ = m_bounds.max(2) - m_bounds.min(2);};
+	void CalcRangeX(void)	{m_rangeX = m_bounds.max(0) - m_bounds.min(0);}
+	void CalcRangeY(void)	{m_rangeY = m_bounds.max(1) - m_bounds.min(1);}
+	void CalcRangeZ(void)	{m_rangeZ = m_bounds.max(2) - m_bounds.min(2);}
 
 	// error messages
 	bool FileError(const char *Reporter);
@@ -211,69 +214,76 @@ private:
 	
 public:
 	// IndexFailed and IndexReady can be used to tell if an Index is ready for a filter operation
-    bool IndexFailed(void)  const {return (! m_indexBuilt);};
-    bool IndexReady(void)  const {return (m_indexBuilt);};
+    bool IndexFailed(void)  const {return (! m_indexBuilt);}
+    bool IndexReady(void)  const {return (m_indexBuilt);}
     // Prep takes the input data and initializes Index values and then either builds or examines the Index
     bool Prep(IndexData const& ParamSrc);
     // Filter performs a point filter using the bounds in ParamSrc
-    const std::vector<boost::uint32_t>& Filter(IndexData const& ParamSrc);
+    const std::vector<boost::uint32_t>& Filter(IndexData & ParamSrc);
+    IndexIterator* Filter(IndexData const& ParamSrc, boost::uint32_t ChunkSize);
+    IndexIterator* Filter(double LowFilterX, double HighFilterX, double LowFilterY, double HighFilterY, 
+		double LowFilterZ, double HighFilterZ, boost::uint32_t ChunkSize);
+    IndexIterator* Filter(Bounds<double> const& BoundsSrc, boost::uint32_t ChunkSize);
+    
     // Return the bounds of the current Index
-	double GetMinX(void) const	{return m_bounds.min(0);};
-	double GetMaxX(void) const	{return m_bounds.max(0);};
-	double GetMinY(void) const	{return m_bounds.min(1);};
-	double GetMaxY(void) const	{return m_bounds.max(1);};
-	double GetMinZ(void) const	{return m_bounds.min(2);};
-	double GetMaxZ(void) const	{return m_bounds.max(2);};
+	double GetMinX(void) const	{return m_bounds.min(0);}
+	double GetMaxX(void) const	{return m_bounds.max(0);}
+	double GetMinY(void) const	{return m_bounds.min(1);}
+	double GetMaxY(void) const	{return m_bounds.max(1);}
+	double GetMinZ(void) const	{return m_bounds.min(2);}
+	double GetMaxZ(void) const	{return m_bounds.max(2);}
 	// Ranges are updated when an index is built or the index header VLR read
-	double GetRangeX(void) const	{return m_rangeX;};
-	double GetRangeY(void) const	{return m_rangeY;};
-	double GetRangeZ(void) const	{return m_rangeZ;};
-	Bounds<double> const& GetBounds(void) const	{return m_bounds;};
+	double GetRangeX(void) const	{return m_rangeX;}
+	double GetRangeY(void) const	{return m_rangeY;}
+	double GetRangeZ(void) const	{return m_rangeZ;}
+	Bounds<double> const& GetBounds(void) const	{return m_bounds;}
 	// Return the number of points used to build the Index
-	boost::uint32_t GetPointRecordsCount(void) const	{return m_pointRecordsCount;};
+	boost::uint32_t GetPointRecordsCount(void) const	{return m_pointRecordsCount;}
 	// Return the number of cells in the Index
-	boost::uint32_t GetCellsX(void) const	{return m_cellsX;};
-	boost::uint32_t GetCellsY(void) const	{return m_cellsY;};
+	boost::uint32_t GetCellsX(void) const	{return m_cellsX;}
+	boost::uint32_t GetCellsY(void) const	{return m_cellsY;}
 	// Return the number of Z-dimension cells in the Index. Value is 1 if no Z-cells were created during Index building
-	boost::uint32_t GetCellsZ(void) const	{return m_cellsZ;};
+	boost::uint32_t GetCellsZ(void) const	{return m_cellsZ;}
 	// 42 is the ID for the Index header VLR and 43 is the normal ID for the Index data VLR's
 	// For future expansion, multiple indexes could assign data VLR ID's of their own choosing
-	boost::uint32_t GetDataVLR_ID(void) const	{return m_DataVLR_ID;};
+	boost::uint32_t GetDataVLR_ID(void) const	{return m_DataVLR_ID;}
 	// Since the user can define a Z cell size it is useful to examine that for an existing index
-	double GetCellSizeZ(void) const	{return m_cellSizeZ;};
+	double GetCellSizeZ(void) const	{return m_cellSizeZ;}
 	// Return values used in building or examining index
-	FILE *GetDebugger(void) const	{return m_debugger;};
-	bool GetReadOnly(void) const	{return m_readOnly;};
-	bool GetStandaloneIndex(void) const	{return m_writestandaloneindex;};
-	bool GetForceNewIndex(void) const	{return m_forceNewIndex;};
-	boost::uint32_t GetMaxMemoryUsage(void) const	{return m_maxMemoryUsage;};
-	int GetDebugOutputLevel(void) const {return m_debugOutputLevel;};
+	FILE *GetDebugger(void) const	{return m_debugger;}
+	bool GetReadOnly(void) const	{return m_readOnly;}
+	bool GetStandaloneIndex(void) const	{return m_writestandaloneindex;}
+	bool GetForceNewIndex(void) const	{return m_forceNewIndex;}
+	boost::uint32_t GetMaxMemoryUsage(void) const	{return m_maxMemoryUsage;}
+	int GetDebugOutputLevel(void) const {return m_debugOutputLevel;}
 	// Not sure if these are more useful than dangerous
-	Header *GetPointHeader(void) {return &m_pointheader;};
-	Header *GetIndexHeader(void) {return &m_idxheader;};
-	Reader *GetReader(void) const {return m_reader;};
-	Reader *GetIndexReader(void) const {return m_idxreader;};
-	const char *GetTempFileName(void) const {return m_tempFileName.c_str();};
+	Header *GetPointHeader(void) {return &m_pointheader;}
+	Header *GetIndexHeader(void) {return &m_idxheader;}
+	Reader *GetReader(void) const {return m_reader;}
+	Reader *GetIndexReader(void) const {return m_idxreader;}
+	const char *GetTempFileName(void) const {return m_tempFileName.c_str();}
 	// Returns the strings set in the index when built
 	const char *GetIndexAuthorStr(void)  const;
 	const char *GetIndexCommentStr(void)  const;
 	const char *GetIndexDateStr(void)  const;
+	boost::uint8_t GetVersionMajor(void) const	{return m_versionMajor;}
+	boost::uint8_t GetVersionMinor(void) const	{return m_versionMinor;}
 	// Methods for setting values used when reading index from file to facilitate moving reading function into
 	// separate IndexInput object at a future time to provide symmetry with IndexOutput
-	void SetDataVLR_ID(boost::uint32_t DataVLR_ID)	{m_DataVLR_ID = DataVLR_ID;};
-	void SetIndexAuthorStr(const char *ias)	{m_indexAuthor = ias;};
-	void SetIndexCommentStr(const char *ics)	{m_indexComment = ics;};
-	void SetIndexDateStr(const char *ids)	{m_indexDate = ids;};
-	void SetMinX(double minX)	{m_bounds.min(0, minX);};
-	void SetMaxX(double maxX)	{m_bounds.max(0, maxX);};
-	void SetMinY(double minY)	{m_bounds.min(1, minY);};
-	void SetMaxY(double maxY)	{m_bounds.max(1, maxY);};
-	void SetMinZ(double minZ)	{m_bounds.min(2, minZ);};
-	void SetMaxZ(double maxZ)	{m_bounds.max(2, maxZ);};
-	void SetPointRecordsCount(boost::uint32_t prc)	{m_pointRecordsCount = prc;};
-	void SetCellsX(boost::uint32_t cellsX)	{m_cellsX = cellsX;};
-	void SetCellsY(boost::uint32_t cellsY)	{m_cellsY = cellsY;};
-	void SetCellsZ(boost::uint32_t cellsZ)	{m_cellsZ = cellsZ;};
+	void SetDataVLR_ID(boost::uint32_t DataVLR_ID)	{m_DataVLR_ID = DataVLR_ID;}
+	void SetIndexAuthorStr(const char *ias)	{m_indexAuthor = ias;}
+	void SetIndexCommentStr(const char *ics)	{m_indexComment = ics;}
+	void SetIndexDateStr(const char *ids)	{m_indexDate = ids;}
+	void SetMinX(double minX)	{m_bounds.min(0, minX);}
+	void SetMaxX(double maxX)	{m_bounds.max(0, maxX);}
+	void SetMinY(double minY)	{m_bounds.min(1, minY);}
+	void SetMaxY(double maxY)	{m_bounds.max(1, maxY);}
+	void SetMinZ(double minZ)	{m_bounds.min(2, minZ);}
+	void SetMaxZ(double maxZ)	{m_bounds.max(2, maxZ);}
+	void SetPointRecordsCount(boost::uint32_t prc)	{m_pointRecordsCount = prc;}
+	void SetCellsX(boost::uint32_t cellsX)	{m_cellsX = cellsX;}
+	void SetCellsY(boost::uint32_t cellsY)	{m_cellsY = cellsY;}
+	void SetCellsZ(boost::uint32_t cellsZ)	{m_cellsZ = cellsZ;}
 	
 }; 
 
@@ -333,9 +343,10 @@ public:
 //		system that a liblas::Header returns with the commands GetMin{X|Y|Z} and a liblas::Point returns with 
 //		Get{X|Y|Z}
 
-class IndexData
+class LAS_DLL IndexData
 {
 friend class Index;
+friend class IndexIterator;
 
 public:
 	IndexData(void);
@@ -383,7 +394,6 @@ public:
 		Index const& index);
 	bool SetFilterValues(Bounds<double> const& src, Index const& index);
 
-    // Blocked copying operations, declared but not defined.
     /// Copy constructor.
     IndexData(IndexData const& other);
     /// Assignment operator.
@@ -392,10 +402,12 @@ public:
 private:
 	void SetValues(void);
 	bool CalcFilterEnablers(void);
+	void Copy(IndexData const& other);
 	
 protected:
 	Reader *m_reader;
 	Reader *m_idxreader;
+	IndexIterator *m_iterator;
 	Bounds<double> m_filter;
 	std::istream *m_ifs;
 	std::ostream *m_ofs;
@@ -404,44 +416,102 @@ protected:
 	const char *m_indexComment;
 	const char *m_indexDate;
 	double m_cellSizeZ;
+	double m_LowXBorderPartCell, m_HighXBorderPartCell, m_LowYBorderPartCell, m_HighYBorderPartCell;
+    boost::int32_t m_LowXCellCompletelyIn, m_HighXCellCompletelyIn, m_LowYCellCompletelyIn, m_HighYCellCompletelyIn,
+		m_LowZCellCompletelyIn, m_HighZCellCompletelyIn;
+    boost::int32_t m_LowXBorderCell, m_HighXBorderCell, m_LowYBorderCell, m_HighYBorderCell,
+		m_LowZBorderCell, m_HighZBorderCell;
 	boost::uint32_t m_maxMemoryUsage;
 	int m_debugOutputLevel;
 	bool m_noFilterX, m_noFilterY, m_noFilterZ, m_readOnly, m_writestandaloneindex, m_forceNewIndex, m_indexValid;
 	FILE *m_debugger;
+
+	void SetIterator(IndexIterator *setIt) {m_iterator = setIt;}
+	IndexIterator *GetIterator(void) {return(m_iterator);}
 	
 public:
-	double GetCellSizeZ(void) const	{return m_cellSizeZ;};
-	FILE *GetDebugger(void) const	{return m_debugger;};
-	bool GetReadOnly(void) const	{return m_readOnly;};
-	bool GetStandaloneIndex(void) const	{return m_writestandaloneindex;};
-	bool GetForceNewIndex(void) const	{return m_forceNewIndex;};
-	boost::uint32_t GetMaxMemoryUsage(void) const	{return m_maxMemoryUsage;};
-	Reader *GetReader(void) const {return m_reader;};
-	int GetDebugOutputLevel(void) const {return m_debugOutputLevel;};
-	const char *GetTempFileName(void) const {return m_tempFileName;};
+	double GetCellSizeZ(void) const	{return m_cellSizeZ;}
+	FILE *GetDebugger(void) const	{return m_debugger;}
+	bool GetReadOnly(void) const	{return m_readOnly;}
+	bool GetStandaloneIndex(void) const	{return m_writestandaloneindex;}
+	bool GetForceNewIndex(void) const	{return m_forceNewIndex;}
+	boost::uint32_t GetMaxMemoryUsage(void) const	{return m_maxMemoryUsage;}
+	Reader *GetReader(void) const {return m_reader;}
+	int GetDebugOutputLevel(void) const {return m_debugOutputLevel;}
+	const char *GetTempFileName(void) const {return m_tempFileName;}
 	const char *GetIndexAuthorStr(void)  const;
 	const char *GetIndexCommentStr(void)  const;
 	const char *GetIndexDateStr(void)  const;
-	double GetMinFilterX(void) const	{return m_filter.min(0);};
-	double GetMaxFilterX(void) const	{return m_filter.max(0);};
-	double GetMinFilterY(void) const	{return m_filter.min(1);};
-	double GetMaxFilterY(void) const	{return m_filter.max(1);};
-	double GetMinFilterZ(void) const	{return m_filter.min(2);};
-	double GetMaxFilterZ(void) const	{return m_filter.max(2);};
+	double GetMinFilterX(void) const	{return m_filter.min(0);}
+	double GetMaxFilterX(void) const	{return m_filter.max(0);}
+	double GetMinFilterY(void) const	{return m_filter.min(1);}
+	double GetMaxFilterY(void) const	{return m_filter.max(1);}
+	double GetMinFilterZ(void) const	{return m_filter.min(2);}
+	double GetMaxFilterZ(void) const	{return m_filter.max(2);}
 	void ClampFilterBounds(Bounds<double> const& m_bounds);
-	void SetReader(Reader *reader)	{m_reader = reader;};
-	void SetIStream(std::istream *ifs)	{m_ifs = ifs;};
-	void SetOStream(std::ostream *ofs)	{m_ofs = ofs;};
-	void SetTmpFileName(const char *tmpfilenme)	{m_tempFileName = tmpfilenme;};
-	void SetIndexAuthor(const char *indexauthor)	{m_indexAuthor = indexauthor;};
-	void SetIndexComment(const char *indexcomment)	{m_indexComment = indexcomment;};
-	void SetIndexDate(const char *indexdate)	{m_indexDate = indexdate;};
-	void SetCellSizeZ(double cellsizez)	{m_cellSizeZ = cellsizez;};
-	void SetMaxMem(boost::uint32_t maxmem)	{m_maxMemoryUsage = maxmem;};
-	void SetDebugOutputLevel(int debugoutputlevel)	{m_debugOutputLevel = debugoutputlevel;};
-	void SetReadOnly(bool readonly)	{m_readOnly = readonly;};
-	void SetStandaloneIndex(bool writestandaloneindex)	{m_writestandaloneindex = writestandaloneindex;};
-	void SetDebugger(FILE *debugger)	{m_debugger = debugger;};
+	void SetReader(Reader *reader)	{m_reader = reader;}
+	void SetIStream(std::istream *ifs)	{m_ifs = ifs;}
+	void SetOStream(std::ostream *ofs)	{m_ofs = ofs;}
+	void SetTmpFileName(const char *tmpfilenme)	{m_tempFileName = tmpfilenme;}
+	void SetIndexAuthor(const char *indexauthor)	{m_indexAuthor = indexauthor;}
+	void SetIndexComment(const char *indexcomment)	{m_indexComment = indexcomment;}
+	void SetIndexDate(const char *indexdate)	{m_indexDate = indexdate;}
+	void SetCellSizeZ(double cellsizez)	{m_cellSizeZ = cellsizez;}
+	void SetMaxMem(boost::uint32_t maxmem)	{m_maxMemoryUsage = maxmem;}
+	void SetDebugOutputLevel(int debugoutputlevel)	{m_debugOutputLevel = debugoutputlevel;}
+	void SetReadOnly(bool readonly)	{m_readOnly = readonly;}
+	void SetStandaloneIndex(bool writestandaloneindex)	{m_writestandaloneindex = writestandaloneindex;}
+	void SetDebugger(FILE *debugger)	{m_debugger = debugger;}
+};
+
+class LAS_DLL IndexIterator
+{
+friend class Index;
+
+protected:
+	IndexData m_indexData;
+	Index *m_index;
+	boost::uint32_t m_chunkSize, m_advance;
+	boost::uint32_t m_curVLR, m_curCellStartPos, m_curCellX, m_curCellY, m_totalPointsScanned, m_ptsScannedCurCell,
+		m_ptsScannedCurVLR;
+	boost::uint32_t m_conformingPtsFound;
+
+public:
+	IndexIterator(Index *IndexSrc, double LowFilterX, double HighFilterX, double LowFilterY, double HighFilterY, 
+		double LowFilterZ, double HighFilterZ, boost::uint32_t ChunkSize);
+	IndexIterator(Index *IndexSrc, IndexData const& IndexDataSrc, boost::uint32_t ChunkSize);
+	IndexIterator(Index *IndexSrc, Bounds<double> const& BoundsSrc, boost::uint32_t ChunkSize);
+    /// Copy constructor.
+ 	IndexIterator(IndexIterator const& other);
+    /// Assignment operator.
+    IndexIterator& operator=(IndexIterator const& rhs);
+private:
+ 	void Copy(IndexIterator const& other);
+	void ResetPosition(void);
+
+public:
+	/// n=0 or n=1 gives next sequence with no gap, n>1 skips n-1 filter-compliant points, n<0 skips backwards
+    const std::vector<boost::uint32_t>& advance(boost::int32_t n);
+    /// returns filter-compliant points beginning with the nth compliant point, 0 and 1 return first set of compliant points
+    const std::vector<boost::uint32_t>& operator()(boost::int32_t n);
+	/// returns next set of filter-compliant points with no skipped points
+	inline const std::vector<boost::uint32_t>& operator++()	{return (advance(1));}
+	/// returns next set of filter-compliant points with no skipped points
+	inline const std::vector<boost::uint32_t>& operator++(int)	{return (advance(1));}
+	/// returns set of filter-compliant points skipping backwards 1 from the end of the last set
+	inline const std::vector<boost::uint32_t>& operator--()	{return (advance(-1));}
+	/// returns set of filter-compliant points skipping backwards 1 from the end of the last set
+	inline const std::vector<boost::uint32_t>& operator--(int)	{return (advance(-1));}
+	/// returns next set of filter-compliant points with n-1 skipped points, for n<0 acts like -=()
+	inline const std::vector<boost::uint32_t>& operator+=(boost::int32_t n)	{return (advance(n));}
+	/// returns next set of filter-compliant points with n-1 skipped points, for n<0 acts like -()
+	inline const std::vector<boost::uint32_t>& operator+(boost::int32_t n)	{return (advance(n));}
+	/// returns set of filter-compliant points beginning n points backwards from the end of the last set, for n<0 acts like +=()
+	inline const std::vector<boost::uint32_t>& operator-=(boost::int32_t n)	{return (advance(-n));}
+	/// returns set of filter-compliant points beginning n points backwards from the end of the last set, for n<0 acts like +()
+	inline const std::vector<boost::uint32_t>& operator-(boost::int32_t n)	{return (advance(-n));}
+    /// returns filter-compliant points beginning with the nth compliant point, 0 and 1 return first set of compliant points
+	inline const std::vector<boost::uint32_t>& operator[](boost::int32_t n)	{return ((*this)(n));}
 };
 
 template <typename T, typename Q>
@@ -489,7 +559,7 @@ inline void ReadVLRDataNoInc_str(char * dest, IndexVLRData const& src, T const s
     if (static_cast<size_t>(pos) + static_cast<size_t>(srclen) > src.size())
 		throw std::out_of_range("liblas::detail::ReadVLRDataNoInc_str: array index out of range");
  	// copy srclen bytes to destination
-	memcpy(dest, &src[pos], srclen);
+    std::memcpy(dest, &src[pos], srclen);
 }
 
 } // namespace liblas
diff --git a/Utilities/otbliblas/include/liblas/laspoint.hpp b/Utilities/otbliblas/include/liblas/laspoint.hpp
index 2337a9ba72bf19f709b93fcc8f3b82712264fb2f..444e7b13f2e324add5361337e50e8d388a4610fc 100755
--- a/Utilities/otbliblas/include/liblas/laspoint.hpp
+++ b/Utilities/otbliblas/include/liblas/laspoint.hpp
@@ -49,6 +49,7 @@
 #include <liblas/detail/private_utility.hpp>
 #include <liblas/external/property_tree/ptree.hpp>
 #include <liblas/lasschema.hpp>
+#include <liblas/export.hpp>
 
 // boost
 #include <boost/array.hpp>
@@ -65,7 +66,7 @@ namespace liblas {
 
 
 /// Point data record composed with X, Y, Z coordinates and attributes.
-class Point
+class LAS_DLL Point
 {
 public:
 
@@ -243,7 +244,7 @@ inline double Point::operator[](std::size_t const& index) const
 }
 
 
-std::ostream& operator<<(std::ostream& os, liblas::Point const&);
+LAS_DLL std::ostream& operator<<(std::ostream& os, liblas::Point const&);
 
 
 } // namespace liblas
diff --git a/Utilities/otbliblas/include/liblas/lasreader.hpp b/Utilities/otbliblas/include/liblas/lasreader.hpp
old mode 100755
new mode 100644
index b1654d34acf92c107fc477721830420ae398d2f3..9a1a25a0585de2b98e5f26b865354d83f9553bfc
--- a/Utilities/otbliblas/include/liblas/lasreader.hpp
+++ b/Utilities/otbliblas/include/liblas/lasreader.hpp
@@ -50,6 +50,7 @@
 #include <liblas/lastransform.hpp>
 #include <liblas/lasfilter.hpp>
 #include <liblas/external/property_tree/ptree.hpp>
+#include <liblas/export.hpp>
 // boost
 #include <boost/cstdint.hpp>
 // std
@@ -63,7 +64,7 @@ namespace liblas {
 
 
 /// Defines public interface to LAS reader implementation.
-class Reader
+class LAS_DLL Reader
 {
 public:
 
@@ -72,14 +73,14 @@ public:
     /// @exception std::runtime_error - on failure state of the input stream.
     Reader(std::istream& ifs);
     Reader(std::istream& ifs, boost::uint32_t cache_size);
-    Reader(std::istream& ifs, boost::uint32_t cache_size, Header& header);
+    Reader(std::istream& ifs, boost::uint32_t cache_size, Header const& header);
     Reader(ReaderI* reader);
     
     
     /// User-defined consructor initializes reader with input stream and
     /// a header to override the values in the file
     /// @exception std::runtime_error - on failure state of the input stream.
-    Reader(std::istream& ifs, Header& header);
+    Reader(std::istream& ifs, Header const& header);
     
     /// Destructor.
     /// @exception nothrow
@@ -188,12 +189,9 @@ private:
     TransformPtr m_reprojection_transform;
 
     SpatialReference m_out_srs;
-    SpatialReference m_in_srs;
-    
+    SpatialReference m_in_srs;  
 };
 
-
-
 } // namespace liblas
 
 #endif // ndef LIBLAS_LASREADER_HPP_INCLUDED
diff --git a/Utilities/otbliblas/include/liblas/lasschema.hpp b/Utilities/otbliblas/include/liblas/lasschema.hpp
old mode 100755
new mode 100644
index e98fdd16fbf1ec4e04ac1aecb20aac82f3d4f3d8..7586da29e5ffb4e5c43d9bc48dbdad94552a8bc4
--- a/Utilities/otbliblas/include/liblas/lasschema.hpp
+++ b/Utilities/otbliblas/include/liblas/lasschema.hpp
@@ -47,6 +47,7 @@
 #include <liblas/lasvariablerecord.hpp>
 #include <liblas/lasversion.hpp>
 #include <liblas/lasdimension.hpp>
+#include <liblas/export.hpp>
 
 // boost
 #include <boost/cstdint.hpp>
@@ -63,7 +64,6 @@
 #include <boost/multi_index/mem_fun.hpp>
 #include <boost/multi_index/random_access_index.hpp>
 
-
 // std
 #include <iosfwd>
 #include <limits>
@@ -93,9 +93,7 @@ typedef multi_index_container<
     random_access<tag<index> >,
     // sort by less<string> on GetName
     hashed_unique<tag<name>, const_mem_fun<Dimension,std::string const&,&Dimension::GetName> >
-    
-
-  >
+      >
 > IndexMap;
 
 typedef IndexMap::index<name>::type index_by_name;
@@ -104,7 +102,7 @@ typedef IndexMap::index<index>::type index_by_index;
 
 
 /// Schema definition
-class Schema
+class LAS_DLL Schema
 {
 public:
     
@@ -114,7 +112,7 @@ public:
     Schema& operator=(Schema const& rhs);
     Schema(Schema const& other);
     
-    ~Schema() {};
+    ~Schema() {}
 
     /// Fetch byte size
     std::size_t GetByteSize() const;
@@ -174,7 +172,7 @@ bool inline sort_dimensions(Dimension i, Dimension j)
     return i < j; 
 }
 
-std::ostream& operator<<(std::ostream& os, liblas::Schema const&);
+LAS_DLL std::ostream& operator<<(std::ostream& os, liblas::Schema const&);
 
 
 } // namespace liblas
diff --git a/Utilities/otbliblas/include/liblas/lasspatialreference.hpp b/Utilities/otbliblas/include/liblas/lasspatialreference.hpp
old mode 100755
new mode 100644
index c6f85a711fb1b14e64e68221a0e5841153adeff7..e52a8fa37c5cebcd12d292db256b54cb23282b96
--- a/Utilities/otbliblas/include/liblas/lasspatialreference.hpp
+++ b/Utilities/otbliblas/include/liblas/lasspatialreference.hpp
@@ -47,15 +47,16 @@
 #include <liblas/lasvariablerecord.hpp>
 #include <liblas/exception.hpp>
 #include <liblas/capi/las_config.h>
+#include <liblas/export.hpp>
 #include <liblas/external/property_tree/ptree.hpp>
 
 // GDAL OSR
 #ifdef HAVE_GDAL
 #include <ogr_srs_api.h>
 #include <cpl_port.h>
-#include <cpl_serv.h>
-#include <geo_tiffp.h>
-#define CPL_ERROR_H_INCLUDED
+//#include <cpl_serv.h>
+//#include <geo_tiffp.h>
+//#define CPL_ERROR_H_INCLUDED
 #include <geo_normalize.h>
 #include <geovalues.h>
 #include <ogr_spatialref.h>
@@ -88,7 +89,7 @@ typedef struct ST_TIFFS *ST_TIFF;
 namespace liblas {
 
 /// Spatial Reference System container for libLAS
-class SpatialReference
+class LAS_DLL SpatialReference
 {
 public:
     enum WKTModeFlag
@@ -147,10 +148,10 @@ public:
     /// range 5100 to 5299 - implied by verticalCSType if that is provided, or 
     /// -1 if no value is available.
     /// \param verticalUnits - the EPSG vertical units code, often 9001 for Metre.
-    void SetVerticalCS(int verticalCSType, 
+    void SetVerticalCS(boost::int32_t verticalCSType, 
                        std::string const& citation = std::string(0),
-                       int verticalDatum = -1,
-                       int verticalUnits = 9001);
+                       boost::int32_t verticalDatum = -1,
+                       boost::int32_t verticalUnits = 9001);
 
     /// Sets the SRS using GDAL's SetFromUserInput function. If GDAL is not linked, this 
     /// operation has no effect.
diff --git a/Utilities/otbliblas/include/liblas/lastransform.hpp b/Utilities/otbliblas/include/liblas/lastransform.hpp
old mode 100755
new mode 100644
index 338feae190863cd61e27c743f2ff7ec4038a62c3..06795e574da8c236d8bfcb6662cf950449ec19fc
--- a/Utilities/otbliblas/include/liblas/lastransform.hpp
+++ b/Utilities/otbliblas/include/liblas/lastransform.hpp
@@ -45,10 +45,12 @@
 #include <liblas/lasversion.hpp>
 #include <liblas/laspoint.hpp>
 #include <liblas/lasspatialreference.hpp>
+#include <liblas/export.hpp>
 // boost
 #include <boost/shared_ptr.hpp>
 // std
 #include <vector>
+#include <string>
 
 namespace liblas {
 
@@ -59,36 +61,106 @@ namespace liblas {
 
 
 /// Defines public interface to LAS transform implementation.
-class TransformI
+class LAS_DLL TransformI
 {
 public:
     
     virtual bool transform(Point& point) = 0;
-    virtual ~TransformI() {};
+    virtual ~TransformI() {}
 };
 
 typedef boost::shared_ptr<liblas::TransformI> TransformPtr;
 
-class ReprojectionTransform: public TransformI
+class LAS_DLL ReprojectionTransform: public TransformI
 {
 public:
     
     ReprojectionTransform(const SpatialReference& inSRS, const SpatialReference& outSRS);    
+    ReprojectionTransform(const SpatialReference& inSRS, const SpatialReference& outSRS, liblas::HeaderPtr new_header);    
     ~ReprojectionTransform();
 
     bool transform(Point& point);
 
 private:
 
-    // FIXME: use shared_ptr with custom deleter and get rid of bloat of OGR manual calls --mloskot
-    OGRCoordinateTransformationH m_transform;
-    OGRSpatialReferenceH m_in_ref;
-    OGRSpatialReferenceH m_out_ref;
+#ifdef HAVE_GDAL
+    struct OGRSpatialReferenceDeleter
+    {
+       template <typename T>
+       void operator()(T* ptr)
+       {
+           ::OSRDestroySpatialReference(ptr);
+       }
+    };
+
+    struct OSRTransformDeleter
+    {
+       template <typename T>
+       void operator()(T* ptr)
+       {
+           ::OCTDestroyCoordinateTransformation(ptr);
+       }
+    };
+
+#endif
+
+    liblas::HeaderPtr m_new_header;
+    
+    typedef boost::shared_ptr<void> ReferencePtr;
+    typedef boost::shared_ptr<void> TransformPtr;
+    ReferencePtr m_in_ref_ptr;
+    ReferencePtr m_out_ref_ptr;
+    TransformPtr m_transform_ptr;
+    
+
 
     ReprojectionTransform(ReprojectionTransform const& other);
     ReprojectionTransform& operator=(ReprojectionTransform const& rhs);
+    
+    void Initialize(SpatialReference const& inSRS, SpatialReference const& outSRS);
 };
 
+class LAS_DLL TranslationTransform: public TransformI
+{
+public:
+    
+    TranslationTransform(std::string const& expression);
+    ~TranslationTransform();
+
+    bool transform(Point& point);
+    
+    enum OPER_TYPE
+    {
+        eOPER_MULTIPLY = 0, 
+        eOPER_DIVIDE = 1, 
+        eOPER_SUBTRACT = 2,  
+        eOPER_ADD = 3,
+        eOPER_NONE = -99
+    };
+
+    // Yes, Mateusz, I'm embarassed by this :)
+    struct operation{
+        OPER_TYPE oper;
+        std::string dimension;
+        double value;
+        std::string expression;
+        
+        operation(std::string name) : oper(eOPER_NONE), dimension(name), value(0.0)
+        {
+        }
+    };
+
+private:
+
+    TranslationTransform(TranslationTransform const& other);
+    TranslationTransform& operator=(TranslationTransform const& rhs);
+    
+    operation GetOperation(std::string const& expression);
+    
+    std::vector<operation> operations;
+    
+    std::string m_expression;
+};
 } // namespace liblas
 
 #endif // ndef LIBLAS_LASTRANSFORM_HPP_INCLUDED
diff --git a/Utilities/otbliblas/include/liblas/lasvariablerecord.hpp b/Utilities/otbliblas/include/liblas/lasvariablerecord.hpp
old mode 100755
new mode 100644
index bc2fe369e1377210c3cc8f6878cbe491089ea2ed..30ac51e107cdaec242fa276eae29e2649785184a
--- a/Utilities/otbliblas/include/liblas/lasvariablerecord.hpp
+++ b/Utilities/otbliblas/include/liblas/lasvariablerecord.hpp
@@ -45,6 +45,7 @@
 
 #include <liblas/detail/private_utility.hpp>
 #include <liblas/external/property_tree/ptree.hpp>
+#include <liblas/export.hpp>
 // boost
 #include <boost/array.hpp>
 #include <boost/cstdint.hpp>
@@ -56,7 +57,7 @@
 namespace liblas {
 
 /// Representation of variable-length record data.
-class VariableRecord
+class LAS_DLL VariableRecord
 {
 public:
 
@@ -151,7 +152,7 @@ inline bool operator!=(VariableRecord const& lhs, VariableRecord const& rhs)
     return (!(lhs == rhs));
 }
 
-std::ostream& operator<<(std::ostream& os, liblas::VariableRecord const&);
+LAS_DLL std::ostream& operator<<(std::ostream& os, liblas::VariableRecord const&);
 
 
 } // namespace liblas
diff --git a/Utilities/otbliblas/include/liblas/lasversion.hpp b/Utilities/otbliblas/include/liblas/lasversion.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/include/liblas/laswriter.hpp b/Utilities/otbliblas/include/liblas/laswriter.hpp
old mode 100755
new mode 100644
index ac5b76ee3c0f09dcf1620947a730914ee799d310..f2fd2c976a65e41227400342c74d457717904fc5
--- a/Utilities/otbliblas/include/liblas/laswriter.hpp
+++ b/Utilities/otbliblas/include/liblas/laswriter.hpp
@@ -47,6 +47,7 @@
 #include <liblas/laspoint.hpp>
 #include <liblas/lastransform.hpp>
 #include <liblas/lasfilter.hpp>
+#include <liblas/export.hpp>
 // boost
 #include <boost/shared_ptr.hpp>
 // std
@@ -59,7 +60,7 @@ namespace liblas {
 
 /// Defines public interface to LAS writer implementation.
 /// This class 
-class Writer
+class LAS_DLL Writer
 {
 public:
 
diff --git a/Utilities/otbliblas/include/liblas/liblas.hpp b/Utilities/otbliblas/include/liblas/liblas.hpp
index 794543c012f878dc49e96fc7976eff9efc40d474..6797dbe37d9ca839da833e1f12a8aae007da7d33 100755
--- a/Utilities/otbliblas/include/liblas/liblas.hpp
+++ b/Utilities/otbliblas/include/liblas/liblas.hpp
@@ -67,6 +67,7 @@
 #include <liblas/detail/endian.hpp>
 #include <liblas/detail/private_utility.hpp>
 #include <liblas/capi/las_version.h>
+#include <liblas/export.hpp>
 
 // booost
 #include <boost/array.hpp>
@@ -130,7 +131,7 @@ public:
     
     virtual std::istream& GetStream() const = 0;
     
-    virtual ~ReaderI() {};    
+    virtual ~ReaderI() {}
 };
 
 class WriterI
@@ -143,11 +144,10 @@ public:
 
     virtual std::ostream& GetStream() const = 0;
 
-    virtual ~WriterI() {};    
+    virtual ~WriterI() {}
 
 };
 
-
 } // namespace liblas
 
 #endif // LIBLAS_HPP_INCLUDED
diff --git a/Utilities/otbliblas/include/liblas/utility.hpp b/Utilities/otbliblas/include/liblas/utility.hpp
index b48bfa61251106ae15e457bc23ebbbe963c38578..578a4cfc0d6d9d2ffb359219c5fff27198f69784 100755
--- a/Utilities/otbliblas/include/liblas/utility.hpp
+++ b/Utilities/otbliblas/include/liblas/utility.hpp
@@ -46,6 +46,7 @@
 #include <liblas/laspoint.hpp>
 #include <liblas/detail/fwd.hpp>
 #include <liblas/external/property_tree/ptree.hpp>
+#include <liblas/export.hpp>
 // boost
 #include <boost/cstdint.hpp>
 #include <boost/foreach.hpp>
@@ -60,7 +61,7 @@ typedef boost::array<boost::uint32_t, 32> classes_type;
 namespace liblas {
 
 /// A summarization utililty for LAS points
-class Summary
+class LAS_DLL Summary
 {
 public:
     
@@ -88,7 +89,7 @@ private:
     bool bHaveHeader; 
 };
 
-std::ostream& operator<<(std::ostream& os, liblas::Summary const& s);
+LAS_DLL std::ostream& operator<<(std::ostream& os, liblas::Summary const& s);
 
 } // namespace liblas
 
diff --git a/Utilities/otbliblas/include/liblas/version.hpp b/Utilities/otbliblas/include/liblas/version.hpp
index 7b7bc5a3274cff2e799473548787ac5cc60ba829..f9193adde829b4e997c14fecbfe5b10da4908ed3 100755
--- a/Utilities/otbliblas/include/liblas/version.hpp
+++ b/Utilities/otbliblas/include/liblas/version.hpp
@@ -50,12 +50,12 @@
 // LIBLAS_VERSION / 100 % 1000 is the minor version
 // LIBLAS_VERSION / 100000 is the major version
 
-#define LIBLAS_VERSION 103000
+#define LIBLAS_VERSION 106000
 
 // LIBLAS_LIB_VERSION must be defined to be the same as LIBLAS_VERSION
 // but as a *string* in the form "x_y[_z]" where x is the major version
 // number, y is the minor version number, and z is the patch level if not 0.
 
-#define LIBLAS_LIB_VERSION "1_3"
+#define LIBLAS_LIB_VERSION "1_6"
 
 #endif // LIBLAS_VERSION_HPP_INCLUDED
diff --git a/Utilities/otbliblas/python/examples/grab_classes.py b/Utilities/otbliblas/python/examples/grab_classes.py
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/python/examples/las_summary.py b/Utilities/otbliblas/python/examples/las_summary.py
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/python/liblas/core.py b/Utilities/otbliblas/python/liblas/core.py
index a71bbb9bd3da9a3d0d31671123e39190d5b5a6ec..d4f5bcfb4ea753e2983a5e1011cd3fa326df8df7 100755
--- a/Utilities/otbliblas/python/liblas/core.py
+++ b/Utilities/otbliblas/python/liblas/core.py
@@ -128,7 +128,7 @@ except ImportError:
 if os.name == 'nt':
 # stolen from Shapely
 # http://trac.gispython.org/projects/PCL/browser/Shapely/trunk/shapely/geos.py
-    lib_name = 'liblas1.dll'
+    lib_name = 'liblas_c.dll'
     try:
         local_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
         original_path = os.environ['PATH']
diff --git a/Utilities/otbliblas/python/scripts/laskdtree.py b/Utilities/otbliblas/python/scripts/laskdtree.py
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/python/setup.py b/Utilities/otbliblas/python/setup.py
index 45fea8e912a79fcfdf23404b2206c905fc46643b..73c3320a29273ca997a343374ef579fe78b43a69 100755
--- a/Utilities/otbliblas/python/setup.py
+++ b/Utilities/otbliblas/python/setup.py
@@ -18,7 +18,7 @@ install_requires = ['setuptools']
 
 import os
 
-version = '1.6.0b1'
+version = '1.6.0b2'
 
 if os.name == 'nt':
     # Windows NT library
diff --git a/Utilities/otbliblas/python/tests/Header.txt b/Utilities/otbliblas/python/tests/Header.txt
index d5004ff78e679e8551420307401617b518e4466b..64e78bd6eaff0565f00d483101f820c03fa2502d 100755
--- a/Utilities/otbliblas/python/tests/Header.txt
+++ b/Utilities/otbliblas/python/tests/Header.txt
@@ -48,7 +48,7 @@
   datetime.datetime(2008, 3, 19, 0, 0)
 
   >>> h.software_id
-  'libLAS 1.2'
+  'libLAS 1.6.0b2'
   >>> h.software_id = 'hobu'
   >>> h.software_id
   'hobu'
diff --git a/Utilities/otbliblas/python/tests/SRS-GDAL.txt b/Utilities/otbliblas/python/tests/SRS-GDAL.txt
index 6823a52cdcf9314ed299064c9b3db8b0eeee0825..72876fc7533374196a0b8687400de77a3afc0ed7 100755
--- a/Utilities/otbliblas/python/tests/SRS-GDAL.txt
+++ b/Utilities/otbliblas/python/tests/SRS-GDAL.txt
@@ -107,7 +107,8 @@ values are 0.01
   >>> del f_project
   >>> f3 = file.File('junk_srs_project.las')
   >>> f3.header.data_offset
-  476L
+  477L
+
   >>> s_utm = srs.SRS()
   >>> s_utm.wkt = utm_wkt
   >>> p3 = f3.read(1)
diff --git a/Utilities/otbliblas/python/tests/SRS-GeoTIFF.txt b/Utilities/otbliblas/python/tests/SRS-GeoTIFF.txt
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/src/CMakeLists.txt b/Utilities/otbliblas/src/CMakeLists.txt
old mode 100755
new mode 100644
index c4a4083a08cfbc56993f8483f5128660a9d7bd9a..687b012af7b2a6161dfa19122640594e20c3f4c3
--- a/Utilities/otbliblas/src/CMakeLists.txt
+++ b/Utilities/otbliblas/src/CMakeLists.txt
@@ -194,28 +194,41 @@ set(LIBLAS_C_SOURCES
   ${LIBLAS_HEADERS_DIR}/capi/liblas.h
   las_c_api.cpp)
 
-# Static libLAS C++ library
-add_library(${LIBLAS_LIB_NAME} STATIC ${LIBLAS_SOURCES})
+# NOTE:
+# This hack is required to correctly link static into shared library.
+# Such practice is not recommended as not portable, instead each library,
+# static and shared should be built from sources separately.
+if(UNIX)
+  add_definitions("-fPIC")
+endif()
+
+if(WIN32)
+    add_definitions("-DLAS_DLL_EXPORT=1")
+endif()
 
-# Shared libLAS C library
+add_library(${LIBLAS_LIB_NAME} SHARED ${LIBLAS_SOURCES})
 add_library(${LIBLAS_C_LIB_NAME} SHARED ${LIBLAS_C_SOURCES})
 
-if (APPLE)
-    set_target_properties(
-    ${LIBLAS_C_LIB_NAME}
-    PROPERTIES
-    INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
-    
-    )
-endif(APPLE)
+target_link_libraries(${LIBLAS_LIB_NAME}
+  ${LIBLAS_LIB_NAME}
+  ${TIFF_LIBRARY}
+  ${GEOTIFF_LIBRARY}
+  ${GDAL_LIBRARY}
+  ${Boost_LIBRARIES})
 
-########
 target_link_libraries(${LIBLAS_C_LIB_NAME}
   ${LIBLAS_LIB_NAME}
   ${TIFF_LIBRARY}
   ${GEOTIFF_LIBRARY}
   ${GDAL_LIBRARY}
-  ${SPATIALINDEX_LIBRARY})
+  ${Boost_LIBRARIES})
+
+if (APPLE)
+  set_target_properties(
+    ${LIBLAS_C_LIB_NAME}
+    PROPERTIES
+    INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+endif()
 
 ###############################################################################
 # Targets installation
diff --git a/Utilities/otbliblas/src/Makefile b/Utilities/otbliblas/src/Makefile
index 22fb8817ddb92db51479a26e1df2910708c4d1f3..0998f931700ee8b1a768449846c9311a3cf86754 100755
--- a/Utilities/otbliblas/src/Makefile
+++ b/Utilities/otbliblas/src/Makefile
@@ -39,10 +39,10 @@ RM = "/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E remove -f
 CMAKE_EDIT_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/ccmake"
 
 # The top-level source directory on which CMake was run.
-CMAKE_SOURCE_DIR = /tmp/liblas-main
+CMAKE_SOURCE_DIR = /tmp/liblas
 
 # The top-level build directory on which CMake was run.
-CMAKE_BINARY_DIR = /tmp/liblas-main
+CMAKE_BINARY_DIR = /tmp/liblas
 
 #=============================================================================
 # Targets provided globally by CMake.
@@ -101,7 +101,7 @@ list_install_components/fast: list_install_components
 # Special rule for the target package
 package: preinstall
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..."
-	cd /tmp/liblas-main && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackConfig.cmake
+	cd /tmp/liblas && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackConfig.cmake
 .PHONY : package
 
 # Special rule for the target package
@@ -111,7 +111,7 @@ package/fast: package
 # Special rule for the target package_source
 package_source:
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..."
-	cd /tmp/liblas-main && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackSourceConfig.cmake /tmp/liblas-main/CPackSourceConfig.cmake
+	cd /tmp/liblas && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackSourceConfig.cmake /tmp/liblas/CPackSourceConfig.cmake
 .PHONY : package_source
 
 # Special rule for the target package_source
@@ -140,14 +140,14 @@ test/fast: test
 
 # The main all target
 all: cmake_check_build_system
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas-main/CMakeFiles /tmp/liblas-main/src/CMakeFiles/progress.marks
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 src/all
-	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas-main/CMakeFiles 0
+	cd /tmp/liblas && $(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas/CMakeFiles /tmp/liblas/src/CMakeFiles/progress.marks
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 src/all
+	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas/CMakeFiles 0
 .PHONY : all
 
 # The main clean target
 clean:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 src/clean
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 src/clean
 .PHONY : clean
 
 # The main clean target
@@ -156,22 +156,22 @@ clean/fast: clean
 
 # Prepare targets for installation.
 preinstall: all
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 src/preinstall
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 src/preinstall
 .PHONY : preinstall
 
 # Prepare targets for installation.
 preinstall/fast:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 src/preinstall
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 src/preinstall
 .PHONY : preinstall/fast
 
 # clear depends
 depend:
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+	cd /tmp/liblas && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
 .PHONY : depend
 
 # Convenience name for target.
 src/CMakeFiles/las.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 src/CMakeFiles/las.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 src/CMakeFiles/las.dir/rule
 .PHONY : src/CMakeFiles/las.dir/rule
 
 # Convenience name for target.
@@ -180,12 +180,12 @@ las: src/CMakeFiles/las.dir/rule
 
 # fast build rule for target.
 las/fast:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/build
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/build
 .PHONY : las/fast
 
 # Convenience name for target.
 src/CMakeFiles/las_c.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 src/CMakeFiles/las_c.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 src/CMakeFiles/las_c.dir/rule
 .PHONY : src/CMakeFiles/las_c.dir/rule
 
 # Convenience name for target.
@@ -194,7 +194,7 @@ las_c: src/CMakeFiles/las_c.dir/rule
 
 # fast build rule for target.
 las_c/fast:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las_c.dir/build.make src/CMakeFiles/las_c.dir/build
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las_c.dir/build.make src/CMakeFiles/las_c.dir/build
 .PHONY : las_c/fast
 
 detail/index/indexcell.o: detail/index/indexcell.cpp.o
@@ -202,7 +202,7 @@ detail/index/indexcell.o: detail/index/indexcell.cpp.o
 
 # target to build an object file
 detail/index/indexcell.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexcell.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexcell.cpp.o
 .PHONY : detail/index/indexcell.cpp.o
 
 detail/index/indexcell.i: detail/index/indexcell.cpp.i
@@ -210,7 +210,7 @@ detail/index/indexcell.i: detail/index/indexcell.cpp.i
 
 # target to preprocess a source file
 detail/index/indexcell.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexcell.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexcell.cpp.i
 .PHONY : detail/index/indexcell.cpp.i
 
 detail/index/indexcell.s: detail/index/indexcell.cpp.s
@@ -218,7 +218,7 @@ detail/index/indexcell.s: detail/index/indexcell.cpp.s
 
 # target to generate assembly for a file
 detail/index/indexcell.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexcell.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexcell.cpp.s
 .PHONY : detail/index/indexcell.cpp.s
 
 detail/index/indexoutput.o: detail/index/indexoutput.cpp.o
@@ -226,7 +226,7 @@ detail/index/indexoutput.o: detail/index/indexoutput.cpp.o
 
 # target to build an object file
 detail/index/indexoutput.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexoutput.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexoutput.cpp.o
 .PHONY : detail/index/indexoutput.cpp.o
 
 detail/index/indexoutput.i: detail/index/indexoutput.cpp.i
@@ -234,7 +234,7 @@ detail/index/indexoutput.i: detail/index/indexoutput.cpp.i
 
 # target to preprocess a source file
 detail/index/indexoutput.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexoutput.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexoutput.cpp.i
 .PHONY : detail/index/indexoutput.cpp.i
 
 detail/index/indexoutput.s: detail/index/indexoutput.cpp.s
@@ -242,7 +242,7 @@ detail/index/indexoutput.s: detail/index/indexoutput.cpp.s
 
 # target to generate assembly for a file
 detail/index/indexoutput.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexoutput.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/index/indexoutput.cpp.s
 .PHONY : detail/index/indexoutput.cpp.s
 
 detail/reader/cachedreader.o: detail/reader/cachedreader.cpp.o
@@ -250,7 +250,7 @@ detail/reader/cachedreader.o: detail/reader/cachedreader.cpp.o
 
 # target to build an object file
 detail/reader/cachedreader.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/cachedreader.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/cachedreader.cpp.o
 .PHONY : detail/reader/cachedreader.cpp.o
 
 detail/reader/cachedreader.i: detail/reader/cachedreader.cpp.i
@@ -258,7 +258,7 @@ detail/reader/cachedreader.i: detail/reader/cachedreader.cpp.i
 
 # target to preprocess a source file
 detail/reader/cachedreader.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/cachedreader.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/cachedreader.cpp.i
 .PHONY : detail/reader/cachedreader.cpp.i
 
 detail/reader/cachedreader.s: detail/reader/cachedreader.cpp.s
@@ -266,7 +266,7 @@ detail/reader/cachedreader.s: detail/reader/cachedreader.cpp.s
 
 # target to generate assembly for a file
 detail/reader/cachedreader.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/cachedreader.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/cachedreader.cpp.s
 .PHONY : detail/reader/cachedreader.cpp.s
 
 detail/reader/header.o: detail/reader/header.cpp.o
@@ -274,7 +274,7 @@ detail/reader/header.o: detail/reader/header.cpp.o
 
 # target to build an object file
 detail/reader/header.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/header.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/header.cpp.o
 .PHONY : detail/reader/header.cpp.o
 
 detail/reader/header.i: detail/reader/header.cpp.i
@@ -282,7 +282,7 @@ detail/reader/header.i: detail/reader/header.cpp.i
 
 # target to preprocess a source file
 detail/reader/header.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/header.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/header.cpp.i
 .PHONY : detail/reader/header.cpp.i
 
 detail/reader/header.s: detail/reader/header.cpp.s
@@ -290,7 +290,7 @@ detail/reader/header.s: detail/reader/header.cpp.s
 
 # target to generate assembly for a file
 detail/reader/header.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/header.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/header.cpp.s
 .PHONY : detail/reader/header.cpp.s
 
 detail/reader/point.o: detail/reader/point.cpp.o
@@ -298,7 +298,7 @@ detail/reader/point.o: detail/reader/point.cpp.o
 
 # target to build an object file
 detail/reader/point.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/point.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/point.cpp.o
 .PHONY : detail/reader/point.cpp.o
 
 detail/reader/point.i: detail/reader/point.cpp.i
@@ -306,7 +306,7 @@ detail/reader/point.i: detail/reader/point.cpp.i
 
 # target to preprocess a source file
 detail/reader/point.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/point.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/point.cpp.i
 .PHONY : detail/reader/point.cpp.i
 
 detail/reader/point.s: detail/reader/point.cpp.s
@@ -314,7 +314,7 @@ detail/reader/point.s: detail/reader/point.cpp.s
 
 # target to generate assembly for a file
 detail/reader/point.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/point.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/point.cpp.s
 .PHONY : detail/reader/point.cpp.s
 
 detail/reader/reader.o: detail/reader/reader.cpp.o
@@ -322,7 +322,7 @@ detail/reader/reader.o: detail/reader/reader.cpp.o
 
 # target to build an object file
 detail/reader/reader.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/reader.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/reader.cpp.o
 .PHONY : detail/reader/reader.cpp.o
 
 detail/reader/reader.i: detail/reader/reader.cpp.i
@@ -330,7 +330,7 @@ detail/reader/reader.i: detail/reader/reader.cpp.i
 
 # target to preprocess a source file
 detail/reader/reader.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/reader.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/reader.cpp.i
 .PHONY : detail/reader/reader.cpp.i
 
 detail/reader/reader.s: detail/reader/reader.cpp.s
@@ -338,7 +338,7 @@ detail/reader/reader.s: detail/reader/reader.cpp.s
 
 # target to generate assembly for a file
 detail/reader/reader.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/reader.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/reader/reader.cpp.s
 .PHONY : detail/reader/reader.cpp.s
 
 detail/utility.o: detail/utility.cpp.o
@@ -346,7 +346,7 @@ detail/utility.o: detail/utility.cpp.o
 
 # target to build an object file
 detail/utility.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/utility.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/utility.cpp.o
 .PHONY : detail/utility.cpp.o
 
 detail/utility.i: detail/utility.cpp.i
@@ -354,7 +354,7 @@ detail/utility.i: detail/utility.cpp.i
 
 # target to preprocess a source file
 detail/utility.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/utility.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/utility.cpp.i
 .PHONY : detail/utility.cpp.i
 
 detail/utility.s: detail/utility.cpp.s
@@ -362,7 +362,7 @@ detail/utility.s: detail/utility.cpp.s
 
 # target to generate assembly for a file
 detail/utility.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/utility.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/utility.cpp.s
 .PHONY : detail/utility.cpp.s
 
 detail/writer/base.o: detail/writer/base.cpp.o
@@ -370,7 +370,7 @@ detail/writer/base.o: detail/writer/base.cpp.o
 
 # target to build an object file
 detail/writer/base.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/base.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/base.cpp.o
 .PHONY : detail/writer/base.cpp.o
 
 detail/writer/base.i: detail/writer/base.cpp.i
@@ -378,7 +378,7 @@ detail/writer/base.i: detail/writer/base.cpp.i
 
 # target to preprocess a source file
 detail/writer/base.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/base.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/base.cpp.i
 .PHONY : detail/writer/base.cpp.i
 
 detail/writer/base.s: detail/writer/base.cpp.s
@@ -386,7 +386,7 @@ detail/writer/base.s: detail/writer/base.cpp.s
 
 # target to generate assembly for a file
 detail/writer/base.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/base.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/base.cpp.s
 .PHONY : detail/writer/base.cpp.s
 
 detail/writer/header.o: detail/writer/header.cpp.o
@@ -394,7 +394,7 @@ detail/writer/header.o: detail/writer/header.cpp.o
 
 # target to build an object file
 detail/writer/header.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/header.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/header.cpp.o
 .PHONY : detail/writer/header.cpp.o
 
 detail/writer/header.i: detail/writer/header.cpp.i
@@ -402,7 +402,7 @@ detail/writer/header.i: detail/writer/header.cpp.i
 
 # target to preprocess a source file
 detail/writer/header.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/header.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/header.cpp.i
 .PHONY : detail/writer/header.cpp.i
 
 detail/writer/header.s: detail/writer/header.cpp.s
@@ -410,7 +410,7 @@ detail/writer/header.s: detail/writer/header.cpp.s
 
 # target to generate assembly for a file
 detail/writer/header.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/header.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/header.cpp.s
 .PHONY : detail/writer/header.cpp.s
 
 detail/writer/point.o: detail/writer/point.cpp.o
@@ -418,7 +418,7 @@ detail/writer/point.o: detail/writer/point.cpp.o
 
 # target to build an object file
 detail/writer/point.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/point.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/point.cpp.o
 .PHONY : detail/writer/point.cpp.o
 
 detail/writer/point.i: detail/writer/point.cpp.i
@@ -426,7 +426,7 @@ detail/writer/point.i: detail/writer/point.cpp.i
 
 # target to preprocess a source file
 detail/writer/point.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/point.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/point.cpp.i
 .PHONY : detail/writer/point.cpp.i
 
 detail/writer/point.s: detail/writer/point.cpp.s
@@ -434,7 +434,7 @@ detail/writer/point.s: detail/writer/point.cpp.s
 
 # target to generate assembly for a file
 detail/writer/point.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/point.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/point.cpp.s
 .PHONY : detail/writer/point.cpp.s
 
 detail/writer/writer.o: detail/writer/writer.cpp.o
@@ -442,7 +442,7 @@ detail/writer/writer.o: detail/writer/writer.cpp.o
 
 # target to build an object file
 detail/writer/writer.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/writer.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/writer.cpp.o
 .PHONY : detail/writer/writer.cpp.o
 
 detail/writer/writer.i: detail/writer/writer.cpp.i
@@ -450,7 +450,7 @@ detail/writer/writer.i: detail/writer/writer.cpp.i
 
 # target to preprocess a source file
 detail/writer/writer.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/writer.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/writer.cpp.i
 .PHONY : detail/writer/writer.cpp.i
 
 detail/writer/writer.s: detail/writer/writer.cpp.s
@@ -458,7 +458,7 @@ detail/writer/writer.s: detail/writer/writer.cpp.s
 
 # target to generate assembly for a file
 detail/writer/writer.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/writer.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/detail/writer/writer.cpp.s
 .PHONY : detail/writer/writer.cpp.s
 
 las_c_api.o: las_c_api.cpp.o
@@ -466,7 +466,7 @@ las_c_api.o: las_c_api.cpp.o
 
 # target to build an object file
 las_c_api.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las_c.dir/build.make src/CMakeFiles/las_c.dir/las_c_api.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las_c.dir/build.make src/CMakeFiles/las_c.dir/las_c_api.cpp.o
 .PHONY : las_c_api.cpp.o
 
 las_c_api.i: las_c_api.cpp.i
@@ -474,7 +474,7 @@ las_c_api.i: las_c_api.cpp.i
 
 # target to preprocess a source file
 las_c_api.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las_c.dir/build.make src/CMakeFiles/las_c.dir/las_c_api.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las_c.dir/build.make src/CMakeFiles/las_c.dir/las_c_api.cpp.i
 .PHONY : las_c_api.cpp.i
 
 las_c_api.s: las_c_api.cpp.s
@@ -482,7 +482,7 @@ las_c_api.s: las_c_api.cpp.s
 
 # target to generate assembly for a file
 las_c_api.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las_c.dir/build.make src/CMakeFiles/las_c.dir/las_c_api.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las_c.dir/build.make src/CMakeFiles/las_c.dir/las_c_api.cpp.s
 .PHONY : las_c_api.cpp.s
 
 lasclassification.o: lasclassification.cpp.o
@@ -490,7 +490,7 @@ lasclassification.o: lasclassification.cpp.o
 
 # target to build an object file
 lasclassification.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasclassification.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasclassification.cpp.o
 .PHONY : lasclassification.cpp.o
 
 lasclassification.i: lasclassification.cpp.i
@@ -498,7 +498,7 @@ lasclassification.i: lasclassification.cpp.i
 
 # target to preprocess a source file
 lasclassification.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasclassification.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasclassification.cpp.i
 .PHONY : lasclassification.cpp.i
 
 lasclassification.s: lasclassification.cpp.s
@@ -506,7 +506,7 @@ lasclassification.s: lasclassification.cpp.s
 
 # target to generate assembly for a file
 lasclassification.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasclassification.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasclassification.cpp.s
 .PHONY : lasclassification.cpp.s
 
 lascolor.o: lascolor.cpp.o
@@ -514,7 +514,7 @@ lascolor.o: lascolor.cpp.o
 
 # target to build an object file
 lascolor.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lascolor.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lascolor.cpp.o
 .PHONY : lascolor.cpp.o
 
 lascolor.i: lascolor.cpp.i
@@ -522,7 +522,7 @@ lascolor.i: lascolor.cpp.i
 
 # target to preprocess a source file
 lascolor.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lascolor.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lascolor.cpp.i
 .PHONY : lascolor.cpp.i
 
 lascolor.s: lascolor.cpp.s
@@ -530,7 +530,7 @@ lascolor.s: lascolor.cpp.s
 
 # target to generate assembly for a file
 lascolor.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lascolor.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lascolor.cpp.s
 .PHONY : lascolor.cpp.s
 
 lasdimension.o: lasdimension.cpp.o
@@ -538,7 +538,7 @@ lasdimension.o: lasdimension.cpp.o
 
 # target to build an object file
 lasdimension.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasdimension.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasdimension.cpp.o
 .PHONY : lasdimension.cpp.o
 
 lasdimension.i: lasdimension.cpp.i
@@ -546,7 +546,7 @@ lasdimension.i: lasdimension.cpp.i
 
 # target to preprocess a source file
 lasdimension.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasdimension.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasdimension.cpp.i
 .PHONY : lasdimension.cpp.i
 
 lasdimension.s: lasdimension.cpp.s
@@ -554,7 +554,7 @@ lasdimension.s: lasdimension.cpp.s
 
 # target to generate assembly for a file
 lasdimension.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasdimension.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasdimension.cpp.s
 .PHONY : lasdimension.cpp.s
 
 laserror.o: laserror.cpp.o
@@ -562,7 +562,7 @@ laserror.o: laserror.cpp.o
 
 # target to build an object file
 laserror.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laserror.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laserror.cpp.o
 .PHONY : laserror.cpp.o
 
 laserror.i: laserror.cpp.i
@@ -570,7 +570,7 @@ laserror.i: laserror.cpp.i
 
 # target to preprocess a source file
 laserror.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laserror.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laserror.cpp.i
 .PHONY : laserror.cpp.i
 
 laserror.s: laserror.cpp.s
@@ -578,7 +578,7 @@ laserror.s: laserror.cpp.s
 
 # target to generate assembly for a file
 laserror.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laserror.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laserror.cpp.s
 .PHONY : laserror.cpp.s
 
 lasfilter.o: lasfilter.cpp.o
@@ -586,7 +586,7 @@ lasfilter.o: lasfilter.cpp.o
 
 # target to build an object file
 lasfilter.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasfilter.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasfilter.cpp.o
 .PHONY : lasfilter.cpp.o
 
 lasfilter.i: lasfilter.cpp.i
@@ -594,7 +594,7 @@ lasfilter.i: lasfilter.cpp.i
 
 # target to preprocess a source file
 lasfilter.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasfilter.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasfilter.cpp.i
 .PHONY : lasfilter.cpp.i
 
 lasfilter.s: lasfilter.cpp.s
@@ -602,7 +602,7 @@ lasfilter.s: lasfilter.cpp.s
 
 # target to generate assembly for a file
 lasfilter.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasfilter.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasfilter.cpp.s
 .PHONY : lasfilter.cpp.s
 
 lasheader.o: lasheader.cpp.o
@@ -610,7 +610,7 @@ lasheader.o: lasheader.cpp.o
 
 # target to build an object file
 lasheader.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasheader.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasheader.cpp.o
 .PHONY : lasheader.cpp.o
 
 lasheader.i: lasheader.cpp.i
@@ -618,7 +618,7 @@ lasheader.i: lasheader.cpp.i
 
 # target to preprocess a source file
 lasheader.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasheader.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasheader.cpp.i
 .PHONY : lasheader.cpp.i
 
 lasheader.s: lasheader.cpp.s
@@ -626,7 +626,7 @@ lasheader.s: lasheader.cpp.s
 
 # target to generate assembly for a file
 lasheader.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasheader.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasheader.cpp.s
 .PHONY : lasheader.cpp.s
 
 lasindex.o: lasindex.cpp.o
@@ -634,7 +634,7 @@ lasindex.o: lasindex.cpp.o
 
 # target to build an object file
 lasindex.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasindex.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasindex.cpp.o
 .PHONY : lasindex.cpp.o
 
 lasindex.i: lasindex.cpp.i
@@ -642,7 +642,7 @@ lasindex.i: lasindex.cpp.i
 
 # target to preprocess a source file
 lasindex.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasindex.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasindex.cpp.i
 .PHONY : lasindex.cpp.i
 
 lasindex.s: lasindex.cpp.s
@@ -650,7 +650,7 @@ lasindex.s: lasindex.cpp.s
 
 # target to generate assembly for a file
 lasindex.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasindex.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasindex.cpp.s
 .PHONY : lasindex.cpp.s
 
 laspoint.o: laspoint.cpp.o
@@ -658,7 +658,7 @@ laspoint.o: laspoint.cpp.o
 
 # target to build an object file
 laspoint.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laspoint.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laspoint.cpp.o
 .PHONY : laspoint.cpp.o
 
 laspoint.i: laspoint.cpp.i
@@ -666,7 +666,7 @@ laspoint.i: laspoint.cpp.i
 
 # target to preprocess a source file
 laspoint.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laspoint.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laspoint.cpp.i
 .PHONY : laspoint.cpp.i
 
 laspoint.s: laspoint.cpp.s
@@ -674,7 +674,7 @@ laspoint.s: laspoint.cpp.s
 
 # target to generate assembly for a file
 laspoint.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laspoint.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laspoint.cpp.s
 .PHONY : laspoint.cpp.s
 
 lasreader.o: lasreader.cpp.o
@@ -682,7 +682,7 @@ lasreader.o: lasreader.cpp.o
 
 # target to build an object file
 lasreader.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasreader.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasreader.cpp.o
 .PHONY : lasreader.cpp.o
 
 lasreader.i: lasreader.cpp.i
@@ -690,7 +690,7 @@ lasreader.i: lasreader.cpp.i
 
 # target to preprocess a source file
 lasreader.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasreader.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasreader.cpp.i
 .PHONY : lasreader.cpp.i
 
 lasreader.s: lasreader.cpp.s
@@ -698,7 +698,7 @@ lasreader.s: lasreader.cpp.s
 
 # target to generate assembly for a file
 lasreader.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasreader.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasreader.cpp.s
 .PHONY : lasreader.cpp.s
 
 lasschema.o: lasschema.cpp.o
@@ -706,7 +706,7 @@ lasschema.o: lasschema.cpp.o
 
 # target to build an object file
 lasschema.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasschema.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasschema.cpp.o
 .PHONY : lasschema.cpp.o
 
 lasschema.i: lasschema.cpp.i
@@ -714,7 +714,7 @@ lasschema.i: lasschema.cpp.i
 
 # target to preprocess a source file
 lasschema.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasschema.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasschema.cpp.i
 .PHONY : lasschema.cpp.i
 
 lasschema.s: lasschema.cpp.s
@@ -722,7 +722,7 @@ lasschema.s: lasschema.cpp.s
 
 # target to generate assembly for a file
 lasschema.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasschema.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasschema.cpp.s
 .PHONY : lasschema.cpp.s
 
 lasspatialreference.o: lasspatialreference.cpp.o
@@ -730,7 +730,7 @@ lasspatialreference.o: lasspatialreference.cpp.o
 
 # target to build an object file
 lasspatialreference.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasspatialreference.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasspatialreference.cpp.o
 .PHONY : lasspatialreference.cpp.o
 
 lasspatialreference.i: lasspatialreference.cpp.i
@@ -738,7 +738,7 @@ lasspatialreference.i: lasspatialreference.cpp.i
 
 # target to preprocess a source file
 lasspatialreference.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasspatialreference.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasspatialreference.cpp.i
 .PHONY : lasspatialreference.cpp.i
 
 lasspatialreference.s: lasspatialreference.cpp.s
@@ -746,7 +746,7 @@ lasspatialreference.s: lasspatialreference.cpp.s
 
 # target to generate assembly for a file
 lasspatialreference.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasspatialreference.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasspatialreference.cpp.s
 .PHONY : lasspatialreference.cpp.s
 
 lastransform.o: lastransform.cpp.o
@@ -754,7 +754,7 @@ lastransform.o: lastransform.cpp.o
 
 # target to build an object file
 lastransform.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lastransform.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lastransform.cpp.o
 .PHONY : lastransform.cpp.o
 
 lastransform.i: lastransform.cpp.i
@@ -762,7 +762,7 @@ lastransform.i: lastransform.cpp.i
 
 # target to preprocess a source file
 lastransform.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lastransform.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lastransform.cpp.i
 .PHONY : lastransform.cpp.i
 
 lastransform.s: lastransform.cpp.s
@@ -770,7 +770,7 @@ lastransform.s: lastransform.cpp.s
 
 # target to generate assembly for a file
 lastransform.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lastransform.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lastransform.cpp.s
 .PHONY : lastransform.cpp.s
 
 lasvariablerecord.o: lasvariablerecord.cpp.o
@@ -778,7 +778,7 @@ lasvariablerecord.o: lasvariablerecord.cpp.o
 
 # target to build an object file
 lasvariablerecord.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasvariablerecord.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasvariablerecord.cpp.o
 .PHONY : lasvariablerecord.cpp.o
 
 lasvariablerecord.i: lasvariablerecord.cpp.i
@@ -786,7 +786,7 @@ lasvariablerecord.i: lasvariablerecord.cpp.i
 
 # target to preprocess a source file
 lasvariablerecord.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasvariablerecord.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasvariablerecord.cpp.i
 .PHONY : lasvariablerecord.cpp.i
 
 lasvariablerecord.s: lasvariablerecord.cpp.s
@@ -794,7 +794,7 @@ lasvariablerecord.s: lasvariablerecord.cpp.s
 
 # target to generate assembly for a file
 lasvariablerecord.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasvariablerecord.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/lasvariablerecord.cpp.s
 .PHONY : lasvariablerecord.cpp.s
 
 laswriter.o: laswriter.cpp.o
@@ -802,7 +802,7 @@ laswriter.o: laswriter.cpp.o
 
 # target to build an object file
 laswriter.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laswriter.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laswriter.cpp.o
 .PHONY : laswriter.cpp.o
 
 laswriter.i: laswriter.cpp.i
@@ -810,7 +810,7 @@ laswriter.i: laswriter.cpp.i
 
 # target to preprocess a source file
 laswriter.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laswriter.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laswriter.cpp.i
 .PHONY : laswriter.cpp.i
 
 laswriter.s: laswriter.cpp.s
@@ -818,7 +818,7 @@ laswriter.s: laswriter.cpp.s
 
 # target to generate assembly for a file
 laswriter.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laswriter.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/laswriter.cpp.s
 .PHONY : laswriter.cpp.s
 
 utility.o: utility.cpp.o
@@ -826,7 +826,7 @@ utility.o: utility.cpp.o
 
 # target to build an object file
 utility.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/utility.cpp.o
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/utility.cpp.o
 .PHONY : utility.cpp.o
 
 utility.i: utility.cpp.i
@@ -834,7 +834,7 @@ utility.i: utility.cpp.i
 
 # target to preprocess a source file
 utility.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/utility.cpp.i
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/utility.cpp.i
 .PHONY : utility.cpp.i
 
 utility.s: utility.cpp.s
@@ -842,7 +842,7 @@ utility.s: utility.cpp.s
 
 # target to generate assembly for a file
 utility.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/utility.cpp.s
+	cd /tmp/liblas && $(MAKE) -f src/CMakeFiles/las.dir/build.make src/CMakeFiles/las.dir/utility.cpp.s
 .PHONY : utility.cpp.s
 
 # Help Target
@@ -954,6 +954,6 @@ help:
 # No rule that depends on this can have commands that come from listfiles
 # because they might be regenerated.
 cmake_check_build_system:
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+	cd /tmp/liblas && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
 .PHONY : cmake_check_build_system
 
diff --git a/Utilities/otbliblas/src/detail/index/indexcell.cpp b/Utilities/otbliblas/src/detail/index/indexcell.cpp
old mode 100755
new mode 100644
index 1fb34d3055a616cbff5d433239e51a9bf1d0ff71..550b3f6a8f52416b22d5f8b98c4ae278d1b010be
--- a/Utilities/otbliblas/src/detail/index/indexcell.cpp
+++ b/Utilities/otbliblas/src/detail/index/indexcell.cpp
@@ -57,7 +57,7 @@ IndexCell::IndexCell() :
 } // IndexCell::IndexCell
 
 
-void IndexCell::SetFileOffset(boost::uint32_t fos)
+void IndexCell::SetFileOffset(TempFileOffsetType fos)
 {
 	m_FileOffset = fos;
 } // IndexCell::SetFileOffset
@@ -67,7 +67,7 @@ void IndexCell::SetNumPoints(boost::uint32_t nmp)
 	m_NumPoints = nmp;
 } // IndexCell::SetNumPoints
 
-boost::uint32_t IndexCell::GetFileOffset(void) const
+TempFileOffsetType IndexCell::GetFileOffset(void) const
 {
 	return(m_FileOffset);
 } // IndexCell::GetFileOffset
diff --git a/Utilities/otbliblas/src/detail/index/indexoutput.cpp b/Utilities/otbliblas/src/detail/index/indexoutput.cpp
old mode 100755
new mode 100644
index 6236928c1e9c0c0ffd02899994dcc4fcfdb11309..60a60e6b8d6003b164faf98ea51868ee12a2b694
--- a/Utilities/otbliblas/src/detail/index/indexoutput.cpp
+++ b/Utilities/otbliblas/src/detail/index/indexoutput.cpp
@@ -49,20 +49,22 @@ namespace liblas { namespace detail {
 
 IndexOutput::IndexOutput(liblas::Index *indexsource) :
 	m_index(indexsource), 
-	m_VLRCommonDataSize(5 * sizeof(boost::uint32_t)),
+	m_VLRCommonDataSize(6 * sizeof(boost::uint32_t)),
 	m_VLRDataSizeLocation(4 * sizeof(boost::uint32_t)),
 	m_FirstCellLocation(0),
-	m_LastCellLocation(sizeof(boost::uint32_t) * 2)
+	m_LastCellLocation(sizeof(boost::uint32_t) * 2),
+	m_VLRPointCountLocation(5 * sizeof(boost::uint32_t)),
+	m_DataPointsThisVLR(0)
 {
 } // IndexOutput::IndexOutput
 
 bool IndexOutput::InitiateOutput(void)
 {
 
-	boost::uint8_t VersionMajor = LIBLAS_INDEX_VERSIONMAJOR, VersionMinor = LIBLAS_INDEX_VERSIONMINOR;
+	boost::uint8_t Version;
 	char DestStr[LIBLAS_INDEX_MAXSTRLEN];
 	boost::uint16_t StringLen;
-	boost::uint16_t WritePos = 0;
+	boost::uint32_t WritePos = 0;
 	
 	try {
 		// write a header in standard VLR format
@@ -72,8 +74,10 @@ bool IndexOutput::InitiateOutput(void)
 		m_indexVLRHeaderRecord.SetDescription("LibLAS Index Header");
 		// set the header data into the header data string
 		// Index file version
-		WriteVLRData_n(m_indexVLRHeaderData, VersionMajor, WritePos);
-		WriteVLRData_n(m_indexVLRHeaderData, VersionMinor, WritePos);
+		Version = m_index->GetVersionMajor();
+		WriteVLRData_n(m_indexVLRHeaderData, Version, WritePos);
+		Version = m_index->GetVersionMinor();
+		WriteVLRData_n(m_indexVLRHeaderData, Version, WritePos);
 		// creator		
 		strncpy(DestStr, m_index->GetIndexAuthorStr(), LIBLAS_INDEX_MAXSTRLEN - 1);
 		DestStr[LIBLAS_INDEX_MAXSTRLEN - 1] = 0;
@@ -107,7 +111,7 @@ bool IndexOutput::InitiateOutput(void)
 		TempData = m_index->GetMaxZ();
 		WriteVLRData_n(m_indexVLRHeaderData, TempData, WritePos);
 
-		// ID number of associated data VLR's - normally 43 but may use heigher numbers
+		// ID number of associated data VLR's - normally 43 but may use higher numbers
 		// in order to store more than one index in a file
 		boost::uint32_t TempLong = m_index->GetDataVLR_ID();
 		WriteVLRData_n(m_indexVLRHeaderData, TempLong, WritePos);
@@ -122,8 +126,9 @@ bool IndexOutput::InitiateOutput(void)
 		TempLong = m_index->GetCellsZ();
 		WriteVLRData_n(m_indexVLRHeaderData, TempLong, WritePos);
 		
-		// record length		
-		m_indexVLRHeaderRecord.SetRecordLength(WritePos);
+		// record length
+		assert(WritePos <= std::numeric_limits<boost::uint16_t>::max());		
+		m_indexVLRHeaderRecord.SetRecordLength(static_cast<boost::uint16_t>(WritePos));
 		m_indexVLRHeaderData.resize(WritePos);
 		m_indexVLRHeaderRecord.SetData(m_indexVLRHeaderData);
 		m_index->GetIndexHeader()->AddVLR(m_indexVLRHeaderRecord);
@@ -166,9 +171,15 @@ bool IndexOutput::OutputCell(liblas::detail::IndexCell *CellBlock, boost::uint32
 		NumPts = CellBlock->GetNumPoints();
 		if (NumPts)
 		{
+			// keep track of the number of points in this VLR - added in Index version 1.1
+			m_DataPointsThisVLR += NumPts;
+			
 			// current cell, x, y
 			WriteVLRData_n(m_indexVLRTempData, x, m_TempWritePos);
 			WriteVLRData_n(m_indexVLRTempData, y, m_TempWritePos);
+			// number of points in this cell - added in Index version 1.1
+			WriteVLRData_n(m_indexVLRTempData, NumPts, m_TempWritePos);
+
 			// min and max Z
 			ElevExtrema ExtremaZ = CellBlock->GetMinZ();
 			WriteVLRData_n(m_indexVLRTempData, ExtremaZ, m_TempWritePos);
@@ -182,6 +193,7 @@ bool IndexOutput::OutputCell(liblas::detail::IndexCell *CellBlock, boost::uint32
 			WriteVLRData_n(m_indexVLRTempData, SubCellsXY, m_TempWritePos);
 			SubCellsZ = CellBlock->GetNumZCellRecords();
 			WriteVLRData_n(m_indexVLRTempData, SubCellsZ, m_TempWritePos);
+			
 
 			// <<<>>> prevent array overruns
 			// compile data into one long vector m_indexVLRTempData
@@ -264,6 +276,8 @@ bool IndexOutput::OutputCell(liblas::detail::IndexCell *CellBlock, boost::uint32
 				// update data record size
 				m_DataRecordSize += m_TempWritePos;
 				WriteVLRDataNoInc_n(m_indexVLRCellPointData, m_DataRecordSize, m_VLRDataSizeLocation);
+				// number of points in this VLR - added in Index version 1.1
+				WriteVLRDataNoInc_n(m_indexVLRCellPointData, m_DataPointsThisVLR, m_VLRPointCountLocation);
 				WriteVLRDataNoInc_str(m_indexVLRCellPointData, (char * const)&m_indexVLRTempData[0], m_TempWritePos, WritePos);
 				m_SomeDataReadyToWrite = true;
 				// rewind counter to start new cell data
@@ -288,6 +302,8 @@ bool IndexOutput::OutputCell(liblas::detail::IndexCell *CellBlock, boost::uint32
 				if (m_indexVLRCellPointData.size() != numeric_limits<unsigned short>::max())
 					m_indexVLRCellPointData.resize(numeric_limits<unsigned short>::max());
 				WriteVLRDataNoInc_n(m_indexVLRCellPointData, m_DataRecordSize, m_VLRDataSizeLocation);
+				// number of points in this VLR - added in Index version 1.1
+				WriteVLRDataNoInc_n(m_indexVLRCellPointData, m_DataPointsThisVLR, m_VLRPointCountLocation);
 				
 				// write out the part that fits in this VLR (excluding the common data)
 				boost::uint32_t WrittenBytes = numeric_limits<unsigned short>::max() - WritePos;
@@ -334,6 +350,7 @@ bool IndexOutput::InitializeVLRData(boost::uint32_t CurCellX, boost::uint32_t Cu
 		m_indexVLRCellPointData.resize(numeric_limits<unsigned short>::max());
 
 		m_DataRecordSize = m_VLRCommonDataSize;
+		m_DataPointsThisVLR = 0;
 		// 1st cell in VLR, x, y
 		WriteVLRDataNoInc_n(m_indexVLRCellPointData, CurCellX, m_FirstCellLocation);
 		WriteVLRDataNoInc_n(m_indexVLRCellPointData, CurCellY, m_FirstCellLocation + sizeof(boost::uint32_t));
@@ -342,6 +359,8 @@ bool IndexOutput::InitializeVLRData(boost::uint32_t CurCellX, boost::uint32_t Cu
 		WriteVLRDataNoInc_n(m_indexVLRCellPointData, CurCellY, m_LastCellLocation + sizeof(boost::uint32_t));
 		// data record size
 		WriteVLRDataNoInc_n(m_indexVLRCellPointData, m_DataRecordSize, m_VLRDataSizeLocation);
+		// number of points in this VLR - added in Index version 1.1
+		WriteVLRDataNoInc_n(m_indexVLRCellPointData, m_DataPointsThisVLR, m_VLRPointCountLocation);
 		m_FirstCellInVLR = false;
 		m_SomeDataReadyToWrite = false;
 
diff --git a/Utilities/otbliblas/src/detail/reader/cachedreader.cpp b/Utilities/otbliblas/src/detail/reader/cachedreader.cpp
old mode 100755
new mode 100644
index 6fc9e6100e0bcda66e8af4db80c38dcb26299732..ee50baa54ea6df391f97ece6474923c98a5e188c
--- a/Utilities/otbliblas/src/detail/reader/cachedreader.cpp
+++ b/Utilities/otbliblas/src/detail/reader/cachedreader.cpp
@@ -66,6 +66,7 @@ CachedReaderImpl::CachedReaderImpl(std::istream& ifs , std::size_t size)
     , m_cache_size(size)
     , m_cache_start_position(0)
     , m_cache_read_position(0)
+    , m_cache_initialized(false)
 {
 }
 
@@ -81,13 +82,13 @@ HeaderPtr CachedReaderImpl::ReadHeader()
     if (m_cache_size > hptr->GetPointRecordsCount()) {
         m_cache_size = hptr->GetPointRecordsCount();
     }
-    m_cache.resize(m_cache_size);
-    
-    // Mark all positions as uncached and build up the mask
-    // to the size of the number of points in the file
-    for (boost::uint32_t i = 0; i < hptr->GetPointRecordsCount(); ++i) {
-        m_mask.push_back(0);
-    }
+    // // FIXME: Note, vector::resize never shrinks the container and frees memory! Are we aware of this fact here? --mloskot
+    // m_cache.resize(m_cache_size);
+    // 
+    // // Mark all positions as uncached and build up the mask
+    // // to the size of the number of points in the file
+    // boost::uint8_t const uncached_mask = 0;
+    // cache_mask_type(hptr->GetPointRecordsCount(), uncached_mask).swap(m_mask);
     
     return hptr;
 }
@@ -138,6 +139,21 @@ liblas::Point const& CachedReaderImpl::ReadCachedPoint(boost::uint32_t position,
     // }
     // std::cout << std::endl;
 
+    // If our point cache and mask have not yet been initialized, we 
+    // should do so before tyring to read any points.  We don't want to do 
+    // this in ::Reset or ::ReadHeader, as these functions may be called 
+    // multiple times and screw up our assumptions.
+    if (!m_cache_initialized) 
+    {
+        m_cache = cache_type(m_cache_size);
+    
+        // Mark all positions as uncached and build up the mask
+        // to the size of the number of points in the file
+        boost::uint8_t const uncached_mask = 0;
+        cache_mask_type(header->GetPointRecordsCount(), uncached_mask).swap(m_mask);
+ 
+        m_cache_initialized = true;
+    }
     if (m_mask[position] == 1) {
         m_cache_read_position = position;
         return m_cache[cache_position];
@@ -206,7 +222,7 @@ liblas::Point const& CachedReaderImpl::ReadPointAt(std::size_t n, HeaderPtr head
         std::string out(output.str());
         throw std::runtime_error(out);
     }
-
+    
     liblas::Point const& p = ReadCachedPoint(n, header);
     m_cache_read_position = n;
     return p;
@@ -215,7 +231,10 @@ liblas::Point const& CachedReaderImpl::ReadPointAt(std::size_t n, HeaderPtr head
 void CachedReaderImpl::Reset(HeaderPtr header)
 {
     if (m_mask.empty())
+    {    
+        ReaderImpl::Reset(header);
         return;
+    }
 
     typedef cache_mask_type::size_type size_type;
     size_type old_cache_start_position = m_cache_start_position;
@@ -232,6 +251,7 @@ void CachedReaderImpl::Reset(HeaderPtr header)
 
     m_cache_start_position = 0;
     m_cache_read_position = 0;
+    m_cache_initialized = false;
 
     ReaderImpl::Reset(header);
 }
diff --git a/Utilities/otbliblas/src/detail/reader/header.cpp b/Utilities/otbliblas/src/detail/reader/header.cpp
index 92883c7bec348866d27672d98dfff87a6458dceb..2187d980854345b3e08be38fe0ea55ff7181d656 100755
--- a/Utilities/otbliblas/src/detail/reader/header.cpp
+++ b/Utilities/otbliblas/src/detail/reader/header.cpp
@@ -203,14 +203,11 @@ void Header::read()
     m_header->SetPointRecordsCount(n4);
 
     // 20. Number of points by return
-    // The committee in its infinite stupidity decided to increase the 
-    // size of this array at 1.3.  Yay for complex code.
+    // A few versions of the spec had this as 7, but 
+    // https://lidarbb.cr.usgs.gov/index.php?showtopic=11388 says 
+    // it is supposed to always be 5
     std::vector<uint32_t>::size_type  return_count_length;
-    if (m_header->GetVersionMinor() > 2) {
-        return_count_length = 7;
-    } else {
-        return_count_length = 5;
-    }
+    return_count_length = 5;
 
     uint32_t* point_counts = new uint32_t[return_count_length];
     for (uint32_t i = 0; i < return_count_length; ++i) {
@@ -280,41 +277,64 @@ void Header::read()
     if (m_ifs.eof())
         m_ifs.clear();
     
-    // NOTE: This section is commented out because we now have to believe 
-    // the header's GetPointRecordsCount due to the fact that the LAS 1.3 
-    // specification no longer mandates that the end of the file is the end
-    // of the points.  See http://trac.liblas.org/ticket/147 for more 
-    // details on this issue and why the seek is a problem in the windows 
-    // case.
-    // // Seek to the beginning
-    // m_ifs.seekg(0, std::ios::beg);
-    // std::ios::pos_type beginning = m_ifs.tellg();
-    // 
-    // // Seek to the end
-    // m_ifs.seekg(0, std::ios::end);
-    // std::ios::pos_type end = m_ifs.tellg();
-    // std::ios::off_type size = end - beginning;
-    //  
-    // // Figure out how many points we have 
-    // std::ios::off_type count = (end - static_cast<std::ios::off_type>(m_header->GetDataOffset())) / 
-    //                              static_cast<std::ios::off_type>(m_header->GetDataRecordLength());
-    // 
-    // if ( m_header->GetPointRecordsCount() != static_cast<uint32_t>(count)) {
-    //     std::ostringstream msg; 
-    //     msg <<  "The number of points in the header that was set "
-    //             "by the software '" << m_header->GetSoftwareId() <<
-    //             "' does not match the actual number of points in the file "
-    //             "as determined by subtracting the data offset (" 
-    //             <<m_header->GetDataOffset() << ") from the file length (" 
-    //             << size <<  ") and dividing by the point record length(" 
-    //             << m_header->GetDataRecordLength() << "). "
-    //             " Actual number of points: " << count << 
-    //             " Header-specified number of points: " 
-    //             << m_header->GetPointRecordsCount() ;
-    //     throw std::runtime_error(msg.str());
-    //     
-    // }
+    // LAS 1.3 specification no longer mandates that the end of the file is the
+    // end of the points. See http://trac.liblas.org/ticket/147 for more details
+    // on this issue and why the seek can be trouble in the windows case.  
+    // If you are having trouble properly seeking to the end of the stream on 
+    // windows, use boost's iostreams or similar, which do not have an overflow 
+    // problem.
+    
+    if (m_header->GetVersionMinor() < 3) 
+    {
+        // Seek to the beginning 
+        m_ifs.seekg(0, std::ios::beg);
+        std::ios::pos_type beginning = m_ifs.tellg();
     
+        // Seek to the end
+        m_ifs.seekg(0, std::ios::end);
+        std::ios::pos_type end = m_ifs.tellg();
+        std::ios::off_type size = end - beginning;
+        std::ios::off_type offset = static_cast<std::ios::off_type>(m_header->GetDataOffset());
+        std::ios::off_type length = static_cast<std::ios::off_type>(m_header->GetDataRecordLength());
+        std::ios::off_type point_bytes = end - offset;
+
+        // Figure out how many points we have and whether or not we have 
+        // extra slop in there.
+        std::ios::off_type count = point_bytes / length;
+        std::ios::off_type remainder = point_bytes % length;
+        
+
+        if ( m_header->GetPointRecordsCount() != static_cast<uint32_t>(count)) {
+            if (remainder == 0)
+            {
+                // The point bytes are exactly long enough, let's use it
+                // Set the count to what we calculated
+                m_header->SetPointRecordsCount(static_cast<boost::uint32_t>(count));
+                
+            } 
+            else 
+            {
+                std::ostringstream msg; 
+                msg <<  "The number of points in the header that was set "
+                        "by the software '" << m_header->GetSoftwareId() <<
+                        "' does not match the actual number of points in the file "
+                        "as determined by subtracting the data offset (" 
+                        <<m_header->GetDataOffset() << ") from the file length (" 
+                        << size <<  ") and dividing by the point record length (" 
+                        << m_header->GetDataRecordLength() << ")."
+                        " It also does not perfectly contain an exact number of"
+                        " point data and we cannot infer a point count."
+                        " Calculated number of points: " << count << 
+                        " Header-specified number of points: " 
+                        << m_header->GetPointRecordsCount() <<
+                        " Point data remainder: " << remainder;
+                throw std::runtime_error(msg.str());                
+            }
+
+
+        
+        }
+    }
     // Seek to the data offset so we can start reading points
     m_ifs.seekg(m_header->GetDataOffset());
 
diff --git a/Utilities/otbliblas/src/detail/reader/point.cpp b/Utilities/otbliblas/src/detail/reader/point.cpp
index bfdfc61acc79a3a70cc77092c2b2658769da008b..381348d21b326709fdf91d018918bfdd8f1a2a98 100755
--- a/Utilities/otbliblas/src/detail/reader/point.cpp
+++ b/Utilities/otbliblas/src/detail/reader/point.cpp
@@ -58,9 +58,9 @@ namespace liblas { namespace detail { namespace reader {
 Point::Point(std::istream& ifs, HeaderPtr header)
     : m_ifs(ifs)
     , m_header(header)
-
+    , m_point(m_header)
+    , m_raw_data(m_header->GetSchema().GetByteSize())
 {
-    setup();
 }
 
 Point::~Point()
@@ -74,23 +74,21 @@ std::istream& Point::GetStream() const
 
 void Point::read()
 {
-    
+    assert(m_header);
+    assert(m_point.GetHeaderPtr());
+    assert(m_raw_data.size() > 0);
+
     try
     {
         detail::read_n(m_raw_data.front(), m_ifs, m_raw_data.size());
     }
     catch (std::out_of_range const& e) // we reached the end of the file
     {
+        // FIXME: Why do we kill the error? It cause setting m_point with invali data, doesn't it? --mloskot
         std::cerr << e.what() << std::endl;
     }    
     
     m_point.SetData(m_raw_data);
 }
 
-void Point::setup()
-{
-    m_raw_data.resize(m_header->GetSchema().GetByteSize());
-    m_point.SetHeaderPtr(m_header);
-}
-
 }}} // namespace liblas::detail::reader
diff --git a/Utilities/otbliblas/src/detail/writer/point.cpp b/Utilities/otbliblas/src/detail/writer/point.cpp
index 40ee2caf0677701a274edf9d513fa2f42b894630..bd363823deb7bb7c83c70476e01160d02bca1edb 100755
--- a/Utilities/otbliblas/src/detail/writer/point.cpp
+++ b/Utilities/otbliblas/src/detail/writer/point.cpp
@@ -77,12 +77,9 @@ void Point::setup()
     // that we can write into the file as necessary.  We make it 
     // here instead of at each ::write() invocation to save the 
     // allocation and writing of the array
-    if (m_format.GetByteSize() != m_format.GetBaseByteSize()) {
-        std::size_t size = m_format.GetByteSize() - m_format.GetBaseByteSize();
-        
-        if (size < 0) {
-            throw std::runtime_error("ByteSize of format was less than BaseByteSize, this cannot happen!");
-        }
+    if (m_format.GetByteSize() != m_format.GetBaseByteSize())
+	{
+        std::size_t const size = m_format.GetByteSize() - m_format.GetBaseByteSize();
         
         m_blanks.resize(size);
         m_blanks.assign(size, 0);
diff --git a/Utilities/otbliblas/src/gt_citation.cpp b/Utilities/otbliblas/src/gt_citation.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/src/gt_wkt_srs.cpp b/Utilities/otbliblas/src/gt_wkt_srs.cpp
old mode 100755
new mode 100644
index f66a4ec53b6aad9bba8246dcdd69572bf17401f6..bbfd2b87f8288aeea70cba65a785587189b7889e
--- a/Utilities/otbliblas/src/gt_wkt_srs.cpp
+++ b/Utilities/otbliblas/src/gt_wkt_srs.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gt_wkt_srs.cpp 20480 2010-08-28 21:20:15Z rouault $
+ * $Id$
  *
  * Project:  GeoTIFF Driver
  * Purpose:  Implements translation between GeoTIFF normalized projection
@@ -42,7 +42,7 @@
 #include "xtiffio.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: gt_wkt_srs.cpp 20480 2010-08-28 21:20:15Z rouault $")
+CPL_CVSID("$Id$")
 
 CPL_C_START
 int CPL_DLL VSIFCloseL( FILE * );
@@ -65,6 +65,12 @@ CPLErr CPL_DLL GTIFMemBufFromWkt( const char *pszWKT,
 CPLErr CPL_DLL GTIFWktFromMemBuf( int nSize, unsigned char *pabyBuffer, 
                           char **ppszWKT, double *padfGeoTransform,
                           int *pnGCPCount, GDAL_GCP **ppasGCPList );
+
+#undef CSVReadParseLine
+char CPL_DLL  **CSVReadParseLine( FILE *fp);
+#undef CSLDestroy
+void CPL_DLL CPL_STDCALL CSLDestroy(char **papszStrList);
+
 CPL_C_END
 
 TIFF* VSI_TIFFOpen(const char* name, const char* mode);
@@ -101,6 +107,24 @@ void GetGeogCSFromCitation(char* szGCSName, int nGCSName,
                           char	**ppszSpheroidName,
                           char	**ppszAngularUnits);
 
+/************************************************************************/
+/*                       GTIFToCPLRecyleString()                        */
+/*                                                                      */
+/*      This changes a string from the libgeotiff heap to the GDAL      */
+/*      heap.                                                           */
+/************************************************************************/
+
+static void GTIFToCPLRecycleString( char **ppszTarget )
+
+{
+    if( *ppszTarget == NULL )
+        return;
+
+    char *pszTempString = CPLStrdup(*ppszTarget);
+    GTIFFreeMemory( *ppszTarget );
+    *ppszTarget = pszTempString;
+}
+
 /************************************************************************/
 /*                          WKTMassageDatum()                           */
 /*                                                                      */
@@ -114,14 +138,7 @@ static void WKTMassageDatum( char ** ppszDatum )
     int		i, j;
     char	*pszDatum;
 
-/* -------------------------------------------------------------------- */
-/*      First copy string and allocate with our CPLStrdup() to so we    */
-/*      know when we are done this function we will have a CPL          */
-/*      string, not a GTIF one.                                         */
-/* -------------------------------------------------------------------- */
-    pszDatum = CPLStrdup(*ppszDatum);
-    GTIFFreeMemory( *ppszDatum );
-    *ppszDatum = pszDatum;
+    pszDatum = *ppszDatum;
     if (pszDatum[0] == '\0')
         return;
 
@@ -179,11 +196,11 @@ static void WKTMassageDatum( char ** ppszDatum )
 /************************************************************************/
 
 /* For example:
-   GTCitationGeoKey (Ascii,215): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 20480 $ $Date: 2010-08-28 17:20:15 -0400 (Sat, 28 Aug 2010) $\nProjection Name = UTM\nUnits = meters\nGeoTIFF Units = meters"
+   GTCitationGeoKey (Ascii,215): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision$ $Date$\nProjection Name = UTM\nUnits = meters\nGeoTIFF Units = meters"
 
-   GeogCitationGeoKey (Ascii,267): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 20480 $ $Date: 2010-08-28 17:20:15 -0400 (Sat, 28 Aug 2010) $\nUnable to match Ellipsoid (Datum) to a GeographicTypeGeoKey value\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
+   GeogCitationGeoKey (Ascii,267): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision$ $Date$\nUnable to match Ellipsoid (Datum) to a GeographicTypeGeoKey value\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
 
-   PCSCitationGeoKey (Ascii,214): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 20480 $ $Date: 2010-08-28 17:20:15 -0400 (Sat, 28 Aug 2010) $\nUTM Zone 10N\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
+   PCSCitationGeoKey (Ascii,214): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision$ $Date$\nUTM Zone 10N\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
  
 */
 
@@ -354,23 +371,36 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
         && hGTIF != NULL 
         && GTIFKeyGet( hGTIF, GeogCitationGeoKey, szGCSName, 0, 
                        sizeof(szGCSName)) )
-      GetGeogCSFromCitation(szGCSName, sizeof(szGCSName),
-                            GeogCitationGeoKey, 
-                          &pszGeogName, &pszDatumName,
-                          &pszPMName, &pszSpheroidName,
-                          &pszAngularUnits);
-
+    {
+        GetGeogCSFromCitation(szGCSName, sizeof(szGCSName),
+                              GeogCitationGeoKey, 
+                              &pszGeogName, &pszDatumName,
+                              &pszPMName, &pszSpheroidName,
+                              &pszAngularUnits);
+    }
+    else
+        GTIFToCPLRecycleString( &pszGeogName );
+        
     if( !pszDatumName )
+    {
       GTIFGetDatumInfo( psDefn->Datum, &pszDatumName, NULL );
+      GTIFToCPLRecycleString( &pszDatumName );
+    }
     if( !pszSpheroidName )
+    {
       GTIFGetEllipsoidInfo( psDefn->Ellipsoid, &pszSpheroidName, NULL, NULL );
+      GTIFToCPLRecycleString( &pszSpheroidName );
+    }
     else
     {
       GTIFKeyGet(hGTIF, GeogSemiMajorAxisGeoKey, &(psDefn->SemiMajor), 0, 1 );
       GTIFKeyGet(hGTIF, GeogInvFlatteningGeoKey, &dfInvFlattening, 0, 1 );
     }
     if( !pszPMName )
-      GTIFGetPMInfo( psDefn->PM, &pszPMName, NULL );
+    {
+        GTIFGetPMInfo( psDefn->PM, &pszPMName, NULL );
+        GTIFToCPLRecycleString( &pszPMName );
+    }
     else
       GTIFKeyGet(hGTIF, GeogPrimeMeridianLongGeoKey, &(psDefn->PMLongToGreenwich), 0, 1 );
     
@@ -379,6 +409,8 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
       GTIFGetUOMAngleInfo( psDefn->UOMAngle, &pszAngularUnits, NULL );
       if( pszAngularUnits == NULL )
           pszAngularUnits = CPLStrdup("unknown");
+      else
+          GTIFToCPLRecycleString( &pszAngularUnits );
     }
     else
     {
@@ -386,8 +418,8 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
       aUnitGot = TRUE;
     }
 
-    if( pszDatumName != NULL )            /* was a GTIFFreeMemory'able string */
-        WKTMassageDatum( &pszDatumName ); /* now a CPLFree'able string */
+    if( pszDatumName != NULL )
+        WKTMassageDatum( &pszDatumName );
 
     dfSemiMajor = psDefn->SemiMajor;
     if( dfSemiMajor == 0.0 )
@@ -408,9 +440,10 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
     }
     if(!pszGeogName || strlen(pszGeogName) == 0)
     {
-      GTIFFreeMemory(pszGeogName);             /* was a GTIFFreeMemory'able string */
-      pszGeogName = CPLStrdup( pszDatumName ); /* now a CPLFree'able string */
+        CPLFree(pszGeogName);
+        pszGeogName = CPLStrdup( pszDatumName );
     }
+
     if(aUnitGot)
       oSRS.SetGeogCS( pszGeogName, pszDatumName, 
                       pszSpheroidName, dfSemiMajor, dfInvFlattening,
@@ -437,9 +470,9 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
 
     CPLFree( pszGeogName );
     CPLFree( pszDatumName );
-    GTIFFreeMemory( pszPMName );
-    GTIFFreeMemory( pszSpheroidName );
-    GTIFFreeMemory( pszAngularUnits );
+    CPLFree( pszSpheroidName );
+    CPLFree( pszPMName );
+    CPLFree( pszAngularUnits );
         
 /* ==================================================================== */
 /*      Handle projection parameters.                                   */
@@ -895,6 +928,7 @@ static int OGCDatumName2EPSGDatumCode( const char * pszOGCName )
     char	**papszTokens;
     int		nReturn = KvUserDefined;
 
+
 /* -------------------------------------------------------------------- */
 /*      Do we know it as a built in?                                    */
 /* -------------------------------------------------------------------- */
@@ -909,7 +943,7 @@ static int OGCDatumName2EPSGDatumCode( const char * pszOGCName )
         return Datum_WGS84;
     else if( EQUAL(pszOGCName,"WGS72") || EQUAL(pszOGCName,"WGS_1972") )
         return Datum_WGS72;
-    
+
 /* -------------------------------------------------------------------- */
 /*      Open the table if possible.                                     */
 /* -------------------------------------------------------------------- */
diff --git a/Utilities/otbliblas/src/las_c_api.cpp b/Utilities/otbliblas/src/las_c_api.cpp
old mode 100755
new mode 100644
index cce5b70dfb2c7dd6ae744dff60f332555da448bf..898fc65086e7411f75c383ded3c6766e8a19a194
--- a/Utilities/otbliblas/src/las_c_api.cpp
+++ b/Utilities/otbliblas/src/las_c_api.cpp
@@ -2038,23 +2038,21 @@ LAS_DLL LASSchemaH LASSchema_Create(  liblas::PointFormatName point_format) {
 }
 
 
-LAS_DLL boost::uint16_t LASSchema_GetByteSize( LASSchemaH hFormat)
+LAS_DLL unsigned int LASSchema_GetByteSize( LASSchemaH hFormat)
 {
     VALIDATE_LAS_POINTER1(hFormat, "LASSchema_GetByteSize", 0);
     
     liblas::Schema* format = ((liblas::Schema*) hFormat);
-    // TODO: I'd advise to change API to return built-in C type size_t --mloskot
-    return format->GetByteSize();    
+    return static_cast<unsigned int>(format->GetByteSize());    
 }
 
 
-LAS_DLL boost::uint16_t LASSchema_GetBaseByteSize( LASSchemaH hFormat)
+LAS_DLL unsigned int LASSchema_GetBaseByteSize( LASSchemaH hFormat)
 {
     VALIDATE_LAS_POINTER1(hFormat, "LASSchema_GetBaseByteSize", 0);
     
     liblas::Schema* format = ((liblas::Schema*) hFormat);
-    // TODO: I'd advise to change API to return built-in C type size_t --mloskot
-    return format->GetByteSize();    
+    return static_cast<unsigned int>(format->GetBaseByteSize());    
 }
 
 
diff --git a/Utilities/otbliblas/src/lasclassification.cpp b/Utilities/otbliblas/src/lasclassification.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/src/lasdimension.cpp b/Utilities/otbliblas/src/lasdimension.cpp
old mode 100755
new mode 100644
index db2f144670fe1e2ed376743b698173f9d5957fa6..f48fe86ca10596fd1dbde05bd1fdf541fb7bb89e
--- a/Utilities/otbliblas/src/lasdimension.cpp
+++ b/Utilities/otbliblas/src/lasdimension.cpp
@@ -77,12 +77,11 @@ Dimension::Dimension(std::string const& name, std::size_t size_in_bits) :
     m_byte_offset(0),
     m_bit_offset(0)
 {
-     if (size_in_bits == 0) {
-        std::ostringstream oss;
-        oss << "The bit size of the dimension is 0, the dimension is invalid.";
-        throw std::runtime_error(oss.str());
+     if (0 == size_in_bits)
+	 {
+        throw std::runtime_error("The bit size of the dimension is 0, the dimension is invalid.");
      }
-};
+}
 
 /// copy constructor
 Dimension::Dimension(Dimension const& other) :
@@ -101,8 +100,8 @@ Dimension::Dimension(Dimension const& other) :
     , m_bit_offset(other.m_bit_offset)
 {
 }
-// 
-// // assignment constructor
+ 
+/// assignment operator
 Dimension& Dimension::operator=(Dimension const& rhs)
 {
     if (&rhs != this)
@@ -127,9 +126,9 @@ Dimension& Dimension::operator=(Dimension const& rhs)
 
 std::size_t Dimension::GetByteSize() const 
 {
-
-    std::size_t bit_position = m_bit_size % 8;
-    if (bit_position > 0) {
+    std::size_t const bit_position = m_bit_size % 8;
+    if (bit_position > 0)
+	{
         // For dimensions that are not byte aligned,
         // we need to determine how many bytes they 
         // will take.  We have to read at least one byte if the 
@@ -160,9 +159,10 @@ liblas::property_tree::ptree Dimension::GetPTree() const
     dim.put("bitoffset" , GetBitOffset());
     dim.put("bytesize", GetByteSize());
     
-   if (IsNumeric()) {
+   if (IsNumeric())
+   {
        if (! (detail::compare_distance(GetMinimum(), GetMaximum() ) 
-            && detail::compare_distance(0.0, GetMaximum())))
+           && detail::compare_distance(0.0, GetMaximum())))
        {
            dim.put("minimum", GetMinimum());
            dim.put("maximum", GetMaximum());
@@ -174,15 +174,22 @@ liblas::property_tree::ptree Dimension::GetPTree() const
 
 std::ostream& operator<<(std::ostream& os, liblas::Dimension const& d)
 {
-    
     using liblas::property_tree::ptree;
     ptree tree = d.GetPTree();
     
-    std::string name = tree.get<std::string>("name");
-    
+    std::string const name = tree.get<std::string>("name");
 
-    os << "'" << name << "'" << " -- ";
-    os << " size: " << tree.get<boost::uint32_t>("size");
+    std::ostringstream quoted_name;
+    quoted_name << "'" << name << "'";
+    std::ostringstream pad;
+    std::string const& cur = quoted_name.str();
+    std::string::size_type size = cur.size();
+    std::string::size_type pad_size = 30 - size;
+    
+    for (std::string::size_type i=0; i != pad_size; i++ ) {
+        pad << " ";
+    }
+    os << quoted_name.str() << pad.str() <<" -- "<< " size: " << tree.get<boost::uint32_t>("size");
     os << " offset: " << tree.get<boost::uint32_t>("byteoffset");
     os << std::endl;
     
diff --git a/Utilities/otbliblas/src/lasfilter.cpp b/Utilities/otbliblas/src/lasfilter.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/src/lasheader.cpp b/Utilities/otbliblas/src/lasheader.cpp
old mode 100755
new mode 100644
index 7daebc2f2e66246ec8d709eb33f8891198c581d1..652555e8f6ce5c84577bd015d753004b3acc6307
--- a/Utilities/otbliblas/src/lasheader.cpp
+++ b/Utilities/otbliblas/src/lasheader.cpp
@@ -64,7 +64,7 @@ namespace liblas {
 
 char const* const Header::FileSignature = "LASF";
 char const* const Header::SystemIdentifier = "libLAS";
-char const* const Header::SoftwareIdentifier = "libLAS 1.2";
+char const* const Header::SoftwareIdentifier = "libLAS 1.6.0b2";
 
 
 Header::Header() : m_schema(ePointFormat3)
@@ -439,10 +439,11 @@ double Header::GetScaleZ() const
 
 void Header::SetScale(double x, double y, double z)
 {
+
     double const minscale = 0.01;
-    m_scales.x = (0 == x) ? minscale : x;
-    m_scales.y = (0 == y) ? minscale : y;
-    m_scales.z = (0 == z) ? minscale : z;
+    m_scales.x = (detail::compare_distance(0.0, x)) ? minscale : x;
+    m_scales.y = (detail::compare_distance(0.0, y)) ? minscale : y;
+    m_scales.z = (detail::compare_distance(0.0, z)) ? minscale : z;
 }
 
 double Header::GetOffsetX() const
@@ -827,34 +828,54 @@ void Header::to_rst(std::ostream& os) const
     os << "  Number of Points by Return:  " << returns_oss.str() << std::endl;
 
     os.setf(std::ios_base::fixed, std::ios_base::floatfield);
-    double scale = tree.get<double>("scale.z");
+    double x_scale = tree.get<double>("scale.x");
+    double y_scale = tree.get<double>("scale.y");
+    double z_scale = tree.get<double>("scale.z");
 
+    boost::uint32_t x_precision = 6;
+    boost::uint32_t y_precision = 6;
+    boost::uint32_t z_precision = 6;
     double frac = 0;
     double integer = 0;
-    frac = std::modf(scale, &integer);
-
-    boost::uint32_t prec = static_cast<boost::uint32_t>(std::fabs(std::floor(std::log10(frac))));
-    os.precision(prec);
-
-    os << "  Scale Factor X Y Z:          " 
-     << tree.get<double>("scale.x") << " " 
-     << tree.get<double>("scale.y") << " " 
-     << tree.get<double>("scale.z") << std::endl;
-
-    os << "  Offset X Y Z:                " 
-     << tree.get<double>("offset.x") << " " 
-     << tree.get<double>("offset.y") << " " 
-     << tree.get<double>("offset.z") << std::endl;
-
-    os << "  Min X Y Z:                   " 
-     << tree.get<double>("minimum.x") << " " 
-     << tree.get<double>("minimum.y") << " " 
-     << tree.get<double>("minimum.z") << std::endl;
-
-    os << "  Max X Y Z:                   " 
-     << tree.get<double>("maximum.x") << " " 
-     << tree.get<double>("maximum.y") << " " 
-     << tree.get<double>("maximum.z") << std::endl;         
+    
+    frac = std::modf(x_scale, &integer);
+    x_precision = static_cast<boost::uint32_t>(std::fabs(std::floor(std::log10(frac))));
+    frac = std::modf(y_scale, &integer);
+    y_precision = static_cast<boost::uint32_t>(std::fabs(std::floor(std::log10(frac))));
+    frac = std::modf(z_scale, &integer);
+    z_precision = static_cast<boost::uint32_t>(std::fabs(std::floor(std::log10(frac))));
+
+    os << "  Scale Factor X Y Z:          ";
+    os.precision(x_precision);
+    os << tree.get<double>("scale.x") << " "; 
+    os.precision(y_precision);
+    os << tree.get<double>("scale.y") << " "; 
+    os.precision(z_precision);
+    os << tree.get<double>("scale.z") << std::endl;
+
+    os << "  Offset X Y Z:                ";
+    os.precision(x_precision);
+    os << tree.get<double>("offset.x") << " ";
+    os.precision(y_precision);
+    os << tree.get<double>("offset.y") << " ";
+    os.precision(z_precision);
+    os << tree.get<double>("offset.z") << std::endl;
+
+    os << "  Min X Y Z:                   ";
+    os.precision(x_precision);
+    os << tree.get<double>("minimum.x") << " "; 
+    os.precision(y_precision);
+    os << tree.get<double>("minimum.y") << " ";
+    os.precision(z_precision);
+    os << tree.get<double>("minimum.z") << std::endl;
+
+    os << "  Max X Y Z:                   ";
+    os.precision(x_precision);
+    os << tree.get<double>("maximum.x") << " ";
+    os.precision(y_precision);
+    os << tree.get<double>("maximum.y") << " ";
+    os.precision(z_precision);
+    os << tree.get<double>("maximum.z") << std::endl;         
 
     os << "  Spatial Reference:  " << std::endl;
     os << tree.get<std::string>("srs.prettywkt") << std::endl;
diff --git a/Utilities/otbliblas/src/lasindex.cpp b/Utilities/otbliblas/src/lasindex.cpp
index 48a3b6807f15a057eea5cb54c5d6177c188c5b01..59cff67d8219f4119c94c65ce8889eed66a68e82 100755
--- a/Utilities/otbliblas/src/lasindex.cpp
+++ b/Utilities/otbliblas/src/lasindex.cpp
@@ -113,6 +113,8 @@ void Index::SetValues(void)
 	m_indexAuthor = "";
 	m_indexComment = "";
 	m_indexDate = "";
+	m_versionMajor = LIBLAS_INDEX_VERSIONMAJOR;
+	m_versionMinor = LIBLAS_INDEX_VERSIONMINOR;
 	m_cellSizeZ = 0.0;
 	m_debugger = stderr;
 	m_readOnly = false;
@@ -120,13 +122,8 @@ void Index::SetValues(void)
 	m_DataVLR_ID = 43;
 	m_maxMemoryUsage = LIBLAS_INDEX_MAXMEMDEFAULT;
     m_rangeX = m_rangeY = m_rangeZ = m_cellSizeZ = m_cellSizeX = m_cellSizeY = 
-		m_filterMinXCell = m_filterMaxXCell = m_filterMinYCell = m_filterMaxYCell = m_filterMinZCell = m_filterMaxZCell = 
-		m_LowXBorderPartCell = m_HighXBorderPartCell = m_LowYBorderPartCell = m_HighYBorderPartCell = 0.0;
-    m_pointRecordsCount = m_maxMemoryUsage = m_cellsX = m_cellsY = m_cellsZ = m_totalCells = m_tempFileWrittenBytes = 0;
-    m_LowXCellCompletelyIn = m_HighXCellCompletelyIn = m_LowYCellCompletelyIn = m_HighYCellCompletelyIn = 
-		m_LowZCellCompletelyIn = m_HighZCellCompletelyIn =
-		m_LowXBorderCell = m_HighXBorderCell = m_LowYBorderCell = m_HighYBorderCell = 
-		m_LowZBorderCell = m_HighZBorderCell = 0;
+		m_pointRecordsCount = m_maxMemoryUsage = m_cellsX = m_cellsY = m_cellsZ = m_totalCells = 0;
+    m_tempFileWrittenBytes = 0;
 	m_indexBuilt = m_tempFileStarted = m_readerCreated = false;
 } // Index::SetValues
 
@@ -253,102 +250,187 @@ bool Index::Validate(void)
 	
 } // Index::Validate
 
-const std::vector<boost::uint32_t>& Index::Filter(IndexData const& ParamSrc)
+boost::uint32_t Index::GetDefaultReserve(void)
 {
+	return (GetPointRecordsCount() < LIBLAS_INDEX_RESERVEFILTERDEFAULT ? GetPointRecordsCount(): LIBLAS_INDEX_RESERVEFILTERDEFAULT);
+} // Index::GetDefaultReserve
 
-	// if there is already a list, get rid of it
-	m_filterResult.resize(0);
-	if (m_reader)
-	{
-		for (boost::uint32_t i = 0; i < m_idxheader.GetRecordsCount(); ++i)
+const std::vector<boost::uint32_t>& Index::Filter(IndexData & ParamSrc)
+{
+
+	try {
+		// if there is already a list, get rid of it
+		m_filterResult.resize(0);
+		// are we asked to advance beyond the number of points in the file? that would be a mistake and waste of time.
+		if (ParamSrc.m_iterator && 
+			(ParamSrc.m_iterator->m_advance + ParamSrc.m_iterator->m_totalPointsScanned > GetPointRecordsCount()))
+			return (m_filterResult);
+			
+		m_filterResult.reserve(ParamSrc.m_iterator ? ParamSrc.m_iterator->m_chunkSize: GetDefaultReserve());
+		if (m_reader)
 		{
-			VariableRecord const& vlr = m_idxheader.GetVLR(i);
-			// a combination of "liblas" and 42 denotes that this is a liblas spatial index id
-			if (std::string(vlr.GetUserId(false)) == std::string("liblas"))
+			boost::uint32_t i;
+			i = ParamSrc.m_iterator ? ParamSrc.m_iterator->m_curVLR: 0;
+			for (; i < m_idxheader.GetRecordsCount(); ++i)
 			{
-				boost::uint16_t RecordID = vlr.GetRecordId();
-				if (RecordID == 42)
+				VariableRecord const& vlr = m_idxheader.GetVLR(i);
+				// a combination of "liblas" and 42 denotes that this is a liblas spatial index id
+				if (std::string(vlr.GetUserId(false)) == std::string("liblas"))
 				{
-					if (! LoadIndexVLR(vlr))
-						break;
-					// Beyond the first record would be more VLR's with the actual index data
-					// some cells will fall completely inside, some outside and some straddling the filter bounds	
-					SetCellFilterBounds(ParamSrc);
-					if (! m_bounds.intersects(ParamSrc.m_filter))
+					boost::uint16_t RecordID = vlr.GetRecordId();
+					if (RecordID == 42)
 					{
-						if (m_debugOutputLevel > 1)
-							fprintf(m_debugger, "Index bounds do not intersect filter bounds.\n");
-						break;
-					} // if
-				} // if 42
-				else if (RecordID == m_DataVLR_ID)
-				{
-					// some of our data is in this record
-					if (! FilterOneVLR(vlr, i, ParamSrc))
-						break;
-				} // else if ID matches ID stored in index header
+						if (! LoadIndexVLR(vlr))
+							break;
+						// Beyond the first record would be more VLR's with the actual index data
+						// some cells will fall completely inside, some outside and some straddling the filter bounds	
+						SetCellFilterBounds(ParamSrc);
+						if (! m_bounds.intersects(ParamSrc.m_filter))
+						{
+							if (m_debugOutputLevel > 1)
+								fprintf(m_debugger, "Index bounds do not intersect filter bounds.\n");
+							break;
+						} // if
+					} // if 42
+					else if (RecordID == m_DataVLR_ID)
+					{
+						// some of our data is in this record
+						bool VLRDone = false;
+						const boost::uint32_t HeadVLR = i;
+						if (! FilterOneVLR(vlr, i, ParamSrc, VLRDone))
+							break;
+						if (ParamSrc.m_iterator)
+						{
+							if (VLRDone)
+								ParamSrc.m_iterator->m_curCellStartPos = ParamSrc.m_iterator->m_ptsScannedCurCell = 
+									ParamSrc.m_iterator->m_ptsScannedCurVLR = 0;
+							// if we've filled our quota break out of loop
+							if (m_filterResult.size() >= ParamSrc.m_iterator->m_chunkSize)
+							{
+								// if we've scanned the entire VLR
+								if (VLRDone)
+									++i;	// increment i so that next iteration starts on next VLR
+								else if (i != HeadVLR)	// if VLR's are linked FilterOneVLR() will have incremented i
+									i = HeadVLR;	// put back i so that the right VLR is loaded first next iteration
+								break;
+							} // if
+						} // if
+					} // else if ID matches ID stored in index header
+				}
 			}
-		}
-	} // m_reader
+			if (ParamSrc.m_iterator)
+				ParamSrc.m_iterator->m_curVLR = i;
+		} // m_reader
+	} // try
+	catch (std::bad_alloc) {
+		m_filterResult.resize(0);
+	} // catch
 	return (m_filterResult);
 
 } // Index::Filter
 
-void Index::SetCellFilterBounds(IndexData const& ParamSrc)
+IndexIterator* Index::Filter(IndexData const& ParamSrc, boost::uint32_t ChunkSize)
+{
+	IndexIterator* NewIter = NULL;
+
+	try {
+		NewIter = new IndexIterator(this, ParamSrc, ChunkSize);
+	} // try
+	catch (std::bad_alloc) {
+		return (NULL);
+	} // catch
+
+	return (NewIter);
+
+} // Index::Filter
+
+IndexIterator* Index::Filter(double LowFilterX, double HighFilterX, double LowFilterY, double HighFilterY, 
+	double LowFilterZ, double HighFilterZ, boost::uint32_t ChunkSize)
 {
-	double LowXCell, HighXCell, LowYCell, HighYCell, LowZCell, HighZCell;
+	IndexIterator* NewIter = NULL;
+
+	try {
+		NewIter = new IndexIterator(this, LowFilterX, HighFilterX, LowFilterY, HighFilterY, 
+			LowFilterZ, HighFilterZ, ChunkSize);
+	} // try
+	catch (std::bad_alloc) {
+		return (NULL);
+	} // catch
+
+	return (NewIter);
+
+} // Index::Filter
+
+IndexIterator* Index::Filter(Bounds<double> const& BoundsSrc, boost::uint32_t ChunkSize)
+{
+	IndexIterator* NewIter = NULL;
+
+	try {
+		NewIter = new IndexIterator(this, BoundsSrc, ChunkSize);
+	} // try
+	catch (std::bad_alloc) {
+		return (NULL);
+	} // catch
+
+	return (NewIter);
+
+} // Index::Filter
+
+void Index::SetCellFilterBounds(IndexData & ParamSrc)
+{
+	double LowXCell, HighXCell, LowYCell, HighYCell, LowZCell, HighZCell,
+		filterMinXCell, filterMaxXCell, filterMinYCell, filterMaxYCell, filterMinZCell, filterMaxZCell;
 	// convert filter bounds into cell numbers
 	// X and Y range can not be 0 or the index would not have been built
-	m_filterMinXCell = m_cellsX * (ParamSrc.GetMinFilterX() - GetMinX()) / GetRangeX();
-	m_filterMaxXCell = m_cellsX * (ParamSrc.GetMaxFilterX() - GetMinX()) / GetRangeX();
-	m_filterMinYCell = m_cellsY * (ParamSrc.GetMinFilterY() - GetMinY()) / GetRangeY();
-	m_filterMaxYCell = m_cellsY * (ParamSrc.GetMaxFilterY() - GetMinY()) / GetRangeY();
+	filterMinXCell = m_cellsX * (ParamSrc.GetMinFilterX() - GetMinX()) / GetRangeX();
+	filterMaxXCell = m_cellsX * (ParamSrc.GetMaxFilterX() - GetMinX()) / GetRangeX();
+	filterMinYCell = m_cellsY * (ParamSrc.GetMinFilterY() - GetMinY()) / GetRangeY();
+	filterMaxYCell = m_cellsY * (ParamSrc.GetMaxFilterY() - GetMinY()) / GetRangeY();
 	// Z range however can be 0
 	if (GetRangeZ() > 0.0 && ! detail::compare_distance(GetRangeZ(), 0.0))
 	{
-		m_filterMinZCell = m_cellsZ * (ParamSrc.GetMinFilterZ() - GetMinZ()) / GetRangeZ();
-		m_filterMaxZCell = m_cellsZ * (ParamSrc.GetMaxFilterZ() - GetMinZ()) / GetRangeZ();
+		filterMinZCell = m_cellsZ * (ParamSrc.GetMinFilterZ() - GetMinZ()) / GetRangeZ();
+		filterMaxZCell = m_cellsZ * (ParamSrc.GetMaxFilterZ() - GetMinZ()) / GetRangeZ();
 	} // if
 	else
 	{
-		m_filterMinZCell = m_filterMaxZCell = 0;
+		filterMinZCell = filterMaxZCell = 0;
 	} // else
-	LowXCell = ceil(m_filterMinXCell);
-	HighXCell = floor(m_filterMaxXCell) - 1.0;
-	LowYCell = ceil(m_filterMinYCell);
-	HighYCell = floor(m_filterMaxYCell) - 1.0;
-	LowZCell = ceil(m_filterMinZCell);
-	HighZCell = floor(m_filterMaxZCell) - 1.0;
-	m_LowXCellCompletelyIn = (boost::int32_t)LowXCell;
-	m_HighXCellCompletelyIn = (boost::int32_t)HighXCell;
-	m_LowYCellCompletelyIn = (boost::int32_t)LowYCell;
-	m_HighYCellCompletelyIn = (boost::int32_t)HighYCell;
-	m_LowZCellCompletelyIn = (boost::int32_t)LowZCell;
-	m_HighZCellCompletelyIn = (boost::int32_t)HighZCell;
-
-    LowXCell = floor(m_filterMinXCell);
-    HighXCell = ceil(m_filterMaxXCell) - 1.0;
-    LowYCell = floor(m_filterMinYCell);
-    HighYCell = ceil(m_filterMaxYCell) - 1.0;
-    LowZCell = floor(m_filterMinZCell);
-    HighZCell = ceil(m_filterMaxZCell) - 1.0;
-    m_LowXBorderCell = (boost::int32_t)LowXCell;
-    m_HighXBorderCell = (boost::int32_t)HighXCell;
-    m_LowYBorderCell = (boost::int32_t)LowYCell;
-    m_HighYBorderCell = (boost::int32_t)HighYCell;
-    m_LowZBorderCell = (boost::int32_t)LowZCell;
-    m_HighZBorderCell = (boost::int32_t)HighZCell;
+	LowXCell = ceil(filterMinXCell);
+	HighXCell = floor(filterMaxXCell) - 1.0;
+	LowYCell = ceil(filterMinYCell);
+	HighYCell = floor(filterMaxYCell) - 1.0;
+	LowZCell = ceil(filterMinZCell);
+	HighZCell = floor(filterMaxZCell) - 1.0;
+	ParamSrc.m_LowXCellCompletelyIn = (boost::int32_t)LowXCell;
+	ParamSrc.m_HighXCellCompletelyIn = (boost::int32_t)HighXCell;
+	ParamSrc.m_LowYCellCompletelyIn = (boost::int32_t)LowYCell;
+	ParamSrc.m_HighYCellCompletelyIn = (boost::int32_t)HighYCell;
+	ParamSrc.m_LowZCellCompletelyIn = (boost::int32_t)LowZCell;
+	ParamSrc.m_HighZCellCompletelyIn = (boost::int32_t)HighZCell;
+
+    LowXCell = floor(filterMinXCell);
+    HighXCell = ceil(filterMaxXCell) - 1.0;
+    LowYCell = floor(filterMinYCell);
+    HighYCell = ceil(filterMaxYCell) - 1.0;
+    LowZCell = floor(filterMinZCell);
+    HighZCell = ceil(filterMaxZCell) - 1.0;
+    ParamSrc.m_LowXBorderCell = (boost::int32_t)LowXCell;
+    ParamSrc.m_HighXBorderCell = (boost::int32_t)HighXCell;
+    ParamSrc.m_LowYBorderCell = (boost::int32_t)LowYCell;
+    ParamSrc.m_HighYBorderCell = (boost::int32_t)HighYCell;
+    ParamSrc.m_LowZBorderCell = (boost::int32_t)LowZCell;
+    ParamSrc.m_HighZBorderCell = (boost::int32_t)HighZCell;
     
-    m_LowXBorderPartCell = m_filterMinXCell - LowXCell;
-    m_HighXBorderPartCell = m_filterMaxXCell - HighXCell;
-    m_LowYBorderPartCell = m_filterMinYCell - LowYCell;
-    m_HighYBorderPartCell = m_filterMaxYCell - HighYCell;
+    ParamSrc.m_LowXBorderPartCell = filterMinXCell - LowXCell;
+    ParamSrc.m_HighXBorderPartCell = filterMaxXCell - HighXCell;
+    ParamSrc.m_LowYBorderPartCell = filterMinYCell - LowYCell;
+    ParamSrc.m_HighYBorderPartCell = filterMaxYCell - HighYCell;
 	
 } // Index::SetCellFilterBounds
 
 bool Index::LoadIndexVLR(VariableRecord const& vlr)
 {
-	boost::uint8_t VersionMajor, VersionMinor;
 	char DestStr[512];
 	boost::uint16_t StringLen;
 	boost::uint16_t ReadPos = 0;
@@ -360,8 +442,8 @@ bool Index::LoadIndexVLR(VariableRecord const& vlr)
 		// read the first record of our index data
 		IndexVLRData const& VLRIndexData = vlr.GetData();
 		// parse the index header data
-		ReadVLRData_n(VersionMajor, VLRIndexData, ReadPos);
-		ReadVLRData_n(VersionMinor, VLRIndexData, ReadPos);
+		ReadVLRData_n(m_versionMajor, VLRIndexData, ReadPos);
+		ReadVLRData_n(m_versionMinor, VLRIndexData, ReadPos);
 		// creator		
 		ReadVLRData_n(StringLen, VLRIndexData, ReadPos);
 		ReadeVLRData_str(DestStr, VLRIndexData, StringLen, ReadPos);
@@ -422,11 +504,12 @@ bool Index::LoadIndexVLR(VariableRecord const& vlr)
 
 } // Index::LoadIndexVLR
 
-bool Index::FilterOneVLR(VariableRecord const& vlr, boost::uint32_t& i, IndexData const& ParamSrc)
+bool Index::FilterOneVLR(VariableRecord const& vlr, boost::uint32_t& i, IndexData & ParamSrc, bool & VLRDone)
 {
 
-	boost::uint16_t ReadPos = 0;
-	boost::uint32_t MinCellX, MinCellY, MaxCellX, MaxCellY, DataRecordSize = 0;
+	boost::uint32_t ReadPos = 0;
+	boost::uint32_t MinCellX, MinCellY, MaxCellX, MaxCellY, PointsThisRecord = 0, PointsThisCell = 0, DataRecordSize = 0,
+		PointsScannedThisTime = 0, PointsScannedCurVLR = 0, PointsToIgnore = 0;
 	IndexVLRData CompositeData;
 	
 	try {
@@ -442,6 +525,9 @@ bool Index::FilterOneVLR(VariableRecord const& vlr, boost::uint32_t& i, IndexDat
 		ReadVLRData_n(MaxCellY, CompositeData, ReadPos);
 		// data record size
 		ReadVLRData_n(DataRecordSize, CompositeData, ReadPos);
+		// number of points in this VLR - added in Index version 1.1
+		if (m_versionMajor > 1 || m_versionMinor >= 1)
+			ReadVLRData_n(PointsThisRecord, CompositeData, ReadPos);
 				
 		if (DataRecordSize > VLRIndexRecLen)
 		{
@@ -467,13 +553,33 @@ bool Index::FilterOneVLR(VariableRecord const& vlr, boost::uint32_t& i, IndexDat
 			
 		if (VLRInteresting(MinCellX, MinCellY, MaxCellX, MaxCellY, ParamSrc))
 		{
+			// if using iterator, jump to start of last cell that was being scanned
+			if (ParamSrc.m_iterator && (ParamSrc.m_iterator->m_curCellStartPos >= ReadPos))
+			{
+				ReadPos = ParamSrc.m_iterator->m_curCellStartPos;
+				PointsToIgnore = ParamSrc.m_iterator->m_ptsScannedCurCell;
+				PointsScannedCurVLR = ParamSrc.m_iterator->m_ptsScannedCurVLR;
+			} // if
 			// translate the data for this VLR
 			while (ReadPos + sizeof (boost::uint32_t) < DataRecordSize)
 			{
+				if (ParamSrc.m_iterator)
+				{
+					ParamSrc.m_iterator->m_curCellStartPos = ReadPos;
+					ParamSrc.m_iterator->m_ptsScannedCurCell = 0;
+				} // if
 				// current cell, x, y
 				boost::uint32_t x, y, PtRecords, SubCellsXY, SubCellsZ;
 				ReadVLRData_n(x, CompositeData, ReadPos);
 				ReadVLRData_n(y, CompositeData, ReadPos);
+				if (ParamSrc.m_iterator)
+				{
+					ParamSrc.m_iterator->m_curCellX = x;
+					ParamSrc.m_iterator->m_curCellY = y;
+				} // if
+				// number of points in this cell - added in Index version 1.1
+				if (m_versionMajor > 1 || m_versionMinor >= 1)
+					ReadVLRData_n(PointsThisCell, CompositeData, ReadPos);
 
 				bool TestPointsInThisCell = CellInteresting(x, y, ParamSrc);
 				// min and max Z
@@ -495,22 +601,27 @@ bool Index::FilterOneVLR(VariableRecord const& vlr, boost::uint32_t& i, IndexDat
 					ReadVLRData_n(ZCellNumRecords, CompositeData, ReadPos);
 					for (boost::uint32_t SubCellZPt = 0; SubCellZPt < ZCellNumRecords; ++SubCellZPt)
 					{
-						boost::uint32_t PointID, LastPointID = static_cast<boost::uint32_t>(~0);
-						bool LastPtRead = 0;
+						boost::uint32_t PointID;
 						ReadVLRData_n(PointID, CompositeData, ReadPos);
 						assert(PointID < m_pointRecordsCount);
 						liblas::detail::ConsecPtAccumulator ConsecutivePts;
 						ReadVLRData_n(ConsecutivePts, CompositeData, ReadPos);
 						if (TestPointsInThisCell && ZCellInteresting(ZCellID, ParamSrc))
 						{
-							for (boost::uint32_t PtCt = 0; PtCt < ConsecutivePts; ++PointID, ++PtCt)
-							{
-								if (FilterOnePoint(x, y, ZCellID, PointID, LastPointID, LastPtRead, ParamSrc))
-									m_filterResult.push_back(PointID);
-								LastPointID = PointID;
-							} // for
+							FilterPointSeries(PointID, PointsScannedThisTime, PointsToIgnore, x, y, ZCellID, 
+								ConsecutivePts, ParamSrc.m_iterator, ParamSrc);
 						} // if
+						else
+						{
+							PointsScannedThisTime += ConsecutivePts;
+							if (ParamSrc.m_iterator)
+								ParamSrc.m_iterator->m_ptsScannedCurCell += ConsecutivePts;
+						} // else
+						if (ParamSrc.m_iterator && (m_filterResult.size() >= ParamSrc.m_iterator->m_chunkSize))
+							break;
 					} // for
+					if (ParamSrc.m_iterator && (m_filterResult.size() >= ParamSrc.m_iterator->m_chunkSize))
+						break;
 				} // for
 				// read the data stored in XY quadtree cells
 				for (boost::uint32_t SubCellXY = 0; SubCellXY < SubCellsXY; ++SubCellXY)
@@ -522,47 +633,71 @@ bool Index::FilterOneVLR(VariableRecord const& vlr, boost::uint32_t& i, IndexDat
 					ReadVLRData_n(SubCellNumRecords, CompositeData, ReadPos);
 					for (boost::uint32_t SubCellPt = 0; SubCellPt < SubCellNumRecords; ++SubCellPt)
 					{
-						boost::uint32_t PointID, LastPointID = static_cast<boost::uint32_t>(~0);
-						bool LastPtRead = 0;
+						boost::uint32_t PointID;
 						ReadVLRData_n(PointID, CompositeData, ReadPos);
 						assert(PointID < m_pointRecordsCount);
 						liblas::detail::ConsecPtAccumulator ConsecutivePts;
 						ReadVLRData_n(ConsecutivePts, CompositeData, ReadPos);
 						if (TestPointsInThisCell && SubCellInteresting(SubCellID, x, y, ParamSrc))
 						{
-							for (boost::uint32_t PtCt = 0; PtCt < ConsecutivePts; ++PointID, ++PtCt)
-							{
-								if (FilterOnePoint(x, y, 0, PointID, LastPointID, LastPtRead, ParamSrc))
-									m_filterResult.push_back(PointID);
-								LastPointID = PointID;
-							} // for
+							FilterPointSeries(PointID, PointsScannedThisTime, PointsToIgnore, x, y, 0, 
+								ConsecutivePts, ParamSrc.m_iterator, ParamSrc);
 						} // if
+						else
+						{
+							PointsScannedThisTime += ConsecutivePts;
+							if (ParamSrc.m_iterator)
+								ParamSrc.m_iterator->m_ptsScannedCurCell += ConsecutivePts;
+						} // else
+						if (ParamSrc.m_iterator && (m_filterResult.size() >= ParamSrc.m_iterator->m_chunkSize))
+							break;
 					} // for
+					if (ParamSrc.m_iterator && (m_filterResult.size() >= ParamSrc.m_iterator->m_chunkSize))
+						break;
 				} // for
 				// read data in unsubdivided cells
 				if (! (SubCellsZ || SubCellsXY))
 				{
 					for (boost::uint32_t CurPt = 0; CurPt < PtRecords; ++CurPt)
 					{
-						boost::uint32_t PointID, LastPointID = static_cast<boost::uint32_t>(~0);
-						bool LastPtRead = 0;
+						boost::uint32_t PointID;
 						ReadVLRData_n(PointID, CompositeData, ReadPos);
 						assert(PointID < m_pointRecordsCount);
 						liblas::detail::ConsecPtAccumulator ConsecutivePts;
 						ReadVLRData_n(ConsecutivePts, CompositeData, ReadPos);
 						if (TestPointsInThisCell)
 						{
-							for (boost::uint32_t PtCt = 0; PtCt < ConsecutivePts; ++PointID, ++PtCt)
-							{
-								if (FilterOnePoint(x, y, 0, PointID, LastPointID, LastPtRead, ParamSrc))
-									m_filterResult.push_back(PointID);
-								LastPointID = PointID;
-							} // for
+							FilterPointSeries(PointID, PointsScannedThisTime, PointsToIgnore, x, y, 0, 
+								ConsecutivePts, ParamSrc.m_iterator, ParamSrc);
 						} // if
+						else
+						{
+							PointsScannedThisTime += ConsecutivePts;
+							if (ParamSrc.m_iterator)
+								ParamSrc.m_iterator->m_ptsScannedCurCell += ConsecutivePts;
+						} // else
+					if (ParamSrc.m_iterator && (m_filterResult.size() >= ParamSrc.m_iterator->m_chunkSize))
+						break;
 					} // for
 				} // if
+				if (ParamSrc.m_iterator && (m_filterResult.size() >= ParamSrc.m_iterator->m_chunkSize))
+					break;
 			} // while
+			PointsScannedCurVLR += PointsScannedThisTime;
+			if (PointsScannedCurVLR >= PointsThisRecord)
+				VLRDone = true;
+			if (ParamSrc.m_iterator)
+			{
+				ParamSrc.m_iterator->m_totalPointsScanned += PointsScannedThisTime;
+				ParamSrc.m_iterator->m_ptsScannedCurVLR = PointsScannedCurVLR;
+			} // if
 		} // if
+		else if (ParamSrc.m_iterator)
+		{
+			ParamSrc.m_iterator->m_totalPointsScanned += PointsThisRecord;
+			VLRDone = true;
+		} // else if
+		// need to be more sophisticated but this is a test
 	} // try
 	catch (std::bad_alloc) {
 		return (false);
@@ -574,16 +709,63 @@ bool Index::FilterOneVLR(VariableRecord const& vlr, boost::uint32_t& i, IndexDat
 	
 } // Index::FilterOneVLR
 
+bool Index::FilterPointSeries(boost::uint32_t & PointID, boost::uint32_t & PointsScanned, 
+	boost::uint32_t const PointsToIgnore, boost::uint32_t const x, boost::uint32_t const y, boost::uint32_t const z, 
+	liblas::detail::ConsecPtAccumulator const ConsecutivePts, IndexIterator *Iterator, 
+	IndexData const& ParamSrc)
+{
+	bool LastPtRead = 0;
+	boost::uint32_t LastPointID = static_cast<boost::uint32_t>(~0);
+	
+	try {	
+		for (boost::uint32_t PtCt = 0; PtCt < ConsecutivePts; ++PointID, ++PtCt)
+		{
+			++PointsScanned;
+			if (Iterator)
+				++Iterator->m_ptsScannedCurCell;
+			if (PointsScanned > PointsToIgnore)
+			{
+				if (FilterOnePoint(x, y, z, PointID, LastPointID, LastPtRead, ParamSrc))
+				{
+					bool SkipIt = false;
+					if (Iterator)
+					{
+						++Iterator->m_conformingPtsFound;
+						if (Iterator->m_advance)
+						{
+							--Iterator->m_advance;
+							if (Iterator->m_advance)
+								SkipIt = true;
+						} // if
+					} // if
+					if (! SkipIt)
+					{
+						m_filterResult.push_back(PointID);
+						if (Iterator && (m_filterResult.size() >= Iterator->m_chunkSize))
+							break;
+					} // if
+				} // if
+			} // if
+			LastPointID = PointID;
+		} // for
+		return (true);
+	} // try
+	catch (std::bad_alloc) {
+		return (false);
+	} // catch
+
+} // Index::FilterPointSeries
+
 bool Index::VLRInteresting(boost::int32_t MinCellX, boost::int32_t MinCellY, boost::int32_t MaxCellX, boost::int32_t MaxCellY, IndexData const& ParamSrc)
 {
 
 	// cells are written in south to north cell order columns (x) and west to east rows (y)
 	// The writing loops through y inside a for x loop. Therefore if the low x and high x are not the same then
 	// we have to assume that all y cells are interesting
-	if (ParamSrc.m_noFilterX || (MaxCellX >= m_LowXBorderCell && MinCellX <= m_HighXBorderCell))
+	if (ParamSrc.m_noFilterX || (MaxCellX >= ParamSrc.m_LowXBorderCell && MinCellX <= ParamSrc.m_HighXBorderCell))
 	{
 		if (ParamSrc.m_noFilterY || (MaxCellX != MinCellX) || 
-			(MaxCellY >= m_LowYBorderCell && MinCellY <= m_HighYBorderCell))
+			(MaxCellY >= ParamSrc.m_LowYBorderCell && MinCellY <= ParamSrc.m_HighYBorderCell))
 			return true;
 	} // if
 	return false;
@@ -593,9 +775,9 @@ bool Index::VLRInteresting(boost::int32_t MinCellX, boost::int32_t MinCellY, boo
 bool Index::CellInteresting(boost::int32_t XCellID, boost::int32_t YCellID, IndexData const& ParamSrc)
 {
 
-	if (ParamSrc.m_noFilterX || (XCellID >= m_LowXBorderCell && XCellID <= m_HighXBorderCell))
+	if (ParamSrc.m_noFilterX || (XCellID >= ParamSrc.m_LowXBorderCell && XCellID <= ParamSrc.m_HighXBorderCell))
 	{
-		if (ParamSrc.m_noFilterY || (YCellID >= m_LowYBorderCell && YCellID <= m_HighYBorderCell))
+		if (ParamSrc.m_noFilterY || (YCellID >= ParamSrc.m_LowYBorderCell && YCellID <= ParamSrc.m_HighYBorderCell))
 			return true;
 	} // if
 	return false;
@@ -605,7 +787,7 @@ bool Index::CellInteresting(boost::int32_t XCellID, boost::int32_t YCellID, Inde
 bool Index::ZCellInteresting(boost::int32_t ZCellID, IndexData const& ParamSrc)
 {
 
-	if (ParamSrc.m_noFilterZ || (ZCellID >= m_LowZBorderCell && ZCellID <= m_HighZBorderCell))
+	if (ParamSrc.m_noFilterZ || (ZCellID >= ParamSrc.m_LowZBorderCell && ZCellID <= ParamSrc.m_HighZBorderCell))
 	{
 		return true;
 	} // if
@@ -618,20 +800,20 @@ bool Index::SubCellInteresting(boost::int32_t SubCellID, boost::int32_t XCellID,
 	bool XGood = false, YGood = false;
 
 	// only need test sub cell if border cell
-	if (ParamSrc.m_noFilterX || (XCellID >= m_LowXCellCompletelyIn && XCellID <= m_HighXCellCompletelyIn))
+	if (ParamSrc.m_noFilterX || (XCellID >= ParamSrc.m_LowXCellCompletelyIn && XCellID <= ParamSrc.m_HighXCellCompletelyIn))
 	{
 		XGood = true;
 	} // if
 	else
 	{
-		if (XCellID == m_LowXBorderCell)
+		if (XCellID == ParamSrc.m_LowXBorderCell)
 		{
 			// left (low) border cell
 			if (SubCellID == 0 || SubCellID == 2)
 			{
 				// low half of cell in X
 				// only true if boundary of search area falls in the left (lower) half of the cell
-				if (m_LowXBorderPartCell <= .5)	// .5 exactly is part of low half of cell
+				if (ParamSrc.m_LowXBorderPartCell <= .5)	// .5 exactly is part of low half of cell
 					XGood = true;
 			} // if
 			else
@@ -654,25 +836,25 @@ bool Index::SubCellInteresting(boost::int32_t SubCellID, boost::int32_t XCellID,
 			{
 				// high half of cell in X
 				// only true if boundary of search area falls in the right (upper) half of the cell
-				if (m_HighXBorderPartCell > .5)
+				if (ParamSrc.m_HighXBorderPartCell > .5)
 					XGood = true;
 			} // else
 		} // else	
 	} // else
-	if (ParamSrc.m_noFilterY || (YCellID >= m_LowYCellCompletelyIn && YCellID <= m_HighYCellCompletelyIn))
+	if (ParamSrc.m_noFilterY || (YCellID >= ParamSrc.m_LowYCellCompletelyIn && YCellID <= ParamSrc.m_HighYCellCompletelyIn))
 	{
 		YGood = true;
 	} // if
 	else
 	{
-		if (YCellID == m_LowYBorderCell)
+		if (YCellID == ParamSrc.m_LowYBorderCell)
 		{
 			// bottom (low) border cell
 			if (SubCellID == 0 || SubCellID == 1)
 			{
 				// low half of cell in Y
 				// only true if boundary of search area falls in the bottom (lower) half of the cell
-				if (m_LowYBorderPartCell <= .5)	// .5 exactly is part of low half of cell
+				if (ParamSrc.m_LowYBorderPartCell <= .5)	// .5 exactly is part of low half of cell
 					YGood = true;
 			} // if
 			else
@@ -695,7 +877,7 @@ bool Index::SubCellInteresting(boost::int32_t SubCellID, boost::int32_t XCellID,
 			{
 				// high half of cell in Y
 				// only true if boundary of search area falls in the top (upper) half of the cell
-				if (m_HighYBorderPartCell > .5)
+				if (ParamSrc.m_HighYBorderPartCell > .5)
 					YGood = true;
 			} // else
 		} // else	
@@ -715,10 +897,10 @@ bool Index::FilterOnePoint(boost::int32_t x, boost::int32_t y, boost::int32_t z,
 	if (ParamSrc.m_noFilterX)
 		XGood = true;
 	// container cell in the region of the filter that requires no individual point testing?
-	else if (x >= m_LowXCellCompletelyIn && x <= m_HighXCellCompletelyIn)
+	else if (x >= ParamSrc.m_LowXCellCompletelyIn && x <= ParamSrc.m_HighXCellCompletelyIn)
 		XGood = true;
 	// container cell in the region of the filter that does require individual point testing?
-	else if (x == m_LowXBorderCell || x == m_HighXBorderCell)
+	else if (x == ParamSrc.m_LowXBorderCell || x == ParamSrc.m_HighXBorderCell)
 	{
 		// save a file seek if it is the subsequent point from the last one read
 		if (PointID == LastPointID + 1)
@@ -732,7 +914,7 @@ bool Index::FilterOnePoint(boost::int32_t x, boost::int32_t y, boost::int32_t z,
 		{
 			// seek and read
 			assert(static_cast<boost::uint32_t>(PointID) < m_pointRecordsCount);
-			PtRead = (m_reader->seek(PointID) && m_reader->ReadNextPoint());
+			PtRead = (m_reader->seek(PointID) && m_reader->ReadNextPoint());
 		} // if
 		if (PtRead)
 		{
@@ -750,10 +932,10 @@ bool Index::FilterOnePoint(boost::int32_t x, boost::int32_t y, boost::int32_t z,
 		if (ParamSrc.m_noFilterY)
 			YGood = true;
 		// container cell in the region of the filter that requires no individual point testing?
-		else if (y >= m_LowYCellCompletelyIn && y <= m_HighYCellCompletelyIn)
+		else if (y >= ParamSrc.m_LowYCellCompletelyIn && y <= ParamSrc.m_HighYCellCompletelyIn)
 			YGood = true;
 		// container cell in the region of the filter that does require individual point testing?
-		else if (y == m_LowYBorderCell || y == m_HighYBorderCell)
+		else if (y == ParamSrc.m_LowYBorderCell || y == ParamSrc.m_HighYBorderCell)
 		{
 			if (PtRead)
 			{
@@ -775,7 +957,7 @@ bool Index::FilterOnePoint(boost::int32_t x, boost::int32_t y, boost::int32_t z,
 				{
 					// seek and read
 					assert(static_cast<boost::uint32_t>(PointID) < m_pointRecordsCount);
-					PtRead = (m_reader->seek(PointID) && m_reader->ReadNextPoint());
+					PtRead = (m_reader->seek(PointID) && m_reader->ReadNextPoint());
 				} // if
 				if (PtRead)
 				{
@@ -794,10 +976,10 @@ bool Index::FilterOnePoint(boost::int32_t x, boost::int32_t y, boost::int32_t z,
 		if (ParamSrc.m_noFilterZ)
 			ZGood = true;
 		// container cell in the region of the filter that requires no individual point testing?
-		else if (z >= m_LowZCellCompletelyIn && z <= m_HighZCellCompletelyIn)
+		else if (z >= ParamSrc.m_LowZCellCompletelyIn && z <= ParamSrc.m_HighZCellCompletelyIn)
 			ZGood = true;
 		// container cell in the region of the filter that does require individual point testing?
-		else if (z == m_LowZBorderCell || z == m_HighZBorderCell)
+		else if (z == ParamSrc.m_LowZBorderCell || z == ParamSrc.m_HighZBorderCell)
 		{
 			if (PtRead)
 			{
@@ -819,7 +1001,7 @@ bool Index::FilterOnePoint(boost::int32_t x, boost::int32_t y, boost::int32_t z,
 				{
 					// seek and read
 					assert(static_cast<boost::uint32_t>(PointID) < m_pointRecordsCount);
-					PtRead = (m_reader->seek(PointID) && m_reader->ReadNextPoint());
+					PtRead = (m_reader->seek(PointID) && m_reader->ReadNextPoint());
 				} // if
 				if (PtRead)
 				{
@@ -840,10 +1022,11 @@ bool Index::BuildIndex(void)
 {
 	// Build an array of two dimensions. Sort data points into
 	boost::uint32_t MaximumCells = LIBLAS_INDEX_MAXCELLS;
+	m_versionMajor = LIBLAS_INDEX_VERSIONMAJOR;
+	m_versionMinor = LIBLAS_INDEX_VERSIONMINOR;
 	
 	// reset to beginning of point data records in case points had been examined before index is built
-	m_reader->Reset();
-
+	m_reader->seek(0);
 	// need the header to get number of point records
     m_pointRecordsCount = m_pointheader.GetPointRecordsCount();
     // get the bounds of the data and scale factors in case they are needed for point translation
@@ -981,11 +1164,9 @@ bool Index::BuildIndex(void)
 		// If a cell contains too many points, subdivide the cell and save sub-cells within the cell structure
 		// If Z-binning is desired, define the bounds of each Z zone and subdivide sort each cell's points into Z bins
 		// Save Z bins within the cell structure.
-		// reset Reader to beginning of point data records in case points had been examined before index is built
 		
 		if (IndexOut.InitiateOutput())
 		{
-			m_reader->Reset();
 			for (boost::uint32_t x = 0; x < m_cellsX; ++x)
 			{
 				for (boost::uint32_t y = 0; y < m_cellsY; ++y)
@@ -1009,7 +1190,7 @@ bool Index::BuildIndex(void)
 							{
 								// get the actual point from the las file
 								assert(MapIt->first < m_pointRecordsCount);
-								if (m_reader->seek(MapIt->first) && m_reader->ReadNextPoint())
+								if (m_reader->seek(MapIt->first) && m_reader->ReadNextPoint())
 								{
 									boost::uint32_t FirstPt = 0, LastCellZ = static_cast<boost::uint32_t>(~0);
 									boost::uint32_t LastSubCell = static_cast<boost::uint32_t>(~0);
@@ -1201,7 +1382,7 @@ bool Index::PurgePointsToTempFile(IndexCellDataBlock& CellBlock)
 {
 	if (m_tempFile || OpenTempFile())
 	{
-		boost::uint32_t EmptyOffset = 0;	// this might not be large enough
+		liblas::detail::TempFileOffsetType EmptyOffset = 0;	// this might not be large enough
 		
 		if (! m_tempFileStarted)
 		{
@@ -1209,12 +1390,12 @@ bool Index::PurgePointsToTempFile(IndexCellDataBlock& CellBlock)
 			// write out a block of file offsets the size of the number of cells
 			for (boost::uint32_t i = 0; i < m_totalCells; ++i)
 			{
-				if (fwrite(&EmptyOffset, sizeof(boost::uint32_t), 1, m_tempFile) < 1)
+				if (fwrite(&EmptyOffset, sizeof(liblas::detail::TempFileOffsetType), 1, m_tempFile) < 1)
 				{
 					return (FileError("Index::PurgePointsToTempFile"));
 				} // if error
 			} // for
-			m_tempFileWrittenBytes = m_totalCells * sizeof(boost::uint32_t);
+			m_tempFileWrittenBytes = m_totalCells * sizeof(liblas::detail::TempFileOffsetType);
 			m_tempFileStarted = true;
 		} // if
 		for (boost::uint32_t x = 0; x < m_cellsX; ++x)
@@ -1228,20 +1409,29 @@ bool Index::PurgePointsToTempFile(IndexCellDataBlock& CellBlock)
 					// if cell block header is 0 write the current file location in the file header
 					// otherwise write the current file location at the file location specified in the 
 					// cell block header
-					boost::uint32_t LastWriteLocation = CellBlock[x][y].GetFileOffset();
+					liblas::detail::TempFileOffsetType LastWriteLocation = CellBlock[x][y].GetFileOffset();
 					if (LastWriteLocation == 0)
-						LastWriteLocation = (x * m_cellsY + y) * sizeof(boost::uint32_t);
+						LastWriteLocation = (x * m_cellsY + y) * sizeof(liblas::detail::TempFileOffsetType);
+#ifdef _MSC_VER
+					_fseeki64(m_tempFile, LastWriteLocation, SEEK_SET);
+#else
 					fseek(m_tempFile, LastWriteLocation, SEEK_SET);
-					if (fwrite(&m_tempFileWrittenBytes, sizeof(boost::uint32_t), 1, m_tempFile) < 1)
+#endif
+					if (fwrite(&m_tempFileWrittenBytes, sizeof(liblas::detail::TempFileOffsetType), 1, m_tempFile) < 1)
 						return (FileError("Index::PurgePointsToTempFile"));
 					CellBlock[x][y].SetFileOffset(m_tempFileWrittenBytes);
 
 					// seek to end of file where next block of data will be written
+#ifdef _MSC_VER
+					_fseeki64(m_tempFile, 0, SEEK_END);
+#else
 					fseek(m_tempFile, 0, SEEK_END);
+#endif
+
 					// write a blank space for later placement of next file block for this cell
-					if (fwrite(&EmptyOffset, sizeof(boost::uint32_t), 1, m_tempFile) < 1)
+					if (fwrite(&EmptyOffset, sizeof(liblas::detail::TempFileOffsetType), 1, m_tempFile) < 1)
 						return (FileError("Index::PurgePointsToTempFile"));
-					m_tempFileWrittenBytes += sizeof(boost::uint32_t);
+					m_tempFileWrittenBytes += sizeof(liblas::detail::TempFileOffsetType);
 					// write the number of records stored in this section
 					if (fwrite(&RecordsToWrite, sizeof(boost::uint32_t), 1, m_tempFile) < 1)
 						return (FileError("Index::PurgePointsToTempFile"));
@@ -1279,23 +1469,35 @@ bool Index::LoadCellFromTempFile(liblas::detail::IndexCell *CellBlock,
 	boost::uint32_t CurCellX, boost::uint32_t CurCellY)
 {
 
-	boost::uint32_t FileOffset, RecordsToRead, FormerNumPts, NewNumPts = 0;
+	boost::uint32_t RecordsToRead, FormerNumPts, NewNumPts = 0;
+	liblas::detail::TempFileOffsetType FileOffset;
 	
 	FormerNumPts = CellBlock->GetNumPoints();
 	CellBlock->SetNumPoints(0);
 	
 	// load the cell as it was written
 	// read the first offset for this cell
-	if (fseek(m_tempFile, (CurCellX * m_cellsY + CurCellY) * sizeof (boost::uint32_t), SEEK_SET))
+
+#ifdef _MSC_VER
+	if (_fseeki64(m_tempFile, (CurCellX * m_cellsY + CurCellY) * sizeof (liblas::detail::TempFileOffsetType), SEEK_SET))
+#else
+	if (fseek(m_tempFile, (CurCellX * m_cellsY + CurCellY) * sizeof (liblas::detail::TempFileOffsetType), SEEK_SET))
+#endif
 		return (FileError("Index::LoadCellFromTempFile"));
-	if (fread(&FileOffset, sizeof (boost::uint32_t), 1, m_tempFile) < 1)
+	if (fread(&FileOffset, sizeof (liblas::detail::TempFileOffsetType), 1, m_tempFile) < 1)
 		return (FileError("Index::LoadCellFromTempFile"));
 	while (FileOffset > 0)
 	{
 		// jump to the first block for this cell, read the next offset
+
+#ifdef _MSC_VER
+		if (_fseeki64(m_tempFile, FileOffset, SEEK_SET))
+#else
 		if (fseek(m_tempFile, FileOffset, SEEK_SET))
+#endif
+
 			return (FileError("Index::LoadCellFromTempFile"));
-		if (fread(&FileOffset, sizeof (boost::uint32_t), 1, m_tempFile) < 1)
+		if (fread(&FileOffset, sizeof (liblas::detail::TempFileOffsetType), 1, m_tempFile) < 1)
 			return (FileError("Index::LoadCellFromTempFile"));
 		// read the data for the cell in this block
 		// first is the number of items to read now
@@ -1351,7 +1553,7 @@ bool Index::SaveIndexInLASFile(void)
 {
 	try {
 		Writer writer(*m_ofs, m_idxheader);
-		m_reader->Reset();
+		m_reader->seek(0);
 		while (m_reader->ReadNextPoint())
 		{
 			Point CurPt = m_reader->GetPoint();
@@ -1370,7 +1572,7 @@ bool Index::SaveIndexInStandAloneFile(void)
 	try {
 		Writer writer(*m_ofs, m_idxheader);
 		/* test block - uncommenting this makes it just like above version with included points
-		m_reader->Reset();
+		m_reader->seek(0);
 		while (m_reader->ReadNextPoint())
 		{
 			Point CurPt = m_reader->GetPoint();
@@ -1559,12 +1761,68 @@ IndexData::IndexData(Index const& index)
 	if (m_maxMemoryUsage < LIBLAS_INDEX_MINMEMDEFAULT)
 		m_maxMemoryUsage = LIBLAS_INDEX_MINMEMDEFAULT;
 	m_indexValid = index.IndexReady();
-} // Index::Index
+} // IndexData::IndexData
+
+IndexData::IndexData(IndexData const& other)
+{
+	Copy(other);
+} // IndexData::IndexData
+
+IndexData& IndexData::operator=(IndexData const& rhs)
+{
+    Copy(rhs);
+	return (*this);
+} // IndexData::operator=
+
+void IndexData::Copy(IndexData const& other)
+{
+    if (&other != this)
+    {
+		m_reader = other.m_reader;
+		m_idxreader = other.m_idxreader;
+		m_iterator = other.m_iterator;
+		m_ifs = other.m_ifs;
+		m_ofs = other.m_ofs;
+		m_tempFileName = other.m_tempFileName;
+		m_indexAuthor = other.m_indexAuthor;
+		m_indexComment = other.m_indexComment;
+		m_indexDate = other.m_indexDate;
+		m_cellSizeZ = other.m_cellSizeZ;
+		m_maxMemoryUsage = other.m_maxMemoryUsage;
+		m_debugOutputLevel = other.m_debugOutputLevel;
+		m_readOnly = other.m_readOnly;
+		m_writestandaloneindex = other.m_writestandaloneindex;
+		m_forceNewIndex = other.m_forceNewIndex;
+		m_debugger = other.m_debugger;
+		m_indexValid = other.m_indexValid;
+		m_noFilterX = other.m_noFilterX;
+		m_noFilterY = other.m_noFilterY;
+		m_noFilterZ = other.m_noFilterZ;
+		m_filter = other.m_filter;
+		m_LowXCellCompletelyIn = other.m_LowXCellCompletelyIn;
+		m_HighXCellCompletelyIn = other.m_HighXCellCompletelyIn;
+		m_LowYCellCompletelyIn = other.m_LowYCellCompletelyIn;
+		m_HighYCellCompletelyIn = other.m_HighYCellCompletelyIn;
+		m_LowZCellCompletelyIn = other.m_LowZCellCompletelyIn;
+		m_HighZCellCompletelyIn = other.m_HighZCellCompletelyIn;
+		m_LowXBorderCell = other.m_LowXBorderCell;
+		m_HighXBorderCell = other.m_HighXBorderCell;
+		m_LowYBorderCell = other.m_LowYBorderCell;
+		m_HighYBorderCell = other.m_HighYBorderCell;
+		m_LowZBorderCell = other.m_LowZBorderCell;
+		m_HighZBorderCell = other.m_HighZBorderCell;
+		m_LowXBorderPartCell = other.m_LowXBorderPartCell;
+		m_HighXBorderPartCell = other.m_HighXBorderPartCell;
+		m_LowYBorderPartCell = other.m_LowYBorderPartCell;
+		m_HighYBorderPartCell = other.m_HighYBorderPartCell;
+	} // if
+} // IndexData::Copy
 
 void IndexData::SetValues(void)
 {
 	m_reader = 0;
 	m_idxreader = 0;
+	m_iterator = 0;
 	m_ifs = 0;
 	m_ofs = 0;
 	m_tempFileName = 0;
@@ -1580,6 +1838,11 @@ void IndexData::SetValues(void)
 	m_debugger = 0;
 	m_indexValid = false;
 	m_noFilterX = m_noFilterY = m_noFilterZ = false;
+    m_LowXCellCompletelyIn = m_HighXCellCompletelyIn = m_LowYCellCompletelyIn = m_HighYCellCompletelyIn = 
+		m_LowZCellCompletelyIn = m_HighZCellCompletelyIn =
+		m_LowXBorderCell = m_HighXBorderCell = m_LowYBorderCell = m_HighYBorderCell = 
+		m_LowZBorderCell = m_HighZBorderCell = 0;
+	m_LowXBorderPartCell = m_HighXBorderPartCell = m_LowYBorderPartCell = m_HighYBorderPartCell = 0.0;
 } // IndexData::SetValues
 
 bool IndexData::SetInitialValues(std::istream *ifs, Reader *reader, std::ostream *ofs, Reader *idxreader, 
@@ -1593,6 +1856,7 @@ bool IndexData::SetInitialValues(std::istream *ifs, Reader *reader, std::ostream
 	m_ofs = ofs;
 	m_reader = reader;
 	m_idxreader = idxreader;
+	m_iterator = 0;
 	m_tempFileName = tmpfilenme;
 	m_indexAuthor = indexauthor;
 	m_indexComment = indexcomment;
@@ -1605,6 +1869,11 @@ bool IndexData::SetInitialValues(std::istream *ifs, Reader *reader, std::ostream
 	m_forceNewIndex = forcenewindex;
 	m_debugger = debugger;
 	m_indexValid = false;
+    m_LowXCellCompletelyIn = m_HighXCellCompletelyIn = m_LowYCellCompletelyIn = m_HighYCellCompletelyIn = 
+		m_LowZCellCompletelyIn = m_HighZCellCompletelyIn =
+		m_LowXBorderCell = m_HighXBorderCell = m_LowYBorderCell = m_HighYBorderCell = 
+		m_LowZBorderCell = m_HighZBorderCell = 0;
+	m_LowXBorderPartCell = m_HighXBorderPartCell = m_LowYBorderPartCell = m_HighYBorderPartCell = 0.0;
 	return (m_reader || m_ifs);
 	
 } // IndexData::SetInitialValues
@@ -1618,6 +1887,7 @@ bool IndexData::SetBuildEmbedValues(Reader *reader, std::ostream *ofs, const cha
 	m_ofs = ofs;
 	m_reader = reader;
 	m_idxreader = 0;
+	m_iterator = 0;
 	m_tempFileName = tmpfilenme;
 	m_indexAuthor = indexauthor;
 	m_indexComment = indexcomment;
@@ -1643,6 +1913,7 @@ bool IndexData::SetBuildAloneValues(Reader *reader, std::ostream *ofs, const cha
 	m_ofs = ofs;
 	m_reader = reader;
 	m_idxreader = 0;
+	m_iterator = 0;
 	m_tempFileName = tmpfilenme;
 	m_indexAuthor = indexauthor;
 	m_indexComment = indexcomment;
@@ -1666,6 +1937,7 @@ bool IndexData::SetReadEmbedValues(Reader *reader, int debugoutputlevel, FILE *d
 	m_ofs = 0;
 	m_reader = reader;
 	m_idxreader = 0;
+	m_iterator = 0;
 	m_tempFileName = 0;
 	m_indexAuthor = 0;
 	m_indexComment = 0;
@@ -1689,6 +1961,7 @@ bool IndexData::SetReadAloneValues(Reader *reader, Reader *idxreader, int debugo
 	m_ofs = 0;
 	m_reader = reader;
 	m_idxreader = idxreader;
+	m_iterator = 0;
 	m_tempFileName = 0;
 	m_indexAuthor = 0;
 	m_indexComment = 0;
@@ -1776,5 +2049,94 @@ void IndexData::ClampFilterBounds(Bounds<double> const& m_bounds)
 	m_filter.clip(m_bounds);
 } // IndexData::ClampFilterBounds
 
+IndexIterator::IndexIterator(Index *IndexSrc, double LowFilterX, double HighFilterX, double LowFilterY, double HighFilterY, 
+	double LowFilterZ, double HighFilterZ, boost::uint32_t ChunkSize)
+	: m_indexData(*IndexSrc)
+{
+	m_index = IndexSrc;
+	m_indexData.m_filter = Bounds<double>(LowFilterX, LowFilterY, LowFilterZ, HighFilterX, HighFilterY, HighFilterZ);
+	m_chunkSize = ChunkSize;
+	m_advance = 0;
+	ResetPosition();
+} // IndexIterator::IndexIterator
+
+IndexIterator::IndexIterator(Index *IndexSrc, IndexData const& IndexDataSrc, boost::uint32_t ChunkSize)
+	: m_indexData(IndexDataSrc)
+{
+	m_index = IndexSrc;
+	m_chunkSize = ChunkSize;
+	m_advance = 0;
+	ResetPosition();
+} // IndexIterator::IndexIterator
+
+IndexIterator::IndexIterator(Index *IndexSrc, Bounds<double> const& BoundsSrc, boost::uint32_t ChunkSize)
+{
+	m_index = IndexSrc;
+	m_indexData = IndexData(*IndexSrc);
+	m_indexData.m_filter = BoundsSrc;
+	m_chunkSize = ChunkSize;
+	m_advance = 0;
+	ResetPosition();
+} // IndexIterator::IndexIterator
+
+IndexIterator::IndexIterator(IndexIterator const& other)
+{
+	Copy(other);
+} // IndexIterator::IndexIterator
+
+IndexIterator& IndexIterator::operator=(IndexIterator const& rhs)
+{
+	Copy(rhs);
+	return (*this);
+} // IndexIterator::operator=
+
+void IndexIterator::Copy(IndexIterator const& other)
+{
+	if (&other != this)
+	{
+		m_index = other.m_index;
+		m_indexData = other.m_indexData;
+		m_chunkSize = other.m_chunkSize;
+		m_advance = other.m_advance;
+		m_curVLR = other.m_curVLR;
+		m_curCellStartPos = other.m_curCellStartPos;
+		m_curCellX = other.m_curCellX;
+		m_curCellY = other.m_curCellY;
+		m_totalPointsScanned = other.m_totalPointsScanned;
+		m_ptsScannedCurCell = other.m_ptsScannedCurCell;
+		m_ptsScannedCurVLR = other.m_ptsScannedCurVLR;
+		m_conformingPtsFound = other.m_conformingPtsFound;
+	} // if
+} // IndexIterator::Copy
+
+void IndexIterator::ResetPosition(void)
+{
+	m_curVLR = m_curCellStartPos = m_curCellX = m_curCellY = 0;
+	m_totalPointsScanned = m_ptsScannedCurCell = m_ptsScannedCurVLR = 0;
+	m_conformingPtsFound = 0;
+} // IndexIterator::ResetPosition
+
+const std::vector<boost::uint32_t>& IndexIterator::operator()(boost::int32_t n)
+{
+	if (n < 0)
+		n = 0;
+	if ((boost::uint32_t)n <= m_conformingPtsFound)
+		ResetPosition();
+	n -= m_conformingPtsFound;
+	return (advance(n));
+} // IndexIterator::operator++
+
+const std::vector<boost::uint32_t>& IndexIterator::advance(boost::int32_t n)
+{
+	if (n < 0)
+	{
+		n = m_conformingPtsFound + n;
+		return((*this)(n));
+	} // if
+	m_advance = n;
+	m_indexData.SetIterator(this);
+	return (m_index->Filter(m_indexData));
+} // IndexIterator::advance
+
 } // namespace liblas
 
diff --git a/Utilities/otbliblas/src/laspoint.cpp b/Utilities/otbliblas/src/laspoint.cpp
index 153d5750919f60b51595c7341436c4674d8f13a2..e6f0b141c391c436b9b15ba8b498925c5eacb9c7 100755
--- a/Utilities/otbliblas/src/laspoint.cpp
+++ b/Utilities/otbliblas/src/laspoint.cpp
@@ -43,6 +43,7 @@
 #include <liblas/lasheader.hpp>
 #include <liblas/lasschema.hpp>
 #include <liblas/exception.hpp>
+#include <liblas/detail/binary.hpp>
 #include <liblas/detail/pointrecord.hpp>
 // boost
 #include <boost/array.hpp>
@@ -95,7 +96,6 @@ Point& Point::operator=(Point const& rhs)
     return *this;
 }
 
-
 void Point::SetCoordinates(double const& x, double const& y, double const& z)
 {
     SetX(x);
@@ -103,7 +103,6 @@ void Point::SetCoordinates(double const& x, double const& y, double const& z)
     SetZ(z);
 }
 
-
 bool Point::equal(Point const& other) const
 {
     // TODO - mloskot: Default epsilon is too small.
@@ -184,7 +183,6 @@ bool Point::IsValid() const
     if (this->GetReturnNumber() > 0x07)
         return false;
 
-
     return true;
 }
 
@@ -230,24 +228,17 @@ void Point::SetHeaderPtr(HeaderPtr header)
         SetUserData(p.GetUserData());
         SetPointSourceID(p.GetPointSourceID());
         
-        try {
-            SetTime(p.GetTime());
-        } catch (std::runtime_error const&) 
+        try
         {
-            
-        }
-
-        try {
+            SetTime(p.GetTime());
             SetColor(p.GetColor());
-        } catch (std::runtime_error const&) 
-        {
-            
         }
-        
+        catch (std::runtime_error const&)
+        {   
+        }
+
         // FIXME: copy other custom dimensions here?  resetting the 
         // headerptr can be catastrophic in a lot of cases.  
-
-        
     }
     
     m_header = header;
@@ -391,59 +382,70 @@ double Point::GetZ() const
 
 void Point::SetX( double const& value ) 
 {
-    boost::int32_t v = static_cast<boost::int32_t>(value);
+    boost::int32_t v;
+    double scale;
+    double offset;
+
     if (m_header.get() != 0 ) 
     {
-        // descale the value given our scale/offset
-        v = static_cast<boost::int32_t>(
-                             detail::sround(((value - m_header->GetOffsetX()) / 
-                                              m_header->GetScaleX())));
-
-    } else 
+        scale = m_header->GetScaleX();
+        offset = m_header->GetOffsetX();
+    } 
+    else 
     {
-        v = static_cast<boost::int32_t>(
-                             detail::sround(((value - m_default_header.GetOffsetX()) / 
-                                              m_default_header.GetScaleX())));
+        scale = m_default_header.GetScaleX();
+        offset = m_default_header.GetOffsetX();
     }
 
+    // descale the value given our scale/offset
+    v = static_cast<boost::int32_t>(
+                         detail::sround((value - offset) / scale));
     SetRawX(v);
 }
 
 void Point::SetY( double const& value ) 
 {
-    boost::int32_t v = static_cast<boost::int32_t>(value);
+    boost::int32_t v;
+    double scale;
+    double offset;
+
     if (m_header.get() != 0 ) 
     {
-        // descale the value given our scale/offset
-        v = static_cast<boost::int32_t>(
-                             detail::sround(((value - m_header->GetOffsetY()) / 
-                                              m_header->GetScaleY())));
-    } else 
+        scale = m_header->GetScaleY();
+        offset = m_header->GetOffsetY();
+    } 
+    else 
     {
-        v = static_cast<boost::int32_t>(
-                             detail::sround(((value - m_default_header.GetOffsetY()) / 
-                                              m_default_header.GetScaleY())));
+        scale = m_default_header.GetScaleY();
+        offset = m_default_header.GetOffsetY();
     }
-    
+
+    // descale the value given our scale/offset
+    v = static_cast<boost::int32_t>(
+                         detail::sround((value - offset) / scale));
     SetRawY(v);
 }
 
 void Point::SetZ( double const& value ) 
 {
-    boost::int32_t v = static_cast<boost::int32_t>(value);
-    if (m_header) 
+    boost::int32_t v;
+    double scale;
+    double offset;
+
+    if (m_header.get() != 0 ) 
     {
-        // descale the value given our scale/offset
-        v = static_cast<boost::int32_t>(
-                             detail::sround(((value - m_header->GetOffsetZ()) / 
-                                              m_header->GetScaleZ())));
-    } else
+        scale = m_header->GetScaleZ();
+        offset = m_header->GetOffsetZ();
+    } 
+    else 
     {
-        v = static_cast<boost::int32_t>(
-                             detail::sround(((value - m_default_header.GetOffsetZ()) / 
-                                              m_default_header.GetScaleZ())));
+        scale = m_default_header.GetScaleZ();
+        offset = m_default_header.GetOffsetZ();
     }
-    
+
+    // descale the value given our scale/offset
+    v = static_cast<boost::int32_t>(
+                         detail::sround((value - offset) / scale));
     SetRawZ(v);
 }
 
@@ -722,14 +724,11 @@ boost::uint16_t Point::GetPointSourceID() const
     return output;
 }
 
-
 void Point::SetPointSourceID(boost::uint16_t const& id)
 {
     // "Point Source ID" is always the 12th dimension    
     std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(11);
-    liblas::detail::intToBits<boost::uint16_t>(id, 
-                                               m_data, 
-                                               pos);
+    liblas::detail::intToBits<boost::uint16_t>(id, m_data, pos);
 }
 
 void Point::SetTime(double const& t)
@@ -753,54 +752,40 @@ void Point::SetTime(double const& t)
     }
     std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(index_pos);
 
-    const boost::uint8_t* x_b =  reinterpret_cast<const boost::uint8_t*>(&t);
-#if defined(LIBLAS_BIG_ENDIAN)
-        for (boost::int32_t n = sizeof( double )-1; n >= 0; n--)
-#else
-        for (boost::uint32_t n = 0; n < sizeof( double ); n++)
-#endif 
-            m_data[pos+n] = x_b[n];
-
+    detail::binary::endian_value<double> value(t);
+    value.store<detail::binary::little_endian_tag>(&m_data[0] + pos);
 }
 
 double Point::GetTime() const
 {
-    // "Time" is the 13th dimension if it exists
-    std::size_t index_pos = 12;
-
     PointFormatName f;
-    if (m_header) {
+    if (m_header)
+    {
         f = m_header->GetDataFormatId();
-    } else {
+    }
+    else
+    {
         f = m_default_header.GetDataFormatId();
     }   
     
-    if ( f == ePointFormat0 || f == ePointFormat2 ) {
+    if (f == ePointFormat0 || f == ePointFormat2)
+    {
         // std::ostringstream msg;
         // msg << "Point::GetTime - Unable to get time for ePointFormat0 or ePointFormat2, "
         //     << "no Time dimension exists on this format";
         // throw std::runtime_error(msg.str());
         return 0.0;
     }
-    std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(index_pos);
-
 
-    boost::uint8_t* data = new boost::uint8_t[8];
-    
-#if defined(LIBLAS_BIG_ENDIAN)
-        for (boost::uint32_t n = 0; n < sizeof( double ); n++)
-#else
-        for (boost::int32_t n = sizeof( double )-1; n >= 0; n--)
-#endif  
-            data[n] = m_data[pos+n];
+    // "Time" is the 13th dimension if it exists
+    std::size_t const index_pos = 12;
+    std::vector<boost::uint8_t>::size_type pos = GetDimensionBytePosition(index_pos);
 
-    const double* output = reinterpret_cast<const double*>(data);
-    double out = *output;
-    delete[] data;
-    return out;
+    detail::binary::endian_value<double> value;
+    value.load<detail::binary::little_endian_tag>(&m_data[0] + pos);
+    return value;
 }
 
-
 Color Point::GetColor() const
 {
     boost::uint16_t red(0);
@@ -868,23 +853,14 @@ void Point::SetColor(Color const& value)
     
     std::vector<boost::uint8_t>::size_type green_pos = GetDimensionBytePosition(index_pos + 1);
     std::vector<boost::uint8_t>::size_type blue_pos = GetDimensionBytePosition(index_pos + 2);
- 
-
     std::vector<boost::uint8_t>::size_type red_pos = GetDimensionBytePosition(index_pos);
     assert(red_pos + sizeof(Color::value_type) <= m_data.size());
+    
     intToBits<boost::uint16_t>(value.GetRed(), m_data, red_pos);
-    intToBits<boost::uint16_t>(value.GetGreen(), 
-                                               m_data, 
-                                               green_pos);
-    intToBits<boost::uint16_t>(value.GetBlue(), 
-                                               m_data, 
-                                               blue_pos);
+    intToBits<boost::uint16_t>(value.GetGreen(), m_data, green_pos);
+    intToBits<boost::uint16_t>(value.GetBlue(), m_data, blue_pos);
 }
 
-
-
-
-
 std::vector<boost::uint8_t>::size_type Point::GetDimensionBytePosition(std::size_t dim_pos) const
 {
     std::size_t output = 0;
@@ -898,19 +874,12 @@ std::vector<boost::uint8_t>::size_type Point::GetDimensionBytePosition(std::size
     return output;
 }
 
-
-
-
-
 boost::any Point::GetValue(Dimension const& d) const
 {
-
     boost::any output;
+    boost::ignore_unused_variable_warning(d);
 
- 
-    
     return output;
 }
 
-
 } // namespace liblas
diff --git a/Utilities/otbliblas/src/lasreader.cpp b/Utilities/otbliblas/src/lasreader.cpp
old mode 100755
new mode 100644
index f566243107ed52e4d663a1651b2b7afc472d7714..7a39c9a6db674092e232c3750fee1b440448c789
--- a/Utilities/otbliblas/src/lasreader.cpp
+++ b/Utilities/otbliblas/src/lasreader.cpp
@@ -64,68 +64,59 @@ namespace liblas
 
 Reader::Reader(std::istream& ifs) :
     m_pimpl(new detail::CachedReaderImpl(ifs,3)),
-    m_header(HeaderPtr()),
     m_point(0),
     m_empty_point(new Point()),
     bCustomHeader(false),
     m_filters(0),
-    m_transforms(0),
-    m_reprojection_transform(TransformPtr())
+    m_transforms(0)
 {
     Init();
 }
 
 Reader::Reader(std::istream& ifs, uint32_t cache_size) :
     m_pimpl(new detail::CachedReaderImpl(ifs, cache_size)),
-    m_header(HeaderPtr()),
     m_point(0),
     m_empty_point(new Point()),
     bCustomHeader(false),
     m_filters(0),
-    m_transforms(0),
-    m_reprojection_transform(TransformPtr())
+    m_transforms(0)
 {
     Init();
 }
 
-Reader::Reader(std::istream& ifs, uint32_t cache_size, Header& header) :
+Reader::Reader(std::istream& ifs, uint32_t cache_size, Header const& header) :
     m_pimpl(new detail::CachedReaderImpl(ifs, cache_size)),
-    m_header(HeaderPtr( )),    
+    m_header(new Header(header)),
     m_point(0),
     m_empty_point(new Point()),
     bCustomHeader(true),
     m_filters(0),
-    m_transforms(0),
-    m_reprojection_transform(TransformPtr())
+    m_transforms(0)
 {
     // if we have a custom header, create a slot for it and then copy 
     // the header we were given
-    m_header = HeaderPtr(new Header(header));
+
     Init();
 }
 
 Reader::Reader(ReaderI* reader) :
     m_pimpl(reader),
-    m_header(HeaderPtr()),
     m_point(0),
     m_empty_point(new Point()),
     bCustomHeader(false),
     m_filters(0),
-    m_transforms(0),
-    m_reprojection_transform(TransformPtr())
+    m_transforms(0)
 {
     Init();
 }
 
-Reader::Reader(std::istream& ifs, Header& header) :
+Reader::Reader(std::istream& ifs, Header const& header) :
     m_pimpl(new detail::ReaderImpl(ifs)),
-    m_header(HeaderPtr( )),    
     m_point(0),
     m_empty_point(new Point()),
     bCustomHeader(true),
     m_filters(0),
-    m_transforms(0),
-    m_reprojection_transform(TransformPtr())
+    m_transforms(0)
 {
     // if we have a custom header, create a slot for it and then copy 
     // the header we were given
@@ -155,18 +146,19 @@ Point const& Reader::GetPoint() const
 }
 
 bool Reader::KeepPoint(liblas::Point const& p)
-{
-    std::vector<liblas::FilterPtr>::const_iterator fi;
-    
+{    
     // If there's no filters on this reader, we keep 
     // the point no matter what.
     if (m_filters.empty() ) {
         return true;
     }
 
-    for (fi = m_filters.begin(); fi != m_filters.end(); ++fi) {
+    std::vector<liblas::FilterPtr>::const_iterator fi;
+    for (fi = m_filters.begin(); fi != m_filters.end(); ++fi)
+    {
         liblas::FilterPtr filter = *fi;
-        if (!filter->filter(p)){
+        if (!filter->filter(p))
+        {
             return false;
         }
     }
@@ -174,72 +166,87 @@ bool Reader::KeepPoint(liblas::Point const& p)
 }
 
 bool Reader::ReadNextPoint()
-{
-    std::vector<liblas::TransformPtr>::const_iterator ti;
-  
-    try {
+{  
+    try
+    {
         // m_point = m_pimpl->ReadNextPoint(m_header).get();
         m_point = const_cast<Point*>(&(m_pimpl->ReadNextPoint(m_header)));
-        
+
         // Filter the points and continue reading until we either find 
         // one to keep or throw an exception.
-        if (!KeepPoint(*m_point)) {
+        if (!KeepPoint(*m_point))
+        {
             m_point = const_cast<Point*>(&(m_pimpl->ReadNextPoint(m_header)));
-            while (!KeepPoint(*m_point)) {
+            while (!KeepPoint(*m_point))
+            {
                 m_point = const_cast<Point*>(&(m_pimpl->ReadNextPoint(m_header)));
             }
         }
         
-        if (!m_transforms.empty()) {
+        if (!m_transforms.empty())
+        {
             // Apply the transforms to each point
+            std::vector<liblas::TransformPtr>::const_iterator ti;
 
-            for (ti = m_transforms.begin(); ti != m_transforms.end(); ++ti) {
+            for (ti = m_transforms.begin(); ti != m_transforms.end(); ++ti)
+            {
                 liblas::TransformPtr transform = *ti;
                 transform->transform(*m_point);
             }            
         }
 
         return true;
-    } catch (std::out_of_range) {
+    }
+    catch (std::out_of_range)
+    {
         m_point = 0;
-        return false;
     }
+
+    return false;
 }
 
 bool Reader::ReadPointAt(std::size_t n)
 {
-    std::vector<liblas::TransformPtr>::const_iterator ti;
-
     if (m_header->GetPointRecordsCount() <= n)
     {
         throw std::out_of_range("point subscript out of range");
     }
     
-    try {
+    try
+    {
         m_point = const_cast<Point*>(&(m_pimpl->ReadPointAt(n, m_header)));
-        if (!m_transforms.empty()) {
-            for (ti = m_transforms.begin(); ti != m_transforms.end(); ++ti) {
+        if (!m_transforms.empty())
+        {
+            std::vector<liblas::TransformPtr>::const_iterator ti;
+            for (ti = m_transforms.begin(); ti != m_transforms.end(); ++ti)
+            {
                 liblas::TransformPtr transform = *ti;
                 transform->transform(*m_point);
             }            
-            }
+        }
         return true;
-    } catch (std::out_of_range) {
+    }
+    catch (std::out_of_range)
+    {
         m_point = 0;
-        return false;
     }
+    return false;
 }
 
 bool Reader::seek(std::size_t n)
 {
-    try {
+    try
+    {
+        assert(n < m_header->GetPointRecordsCount());
+
         m_pimpl->Seek(n, m_header);
         return true;
-    } catch (std::out_of_range) {
+    }
+    catch (std::out_of_range)
+    {
         m_point = 0;
-        return false;
     }
-
+    return false;
 }
 Point const& Reader::operator[](std::size_t n)
 {
@@ -338,7 +345,7 @@ bool Reader::SetOutputSRS(const SpatialReference& srs)
         possible_reprojection_transform = m_transforms.at(0);
     }
     
-    if (m_reprojection_transform == possible_reprojection_transform && m_reprojection_transform.get() != 0) {
+    if (m_reprojection_transform == possible_reprojection_transform && m_reprojection_transform) {
         // remove it from the transforms list
         std::vector<liblas::TransformPtr>::iterator i = m_transforms.begin();
         m_transforms.erase(i);
@@ -361,8 +368,6 @@ bool Reader::SetOutputSRS(const SpatialReference& srs)
 
 liblas::property_tree::ptree Reader::Summarize() 
 {
-
-    
     liblas::Summary s;
 
     Reset();
@@ -378,7 +383,7 @@ liblas::property_tree::ptree Reader::Summarize()
         s.AddPoint(p);
         read = ReadNextPoint();
     }
-    
+
     return s.GetPTree();
     
     // Summarize the schema
diff --git a/Utilities/otbliblas/src/lasschema.cpp b/Utilities/otbliblas/src/lasschema.cpp
old mode 100755
new mode 100644
index 3d56f5791d67f9f28d368941a502ebc343ea28f9..96147369a6e67c5b0e918736d9b6328479a20e35
--- a/Utilities/otbliblas/src/lasschema.cpp
+++ b/Utilities/otbliblas/src/lasschema.cpp
@@ -436,7 +436,10 @@ IndexMap Schema::LoadDimensions(liblas::property_tree::ptree tree)
         d.IsSigned(issigned);
         d.IsRequired(isrequired);
         d.SetPosition(position);
-        if (min != max && min != 0 && max != 0) {
+        if (!detail::compare_distance(max, min ) && 
+            !detail::compare_distance(0.0, min) &&
+            !detail::compare_distance(0.0, max))
+        {
             d.SetMinimum(min);
             d.SetMaximum(max);
         }
diff --git a/Utilities/otbliblas/src/lasspatialreference.cpp b/Utilities/otbliblas/src/lasspatialreference.cpp
old mode 100755
new mode 100644
index bdb46c75e3c1fe11d5a6b9e022e1dccca3e63c7c..76e428edf645bcb7308844d16e769f5abebca22e
--- a/Utilities/otbliblas/src/lasspatialreference.cpp
+++ b/Utilities/otbliblas/src/lasspatialreference.cpp
@@ -50,6 +50,10 @@
 #include <string>
 #include <vector>
 
+#ifdef HAVE_GDAL
+#  include "cpl_conv.h"
+#endif
+
 using namespace boost;
 
 namespace liblas {
@@ -364,7 +368,7 @@ const GTIF* SpatialReference::GetGTIF()
 
     m_gtiff = GTIFNewSimpleTags(m_tiff);
     if (!m_gtiff) 
-        throw std::runtime_error("The geotiff keys could not read from VLR records");
+        throw std::runtime_error("The geotiff keys could not be read from VLR records");
     
     return m_gtiff;
 #endif
@@ -395,16 +399,16 @@ std::string SpatialReference::GetWKT(WKTModeFlag mode_flag , bool pretty) const
     {
         pszWKT = GTIFGetOGISDefn( m_gtiff, &sGTIFDefn );
 
-            if (pretty) {
-                OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL);
-                char *pszOrigWKT = pszWKT;
-                poSRS->importFromWkt( &pszOrigWKT );
-
-                CPLFree( pszWKT );
-                pszWKT = NULL;
-                poSRS->exportToPrettyWkt(&pszWKT, false);
-                delete poSRS;
-            }
+        if (pretty) {
+            OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL);
+            char *pszOrigWKT = pszWKT;
+            poSRS->importFromWkt( &pszOrigWKT );
+            
+            CPLFree( pszWKT );
+            pszWKT = NULL;
+            poSRS->exportToPrettyWkt(&pszWKT, false);
+            delete poSRS;
+        }
                 
         // Older versions of GDAL lack StripVertical(), but should never
         // actually return COMPD_CS anyways.
@@ -499,10 +503,10 @@ void SpatialReference::SetWKT(std::string const& v)
 #endif
 }
 
-void SpatialReference::SetVerticalCS(int verticalCSType, 
+void SpatialReference::SetVerticalCS(boost::int32_t verticalCSType, 
                                      std::string const& citation,
-                                     int verticalDatum,
-                                     int verticalUnits)
+                                     boost::int32_t verticalDatum,
+                                     boost::int32_t verticalUnits)
 {
     if (!m_gtiff)
     {
diff --git a/Utilities/otbliblas/src/lastransform.cpp b/Utilities/otbliblas/src/lastransform.cpp
old mode 100755
new mode 100644
index f6e002c817f05f3aeeedb3b13bca7b1c2277d4f2..1af16955c4e68d827074f9883279084214dafbcc
--- a/Utilities/otbliblas/src/lastransform.cpp
+++ b/Utilities/otbliblas/src/lastransform.cpp
@@ -42,38 +42,43 @@
 #include <liblas/lastransform.hpp>
 // boost
 #include <boost/concept_check.hpp>
+#include <boost/tokenizer.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string/erase.hpp>
+
 // std
 #include <sstream>
 #include <stdexcept>
 #include <string>
+#include <algorithm>
+
+typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
 
 namespace liblas { 
 
 ReprojectionTransform::ReprojectionTransform(const SpatialReference& inSRS, const SpatialReference& outSRS)
-    : m_transform(0)
-    , m_in_ref(0)
-    , m_out_ref(0)
+    : m_new_header(HeaderPtr())
 {
+    Initialize(inSRS, outSRS);
+}
 
+ReprojectionTransform::ReprojectionTransform(
+    const SpatialReference& inSRS, 
+    const SpatialReference& outSRS,
+    liblas::HeaderPtr new_header)
+    : m_new_header(new_header)
+{
+    Initialize(inSRS, outSRS);
+}
+
+void ReprojectionTransform::Initialize(const SpatialReference& inSRS, const SpatialReference& outSRS)
+{
 #ifdef HAVE_GDAL
     
-    if (m_transform)
-    {
-        OCTDestroyCoordinateTransformation(m_transform);
-    }
-    if (m_in_ref)
-    {
-        OSRDestroySpatialReference(m_in_ref);
-    }
-    if (m_out_ref)
-    {
-        OSRDestroySpatialReference(m_out_ref);
-    }
+    m_in_ref_ptr = ReferencePtr(OSRNewSpatialReference(0), OGRSpatialReferenceDeleter());
+    m_out_ref_ptr = ReferencePtr(OSRNewSpatialReference(0), OGRSpatialReferenceDeleter());
     
-    m_in_ref = OSRNewSpatialReference(0);
-    m_out_ref = OSRNewSpatialReference(0);
-    
-    int result = OSRSetFromUserInput(m_in_ref, inSRS.GetWKT(liblas::SpatialReference::eCompoundOK).c_str());
+    int result = OSRSetFromUserInput(m_in_ref_ptr.get(), inSRS.GetWKT(liblas::SpatialReference::eCompoundOK).c_str());
     if (result != OGRERR_NONE) 
     {
         std::ostringstream msg; 
@@ -83,7 +88,7 @@ ReprojectionTransform::ReprojectionTransform(const SpatialReference& inSRS, cons
         throw std::runtime_error(msg.str());
     }
     
-    result = OSRSetFromUserInput(m_out_ref, outSRS.GetWKT(liblas::SpatialReference::eCompoundOK).c_str());
+    result = OSRSetFromUserInput(m_out_ref_ptr.get(), outSRS.GetWKT(liblas::SpatialReference::eCompoundOK).c_str());
     if (result != OGRERR_NONE) 
     {
         std::ostringstream msg; 
@@ -93,8 +98,7 @@ ReprojectionTransform::ReprojectionTransform(const SpatialReference& inSRS, cons
         std::string message(msg.str());
         throw std::runtime_error(message);
     }
-
-    m_transform = OCTNewCoordinateTransformation( m_in_ref, m_out_ref);
+    m_transform_ptr = TransformPtr(OCTNewCoordinateTransformation( m_in_ref_ptr.get(), m_out_ref_ptr.get()), OSRTransformDeleter());
 #else
 
     boost::ignore_unused_variable_warning(inSRS);
@@ -104,21 +108,7 @@ ReprojectionTransform::ReprojectionTransform(const SpatialReference& inSRS, cons
 
 ReprojectionTransform::~ReprojectionTransform()
 {
-#ifdef HAVE_GDAL
-    if (m_transform)
-    {
-        OCTDestroyCoordinateTransformation(m_transform);
-    }
-    if (m_in_ref)
-    {
-        OSRDestroySpatialReference(m_in_ref);
-    }
-    if (m_out_ref)
-    {
-        OSRDestroySpatialReference(m_out_ref);
-    }
 
-#endif
 }
 
 
@@ -130,8 +120,8 @@ bool ReprojectionTransform::transform(Point& point)
     double x = point.GetX();
     double y = point.GetY();
     double z = point.GetZ();
-    
-    ret = OCTTransform(m_transform, 1, &x, &y, &z);    
+
+    ret = OCTTransform(m_transform_ptr.get(), 1, &x, &y, &z);    
     if (!ret)
     {
         std::ostringstream msg; 
@@ -139,14 +129,256 @@ bool ReprojectionTransform::transform(Point& point)
         throw std::runtime_error(msg.str());
     }
 
+    if (m_new_header.get()) 
+    {
+        point.SetHeaderPtr(m_new_header);
+    }
+
     point.SetX(x);
     point.SetY(y);
     point.SetZ(z);
     
+    if (detail::compare_distance(point.GetRawX(), std::numeric_limits<boost::int32_t>::max()) ||
+        detail::compare_distance(point.GetRawX(), std::numeric_limits<boost::int32_t>::min())) {
+        throw std::domain_error("X scale and offset combination is insufficient to represent the data");
+    }
+
+    if (detail::compare_distance(point.GetRawY(), std::numeric_limits<boost::int32_t>::max()) ||
+        detail::compare_distance(point.GetRawY(), std::numeric_limits<boost::int32_t>::min())) {
+        throw std::domain_error("Y scale and offset combination is insufficient to represent the data");
+    }    
+
+    if (detail::compare_distance(point.GetRawZ(), std::numeric_limits<boost::int32_t>::max()) ||
+        detail::compare_distance(point.GetRawZ(), std::numeric_limits<boost::int32_t>::min())) {
+        throw std::domain_error("Z scale and offset combination is insufficient to represent the data");
+    }        
+
     return true;
 #else
     boost::ignore_unused_variable_warning(point);
     return true;
 #endif
 }
+
+
+
+TranslationTransform::TranslationTransform(std::string const& expression)
+{
+    if (expression.size() == 0) 
+        throw std::runtime_error("no expression was given to TranslationTransform");
+    
+    boost::char_separator<char> sep_space(" ");
+
+    tokenizer dimensions(expression, sep_space);
+    for (tokenizer::iterator t = dimensions.begin(); t != dimensions.end(); ++t) {
+        std::string const& s = *t;
+        
+        operation op = GetOperation(s);
+        operations.push_back(op);
+    }
+    
+}
+
+TranslationTransform::operation TranslationTransform::GetOperation(std::string const& expr)
+{
+
+    std::string x("x");
+    std::string y("y");
+    std::string z("z");
+    std::string star("*");
+    std::string divide("/");
+    std::string plus("+");
+    std::string minus("-");
+
+    if (expr.find(x) == std::string::npos &&
+        expr.find(y) == std::string::npos &&
+        expr.find(z) == std::string::npos)
+        throw std::runtime_error("expression is invalid -- use x, y, or z to define a dimension.  No 'x', 'y', or 'z' was found");
+
+    operation output("X");
+    
+    
+    std::string expression(expr);
+    boost::erase_all(expression, " "); // Get rid of any spaces in the expression chunk
+
+
+    std::size_t found_x = expression.find(x);
+    std::size_t found_y = expression.find(y);
+    std::size_t found_z = expression.find(z);
+    std::size_t found_star = expression.find(star);
+    std::size_t found_divide = expression.find(divide);
+    std::size_t found_plus = expression.find(plus);
+    std::size_t found_minus = expression.find(minus);
+    
+    // if they gave something like 'xyz*34' it's invalid
+    if (found_x != std::string::npos &&
+        found_y != std::string::npos &&
+        found_z != std::string::npos)
+        throw std::runtime_error("expression is invalid");
+    
+    std::string::size_type op_pos=std::string::npos;
+    if (found_x != std::string::npos)
+    {
+        output = operation("X");
+        op_pos = expression.find_last_of(x) + 1;
+    }
+
+    if (found_y != std::string::npos)
+    {
+        output = operation("Y");
+        op_pos = expression.find_last_of(y) + 1;
+    }
+
+    if (found_z != std::string::npos)
+    {
+        output = operation("Z");
+        op_pos = expression.find_last_of(z) + 1;
+    }
+    
+    if (op_pos == std::string::npos) 
+    {
+        std::ostringstream oss;
+        oss << "Expression '" << expression << "' does not have 'x', 'y', or 'z' to denote fields";
+        throw std::runtime_error(oss.str());
+    }
+    
+    std::string::size_type data_pos = std::string::npos;
+    if (found_star != std::string::npos) 
+    {
+        output.oper = eOPER_MULTIPLY;
+        data_pos = expression.find_last_of(star) + 1;
+    }
+
+    if (found_divide != std::string::npos) 
+    {
+        output.oper = eOPER_DIVIDE;
+        data_pos = expression.find_last_of(divide) + 1;
+    }
+
+    if (found_plus != std::string::npos) 
+    {
+        output.oper = eOPER_ADD;
+        data_pos = expression.find_last_of(plus) + 1;
+    }
+    if (found_minus != std::string::npos) 
+    {
+        output.oper = eOPER_SUBTRACT;
+        data_pos = expression.find_last_of(minus) + 1;
+    }
+
+    if (data_pos == std::string::npos) 
+    {
+        std::ostringstream oss;
+        oss << "Expression '" << expression << "' does not have '*', '/', '+', or '-' to denote operations";
+        throw std::runtime_error(oss.str());
+    }
+    
+    std::string out;
+    out = expression.substr(data_pos, expression.size());
+    
+    double value =  boost::lexical_cast<double>(out);    
+    output.expression = expression;
+    output.value = value;
+    
+    return output;
+            
+}
+bool TranslationTransform::transform(Point& point)
+{
+    for(std::vector<TranslationTransform::operation>::const_iterator op = operations.begin();
+        op != operations.end();
+        op++) 
+    {
+
+        switch (op->oper) 
+            {
+                case eOPER_MULTIPLY:
+                    if (!op->dimension.compare("X")) 
+                    {
+                        point.SetX(point.GetX() * op->value);
+                    }
+                    if (!op->dimension.compare("Y")) 
+                    {
+                        point.SetY(point.GetY() * op->value);
+                    }
+                    if (!op->dimension.compare("Z")) 
+                    {
+                        point.SetZ(point.GetZ() * op->value);
+                    }
+                    break;
+                case eOPER_DIVIDE:
+                    if (!op->dimension.compare("X")) 
+                    {
+                        point.SetX(point.GetX() / op->value);
+                    }
+                    if (!op->dimension.compare("Y")) 
+                    {
+                        point.SetY(point.GetY() / op->value);
+                    }
+                    if (!op->dimension.compare("Z")) 
+                    {
+                        point.SetZ(point.GetZ() / op->value);
+                    }
+                    break;
+                case eOPER_ADD:
+                    if (!op->dimension.compare("X")) 
+                    {
+                        point.SetX(point.GetX() + op->value);
+                    }
+                    if (!op->dimension.compare("Y")) 
+                    {
+                        point.SetY(point.GetY() + op->value);
+                    }
+                    if (!op->dimension.compare("Z")) 
+                    {
+                        point.SetZ(point.GetZ() + op->value);
+                    }
+
+                    break;
+                case eOPER_SUBTRACT:
+                    if (!op->dimension.compare("X")) 
+                    {
+                        point.SetX(point.GetX() - op->value);
+                    }
+                    if (!op->dimension.compare("Y")) 
+                    {
+                        point.SetY(point.GetY() - op->value);
+                    }
+                    if (!op->dimension.compare("Z")) 
+                    {
+                        point.SetZ(point.GetZ() - op->value);
+                    }
+                    break;
+
+                default:
+                    std::ostringstream oss;
+                    oss << "Unhandled expression operation id " << static_cast<boost::int32_t>(op->oper);
+                    throw std::runtime_error(oss.str());
+            }
+
+    if (detail::compare_distance(point.GetRawX(), std::numeric_limits<boost::int32_t>::max()) ||
+        detail::compare_distance(point.GetRawX(), std::numeric_limits<boost::int32_t>::min())) {
+        throw std::domain_error("X scale and offset combination of this file is insufficient to represent the data given the expression ");
+    }
+
+    if (detail::compare_distance(point.GetRawY(), std::numeric_limits<boost::int32_t>::max()) ||
+        detail::compare_distance(point.GetRawY(), std::numeric_limits<boost::int32_t>::min())) {
+        throw std::domain_error("Y scale and offset combination of this file is insufficient to represent the data given the expression");
+    }    
+
+    if (detail::compare_distance(point.GetRawZ(), std::numeric_limits<boost::int32_t>::max()) ||
+        detail::compare_distance(point.GetRawZ(), std::numeric_limits<boost::int32_t>::min())) {
+        throw std::domain_error("Z scale and offset combination of this file is insufficient to represent the data given the expression");
+    }   
+
+    }
+    return true;
+}
+
+
+TranslationTransform::~TranslationTransform()
+{
+}
+
+
 } // namespace liblas
diff --git a/Utilities/otbliblas/src/lasvariablerecord.cpp b/Utilities/otbliblas/src/lasvariablerecord.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/src/laswriter.cpp b/Utilities/otbliblas/src/laswriter.cpp
old mode 100755
new mode 100644
index a8a3ca8e4ee99cff48c73333c7af20c7ffefb04f..f10020a6b1b2390588cbd9358a6c125e8dd2c517
--- a/Utilities/otbliblas/src/laswriter.cpp
+++ b/Utilities/otbliblas/src/laswriter.cpp
@@ -86,26 +86,15 @@ bool Writer::WritePoint(Point const& point)
         return false;
     }
 
-    std::vector<liblas::FilterI*>::const_iterator fi;
-    std::vector<liblas::TransformI*>::const_iterator ti;
-    bool bHaveTransforms = false;
-    bool bHaveFilters = false;
-    
-    if (m_transforms != 0 ) {
-        bHaveTransforms = true;
-    }
-    
-    if (m_filters != 0 ) {
-        bHaveFilters = true;
-    }
-    
+    bool bHaveTransforms = (m_transforms != 0);
+    bool bHaveFilters = (m_filters != 0);
 
     if (bHaveFilters) {
     if (m_filters->size() != 0) {
         // We have filters, filter this point.  All filters must 
         // return true for us to keep it.
         bool keep = false;
-        for (fi = m_filters->begin(); fi != m_filters->end(); ++fi) {
+        for (std::vector<liblas::FilterI*>::const_iterator fi = m_filters->begin(); fi != m_filters->end(); ++fi) {
             liblas::FilterI* filter = *fi;
             if (filter->filter(point)){
                 // if ->filter() is true, we keep the point
@@ -127,7 +116,8 @@ bool Writer::WritePoint(Point const& point)
     
         // Apply the transforms to each point
         Point p(point);
-        for (ti = m_transforms->begin(); ti != m_transforms->end(); ++ti) {
+        for (std::vector<liblas::TransformI*>::const_iterator ti = m_transforms->begin();
+             ti != m_transforms->end(); ++ti) {
             liblas::TransformI* transform = *ti;
             transform->transform(p);
 
@@ -137,7 +127,6 @@ bool Writer::WritePoint(Point const& point)
         // transformations that change the point.
         m_pimpl->WritePoint(p, m_header);
         return true;
-        
     }
     }
 
@@ -198,7 +187,7 @@ bool Writer::SetOutputSRS(const SpatialReference& srs)
     }
     
     // overwrite our reprojection transform
-    m_reprojection_transform = TransformPtr(new ReprojectionTransform(m_in_srs, m_out_srs));
+    m_reprojection_transform = TransformPtr(new ReprojectionTransform(m_in_srs, m_out_srs, m_header));
     
     if (m_transforms != 0) {
         if (m_transforms->size() > 0) {
diff --git a/Utilities/otbliblas/src/utility.cpp b/Utilities/otbliblas/src/utility.cpp
index 87d174bcf74fdd3dbda5b43931ed58a47fdc17b1..ae615a146a2ca72de38b6ddd98c74c7ff657155f 100755
--- a/Utilities/otbliblas/src/utility.cpp
+++ b/Utilities/otbliblas/src/utility.cpp
@@ -112,8 +112,25 @@ void Summary::AddPoint(liblas::Point const& p)
             // point copy here would set the header ptr of min/max
             // to be whatever might have come off of the file, 
             // and this may/may not have space for time/color
-            min.SetHeaderPtr(HeaderPtr());
-            max.SetHeaderPtr(HeaderPtr());
+            
+            // If we do have scale/offset values, we do want to keep those, 
+            // however.  
+            liblas::HeaderPtr hdr = p.GetHeaderPtr();
+            if (hdr.get()) 
+            {
+                // Keep scale/offset values around because we need these 
+                liblas::Header header;
+                header.SetScale(hdr->GetScaleX(), hdr->GetScaleY(), hdr->GetScaleZ());
+                header.SetOffset(hdr->GetOffsetX(), hdr->GetOffsetY(), hdr->GetOffsetZ());
+                liblas::HeaderPtr h(new liblas::Header(header));
+                min.SetHeaderPtr(h);
+                max.SetHeaderPtr(h);
+            } else 
+            {
+                min.SetHeaderPtr(HeaderPtr());
+                max.SetHeaderPtr(HeaderPtr()); 
+            }
+
             first = false;
         }
         
@@ -273,6 +290,11 @@ std::ostream& operator<<(std::ostream& os, liblas::Summary const& s)
     os << "  Point Inspection Summary" << std::endl;
     os << "---------------------------------------------------------" << std::endl;
 
+    if (tree.get<boost::uint32_t>("summary.points.count") == 0 )
+    {
+        os << "  File has no points ...";
+        return os;
+    }
     os << "  Header Point Count: " << tree.get<std::string>("summary.header.count") << std::endl;
     os << "  Actual Point Count: " << tree.get<std::string>("summary.points.count") << std::endl;
     
@@ -289,7 +311,7 @@ std::ostream& operator<<(std::ostream& os, liblas::Summary const& s)
         double integer = 0;
         double x_scale = tree.get<double>("summary.header.scale.x");
         double y_scale = tree.get<double>("summary.header.scale.y");
-        double z_scale = tree.get<double>("summary.header.scale.x");
+        double z_scale = tree.get<double>("summary.header.scale.z");
         frac = std::modf(x_scale, &integer);
         x_precision = static_cast<boost::uint32_t>(std::fabs(std::floor(std::log10(frac))));
         frac = std::modf(y_scale, &integer);
@@ -310,7 +332,7 @@ std::ostream& operator<<(std::ostream& os, liblas::Summary const& s)
     os.precision(y_precision);
     os << tree.get<double>("summary.points.minimum.y") << ", ";
     os.precision(z_precision);
-    os << tree.get<double>("summary.points.minimum.z") << ", ";
+    os << tree.get<double>("summary.points.minimum.z");
 
     os << std::endl;
     os << "  Max X, Y, Z: \t\t";
@@ -320,14 +342,19 @@ std::ostream& operator<<(std::ostream& os, liblas::Summary const& s)
     os.precision(y_precision);
     os << tree.get<double>("summary.points.maximum.y") << ", ";
     os.precision(z_precision);
-    os << tree.get<double>("summary.points.maximum.z") << ", ";
+    os << tree.get<double>("summary.points.maximum.z");
     
     os << std::endl;
     os << "  Bounding Box:\t\t";
-    os << tree.get<double>("summary.points.minimum.x") << ", "
-       << tree.get<double>("summary.points.minimum.y") << ", "
-       << tree.get<double>("summary.points.maximum.x") << ", "
-       << tree.get<double>("summary.points.maximum.y");
+
+    os.precision(x_precision);
+    os << tree.get<double>("summary.points.minimum.x") << ", ";
+    os.precision(y_precision);
+    os << tree.get<double>("summary.points.minimum.y") << ", ";
+    os.precision(x_precision);
+    os << tree.get<double>("summary.points.maximum.x") << ", ";
+    os.precision(y_precision);
+    os << tree.get<double>("summary.points.maximum.y");
     
     os << std::endl;
     os.precision(6);
diff --git a/Utilities/otbliblas/test/CMakeLists.txt b/Utilities/otbliblas/test/CMakeLists.txt
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/CTestTestfile.cmake b/Utilities/otbliblas/test/CTestTestfile.cmake
old mode 100755
new mode 100644
index c96523249d62388e584f4d16b074bce51819c505..d57a1ed9ad48d1dcb9e2178cab5c4b2216c4f0bb
--- a/Utilities/otbliblas/test/CTestTestfile.cmake
+++ b/Utilities/otbliblas/test/CTestTestfile.cmake
@@ -1,6 +1,6 @@
 # CMake generated Testfile for 
-# Source directory: /tmp/liblas-main/test
-# Build directory: /tmp/liblas-main/test
+# Source directory: /tmp/liblas/test
+# Build directory: /tmp/liblas/test
 # 
 # This file includes the relevent testing commands required for 
 # testing this directory and lists subdirectories to be tested as well.
diff --git a/Utilities/otbliblas/test/Makefile b/Utilities/otbliblas/test/Makefile
index 78d8e5d8acb5c8c2c1f482e1580d6786fa7e01f9..190782785395e9f278a78cc37001194d240a8686 100755
--- a/Utilities/otbliblas/test/Makefile
+++ b/Utilities/otbliblas/test/Makefile
@@ -39,10 +39,10 @@ RM = "/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E remove -f
 CMAKE_EDIT_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/ccmake"
 
 # The top-level source directory on which CMake was run.
-CMAKE_SOURCE_DIR = /tmp/liblas-main
+CMAKE_SOURCE_DIR = /tmp/liblas
 
 # The top-level build directory on which CMake was run.
-CMAKE_BINARY_DIR = /tmp/liblas-main
+CMAKE_BINARY_DIR = /tmp/liblas
 
 #=============================================================================
 # Targets provided globally by CMake.
@@ -101,7 +101,7 @@ list_install_components/fast: list_install_components
 # Special rule for the target package
 package: preinstall
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..."
-	cd /tmp/liblas-main && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackConfig.cmake
+	cd /tmp/liblas && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackConfig.cmake
 .PHONY : package
 
 # Special rule for the target package
@@ -111,7 +111,7 @@ package/fast: package
 # Special rule for the target package_source
 package_source:
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..."
-	cd /tmp/liblas-main && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackSourceConfig.cmake /tmp/liblas-main/CPackSourceConfig.cmake
+	cd /tmp/liblas && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackSourceConfig.cmake /tmp/liblas/CPackSourceConfig.cmake
 .PHONY : package_source
 
 # Special rule for the target package_source
@@ -140,14 +140,14 @@ test/fast: test
 
 # The main all target
 all: cmake_check_build_system
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas-main/CMakeFiles /tmp/liblas-main/test/CMakeFiles/progress.marks
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 test/all
-	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas-main/CMakeFiles 0
+	cd /tmp/liblas && $(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas/CMakeFiles /tmp/liblas/test/CMakeFiles/progress.marks
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 test/all
+	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas/CMakeFiles 0
 .PHONY : all
 
 # The main clean target
 clean:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 test/clean
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 test/clean
 .PHONY : clean
 
 # The main clean target
@@ -156,17 +156,17 @@ clean/fast: clean
 
 # Prepare targets for installation.
 preinstall: all
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 test/preinstall
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 test/preinstall
 .PHONY : preinstall
 
 # Prepare targets for installation.
 preinstall/fast:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 test/preinstall
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 test/preinstall
 .PHONY : preinstall/fast
 
 # clear depends
 depend:
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+	cd /tmp/liblas && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
 .PHONY : depend
 
 # Help Target
@@ -195,6 +195,6 @@ help:
 # No rule that depends on this can have commands that come from listfiles
 # because they might be regenerated.
 cmake_check_build_system:
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+	cd /tmp/liblas && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
 .PHONY : cmake_check_build_system
 
diff --git a/Utilities/otbliblas/test/cmake_install.cmake b/Utilities/otbliblas/test/cmake_install.cmake
old mode 100755
new mode 100644
index 5cdc5e00e0962a7bd52f39f59511030615feeef9..2afb4e3e160cb50bd29b8e7a011d979a524ad273
--- a/Utilities/otbliblas/test/cmake_install.cmake
+++ b/Utilities/otbliblas/test/cmake_install.cmake
@@ -1,4 +1,4 @@
-# Install script for directory: /tmp/liblas-main/test
+# Install script for directory: /tmp/liblas/test
 
 # Set the install prefix
 IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
@@ -29,7 +29,7 @@ ENDIF(NOT CMAKE_INSTALL_COMPONENT)
 
 IF(NOT CMAKE_INSTALL_LOCAL_ONLY)
   # Include the install script for each subdirectory.
-  INCLUDE("/tmp/liblas-main/test/unit/cmake_install.cmake")
+  INCLUDE("/tmp/liblas/test/unit/cmake_install.cmake")
 
 ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)
 
diff --git a/Utilities/otbliblas/test/data/1.2-with-color.las b/Utilities/otbliblas/test/data/1.2-with-color.las
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/data/TO_core_last_clip.las b/Utilities/otbliblas/test/data/TO_core_last_clip.las
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/data/bad_points_1.1.las b/Utilities/otbliblas/test/data/bad_points_1.1.las
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/data/lots_of_vlr.las b/Utilities/otbliblas/test/data/lots_of_vlr.las
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/data/make_bad_points.py b/Utilities/otbliblas/test/data/make_bad_points.py
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/data/make_data.py b/Utilities/otbliblas/test/data/make_data.py
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/data/srs_utm17.las b/Utilities/otbliblas/test/data/srs_utm17.las
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/data/srs_vertcs.las b/Utilities/otbliblas/test/data/srs_vertcs.las
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/sample/CMakeLists.txt b/Utilities/otbliblas/test/sample/CMakeLists.txt
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/sample/files.vcproj b/Utilities/otbliblas/test/sample/files.vcproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/sample/liblas.vsprops b/Utilities/otbliblas/test/sample/liblas.vsprops
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/sample/liblas_sample.sln b/Utilities/otbliblas/test/sample/liblas_sample.sln
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/sample/read.vcproj b/Utilities/otbliblas/test/sample/read.vcproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/sample/update.vcproj b/Utilities/otbliblas/test/sample/update.vcproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/sample/write.vcproj b/Utilities/otbliblas/test/sample/write.vcproj
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/CMakeFiles/CMakeDirectoryInformation.cmake b/Utilities/otbliblas/test/unit/CMakeFiles/CMakeDirectoryInformation.cmake
old mode 100755
new mode 100644
index 9342b6fb33ab28396908a3b1bd00a86a135c7423..8a1404cf73f52be8a89bcad99f9dd6527a71be8d
--- a/Utilities/otbliblas/test/unit/CMakeFiles/CMakeDirectoryInformation.cmake
+++ b/Utilities/otbliblas/test/unit/CMakeFiles/CMakeDirectoryInformation.cmake
@@ -2,8 +2,8 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 2.8
 
 # Relative path conversion top directories.
-SET(CMAKE_RELATIVE_PATH_TOP_SOURCE "/tmp/liblas-main")
-SET(CMAKE_RELATIVE_PATH_TOP_BINARY "/tmp/liblas-main")
+SET(CMAKE_RELATIVE_PATH_TOP_SOURCE "/tmp/liblas")
+SET(CMAKE_RELATIVE_PATH_TOP_BINARY "/tmp/liblas")
 
 # Force unix paths in dependencies.
 SET(CMAKE_FORCE_UNIX_PATHS 1)
diff --git a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/DependInfo.cmake b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/DependInfo.cmake
old mode 100755
new mode 100644
index 4fb85fe355f1e2fa7900eaa417d99083c4f8975f..0cb688b58de03beb72ad865d1050190471e860ea
--- a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/DependInfo.cmake
+++ b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/DependInfo.cmake
@@ -4,22 +4,27 @@ SET(CMAKE_DEPENDS_LANGUAGES
   )
 # The set of files for implicit dependencies of each language:
 SET(CMAKE_DEPENDS_CHECK_CXX
-  "/tmp/liblas-main/test/unit/common.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/common.cpp.o"
-  "/tmp/liblas-main/test/unit/guid_test.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.o"
-  "/tmp/liblas-main/test/unit/lasbounds_test.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o"
-  "/tmp/liblas-main/test/unit/laserror_test.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.o"
-  "/tmp/liblas-main/test/unit/lasheader_test.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.o"
-  "/tmp/liblas-main/test/unit/laspoint_test.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.o"
-  "/tmp/liblas-main/test/unit/lasreader_iterator_test.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o"
-  "/tmp/liblas-main/test/unit/lasreader_test.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.o"
-  "/tmp/liblas-main/test/unit/lasspatialreference_test.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o"
-  "/tmp/liblas-main/test/unit/lasvariablerecord_test.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o"
-  "/tmp/liblas-main/test/unit/laswriter_test.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o"
-  "/tmp/liblas-main/test/unit/liblas_test_suite.cpp" "/tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o"
+  "/tmp/liblas/test/unit/common.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/common.cpp.o"
+  "/tmp/liblas/test/unit/guid_test.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.o"
+  "/tmp/liblas/test/unit/lasbounds_test.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o"
+  "/tmp/liblas/test/unit/laserror_test.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.o"
+  "/tmp/liblas/test/unit/lasheader_test.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.o"
+  "/tmp/liblas/test/unit/laspoint_test.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.o"
+  "/tmp/liblas/test/unit/lasreader_iterator_test.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o"
+  "/tmp/liblas/test/unit/lasreader_test.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.o"
+  "/tmp/liblas/test/unit/lasspatialreference_test.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o"
+  "/tmp/liblas/test/unit/lasvariablerecord_test.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o"
+  "/tmp/liblas/test/unit/laswriter_test.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o"
+  "/tmp/liblas/test/unit/liblas_test_suite.cpp" "/tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o"
   )
 SET(CMAKE_CXX_COMPILER_ID "GNU")
 
+# Preprocessor definitions for this target.
+SET(CMAKE_TARGET_DEFINITIONS
+  "LAS_DLL_IMPORT"
+  )
+
 # Targets to which this target links.
 SET(CMAKE_TARGET_LINKED_INFO_FILES
-  "/tmp/liblas-main/src/CMakeFiles/las.dir/DependInfo.cmake"
+  "/tmp/liblas/src/CMakeFiles/las.dir/DependInfo.cmake"
   )
diff --git a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/build.make b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/build.make
old mode 100755
new mode 100644
index d71bdf6ef2953ab55ffd6d3be33e9c4a1e4ed1fa..14d83a09238b5f73c578b7cce5597677ef7d5e04
--- a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/build.make
+++ b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/build.make
@@ -35,10 +35,10 @@ RM = "/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E remove -f
 CMAKE_EDIT_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/ccmake"
 
 # The top-level source directory on which CMake was run.
-CMAKE_SOURCE_DIR = /tmp/liblas-main
+CMAKE_SOURCE_DIR = /tmp/liblas
 
 # The top-level build directory on which CMake was run.
-CMAKE_BINARY_DIR = /tmp/liblas-main
+CMAKE_BINARY_DIR = /tmp/liblas
 
 # Include any dependencies generated for this target.
 include test/unit/CMakeFiles/liblas_test.dir/depend.make
@@ -51,17 +51,17 @@ include test/unit/CMakeFiles/liblas_test.dir/flags.make
 
 test/unit/CMakeFiles/liblas_test.dir/common.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/common.cpp.o: test/unit/common.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_1)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_1)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/common.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/common.cpp.o -c /tmp/liblas-main/test/unit/common.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/common.cpp.o -c /tmp/liblas/test/unit/common.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/common.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/common.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/common.cpp > CMakeFiles/liblas_test.dir/common.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/common.cpp > CMakeFiles/liblas_test.dir/common.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/common.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/common.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/common.cpp -o CMakeFiles/liblas_test.dir/common.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/common.cpp -o CMakeFiles/liblas_test.dir/common.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/common.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/common.cpp.o.requires
@@ -75,17 +75,17 @@ test/unit/CMakeFiles/liblas_test.dir/common.cpp.o.provides.build: test/unit/CMak
 
 test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.o: test/unit/guid_test.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_2)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_2)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/guid_test.cpp.o -c /tmp/liblas-main/test/unit/guid_test.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/guid_test.cpp.o -c /tmp/liblas/test/unit/guid_test.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/guid_test.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/guid_test.cpp > CMakeFiles/liblas_test.dir/guid_test.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/guid_test.cpp > CMakeFiles/liblas_test.dir/guid_test.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/guid_test.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/guid_test.cpp -o CMakeFiles/liblas_test.dir/guid_test.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/guid_test.cpp -o CMakeFiles/liblas_test.dir/guid_test.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.o.requires
@@ -99,17 +99,17 @@ test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.o.provides.build: test/unit/C
 
 test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o: test/unit/lasbounds_test.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_3)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_3)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o -c /tmp/liblas-main/test/unit/lasbounds_test.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o -c /tmp/liblas/test/unit/lasbounds_test.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/lasbounds_test.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/lasbounds_test.cpp > CMakeFiles/liblas_test.dir/lasbounds_test.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/lasbounds_test.cpp > CMakeFiles/liblas_test.dir/lasbounds_test.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/lasbounds_test.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/lasbounds_test.cpp -o CMakeFiles/liblas_test.dir/lasbounds_test.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/lasbounds_test.cpp -o CMakeFiles/liblas_test.dir/lasbounds_test.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o.requires
@@ -123,17 +123,17 @@ test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o.provides.build: test/u
 
 test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.o: test/unit/laserror_test.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_4)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_4)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/laserror_test.cpp.o -c /tmp/liblas-main/test/unit/laserror_test.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/laserror_test.cpp.o -c /tmp/liblas/test/unit/laserror_test.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/laserror_test.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/laserror_test.cpp > CMakeFiles/liblas_test.dir/laserror_test.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/laserror_test.cpp > CMakeFiles/liblas_test.dir/laserror_test.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/laserror_test.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/laserror_test.cpp -o CMakeFiles/liblas_test.dir/laserror_test.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/laserror_test.cpp -o CMakeFiles/liblas_test.dir/laserror_test.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.o.requires
@@ -147,17 +147,17 @@ test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.o.provides.build: test/un
 
 test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.o: test/unit/lasheader_test.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_5)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_5)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasheader_test.cpp.o -c /tmp/liblas-main/test/unit/lasheader_test.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasheader_test.cpp.o -c /tmp/liblas/test/unit/lasheader_test.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/lasheader_test.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/lasheader_test.cpp > CMakeFiles/liblas_test.dir/lasheader_test.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/lasheader_test.cpp > CMakeFiles/liblas_test.dir/lasheader_test.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/lasheader_test.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/lasheader_test.cpp -o CMakeFiles/liblas_test.dir/lasheader_test.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/lasheader_test.cpp -o CMakeFiles/liblas_test.dir/lasheader_test.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.o.requires
@@ -171,17 +171,17 @@ test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.o.provides.build: test/u
 
 test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.o: test/unit/laspoint_test.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_6)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_6)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/laspoint_test.cpp.o -c /tmp/liblas-main/test/unit/laspoint_test.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/laspoint_test.cpp.o -c /tmp/liblas/test/unit/laspoint_test.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/laspoint_test.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/laspoint_test.cpp > CMakeFiles/liblas_test.dir/laspoint_test.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/laspoint_test.cpp > CMakeFiles/liblas_test.dir/laspoint_test.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/laspoint_test.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/laspoint_test.cpp -o CMakeFiles/liblas_test.dir/laspoint_test.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/laspoint_test.cpp -o CMakeFiles/liblas_test.dir/laspoint_test.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.o.requires
@@ -195,17 +195,17 @@ test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.o.provides.build: test/un
 
 test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o: test/unit/lasreader_iterator_test.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_7)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_7)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o -c /tmp/liblas-main/test/unit/lasreader_iterator_test.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o -c /tmp/liblas/test/unit/lasreader_iterator_test.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/lasreader_iterator_test.cpp > CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/lasreader_iterator_test.cpp > CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/lasreader_iterator_test.cpp -o CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/lasreader_iterator_test.cpp -o CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o.requires
@@ -219,17 +219,17 @@ test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o.provides.buil
 
 test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.o: test/unit/lasreader_test.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_8)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_8)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasreader_test.cpp.o -c /tmp/liblas-main/test/unit/lasreader_test.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasreader_test.cpp.o -c /tmp/liblas/test/unit/lasreader_test.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/lasreader_test.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/lasreader_test.cpp > CMakeFiles/liblas_test.dir/lasreader_test.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/lasreader_test.cpp > CMakeFiles/liblas_test.dir/lasreader_test.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/lasreader_test.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/lasreader_test.cpp -o CMakeFiles/liblas_test.dir/lasreader_test.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/lasreader_test.cpp -o CMakeFiles/liblas_test.dir/lasreader_test.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.o.requires
@@ -243,17 +243,17 @@ test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.o.provides.build: test/u
 
 test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o: test/unit/lasspatialreference_test.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_9)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_9)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o -c /tmp/liblas-main/test/unit/lasspatialreference_test.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o -c /tmp/liblas/test/unit/lasspatialreference_test.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/lasspatialreference_test.cpp > CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/lasspatialreference_test.cpp > CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/lasspatialreference_test.cpp -o CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/lasspatialreference_test.cpp -o CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o.requires
@@ -267,17 +267,17 @@ test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o.provides.bui
 
 test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o: test/unit/lasvariablerecord_test.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_10)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_10)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o -c /tmp/liblas-main/test/unit/lasvariablerecord_test.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o -c /tmp/liblas/test/unit/lasvariablerecord_test.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/lasvariablerecord_test.cpp > CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/lasvariablerecord_test.cpp > CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/lasvariablerecord_test.cpp -o CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/lasvariablerecord_test.cpp -o CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o.requires
@@ -291,17 +291,17 @@ test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o.provides.build
 
 test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o: test/unit/laswriter_test.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_11)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_11)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/laswriter_test.cpp.o -c /tmp/liblas-main/test/unit/laswriter_test.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/laswriter_test.cpp.o -c /tmp/liblas/test/unit/laswriter_test.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/laswriter_test.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/laswriter_test.cpp > CMakeFiles/liblas_test.dir/laswriter_test.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/laswriter_test.cpp > CMakeFiles/liblas_test.dir/laswriter_test.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/laswriter_test.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/laswriter_test.cpp -o CMakeFiles/liblas_test.dir/laswriter_test.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/laswriter_test.cpp -o CMakeFiles/liblas_test.dir/laswriter_test.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o.requires
@@ -315,17 +315,17 @@ test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o.provides.build: test/u
 
 test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o: test/unit/CMakeFiles/liblas_test.dir/flags.make
 test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o: test/unit/liblas_test_suite.cpp
-	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas-main/CMakeFiles $(CMAKE_PROGRESS_12)
+	$(CMAKE_COMMAND) -E cmake_progress_report /tmp/liblas/CMakeFiles $(CMAKE_PROGRESS_12)
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o -c /tmp/liblas-main/test/unit/liblas_test_suite.cpp
+	cd /tmp/liblas/test/unit && /usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o -c /tmp/liblas/test/unit/liblas_test_suite.cpp
 
 test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.i: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.i"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas-main/test/unit/liblas_test_suite.cpp > CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.i
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -E /tmp/liblas/test/unit/liblas_test_suite.cpp > CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.i
 
 test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.s: cmake_force
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.s"
-	cd /tmp/liblas-main/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas-main/test/unit/liblas_test_suite.cpp -o CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.s
+	cd /tmp/liblas/test/unit && /usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -S /tmp/liblas/test/unit/liblas_test_suite.cpp -o CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.s
 
 test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o.requires:
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o.requires
@@ -367,11 +367,12 @@ bin/liblas_test: test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.c
 bin/liblas_test: test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o
 bin/liblas_test: test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o
 bin/liblas_test: test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o
-bin/liblas_test: bin/liblas.a
+bin/liblas_test: bin/liblas.dylib
+bin/liblas_test: /usr/local/lib/libboost_program_options.a
 bin/liblas_test: test/unit/CMakeFiles/liblas_test.dir/build.make
 bin/liblas_test: test/unit/CMakeFiles/liblas_test.dir/link.txt
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking CXX executable ../../bin/liblas_test"
-	cd /tmp/liblas-main/test/unit && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/liblas_test.dir/link.txt --verbose=$(VERBOSE)
+	cd /tmp/liblas/test/unit && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/liblas_test.dir/link.txt --verbose=$(VERBOSE)
 
 # Rule to build all files generated by this target.
 test/unit/CMakeFiles/liblas_test.dir/build: bin/liblas_test
@@ -392,10 +393,10 @@ test/unit/CMakeFiles/liblas_test.dir/requires: test/unit/CMakeFiles/liblas_test.
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/requires
 
 test/unit/CMakeFiles/liblas_test.dir/clean:
-	cd /tmp/liblas-main/test/unit && $(CMAKE_COMMAND) -P CMakeFiles/liblas_test.dir/cmake_clean.cmake
+	cd /tmp/liblas/test/unit && $(CMAKE_COMMAND) -P CMakeFiles/liblas_test.dir/cmake_clean.cmake
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/clean
 
 test/unit/CMakeFiles/liblas_test.dir/depend:
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /tmp/liblas-main /tmp/liblas-main/test/unit /tmp/liblas-main /tmp/liblas-main/test/unit /tmp/liblas-main/test/unit/CMakeFiles/liblas_test.dir/DependInfo.cmake --color=$(COLOR)
+	cd /tmp/liblas && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /tmp/liblas /tmp/liblas/test/unit /tmp/liblas /tmp/liblas/test/unit /tmp/liblas/test/unit/CMakeFiles/liblas_test.dir/DependInfo.cmake --color=$(COLOR)
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/depend
 
diff --git a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/cmake_clean.cmake b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/cmake_clean.cmake
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/depend.make b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/depend.make
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/flags.make b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/flags.make
old mode 100755
new mode 100644
index fa7ca4cb0caf49c575951dc129867583e9f3688c..b7b5de938c96fb33b33f50afc137fb6519b8725a
--- a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/flags.make
+++ b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/flags.make
@@ -2,7 +2,7 @@
 # Generated by "Unix Makefiles" Generator, CMake Version 2.8
 
 # compile CXX with /usr/bin/c++
-CXX_FLAGS =  -mmacosx-version-min=10.6  -fPIC -Wall -Wno-long-long -ansi -std=c++98 -I/tmp/liblas-main/test/unit/. -I/tmp/liblas-main/test/unit/../../include -I/usr/local/include  
+CXX_FLAGS =  -mmacosx-version-min=10.6  -fPIC -pedantic -ansi -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Wredundant-decls -Wno-long-long -std=c++98 -I/tmp/liblas/test/unit/. -I/tmp/liblas/test/unit/../../include -I/usr/local/include  
 
-CXX_DEFINES = 
+CXX_DEFINES = -DLAS_DLL_IMPORT
 
diff --git a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/link.txt b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/link.txt
old mode 100755
new mode 100644
index cf6fb9512c6a09f3f5171822f31ed8d814a3dfdc..f5be7d8e324abd9021b4d883342f879aed8304b2
--- a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/link.txt
+++ b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/link.txt
@@ -1 +1 @@
-/usr/bin/c++    -mmacosx-version-min=10.6  -fPIC -Wall -Wno-long-long -ansi -std=c++98 -Wl,-search_paths_first -headerpad_max_install_names  CMakeFiles/liblas_test.dir/common.cpp.o CMakeFiles/liblas_test.dir/guid_test.cpp.o CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o CMakeFiles/liblas_test.dir/laserror_test.cpp.o CMakeFiles/liblas_test.dir/lasheader_test.cpp.o CMakeFiles/liblas_test.dir/laspoint_test.cpp.o CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o CMakeFiles/liblas_test.dir/lasreader_test.cpp.o CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o CMakeFiles/liblas_test.dir/laswriter_test.cpp.o CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o  -o ../../bin/liblas_test  -L/usr/local/lib ../../bin/liblas.a 
+/usr/bin/c++    -mmacosx-version-min=10.6  -fPIC -pedantic -ansi -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Wredundant-decls -Wno-long-long -std=c++98 -Wl,-search_paths_first -headerpad_max_install_names  CMakeFiles/liblas_test.dir/common.cpp.o CMakeFiles/liblas_test.dir/guid_test.cpp.o CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o CMakeFiles/liblas_test.dir/laserror_test.cpp.o CMakeFiles/liblas_test.dir/lasheader_test.cpp.o CMakeFiles/liblas_test.dir/laspoint_test.cpp.o CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o CMakeFiles/liblas_test.dir/lasreader_test.cpp.o CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o CMakeFiles/liblas_test.dir/laswriter_test.cpp.o CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o  -o ../../bin/liblas_test  -L/usr/local/lib ../../bin/liblas.dylib /usr/local/lib/libboost_program_options.a 
diff --git a/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/progress.make b/Utilities/otbliblas/test/unit/CMakeFiles/liblas_test.dir/progress.make
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/CMakeFiles/progress.marks b/Utilities/otbliblas/test/unit/CMakeFiles/progress.marks
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/CMakeLists.txt b/Utilities/otbliblas/test/unit/CMakeLists.txt
old mode 100755
new mode 100644
index 1c36680a44090a50f03b78b82c168eedf0130a21..2dc84e1f16271bbf35d4d30cc39a176b586995a7
--- a/Utilities/otbliblas/test/unit/CMakeLists.txt
+++ b/Utilities/otbliblas/test/unit/CMakeLists.txt
@@ -27,7 +27,9 @@ INCLUDE_DIRECTORIES(
     ${GDAL_INCLUDE_DIR}
     ${GEOTIFF_INCLUDE_DIR})
 
-ADD_EXECUTABLE(${LIBLAS_UNIT_TEST} ${LIBLAS_UNIT_TEST_SRC})
+ADD_EXECUTABLE(${LIBLAS_UNIT_TEST} ${LIBLAS_UNIT_TEST_SRC} )
+
+set_target_properties(${LIBLAS_UNIT_TEST} PROPERTIES COMPILE_DEFINITIONS LAS_DLL_IMPORT)
 
 TARGET_LINK_LIBRARIES(${LIBLAS_UNIT_TEST} 
     ${LIBLAS_LIB_NAME}
diff --git a/Utilities/otbliblas/test/unit/CTestTestfile.cmake b/Utilities/otbliblas/test/unit/CTestTestfile.cmake
old mode 100755
new mode 100644
index 56a0847be63e4cb5658c13120989f4387c461c22..0dd13def98a6e05e685b0bc5844a8770d1af1cf0
--- a/Utilities/otbliblas/test/unit/CTestTestfile.cmake
+++ b/Utilities/otbliblas/test/unit/CTestTestfile.cmake
@@ -1,7 +1,7 @@
 # CMake generated Testfile for 
-# Source directory: /tmp/liblas-main/test/unit
-# Build directory: /tmp/liblas-main/test/unit
+# Source directory: /tmp/liblas/test/unit
+# Build directory: /tmp/liblas/test/unit
 # 
 # This file includes the relevent testing commands required for 
 # testing this directory and lists subdirectories to be tested as well.
-ADD_TEST(liblas_test "/tmp/liblas-main/bin/liblas_test" "/tmp/liblas-main/test/data")
+ADD_TEST(liblas_test "/tmp/liblas/bin/liblas_test" "/tmp/liblas/test/data")
diff --git a/Utilities/otbliblas/test/unit/Makefile b/Utilities/otbliblas/test/unit/Makefile
index 4d9b11fb2765358d5e8c8597976ba01e65bf7266..98ab4c7d20041cb4060ae027c982d12a370da241 100755
--- a/Utilities/otbliblas/test/unit/Makefile
+++ b/Utilities/otbliblas/test/unit/Makefile
@@ -39,10 +39,10 @@ RM = "/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E remove -f
 CMAKE_EDIT_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/ccmake"
 
 # The top-level source directory on which CMake was run.
-CMAKE_SOURCE_DIR = /tmp/liblas-main
+CMAKE_SOURCE_DIR = /tmp/liblas
 
 # The top-level build directory on which CMake was run.
-CMAKE_BINARY_DIR = /tmp/liblas-main
+CMAKE_BINARY_DIR = /tmp/liblas
 
 #=============================================================================
 # Targets provided globally by CMake.
@@ -101,7 +101,7 @@ list_install_components/fast: list_install_components
 # Special rule for the target package
 package: preinstall
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..."
-	cd /tmp/liblas-main && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackConfig.cmake
+	cd /tmp/liblas && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackConfig.cmake
 .PHONY : package
 
 # Special rule for the target package
@@ -111,7 +111,7 @@ package/fast: package
 # Special rule for the target package_source
 package_source:
 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..."
-	cd /tmp/liblas-main && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackSourceConfig.cmake /tmp/liblas-main/CPackSourceConfig.cmake
+	cd /tmp/liblas && "/Applications/CMake 2.8-0.app/Contents/bin/cpack" --config ./CPackSourceConfig.cmake /tmp/liblas/CPackSourceConfig.cmake
 .PHONY : package_source
 
 # Special rule for the target package_source
@@ -140,14 +140,14 @@ test/fast: test
 
 # The main all target
 all: cmake_check_build_system
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas-main/CMakeFiles /tmp/liblas-main/test/unit/CMakeFiles/progress.marks
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 test/unit/all
-	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas-main/CMakeFiles 0
+	cd /tmp/liblas && $(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas/CMakeFiles /tmp/liblas/test/unit/CMakeFiles/progress.marks
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 test/unit/all
+	$(CMAKE_COMMAND) -E cmake_progress_start /tmp/liblas/CMakeFiles 0
 .PHONY : all
 
 # The main clean target
 clean:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 test/unit/clean
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 test/unit/clean
 .PHONY : clean
 
 # The main clean target
@@ -156,22 +156,22 @@ clean/fast: clean
 
 # Prepare targets for installation.
 preinstall: all
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 test/unit/preinstall
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 test/unit/preinstall
 .PHONY : preinstall
 
 # Prepare targets for installation.
 preinstall/fast:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 test/unit/preinstall
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 test/unit/preinstall
 .PHONY : preinstall/fast
 
 # clear depends
 depend:
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+	cd /tmp/liblas && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
 .PHONY : depend
 
 # Convenience name for target.
 test/unit/CMakeFiles/liblas_test.dir/rule:
-	cd /tmp/liblas-main && $(MAKE) -f CMakeFiles/Makefile2 test/unit/CMakeFiles/liblas_test.dir/rule
+	cd /tmp/liblas && $(MAKE) -f CMakeFiles/Makefile2 test/unit/CMakeFiles/liblas_test.dir/rule
 .PHONY : test/unit/CMakeFiles/liblas_test.dir/rule
 
 # Convenience name for target.
@@ -180,7 +180,7 @@ liblas_test: test/unit/CMakeFiles/liblas_test.dir/rule
 
 # fast build rule for target.
 liblas_test/fast:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/build
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/build
 .PHONY : liblas_test/fast
 
 common.o: common.cpp.o
@@ -188,7 +188,7 @@ common.o: common.cpp.o
 
 # target to build an object file
 common.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/common.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/common.cpp.o
 .PHONY : common.cpp.o
 
 common.i: common.cpp.i
@@ -196,7 +196,7 @@ common.i: common.cpp.i
 
 # target to preprocess a source file
 common.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/common.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/common.cpp.i
 .PHONY : common.cpp.i
 
 common.s: common.cpp.s
@@ -204,7 +204,7 @@ common.s: common.cpp.s
 
 # target to generate assembly for a file
 common.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/common.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/common.cpp.s
 .PHONY : common.cpp.s
 
 guid_test.o: guid_test.cpp.o
@@ -212,7 +212,7 @@ guid_test.o: guid_test.cpp.o
 
 # target to build an object file
 guid_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.o
 .PHONY : guid_test.cpp.o
 
 guid_test.i: guid_test.cpp.i
@@ -220,7 +220,7 @@ guid_test.i: guid_test.cpp.i
 
 # target to preprocess a source file
 guid_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.i
 .PHONY : guid_test.cpp.i
 
 guid_test.s: guid_test.cpp.s
@@ -228,7 +228,7 @@ guid_test.s: guid_test.cpp.s
 
 # target to generate assembly for a file
 guid_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/guid_test.cpp.s
 .PHONY : guid_test.cpp.s
 
 lasbounds_test.o: lasbounds_test.cpp.o
@@ -236,7 +236,7 @@ lasbounds_test.o: lasbounds_test.cpp.o
 
 # target to build an object file
 lasbounds_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.o
 .PHONY : lasbounds_test.cpp.o
 
 lasbounds_test.i: lasbounds_test.cpp.i
@@ -244,7 +244,7 @@ lasbounds_test.i: lasbounds_test.cpp.i
 
 # target to preprocess a source file
 lasbounds_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.i
 .PHONY : lasbounds_test.cpp.i
 
 lasbounds_test.s: lasbounds_test.cpp.s
@@ -252,7 +252,7 @@ lasbounds_test.s: lasbounds_test.cpp.s
 
 # target to generate assembly for a file
 lasbounds_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasbounds_test.cpp.s
 .PHONY : lasbounds_test.cpp.s
 
 laserror_test.o: laserror_test.cpp.o
@@ -260,7 +260,7 @@ laserror_test.o: laserror_test.cpp.o
 
 # target to build an object file
 laserror_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.o
 .PHONY : laserror_test.cpp.o
 
 laserror_test.i: laserror_test.cpp.i
@@ -268,7 +268,7 @@ laserror_test.i: laserror_test.cpp.i
 
 # target to preprocess a source file
 laserror_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.i
 .PHONY : laserror_test.cpp.i
 
 laserror_test.s: laserror_test.cpp.s
@@ -276,7 +276,7 @@ laserror_test.s: laserror_test.cpp.s
 
 # target to generate assembly for a file
 laserror_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laserror_test.cpp.s
 .PHONY : laserror_test.cpp.s
 
 lasheader_test.o: lasheader_test.cpp.o
@@ -284,7 +284,7 @@ lasheader_test.o: lasheader_test.cpp.o
 
 # target to build an object file
 lasheader_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.o
 .PHONY : lasheader_test.cpp.o
 
 lasheader_test.i: lasheader_test.cpp.i
@@ -292,7 +292,7 @@ lasheader_test.i: lasheader_test.cpp.i
 
 # target to preprocess a source file
 lasheader_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.i
 .PHONY : lasheader_test.cpp.i
 
 lasheader_test.s: lasheader_test.cpp.s
@@ -300,7 +300,7 @@ lasheader_test.s: lasheader_test.cpp.s
 
 # target to generate assembly for a file
 lasheader_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasheader_test.cpp.s
 .PHONY : lasheader_test.cpp.s
 
 laspoint_test.o: laspoint_test.cpp.o
@@ -308,7 +308,7 @@ laspoint_test.o: laspoint_test.cpp.o
 
 # target to build an object file
 laspoint_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.o
 .PHONY : laspoint_test.cpp.o
 
 laspoint_test.i: laspoint_test.cpp.i
@@ -316,7 +316,7 @@ laspoint_test.i: laspoint_test.cpp.i
 
 # target to preprocess a source file
 laspoint_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.i
 .PHONY : laspoint_test.cpp.i
 
 laspoint_test.s: laspoint_test.cpp.s
@@ -324,7 +324,7 @@ laspoint_test.s: laspoint_test.cpp.s
 
 # target to generate assembly for a file
 laspoint_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laspoint_test.cpp.s
 .PHONY : laspoint_test.cpp.s
 
 lasreader_iterator_test.o: lasreader_iterator_test.cpp.o
@@ -332,7 +332,7 @@ lasreader_iterator_test.o: lasreader_iterator_test.cpp.o
 
 # target to build an object file
 lasreader_iterator_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.o
 .PHONY : lasreader_iterator_test.cpp.o
 
 lasreader_iterator_test.i: lasreader_iterator_test.cpp.i
@@ -340,7 +340,7 @@ lasreader_iterator_test.i: lasreader_iterator_test.cpp.i
 
 # target to preprocess a source file
 lasreader_iterator_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.i
 .PHONY : lasreader_iterator_test.cpp.i
 
 lasreader_iterator_test.s: lasreader_iterator_test.cpp.s
@@ -348,7 +348,7 @@ lasreader_iterator_test.s: lasreader_iterator_test.cpp.s
 
 # target to generate assembly for a file
 lasreader_iterator_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_iterator_test.cpp.s
 .PHONY : lasreader_iterator_test.cpp.s
 
 lasreader_test.o: lasreader_test.cpp.o
@@ -356,7 +356,7 @@ lasreader_test.o: lasreader_test.cpp.o
 
 # target to build an object file
 lasreader_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.o
 .PHONY : lasreader_test.cpp.o
 
 lasreader_test.i: lasreader_test.cpp.i
@@ -364,7 +364,7 @@ lasreader_test.i: lasreader_test.cpp.i
 
 # target to preprocess a source file
 lasreader_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.i
 .PHONY : lasreader_test.cpp.i
 
 lasreader_test.s: lasreader_test.cpp.s
@@ -372,7 +372,7 @@ lasreader_test.s: lasreader_test.cpp.s
 
 # target to generate assembly for a file
 lasreader_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasreader_test.cpp.s
 .PHONY : lasreader_test.cpp.s
 
 lasspatialreference_test.o: lasspatialreference_test.cpp.o
@@ -380,7 +380,7 @@ lasspatialreference_test.o: lasspatialreference_test.cpp.o
 
 # target to build an object file
 lasspatialreference_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.o
 .PHONY : lasspatialreference_test.cpp.o
 
 lasspatialreference_test.i: lasspatialreference_test.cpp.i
@@ -388,7 +388,7 @@ lasspatialreference_test.i: lasspatialreference_test.cpp.i
 
 # target to preprocess a source file
 lasspatialreference_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.i
 .PHONY : lasspatialreference_test.cpp.i
 
 lasspatialreference_test.s: lasspatialreference_test.cpp.s
@@ -396,7 +396,7 @@ lasspatialreference_test.s: lasspatialreference_test.cpp.s
 
 # target to generate assembly for a file
 lasspatialreference_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasspatialreference_test.cpp.s
 .PHONY : lasspatialreference_test.cpp.s
 
 lasvariablerecord_test.o: lasvariablerecord_test.cpp.o
@@ -404,7 +404,7 @@ lasvariablerecord_test.o: lasvariablerecord_test.cpp.o
 
 # target to build an object file
 lasvariablerecord_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.o
 .PHONY : lasvariablerecord_test.cpp.o
 
 lasvariablerecord_test.i: lasvariablerecord_test.cpp.i
@@ -412,7 +412,7 @@ lasvariablerecord_test.i: lasvariablerecord_test.cpp.i
 
 # target to preprocess a source file
 lasvariablerecord_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.i
 .PHONY : lasvariablerecord_test.cpp.i
 
 lasvariablerecord_test.s: lasvariablerecord_test.cpp.s
@@ -420,7 +420,7 @@ lasvariablerecord_test.s: lasvariablerecord_test.cpp.s
 
 # target to generate assembly for a file
 lasvariablerecord_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/lasvariablerecord_test.cpp.s
 .PHONY : lasvariablerecord_test.cpp.s
 
 laswriter_test.o: laswriter_test.cpp.o
@@ -428,7 +428,7 @@ laswriter_test.o: laswriter_test.cpp.o
 
 # target to build an object file
 laswriter_test.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.o
 .PHONY : laswriter_test.cpp.o
 
 laswriter_test.i: laswriter_test.cpp.i
@@ -436,7 +436,7 @@ laswriter_test.i: laswriter_test.cpp.i
 
 # target to preprocess a source file
 laswriter_test.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.i
 .PHONY : laswriter_test.cpp.i
 
 laswriter_test.s: laswriter_test.cpp.s
@@ -444,7 +444,7 @@ laswriter_test.s: laswriter_test.cpp.s
 
 # target to generate assembly for a file
 laswriter_test.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/laswriter_test.cpp.s
 .PHONY : laswriter_test.cpp.s
 
 liblas_test_suite.o: liblas_test_suite.cpp.o
@@ -452,7 +452,7 @@ liblas_test_suite.o: liblas_test_suite.cpp.o
 
 # target to build an object file
 liblas_test_suite.cpp.o:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.o
 .PHONY : liblas_test_suite.cpp.o
 
 liblas_test_suite.i: liblas_test_suite.cpp.i
@@ -460,7 +460,7 @@ liblas_test_suite.i: liblas_test_suite.cpp.i
 
 # target to preprocess a source file
 liblas_test_suite.cpp.i:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.i
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.i
 .PHONY : liblas_test_suite.cpp.i
 
 liblas_test_suite.s: liblas_test_suite.cpp.s
@@ -468,7 +468,7 @@ liblas_test_suite.s: liblas_test_suite.cpp.s
 
 # target to generate assembly for a file
 liblas_test_suite.cpp.s:
-	cd /tmp/liblas-main && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.s
+	cd /tmp/liblas && $(MAKE) -f test/unit/CMakeFiles/liblas_test.dir/build.make test/unit/CMakeFiles/liblas_test.dir/liblas_test_suite.cpp.s
 .PHONY : liblas_test_suite.cpp.s
 
 # Help Target
@@ -534,6 +534,6 @@ help:
 # No rule that depends on this can have commands that come from listfiles
 # because they might be regenerated.
 cmake_check_build_system:
-	cd /tmp/liblas-main && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+	cd /tmp/liblas && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
 .PHONY : cmake_check_build_system
 
diff --git a/Utilities/otbliblas/test/unit/cmake_install.cmake b/Utilities/otbliblas/test/unit/cmake_install.cmake
old mode 100755
new mode 100644
index aebe9dac9ce53ae131b87dc044d73e6760d059bf..b966e497fa90321080488d0aa03f314dfa350f60
--- a/Utilities/otbliblas/test/unit/cmake_install.cmake
+++ b/Utilities/otbliblas/test/unit/cmake_install.cmake
@@ -1,4 +1,4 @@
-# Install script for directory: /tmp/liblas-main/test/unit
+# Install script for directory: /tmp/liblas/test/unit
 
 # Set the install prefix
 IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
diff --git a/Utilities/otbliblas/test/unit/guid_test.cpp b/Utilities/otbliblas/test/unit/guid_test.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/lasbounds_test.cpp b/Utilities/otbliblas/test/unit/lasbounds_test.cpp
old mode 100755
new mode 100644
index fa30f9468010715212865e7837c63a2f0bb496c9..a15556ca829aa2a6707bc976e4a85c1b2ba82eda
--- a/Utilities/otbliblas/test/unit/lasbounds_test.cpp
+++ b/Utilities/otbliblas/test/unit/lasbounds_test.cpp
@@ -35,20 +35,19 @@ namespace tut
     template<>
     void to::test<1>()
     {
-
-        
         Ranges rngs;
         rngs.push_back(xrng);
         rngs.push_back(yrng);
         rngs.push_back(zrng);
         
-        liblas::Bounds<double> b(rngs);        
-        ensure_equals(b.minx(), 0);
-        ensure_equals(b.maxx(), 100);
-        ensure_equals(b.miny(), 0);
-        ensure_equals(b.maxy(), 200);
-        ensure_equals(b.minz(), 0);
-        ensure_equals(b.maxz(), 300);
+        typedef liblas::Bounds<double> b_t;
+        b_t b(rngs);
+        ensure_equals(b.minx(), b_t::value_type(0));
+        ensure_equals(b.maxx(), b_t::value_type(100));
+        ensure_equals(b.miny(), b_t::value_type(0));
+        ensure_equals(b.maxy(), b_t::value_type(200));
+        ensure_equals(b.minz(), b_t::value_type(0));
+        ensure_equals(b.maxz(), b_t::value_type(300));
     }
 
     template<>
@@ -87,4 +86,4 @@ namespace tut
         liblas::Range<double> r;
         ensure(r.empty());
     }
-}
\ No newline at end of file
+}
diff --git a/Utilities/otbliblas/test/unit/lasclassification_test.cpp b/Utilities/otbliblas/test/unit/lasclassification_test.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/laserror_test.cpp b/Utilities/otbliblas/test/unit/laserror_test.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/lasheader_test.cpp b/Utilities/otbliblas/test/unit/lasheader_test.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/laspoint_test.cpp b/Utilities/otbliblas/test/unit/laspoint_test.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/lasreader_iterator_test.cpp b/Utilities/otbliblas/test/unit/lasreader_iterator_test.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/lasreader_test.cpp b/Utilities/otbliblas/test/unit/lasreader_test.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/lasspatialreference_test.cpp b/Utilities/otbliblas/test/unit/lasspatialreference_test.cpp
old mode 100755
new mode 100644
index f1644d9e80da8c085e499746b4a553974c14f317..97a8df1735e3cb13af9a2b974114c7cfe5301e63
--- a/Utilities/otbliblas/test/unit/lasspatialreference_test.cpp
+++ b/Utilities/otbliblas/test/unit/lasspatialreference_test.cpp
@@ -5,18 +5,25 @@
 // (See accompanying file LICENSE.txt or copy at
 // http://www.opensource.org/licenses/bsd-license.php)
 //
-#include <liblas/lasspatialreference.hpp>
-#include <liblas/guid.hpp>
+#include <liblas/liblas.hpp>
 #include <tut/tut.hpp>
 #include <string>
 #include <stdexcept>
 #include "common.hpp"
+#include "liblas_test.hpp"
 
 namespace tut
 { 
     struct lasspatialreference_data
     {
         liblas::SpatialReference m_default;
+        std::string utm17_filename;
+        std::string utm15_filename;
+
+        lasspatialreference_data()
+            : utm17_filename(g_test_data_path + "//srs.las")
+            , utm15_filename(g_test_data_path + "//1.2_3.las")
+        {}
     };
 
     typedef test_group<lasspatialreference_data> tg;
@@ -24,14 +31,166 @@ namespace tut
 
     tg test_group_lasspatialreference("liblas::SpatialReference");
 
+
     // Test default constructor
     template<>
     template<>
     void to::test<1>()
     {
+        
         ensure_equals(m_default.GetProj4(), "");
         ensure_equals(m_default.GetWKT(), "");
     }
+    
+#ifdef HAVE_GDAL
+
+    // Test fetching SRS from an existing file
+    template<>
+    template<>
+    void to::test<2>()
+    {
+        std::ifstream ifs;
+        ifs.open(utm17_filename.c_str(), std::ios::in | std::ios::binary);
+        liblas::Reader reader(ifs);
+        
+        liblas::Header const& header = reader.GetHeader();
+        liblas::SpatialReference const& ref = header.GetSRS();
+        
+        const char* wkt_c = "PROJCS[\"WGS 84 / UTM zone 17N\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-81],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"32617\"]]";
+        ensure_equals("WKT comparison", wkt_c, ref.GetWKT());
+        
+        const char* proj4_c = "+proj=utm +zone=17 +datum=WGS84 +units=m +no_defs ";
+        ensure_equals("Proj.4 comparison", proj4_c, ref.GetProj4());
+
+    }
+
+    // Test round-tripping proj.4 string
+    template<>
+    template<>
+    void to::test<3>()
+    {
+        liblas::SpatialReference ref;
+        const char* proj4_c = "+proj=utm +zone=15 +datum=WGS84 +units=m +no_defs ";
+        ref.SetProj4(proj4_c);
+        
+        ensure_equals("Proj.4 comparison", proj4_c, ref.GetProj4());
+        
+    }
+
+    // Test setting EPSG:4326 from User string
+    template<>
+    template<>
+    void to::test<4>()
+    {
+        liblas::SpatialReference ref;
+        const char* code = "EPSG:4326";
+        const char* proj4_c = "+proj=longlat +datum=WGS84 +no_defs ";
+        const char* wkt_c = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]";
+        ref.SetFromUserInput(code);
+        
+        ensure_equals("Proj.4 comparison", proj4_c, ref.GetProj4());
+        ensure_equals("WKT comparison", wkt_c, ref.GetWKT());
+        
+    }
+
+    // Test reprojecting UTM 15 to DD with a filter
+    template<>
+    template<>
+    void to::test<5>()
+    {
+        std::ifstream ifs;
+        ifs.open(utm15_filename.c_str(), std::ios::in | std::ios::binary);
+        liblas::Reader reader(ifs);
+        
+        liblas::Header const& header = reader.GetHeader();
+        liblas::SpatialReference const& in_ref = header.GetSRS();
+        
+        const char* utm15_wkt = "PROJCS[\"NAD83 / UTM zone 15N\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.2572221010002,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4269\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-93],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"26915\"]]";
+        ensure_equals("Input WKT comparison", utm15_wkt, in_ref.GetWKT());
+
+        const char* epsg4326_wkt = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]";
+        
+        liblas::SpatialReference out_ref;
+        out_ref.SetWKT(epsg4326_wkt);
+        ensure_equals("Output WKT comparison", epsg4326_wkt, out_ref.GetWKT());
+        
+        liblas::HeaderPtr out_hdr = liblas::HeaderPtr(new liblas::Header(header));
+        out_hdr->SetScale(0.00000001, 0.00000001, 0.01);
+        out_hdr->SetOffset(0,0,0);
+        liblas::TransformPtr srs_transform = liblas::TransformPtr(new liblas::ReprojectionTransform(in_ref, out_ref, out_hdr));
+        
+        std::vector<liblas::TransformPtr> transforms;
+        transforms.push_back(srs_transform);
+        reader.ReadPointAt(0);
+
+        liblas::Point unprojected_point = reader.GetPoint();
+        
+        ensure_distance("unprojected_point.GetX()", 
+                        unprojected_point.GetX(), 
+                        double(470692.44), 
+                        0.01);
+
+        ensure_distance("unprojected_point.GetY()", 
+                        unprojected_point.GetY(), 
+                        double(4602888.90), 
+                        0.01);
+                        
+        reader.SetTransforms(transforms);
+
+        // This should throw an out of range exception because the given scale/offset 
+        // combination is not sufficient to store the data.
+        try
+        {
+            reader.ReadPointAt(0);
+            ensure("std::domain_error was not thrown", false);
+        }
+        catch (std::domain_error const& e)
+        {
+            ensure(e.what(), true);
+        }
+        
+
+        out_hdr->SetScale(0.0000001, 0.0000001, 0.01);
+        out_hdr->SetOffset(0,0,0);
+        srs_transform = liblas::TransformPtr(new liblas::ReprojectionTransform(in_ref, out_ref, out_hdr));
+        
+        transforms.clear();
+        transforms.push_back(srs_transform);
+        reader.SetTransforms(transforms);
+        
+        reader.Reset();
+        reader.ReadPointAt(0);
+
+        
+        liblas::Point const& projected_point = reader.GetPoint();
+
+        ensure_distance("projected_point.GetX()", 
+                        projected_point.GetX(), 
+                        double(-93.35156259), 
+                        0.0000001);
+        ensure_distance("projected_point.GetY()", 
+                        projected_point.GetY(), 
+                        double(41.57714839), 
+                        0.000001);
+        
+    }
+
+    // Test VLR sizes from setting SRS
+    template<>
+    template<>
+    void to::test<6>()
+    {
+        liblas::SpatialReference ref;
+        const char* code = "EPSG:4326";
+        ref.SetFromUserInput(code);
+        
+        std::vector<liblas::VariableRecord> const& vlrs = ref.GetVLRs();
+        ensure_equals("VLR count", boost::uint32_t(3), vlrs.size());
+        ensure_equals("First record size", boost::uint32_t(64), vlrs[0].GetRecordLength());
+        
+    }
+
+#endif
 
 }
 
diff --git a/Utilities/otbliblas/test/unit/lasvariablerecord_test.cpp b/Utilities/otbliblas/test/unit/lasvariablerecord_test.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/laswriter_test.cpp b/Utilities/otbliblas/test/unit/laswriter_test.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/liblas_test.hpp b/Utilities/otbliblas/test/unit/liblas_test.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/liblas_test_suite.cpp b/Utilities/otbliblas/test/unit/liblas_test_suite.cpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/tut/tut_assert.hpp b/Utilities/otbliblas/test/unit/tut/tut_assert.hpp
old mode 100755
new mode 100644
index c1959012ade5a6f78756f78b618ef56015f93ab5..bd08fcb9a1dd00f69a911d24713f575a8eeec5fe
--- a/Utilities/otbliblas/test/unit/tut/tut_assert.hpp
+++ b/Utilities/otbliblas/test/unit/tut/tut_assert.hpp
@@ -135,7 +135,7 @@ void ensure_equals(const M& msg, const double& actual, const double& expected, c
 {
     const double diff = actual - expected;
 
-    if ( (actual != expected) && !((diff <= epsilon) && (diff >= -epsilon )) )
+    if ( !((diff <= epsilon) && (diff >= -epsilon )) )
     {
         std::ostringstream ss;
         detail::msg_prefix(ss,msg)
diff --git a/Utilities/otbliblas/test/unit/tut/tut_config.hpp b/Utilities/otbliblas/test/unit/tut/tut_config.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/tut/tut_console_reporter.hpp b/Utilities/otbliblas/test/unit/tut/tut_console_reporter.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/tut/tut_exception.hpp b/Utilities/otbliblas/test/unit/tut/tut_exception.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/tut/tut_posix.hpp b/Utilities/otbliblas/test/unit/tut/tut_posix.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/tut/tut_reporter.hpp b/Utilities/otbliblas/test/unit/tut/tut_reporter.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/tut/tut_restartable.hpp b/Utilities/otbliblas/test/unit/tut/tut_restartable.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/tut/tut_result.hpp b/Utilities/otbliblas/test/unit/tut/tut_result.hpp
old mode 100755
new mode 100644
diff --git a/Utilities/otbliblas/test/unit/tut/tut_runner.hpp b/Utilities/otbliblas/test/unit/tut/tut_runner.hpp
old mode 100755
new mode 100644