Commit 231a23d9 authored by OTB Bot's avatar OTB Bot

STYLE

parent 2ab61527

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

...@@ -26,81 +26,81 @@ ...@@ -26,81 +26,81 @@
namespace otb namespace otb
{ {
namespace Functor namespace Functor
{ {
/** /**
* \class AmplitudePhaseToRGBFunctor * \class AmplitudePhaseToRGBFunctor
* \brief Function object to compute a color representation of a radar image. * \brief Function object to compute a color representation of a radar image.
* *
* This class is useful for visualizing radar images with a combination of * This class is useful for visualizing radar images with a combination of
* the phase and the amplitude at the same time. * the phase and the amplitude at the same time.
* *
* The amplitude is used to represent the intensity of the pixel and the phase * The amplitude is used to represent the intensity of the pixel and the phase
* to represent it's hue. * to represent it's hue.
* *
* Amplitude and phase can be obtained using the itk::ComplexToModulusImageFilter * Amplitude and phase can be obtained using the itk::ComplexToModulusImageFilter
* and itk::ComplexToPhaseImageFilter for example. * and itk::ComplexToPhaseImageFilter for example.
* *
*/ */
template< class TInput1, class TInput2=TInput1, class TInput3=TInput1, class TOutput=TInput1> template<class TInput1, class TInput2 = TInput1, class TInput3 = TInput1, class TOutput = TInput1>
class ITK_EXPORT AmplitudePhaseToRGBFunctor class ITK_EXPORT AmplitudePhaseToRGBFunctor
{
public:
typedef TOutput RGBPixelType;
typedef typename RGBPixelType::ValueType RGBComponentType;
typedef HSVToRGBFunctor<RGBPixelType> HSVToRGBFunctorType;
typedef TInput1 ScalarType;
AmplitudePhaseToRGBFunctor()
{ {
public: m_Minimum = 0;
typedef TOutput RGBPixelType; m_Maximum = itk::NumericTraits<ScalarType>::max();
typedef typename RGBPixelType::ValueType RGBComponentType;
typedef HSVToRGBFunctor<RGBPixelType> HSVToRGBFunctorType;
typedef TInput1 ScalarType;
AmplitudePhaseToRGBFunctor()
{
m_Minimum = 0;
m_Maximum = itk::NumericTraits<ScalarType>::max();
};
~AmplitudePhaseToRGBFunctor(){};
void SetMaximum(ScalarType max)
{
this->m_Maximum = max;
}
void SetMinimum(ScalarType min)
{
this->m_Minimum = min;
}
inline TOutput operator()( const TInput1 & amplitude, const TInput2 & coherence, const TInput3 & phase) const
{
// std::cout << amplitude << " - " << phase << std::endl;
double hinc, sinc, vinc;
hinc=0.6/(CONST_2PI);
sinc=0.0;
vinc=0.0;
double hue, sat, val;
hue = 0.6 - (phase+CONST_PI)*hinc;
sat = 0.6*coherence+0.3;
val = itk::NumericTraits<RGBComponentType>::max()/2
* ( (amplitude-m_Minimum)/(m_Maximum-m_Minimum)+1.0);
if (amplitude < m_Minimum)
{
val = 0;
}
if (amplitude > m_Maximum)
{
val = itk::NumericTraits<RGBComponentType>::max();
}
return m_HSVToRGBFunctor(hue, sat, val);
}
private:
ScalarType m_Maximum;
ScalarType m_Minimum;
HSVToRGBFunctorType m_HSVToRGBFunctor;
}; };
~AmplitudePhaseToRGBFunctor(){}
void SetMaximum(ScalarType max)
{
this->m_Maximum = max;
}
void SetMinimum(ScalarType min)
{
this->m_Minimum = min;
} }
inline TOutput operator ()(const TInput1& amplitude, const TInput2& coherence, const TInput3& phase) const
{
// std::cout << amplitude << " - " << phase << std::endl;
double hinc, sinc, vinc;
hinc = 0.6 / (CONST_2PI);
sinc = 0.0;
vinc = 0.0;
double hue, sat, val;
hue = 0.6 - (phase + CONST_PI) * hinc;
sat = 0.6 * coherence + 0.3;
val = itk::NumericTraits<RGBComponentType>::max() / 2
* ((amplitude - m_Minimum) / (m_Maximum - m_Minimum) + 1.0);
if (amplitude < m_Minimum)
{
val = 0;
}
if (amplitude > m_Maximum)
{
val = itk::NumericTraits<RGBComponentType>::max();
}
return m_HSVToRGBFunctor(hue, sat, val);
}
private:
ScalarType m_Maximum;
ScalarType m_Minimum;
HSVToRGBFunctorType m_HSVToRGBFunctor;
};
}
} }
#endif #endif
...@@ -36,29 +36,29 @@ namespace otb ...@@ -36,29 +36,29 @@ namespace otb
*/ */
template <class TInputImage, class TOutputImage> template <class TInputImage, class TOutputImage>
class ITK_EXPORT BSplineDecompositionImageFilter : class ITK_EXPORT BSplineDecompositionImageFilter :
public itk::ImageToImageFilter<TInputImage,TOutputImage> public itk::ImageToImageFilter<TInputImage, TOutputImage>
{ {
public: public:
/** Standard class typedefs. */ /** Standard class typedefs. */
typedef BSplineDecompositionImageFilter Self; typedef BSplineDecompositionImageFilter Self;
typedef itk::ImageToImageFilter<TInputImage,TOutputImage> Superclass; typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer; typedef itk::SmartPointer<const Self> ConstPointer;
/** Run-time type information (and related methods). */ /** Run-time type information (and related methods). */
itkTypeMacro(BSplineDecompositionImageFilter, ImageToImageFilter); itkTypeMacro(BSplineDecompositionImageFilter, ImageToImageFilter);
/** New macro for creation of through a Smart Pointer */ /** New macro for creation of through a Smart Pointer */
itkNewMacro( Self ); itkNewMacro(Self);
/** Inherit input and output image types from Superclass. */ /** Inherit input and output image types from Superclass. */
typedef typename Superclass::InputImageType InputImageType; typedef typename Superclass::InputImageType InputImageType;
typedef typename Superclass::InputImagePointer InputImagePointer; typedef typename Superclass::InputImagePointer InputImagePointer;
typedef typename Superclass::InputImageConstPointer InputImageConstPointer; typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
typedef typename Superclass::OutputImagePointer OutputImagePointer; typedef typename Superclass::OutputImagePointer OutputImagePointer;
/** Dimension underlying input image. */ /** Dimension underlying input image. */
itkStaticConstMacro(ImageDimension, unsigned int,TInputImage::ImageDimension); itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int, itkStaticConstMacro(OutputImageDimension, unsigned int,
TOutputImage::ImageDimension); TOutputImage::ImageDimension);
...@@ -72,24 +72,23 @@ public: ...@@ -72,24 +72,23 @@ public:
protected: protected:
BSplineDecompositionImageFilter(); BSplineDecompositionImageFilter();
virtual ~BSplineDecompositionImageFilter() {}; virtual ~BSplineDecompositionImageFilter() {}
void PrintSelf(std::ostream& os, itk::Indent indent) const; void PrintSelf(std::ostream& os, itk::Indent indent) const;
void GenerateData( ); void GenerateData();
/** These are needed by the smoothing spline routine. */ /** These are needed by the smoothing spline routine. */
std::vector<double> m_Scratch; // temp storage for processing of Coefficients std::vector<double> m_Scratch; // temp storage for processing of Coefficients
typename TInputImage::SizeType m_DataLength; // Image size typename TInputImage::SizeType m_DataLength; // Image size
unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default) unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default)
double m_SplinePoles[3];// Poles calculated for a given spline order