Commit 38ace640 authored by OTB Bot's avatar OTB Bot
Browse files

STYLE

parent 70f550a4
......@@ -132,39 +132,39 @@ BSplineDecompositionImageFilter<TInputImage, TOutputImage>
// 2000, pg. 416.
switch (m_SplineOrder)
{
case 3:
m_NumberOfPoles = 1;
m_SplinePoles[0] = vcl_sqrt(3.0) - 2.0;
break;
case 0:
m_NumberOfPoles = 0;
break;
case 1:
m_NumberOfPoles = 0;
break;
case 2:
m_NumberOfPoles = 1;
m_SplinePoles[0] = vcl_sqrt(8.0) - 3.0;
break;
case 4:
m_NumberOfPoles = 2;
m_SplinePoles[0] = vcl_sqrt(664.0 - vcl_sqrt(438976.0)) + vcl_sqrt(304.0) - 19.0;
m_SplinePoles[1] = vcl_sqrt(664.0 + vcl_sqrt(438976.0)) - vcl_sqrt(304.0) - 19.0;
break;
case 5:
m_NumberOfPoles = 2;
m_SplinePoles[0] = vcl_sqrt(135.0 / 2.0 - vcl_sqrt(17745.0 / 4.0)) + vcl_sqrt(105.0 / 4.0)
- 13.0 / 2.0;
m_SplinePoles[1] = vcl_sqrt(135.0 / 2.0 + vcl_sqrt(17745.0 / 4.0)) - vcl_sqrt(105.0 / 4.0)
- 13.0 / 2.0;
break;
default:
// SplineOrder not implemented yet.
itk::ExceptionObject err(__FILE__, __LINE__);
err.SetLocation(ITK_LOCATION);
err.SetDescription("SplineOrder must be between 0 and 5. Requested spline order has not been implemented yet.");
throw err;
break;
case 3:
m_NumberOfPoles = 1;
m_SplinePoles[0] = vcl_sqrt(3.0) - 2.0;
break;
case 0:
m_NumberOfPoles = 0;
break;
case 1:
m_NumberOfPoles = 0;
break;
case 2:
m_NumberOfPoles = 1;
m_SplinePoles[0] = vcl_sqrt(8.0) - 3.0;
break;
case 4:
m_NumberOfPoles = 2;
m_SplinePoles[0] = vcl_sqrt(664.0 - vcl_sqrt(438976.0)) + vcl_sqrt(304.0) - 19.0;
m_SplinePoles[1] = vcl_sqrt(664.0 + vcl_sqrt(438976.0)) - vcl_sqrt(304.0) - 19.0;
break;
case 5:
m_NumberOfPoles = 2;
m_SplinePoles[0] = vcl_sqrt(135.0 / 2.0 - vcl_sqrt(17745.0 / 4.0)) + vcl_sqrt(105.0 / 4.0)
- 13.0 / 2.0;
m_SplinePoles[1] = vcl_sqrt(135.0 / 2.0 + vcl_sqrt(17745.0 / 4.0)) - vcl_sqrt(105.0 / 4.0)
- 13.0 / 2.0;
break;
default:
// SplineOrder not implemented yet.
itk::ExceptionObject err(__FILE__, __LINE__);
err.SetLocation(ITK_LOCATION);
err.SetDescription("SplineOrder must be between 0 and 5. Requested spline order has not been implemented yet.");
throw err;
break;
}
}
......
......@@ -41,9 +41,9 @@ namespace otb
* \ingroup ImageFunctions
*/
template <
class TImageType,
class TCoordRep = double,
class TCoefficientType = double>
class TImageType,
class TCoordRep = double,
class TCoefficientType = double>
class ITK_EXPORT BSplineInterpolateImageFunction :
public itk::InterpolateImageFunction<TImageType, TCoordRep>
{
......@@ -87,8 +87,8 @@ public:
/** Internal Coefficient typedef support */
typedef TCoefficientType CoefficientDataType;
typedef itk::Image<CoefficientDataType,
itkGetStaticConstMacro(ImageDimension)
> CoefficientImageType;
itkGetStaticConstMacro(ImageDimension)
> CoefficientImageType;
/** Define filter for calculating the BSpline coefficients */
typedef otb::BSplineDecompositionImageFilter<TImageType, CoefficientImageType>
......@@ -108,8 +108,8 @@ public:
/** Derivative typedef support */
typedef itk::CovariantVector<OutputType,
itkGetStaticConstMacro(ImageDimension)
> CovariantVectorType;
itkGetStaticConstMacro(ImageDimension)
> CovariantVectorType;
CovariantVectorType EvaluateDerivative(const PointType& point) const
{
......
......@@ -262,87 +262,87 @@ BSplineInterpolateImageFunction<TImageType, TCoordRep, TCoefficientType>
switch (splineOrder)
{
case 3:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] - (double) EvaluateIndex[n][1];
weights[n][3] = (1.0 / 6.0) * w * w * w;
weights[n][0] = (1.0 / 6.0) + 0.5 * w * (w - 1.0) - weights[n][3];
weights[n][2] = w + weights[n][0] - 2.0 * weights[n][3];
weights[n][1] = 1.0 - weights[n][0] - weights[n][2] - weights[n][3];
}
break;
case 0:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
weights[n][0] = 1; // implements nearest neighbor
}
break;
case 1:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] - (double) EvaluateIndex[n][0];
weights[n][1] = w;
weights[n][0] = 1.0 - w;
}
break;
case 2:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
/* x */
w = x[n] - (double) EvaluateIndex[n][1];
weights[n][1] = 0.75 - w * w;
weights[n][2] = 0.5 * (w - weights[n][1] + 1.0);
weights[n][0] = 1.0 - weights[n][1] - weights[n][2];
}
break;
case 4:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
/* x */
w = x[n] - (double) EvaluateIndex[n][2];
w2 = w * w;
t = (1.0 / 6.0) * w2;
weights[n][0] = 0.5 - w;
weights[n][0] *= weights[n][0];
weights[n][0] *= (1.0 / 24.0) * weights[n][0];
t0 = w * (t - 11.0 / 24.0);
t1 = 19.0 / 96.0 + w2 * (0.25 - t);
weights[n][1] = t1 + t0;
weights[n][3] = t1 - t0;
weights[n][4] = weights[n][0] + t0 + 0.5 * w;
weights[n][2] = 1.0 - weights[n][0] - weights[n][1] - weights[n][3] - weights[n][4];
}
break;
case 5:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
/* x */
w = x[n] - (double) EvaluateIndex[n][2];
w2 = w * w;
weights[n][5] = (1.0 / 120.0) * w * w2 * w2;
w2 -= w;
w4 = w2 * w2;
w -= 0.5;
t = w2 * (w2 - 3.0);
weights[n][0] = (1.0 / 24.0) * (1.0 / 5.0 + w2 + w4) - weights[n][5];
t0 = (1.0 / 24.0) * (w2 * (w2 - 5.0) + 46.0 / 5.0);
t1 = (-1.0 / 12.0) * w * (t + 4.0);
weights[n][2] = t0 + t1;
weights[n][3] = t0 - t1;
t0 = (1.0 / 16.0) * (9.0 / 5.0 - t);
t1 = (1.0 / 24.0) * w * (w4 - w2 - 5.0);
weights[n][1] = t0 + t1;
weights[n][4] = t0 - t1;
}
break;
default:
// SplineOrder not implemented yet.
itk::ExceptionObject err(__FILE__, __LINE__);
err.SetLocation(ITK_LOCATION);
err.SetDescription("SplineOrder must be between 0 and 5. Requested spline order has not been implemented yet.");
throw err;
break;
case 3:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] - (double) EvaluateIndex[n][1];
weights[n][3] = (1.0 / 6.0) * w * w * w;
weights[n][0] = (1.0 / 6.0) + 0.5 * w * (w - 1.0) - weights[n][3];
weights[n][2] = w + weights[n][0] - 2.0 * weights[n][3];
weights[n][1] = 1.0 - weights[n][0] - weights[n][2] - weights[n][3];
}
break;
case 0:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
weights[n][0] = 1; // implements nearest neighbor
}
break;
case 1:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] - (double) EvaluateIndex[n][0];
weights[n][1] = w;
weights[n][0] = 1.0 - w;
}
break;
case 2:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
/* x */
w = x[n] - (double) EvaluateIndex[n][1];
weights[n][1] = 0.75 - w * w;
weights[n][2] = 0.5 * (w - weights[n][1] + 1.0);
weights[n][0] = 1.0 - weights[n][1] - weights[n][2];
}
break;
case 4:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
/* x */
w = x[n] - (double) EvaluateIndex[n][2];
w2 = w * w;
t = (1.0 / 6.0) * w2;
weights[n][0] = 0.5 - w;
weights[n][0] *= weights[n][0];
weights[n][0] *= (1.0 / 24.0) * weights[n][0];
t0 = w * (t - 11.0 / 24.0);
t1 = 19.0 / 96.0 + w2 * (0.25 - t);
weights[n][1] = t1 + t0;
weights[n][3] = t1 - t0;
weights[n][4] = weights[n][0] + t0 + 0.5 * w;
weights[n][2] = 1.0 - weights[n][0] - weights[n][1] - weights[n][3] - weights[n][4];
}
break;
case 5:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
/* x */
w = x[n] - (double) EvaluateIndex[n][2];
w2 = w * w;
weights[n][5] = (1.0 / 120.0) * w * w2 * w2;
w2 -= w;
w4 = w2 * w2;
w -= 0.5;
t = w2 * (w2 - 3.0);
weights[n][0] = (1.0 / 24.0) * (1.0 / 5.0 + w2 + w4) - weights[n][5];
t0 = (1.0 / 24.0) * (w2 * (w2 - 5.0) + 46.0 / 5.0);
t1 = (-1.0 / 12.0) * w * (t + 4.0);
weights[n][2] = t0 + t1;
weights[n][3] = t0 - t1;
t0 = (1.0 / 16.0) * (9.0 / 5.0 - t);
t1 = (1.0 / 24.0) * w * (w4 - w2 - 5.0);
weights[n][1] = t0 + t1;
weights[n][4] = t0 - t1;
}
break;
default:
// SplineOrder not implemented yet.
itk::ExceptionObject err(__FILE__, __LINE__);
err.SetLocation(ITK_LOCATION);
err.SetDescription("SplineOrder must be between 0 and 5. Requested spline order has not been implemented yet.");
throw err;
break;
}
}
......@@ -364,98 +364,98 @@ BSplineInterpolateImageFunction<TImageType, TCoordRep, TCoefficientType>
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?
for (unsigned int n = 0; n < ImageDimension; ++n)
{
weights[n][0] = 0.0;
}
break;
case 0:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
weights[n][0] = -1.0;
weights[n][1] = 1.0;
}
break;
case 1:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] + 0.5 - (double) EvaluateIndex[n][1];
// w2 = w;
w1 = 1.0 - w;
// Calculates B(splineOrder) ( (x + 1/2) - xi) - B(splineOrder -1) ( (x - 1/2) - xi)
case -1:
// Why would we want to do this?
for (unsigned int n = 0; n < ImageDimension; ++n)
{
weights[n][0] = 0.0;
}
break;
case 0:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
weights[n][0] = -1.0;
weights[n][1] = 1.0;
}
break;
case 1:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] + 0.5 - (double) EvaluateIndex[n][1];
// w2 = w;
w1 = 1.0 - w;
weights[n][0] = 0.0 - w1;
weights[n][1] = w1 - w;
weights[n][2] = w;
}
break;
case 2:
weights[n][0] = 0.0 - w1;
weights[n][1] = w1 - w;
weights[n][2] = w;
}
break;
case 2:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] + .5 - (double) EvaluateIndex[n][2];
w2 = 0.75 - w * w;
w3 = 0.5 * (w - w2 + 1.0);
w1 = 1.0 - w2 - w3;
weights[n][0] = 0.0 - w1;
weights[n][1] = w1 - w2;
weights[n][2] = w2 - w3;
weights[n][3] = w3;
}
break;
case 3:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] + .5 - (double) EvaluateIndex[n][2];
w2 = 0.75 - w * w;
w3 = 0.5 * (w - w2 + 1.0);
w1 = 1.0 - w2 - w3;
weights[n][0] = 0.0 - w1;
weights[n][1] = w1 - w2;
weights[n][2] = w2 - 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];
w4 = (1.0 / 6.0) * w * w * w;
w1 = (1.0 / 6.0) + 0.5 * w * (w - 1.0) - w4;
w3 = w + w1 - 2.0 * w4;
w2 = 1.0 - w1 - w3 - w4;
weights[n][0] = 0.0 - w1;
weights[n][1] = w1 - w2;
weights[n][2] = w2 - w3;
weights[n][3] = w3 - w4;
weights[n][4] = w4;
}
break;
case 4:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] + .5 - (double) EvaluateIndex[n][3];
t2 = w * w;
t = (1.0 / 6.0) * t2;
w1 = 0.5 - w;
w1 *= w1;
w1 *= (1.0 / 24.0) * w1;
t0 = w * (t - 11.0 / 24.0);
t1 = 19.0 / 96.0 + t2 * (0.25 - t);
w2 = t1 + t0;
w4 = t1 - t0;
w5 = w1 + t0 + 0.5 * w;
w3 = 1.0 - w1 - w2 - w4 - w5;
weights[n][0] = 0.0 - w1;
weights[n][1] = w1 - w2;
weights[n][2] = w2 - w3;
weights[n][3] = w3 - w4;
weights[n][4] = w4 - w5;
weights[n][5] = w5;
}
break;
default:
// SplineOrder not implemented yet.
itk::ExceptionObject err(__FILE__, __LINE__);
err.SetLocation(ITK_LOCATION);
err.SetDescription(
"SplineOrder (for derivatives) must be between 1 and 5. Requested spline order has not been implemented yet.");
throw err;
break;
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] + 0.5 - (double) EvaluateIndex[n][2];
w4 = (1.0 / 6.0) * w * w * w;
w1 = (1.0 / 6.0) + 0.5 * w * (w - 1.0) - w4;
w3 = w + w1 - 2.0 * w4;
w2 = 1.0 - w1 - w3 - w4;
weights[n][0] = 0.0 - w1;
weights[n][1] = w1 - w2;
weights[n][2] = w2 - w3;
weights[n][3] = w3 - w4;
weights[n][4] = w4;
}
break;
case 4:
for (unsigned int n = 0; n < ImageDimension; ++n)
{
w = x[n] + .5 - (double) EvaluateIndex[n][3];
t2 = w * w;
t = (1.0 / 6.0) * t2;
w1 = 0.5 - w;
w1 *= w1;
w1 *= (1.0 / 24.0) * w1;
t0 = w * (t - 11.0 / 24.0);
t1 = 19.0 / 96.0 + t2 * (0.25 - t);
w2 = t1 + t0;
w4 = t1 - t0;
w5 = w1 + t0 + 0.5 * w;
w3 = 1.0 - w1 - w2 - w4 - w5;
weights[n][0] = 0.0 - w1;
weights[n][1] = w1 - w2;
weights[n][2] = w2 - w3;
weights[n][3] = w3 - w4;
weights[n][4] = w4 - w5;
weights[n][5] = w5;
}
break;
default:
// SplineOrder not implemented yet.
itk::ExceptionObject err(__FILE__, __LINE__);
err.SetLocation(ITK_LOCATION);
err.SetDescription(
"SplineOrder (for derivatives) must be between 1 and 5. Requested spline order has not been implemented yet.");
throw err;
break;
}
}
......
......@@ -44,13 +44,13 @@ namespace otb
template <class TInputImage, class TCoordRep = float>
class ITK_EXPORT BinaryImageDensityFunction :
public itk::ImageFunction<TInputImage, typename itk::NumericTraits<typename TInputImage::PixelType>::RealType,
TCoordRep>
TCoordRep>
{
public:
/** Standard class typedefs. */
typedef BinaryImageDensityFunction Self;
typedef itk::ImageFunction<TInputImage, typename itk::NumericTraits<typename TInputImage::PixelType>::RealType,
TCoordRep> Superclass;
TCoordRep> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
......
......@@ -113,17 +113,17 @@ private:
template <class TInputImage, class TOutputImage>
class ITK_EXPORT ChangeLabelImageFilter :
public itk::UnaryFunctorImageFilter<TInputImage, TOutputImage,
Functor::VectorChangeLabel<typename TInputImage::PixelType,
typename TOutputImage::PixelType> >
Functor::VectorChangeLabel<typename TInputImage::PixelType,
typename TOutputImage::PixelType> >
{
public:
/** Standard class typedefs. */
typedef ChangeLabelImageFilter Self;
typedef itk::UnaryFunctorImageFilter<TInputImage, TOutputImage,
Functor::VectorChangeLabel<
typename TInputImage::PixelType,
typename TOutputImage::PixelType>
> Superclass;
Functor::VectorChangeLabel<
typename TInputImage::PixelType,
typename TOutputImage::PixelType>
> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
......
......@@ -59,8 +59,8 @@ namespace otb
* \ingroup MultiThreaded
*/
template <class TInputImage, class TOutputImage, class TBoundaryCondition =
itk::ZeroFluxNeumannBoundaryCondition<TInputImage>,
class TFilterPrecision = typename itk::NumericTraits<typename TInputImage::InternalPixelType>::RealType >
itk::ZeroFluxNeumannBoundaryCondition<TInputImage>,
class TFilterPrecision = typename itk::NumericTraits<typename TInputImage::InternalPixelType>::RealType>
class ITK_EXPORT ConvolutionImageFilter :
public itk::ImageToImageFilter<TInputImage, TOutputImage>
{
......
......@@ -72,8 +72,8 @@ public:
/** PointSetToDensityImageFilter support*/
typedef otb::BinaryImageToDensityImageFilter<InputImageType,
OutputImageType,
DensityCountFunctionType> DensityImageType;
OutputImageType,
DensityCountFunctionType> DensityImageType;
typedef typename DensityImageType::Pointer DensityImagePointerType;
......
......@@ -39,16 +39,16 @@ class ITK_EXPORT HillShadingFilter :
public UnaryFunctorNeighborhoodImageFilter<TInputImage, TOutputImage,
Functor::HillShadingFunctor<itk::ConstNeighborhoodIterator<TInputImage>,
TInputImage, typename TOutputImage::PixelType>
>
>
{
public:
/** Standard class typedefs. */
typedef HillShadingFilter Self;
typedef HillShadingFilter Self;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
......
......@@ -148,8 +148,8 @@ public:
float xSlope =
((makeValid(it.GetPixel(LEFTUP)) + 2 * makeValid(it.GetPixel(LEFT)) + makeValid(it.GetPixel(RIGHTDOWN)))
- (makeValid(it.GetPixel(RIGHTUP)) + 2 * makeValid(it.GetPixel(RIGHT)) +
makeValid(it.GetPixel(RIGHTDOWN))))
- (makeValid(it.GetPixel(RIGHTUP)) + 2 * makeValid(it.GetPixel(RIGHT)) +
makeValid(it.GetPixel(RIGHTDOWN))))
/ (m_XRes * m_Scale);
// - as the azimuth is given compared to y axis pointing up
float ySlope = -((makeValid(it.GetPixel(LEFTUP)) + 2 * makeValid(it.GetPixel(UP)) + makeValid(it.GetPixel(RIGHTUP)))
......
......@@ -60,33 +60,33 @@ public:
switch (m_Operator)
{
case MULTIPLICATION:
{
vInTmp *= static_cast<InternalInputPixelType>(inPix);
break;
}
case ADDITION:
{
vInTmp += static_cast<InternalInputPixelType>(inPix);
break;
}
case DIVISON: