Commit 3ba66e74 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

STYLE: removing trailing spaces (Code)

parent fd444d90
......@@ -10,8 +10,8 @@
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
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.
=========================================================================*/
......@@ -35,7 +35,7 @@ namespace otb
* \ingroup ImageFilters
*/
template <class TInputImage, class TOutputImage>
class ITK_EXPORT BSplineDecompositionImageFilter :
class ITK_EXPORT BSplineDecompositionImageFilter :
public itk::ImageToImageFilter<TInputImage,TOutputImage>
{
public:
......@@ -47,7 +47,7 @@ public:
/** Run-time type information (and related methods). */
itkTypeMacro(BSplineDecompositionImageFilter, ImageToImageFilter);
/** New macro for creation of through a Smart Pointer */
itkNewMacro( Self );
......@@ -115,7 +115,7 @@ private:
/** Copies a vector of data from m_Scratch to the Coefficients image. */
void CopyScratchToCoefficients( OutputLinearIterator & );
};
......
......@@ -10,8 +10,8 @@
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
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.
=========================================================================*/
......@@ -48,7 +48,7 @@ template <class TInputImage, class TOutputImage>
void
BSplineDecompositionImageFilter<TInputImage, TOutputImage>
::PrintSelf(
std::ostream& os,
std::ostream& os,
itk::Indent indent) const
{
Superclass::PrintSelf( os, indent );
......@@ -61,13 +61,13 @@ template <class TInputImage, class TOutputImage>
bool
BSplineDecompositionImageFilter<TInputImage, TOutputImage>
::DataToCoefficients1D()
{
{
// See Unser, 1993, Part II, Equation 2.5,
// or Unser, 1999, Box 2. for an explaination.
// See Unser, 1993, Part II, Equation 2.5,
// or Unser, 1999, Box 2. for an explaination.
double c0 = 1.0;
double c0 = 1.0;
if (m_DataLength[m_IteratorDirection] == 1) //Required by mirror boundaries
{
return false;
......@@ -76,30 +76,30 @@ BSplineDecompositionImageFilter<TInputImage, TOutputImage>
// Compute overall gain
for (int k = 0; k < m_NumberOfPoles; k++)
{
// Note for cubic splines lambda = 6
// Note for cubic splines lambda = 6
c0 = c0 * (1.0 - m_SplinePoles[k]) * (1.0 - 1.0 / m_SplinePoles[k]);
}
// apply the gain
// apply the gain
for (unsigned int n = 0; n < m_DataLength[m_IteratorDirection]; n++)
{
m_Scratch[n] *= c0;
}
// loop over all poles
for (int k = 0; k < m_NumberOfPoles; k++)
// loop over all poles
for (int k = 0; k < m_NumberOfPoles; k++)
{
// causal initialization
// causal initialization
this->SetInitialCausalCoefficient(m_SplinePoles[k]);
// causal recursion
// causal recursion
for (unsigned int n = 1; n < m_DataLength[m_IteratorDirection]; n++)
{
m_Scratch[n] += m_SplinePoles[k] * m_Scratch[n - 1];
}
// anticausal initialization
// anticausal initialization
this->SetInitialAntiCausalCoefficient(m_SplinePoles[k]);
// anticausal recursion
// anticausal recursion
for ( int n = m_DataLength[m_IteratorDirection] - 2; 0 <= n; n--)
{
m_Scratch[n] = m_SplinePoles[k] * (m_Scratch[n + 1] - m_Scratch[n]);
......@@ -132,7 +132,7 @@ BSplineDecompositionImageFilter<TInputImage, TOutputImage>
::SetPoles()
{
/* See Unser, 1997. Part II, Table I for Pole values */
// See also, Handbook of Medical Imaging, Processing and Analysis, Ed. Isaac N. Bankman,
// See also, Handbook of Medical Imaging, Processing and Analysis, Ed. Isaac N. Bankman,
// 2000, pg. 416.
switch (m_SplineOrder)
{
......@@ -195,7 +195,7 @@ BSplineDecompositionImageFilter<TInputImage, TOutputImage>
{
/* accelerated loop */
sum = m_Scratch[0]; // verify this
for (unsigned int n = 1; n < horizon; n++)
for (unsigned int n = 1; n < horizon; n++)
{
sum += zn * m_Scratch[n];
zn *= z;
......@@ -224,11 +224,11 @@ void
BSplineDecompositionImageFilter<TInputImage, TOutputImage>
::SetInitialAntiCausalCoefficient(double z)
{
// this initialization corresponds to mirror boundaries
// this initialization corresponds to mirror boundaries
/* See Unser, 1999, Box 2 for explaination */
// Also see erratum at http://bigwww.epfl.ch/publications/unser9902.html
m_Scratch[m_DataLength[m_IteratorDirection] - 1] =
(z / (z * z - 1.0)) *
(z / (z * z - 1.0)) *
(z * m_Scratch[m_DataLength[m_IteratorDirection] - 2] + m_Scratch[m_DataLength[m_IteratorDirection] - 1]);
}
......@@ -266,7 +266,7 @@ BSplineDecompositionImageFilter<TInputImage, TOutputImage>
// Perform 1D BSpline calculations
this->DataToCoefficients1D();
// Copy scratch back to coefficients.
// Brings us back to the end of the line we were working on.
CIterator.GoToBeginOfLine();
......@@ -303,7 +303,7 @@ BSplineDecompositionImageFilter<TInputImage, TOutputImage>
++inIt;
++outIt;
}
}
......
......@@ -10,8 +10,8 @@
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
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.
=========================================================================*/
......@@ -41,11 +41,11 @@ namespace otb
* \ingroup ImageFunctions
*/
template <
class TImageType,
class TImageType,
class TCoordRep = double,
class TCoefficientType = double >
class ITK_EXPORT BSplineInterpolateImageFunction :
public itk::InterpolateImageFunction<TImageType,TCoordRep>
class ITK_EXPORT BSplineInterpolateImageFunction :
public itk::InterpolateImageFunction<TImageType,TCoordRep>
{
public:
/** Standard class typedefs. */
......@@ -57,7 +57,7 @@ public:
/** Run-time type information (and related methods). */
itkTypeMacro(BSplineInterpolateImageFunction, InterpolateImageFunction);
/** New macro for creation of through a Smart Pointer */
itkNewMacro( Self );
......@@ -87,25 +87,25 @@ typedef typename InputImageType::RegionType RegionType;
/** Internal Coefficient typedef support */
typedef TCoefficientType CoefficientDataType;
typedef itk::Image<CoefficientDataType,
typedef itk::Image<CoefficientDataType,
itkGetStaticConstMacro(ImageDimension)
> CoefficientImageType;
/** Define filter for calculating the BSpline coefficients */
typedef otb::BSplineDecompositionImageFilter<TImageType, CoefficientImageType>
typedef otb::BSplineDecompositionImageFilter<TImageType, CoefficientImageType>
CoefficientFilter;
typedef typename CoefficientFilter::Pointer CoefficientFilterPointer;
/** Evaluate the function at a ContinuousIndex position.
*
* Returns the B-Spline interpolated image intensity at a
* Returns the B-Spline interpolated image intensity at a
* specified point position. No bounds checking is done.
* The point is assume to lie within the image buffer.
*
* ImageFunction::IsInsideBuffer() can be used to check bounds before
* calling the method. */
virtual OutputType EvaluateAtContinuousIndex(
const ContinuousIndexType & index ) const;
virtual OutputType EvaluateAtContinuousIndex(
const ContinuousIndexType & index ) const;
/** Derivative typedef support */
typedef itk::CovariantVector<OutputType,
......@@ -113,13 +113,13 @@ typedef typename InputImageType::RegionType RegionType;
> CovariantVectorType;
CovariantVectorType EvaluateDerivative( const PointType & point ) const
{
{
ContinuousIndexType index;
this->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
return ( this->EvaluateDerivativeAtContinuousIndex( index ) );
}
}
CovariantVectorType EvaluateDerivativeAtContinuousIndex(
CovariantVectorType EvaluateDerivativeAtContinuousIndex(
const ContinuousIndexType & x ) const;
......@@ -133,7 +133,7 @@ typedef typename InputImageType::RegionType RegionType;
virtual void SetInputImage(const TImageType * inputData);
/** Update coefficients filter. Coefficient filter are computed over the buffered
/** Update coefficients filter. Coefficient filter are computed over the buffered
region of the input image. */
virtual void UpdateCoefficientsFilter(void);
......@@ -148,34 +148,34 @@ protected:
typename TImageType::SizeType m_DataLength; // Image size
unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default)
typename CoefficientImageType::ConstPointer m_Coefficients; // Spline coefficients
typename CoefficientImageType::ConstPointer m_Coefficients; // Spline coefficients
private:
BSplineInterpolateImageFunction( const Self& ); //purposely not implemented
/** Determines the weights for interpolation of the value x */
void SetInterpolationWeights( const ContinuousIndexType & x,
const vnl_matrix<long> & EvaluateIndex,
vnl_matrix<double> & weights,
void SetInterpolationWeights( const ContinuousIndexType & x,
const vnl_matrix<long> & EvaluateIndex,
vnl_matrix<double> & weights,
unsigned int splineOrder ) const;
/** Determines the weights for the derivative portion of the value x */
void SetDerivativeWeights( const ContinuousIndexType & x,
const vnl_matrix<long> & EvaluateIndex,
vnl_matrix<double> & weights,
void SetDerivativeWeights( const ContinuousIndexType & x,
const vnl_matrix<long> & EvaluateIndex,
vnl_matrix<double> & weights,
unsigned int splineOrder ) const;
/** Precomputation for converting the 1D index of the interpolation neighborhood
/** Precomputation for converting the 1D index of the interpolation neighborhood
* to an N-dimensional index. */
void GeneratePointsToIndex( );
/** Determines the indicies to use give the splines region of support */
void DetermineRegionOfSupport( vnl_matrix<long> & evaluateIndex,
const ContinuousIndexType & x,
void DetermineRegionOfSupport( vnl_matrix<long> & evaluateIndex,
const ContinuousIndexType & x,
unsigned int splineOrder ) const;
/** Set the indicies in evaluateIndex at the boundaries based on mirror
/** Set the indicies in evaluateIndex at the boundaries based on mirror
* boundary conditions. */
void ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex,
void ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex,
unsigned int splineOrder) const;
......@@ -186,7 +186,7 @@ private:
CoefficientFilterPointer m_CoefficientFilter;
RegionType m_CurrentBufferedRegion;
};
} // namespace otb
......
......@@ -10,8 +10,8 @@
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
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.
=========================================================================*/
......@@ -51,7 +51,7 @@ template <class TImageType, class TCoordRep, class TCoefficientType>
void
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
::PrintSelf(
std::ostream& os,
std::ostream& os,
itk::Indent indent) const
{
Superclass::PrintSelf( os, indent );
......@@ -60,7 +60,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
}
template <class TImageType, class TCoordRep, class TCoefficientType>
void
void
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
::UpdateCoefficientsFilter(void)
{
......@@ -72,7 +72,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
m_CurrentBufferedRegion =m_CoefficientFilter->GetInput()->GetBufferedRegion();
}
template <class TImageType, class TCoordRep, class TCoefficientType>
void
void
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
::SetInputImage(const TImageType * inputData)
{
......@@ -82,7 +82,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
// the Coefficient Filter requires that the spline order and the input data be set.
// TODO: We need to ensure that this is only run once and only after both input and
// spline order have been set. Should we force an update after the
// spline order have been set. Should we force an update after the
// splineOrder has been set also?
UpdateCoefficientsFilter();
......@@ -101,7 +101,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
template <class TImageType, class TCoordRep, class TCoefficientType>
void
void
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
::SetSplineOrder(unsigned int SplineOrder)
{
......@@ -117,13 +117,13 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
for (unsigned int n=0; n < ImageDimension; n++)
{
m_MaxNumberInterpolationPoints *= ( m_SplineOrder + 1);
}
}
this->GeneratePointsToIndex( );
}
template <class TImageType, class TCoordRep, class TCoefficientType>
typename
typename
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
::OutputType
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
......@@ -132,8 +132,8 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
//UpdateCoefficientsFilter();
vnl_matrix<long> EvaluateIndex(ImageDimension, ( m_SplineOrder + 1 ));
// compute the interpolation indexes
this->DetermineRegionOfSupport(EvaluateIndex, x, m_SplineOrder);
// compute the interpolation indexes
this->DetermineRegionOfSupport(EvaluateIndex, x, m_SplineOrder);
// Determine weights
vnl_matrix<double> weights(ImageDimension, ( m_SplineOrder + 1 ));
......@@ -145,8 +145,8 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
// Modify EvaluateIndex at the boundaries using mirror boundary conditions
this->ApplyMirrorBoundaryConditions(EvaluateIndex, m_SplineOrder);
// perform interpolation
// perform interpolation
double interpolated = 0.0;
IndexType coefficientIndex;
// Step through eachpoint in the N-dimensional interpolation cube.
......@@ -167,7 +167,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
// m_Coefficients cube.
interpolated += w * m_Coefficients->GetPixel(coefficientIndex);
}
/* double interpolated = 0.0;
IndexType coefficientIndex;
// Step through eachpoint in the N-dimensional interpolation cube.
......@@ -184,16 +184,16 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
}
interpolated += w * m_Coefficients->GetPixel(coefficientIndex);
}
}
}
*/
return(interpolated);
}
template <class TImageType, class TCoordRep, class TCoefficientType>
typename
typename
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
:: CovariantVectorType
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
......@@ -202,7 +202,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
UpdateCoefficientsFilter();
vnl_matrix<long> EvaluateIndex(ImageDimension, ( m_SplineOrder + 1 ));
// compute the interpolation indexes
// compute the interpolation indexes
// TODO: Do we need to revisit region of support for the derivatives?
this->DetermineRegionOfSupport(EvaluateIndex, x, m_SplineOrder);
......@@ -215,7 +215,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
// Modify EvaluateIndex at the boundaries using mirror boundary conditions
this->ApplyMirrorBoundaryConditions(EvaluateIndex, m_SplineOrder);
// Calculate derivative
CovariantVectorType derivativeValue;
double tempValue;
......@@ -225,7 +225,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
derivativeValue[n] = 0.0;
for (unsigned int p = 0; p < m_MaxNumberInterpolationPoints; p++)
{
tempValue = 1.0 ;
tempValue = 1.0 ;
for (unsigned int n1 = 0; n1 < ImageDimension; n1++)
{
//coefficientIndex[n1] = EvaluateIndex[n1][sp];
......@@ -238,7 +238,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
}
else
{
tempValue *= weights[n1][ m_PointsToIndex[p][n1] ];
tempValue *= weights[n1][ m_PointsToIndex[p][n1] ];
}
}
derivativeValue[n] += m_Coefficients->GetPixel(coefficientIndex) * tempValue ;
......@@ -247,21 +247,21 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
}
return(derivativeValue);
}
template <class TImageType, class TCoordRep, class TCoefficientType>
void
void
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
::SetInterpolationWeights( const ContinuousIndexType & x, const vnl_matrix<long> & EvaluateIndex,
::SetInterpolationWeights( const ContinuousIndexType & x, const vnl_matrix<long> & EvaluateIndex,
vnl_matrix<double> & weights, unsigned int splineOrder ) const
{
// For speed improvements we could make each case a separate function and use
// function pointers to reference the correct weight order.
// Left as is for now for readability.
double w, w2, w4, t, t0, t1;
switch (splineOrder)
{
case 3:
......@@ -346,13 +346,13 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
throw err;
break;
}
}
template <class TImageType, class TCoordRep, class TCoefficientType>
void
void
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
::SetDerivativeWeights( const ContinuousIndexType & x, const vnl_matrix<long> & EvaluateIndex,
::SetDerivativeWeights( const ContinuousIndexType & x, const vnl_matrix<long> & EvaluateIndex,
vnl_matrix<double> & weights, unsigned int splineOrder ) const
{
// For speed improvements we could make each case a separate function and use
......@@ -362,10 +362,10 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
// Left as is for now for readability.
double w, w1, w2, w3, w4, w5, t, t0, t1, t2;
int derivativeSplineOrder = (int) splineOrder -1;
switch (derivativeSplineOrder)
{
// Calculates B(splineOrder) ( (x + 1/2) - xi) - B(splineOrder -1) ( (x - 1/2) - xi)
case -1:
// Why would we want to do this?
......@@ -390,11 +390,11 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
weights[n][0] = 0.0 - w1;
weights[n][1] = w1 - w;
weights[n][2] = w;
weights[n][2] = w;
}
break;
case 2:
for (unsigned int n = 0; n < ImageDimension; n++)
{
w = x[n] + .5 - (double)EvaluateIndex[n][2];
......@@ -405,11 +405,11 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
weights[n][0] = 0.0 - w1;
weights[n][1] = w1 - w2;
weights[n][2] = w2 - w3;
weights[n][3] = w3;
weights[n][3] = w3;
}
break;
case 3:
for (unsigned int n = 0; n < ImageDimension; n++)
{
w = x[n] + 0.5 - (double)EvaluateIndex[n][2];
......@@ -449,7 +449,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
weights[n][5] = w5;
}
break;
default:
// SplineOrder not implemented yet.
itk::ExceptionObject err(__FILE__, __LINE__);
......@@ -458,7 +458,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
throw err;
break;
}
}
......@@ -491,13 +491,13 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
template <class TImageType, class TCoordRep, class TCoefficientType>
void
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
::DetermineRegionOfSupport( vnl_matrix<long> & evaluateIndex,
const ContinuousIndexType & x,
::DetermineRegionOfSupport( vnl_matrix<long> & evaluateIndex,
const ContinuousIndexType & x,
unsigned int splineOrder ) const
{
{
long indx;
// compute the interpolation indexes
// compute the interpolation indexes
for (unsigned int n = 0; n< ImageDimension; n++)
{
if (splineOrder & 1) // Use this index calculation for odd splineOrder
......@@ -512,8 +512,8 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
}
}
else // Use this index calculation for even splineOrder
{
{
indx = (long)vcl_floor((float)(x[n] + 0.5)) - splineOrder / 2;
//std::cout<<"x: "<<x<<std::endl;
//std::cout<<"splineOrder: "<<splineOrder<<std::endl;
......@@ -529,16 +529,16 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
template <class TImageType, class TCoordRep, class TCoefficientType>
void
BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
::ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex,
::ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex,
unsigned int splineOrder) const
{
for (unsigned int n = 0; n < ImageDimension; n++)
{
long dataLength = m_DataLength[n];
long dataOffset = m_CurrentBufferedRegion.GetIndex()[n];
// apply the mirror boundary conditions
// apply the mirror boundary conditions
// TODO: We could implement other boundary options beside mirror
if (m_DataLength[n] == 1)
{
......@@ -561,7 +561,7 @@ BSplineInterpolateImageFunction<TImageType,TCoordRep,TCoefficientType>
}
}
}
}
......
......@@ -10,8 +10,8 @@
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
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.
=========================================================================*/
......@@ -26,12 +26,12 @@ namespace otb
/**
* \class BinaryImageMinimalBoundingRegionCalculator
* \brief This class compute the smallest region of the image
* containing every pixel with the foreground value.
* containing every pixel with the foreground value.
*
* This class is used for instance in the RCC8 calculator filter,