Commit 3fc1725a authored by Victor Poughon's avatar Victor Poughon

Merge branch 'sonar-bugs' into 'develop'

Fix some sonar qube issues

See merge request !542
parents ec1e76ee 9ad84f54
Pipeline #2155 passed with stages
in 80 minutes and 29 seconds
...@@ -185,7 +185,7 @@ public: ...@@ -185,7 +185,7 @@ public:
} }
protected: protected:
CurlFileDescriptorResource(){} CurlFileDescriptorResource(): m_File(nullptr) {}
~CurlFileDescriptorResource() override ~CurlFileDescriptorResource() override
{ {
...@@ -195,9 +195,9 @@ protected: ...@@ -195,9 +195,9 @@ protected:
private: private:
FILE * m_File; FILE * m_File;
// prevent copying and assignment; not implemented // prevent copying and assignment
CurlFileDescriptorResource (const CurlFileDescriptorResource &); CurlFileDescriptorResource (const CurlFileDescriptorResource &) = delete;
CurlFileDescriptorResource & operator= (const CurlFileDescriptorResource &); CurlFileDescriptorResource & operator= (const CurlFileDescriptorResource &) = delete;
}; //end of class FileResource }; //end of class FileResource
#endif // OTB_USE_CURL #endif // OTB_USE_CURL
......
...@@ -123,7 +123,7 @@ public: ...@@ -123,7 +123,7 @@ public:
const RegionType& region) override; const RegionType& region) override;
protected: protected:
ImageRegionTileMapSplitter() : m_AlignStep(256){} ImageRegionTileMapSplitter() : m_SplitsPerDimension{0}, m_AlignStep(256) {}
~ImageRegionTileMapSplitter() override {} ~ImageRegionTileMapSplitter() override {}
void PrintSelf(std::ostream& os, itk::Indent indent) const override; void PrintSelf(std::ostream& os, itk::Indent indent) const override;
......
...@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double> ...@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double>
class BlackmanWindowFunction class BlackmanWindowFunction
{ {
public: public:
BlackmanWindowFunction(): m_Radius(1), m_Factor1(CONST_PI), m_Factor2(2.0 * CONST_PI) {} // default radius is 1 at construction
void SetRadius(unsigned int radius) void SetRadius(unsigned int radius)
{ {
m_Radius = radius; m_Radius = radius;
...@@ -95,8 +96,7 @@ template<class TInputImage, class TBoundaryCondition = itk::ConstantBoundaryCond ...@@ -95,8 +96,7 @@ template<class TInputImage, class TBoundaryCondition = itk::ConstantBoundaryCond
double, class TInputInterpolator = double, class TOutputInterpolator = double> double, class TInputInterpolator = double, class TOutputInterpolator = double>
class ITK_EXPORT WindowedSincInterpolateImageBlackmanFunction : class ITK_EXPORT WindowedSincInterpolateImageBlackmanFunction :
public WindowedSincInterpolateImageFunctionBase<TInputImage, public WindowedSincInterpolateImageFunctionBase<TInputImage,
typename Function::BlackmanWindowFunction<TInputInterpolator, typename Function::BlackmanWindowFunction<TInputInterpolator, TOutputInterpolator>,
TOutputInterpolator>,
TBoundaryCondition, TBoundaryCondition,
TCoordRep> TCoordRep>
{ {
......
...@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double> ...@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double>
class CosineWindowFunction class CosineWindowFunction
{ {
public: public:
CosineWindowFunction(): m_Radius(1), m_Factor(CONST_PI / 2.0) {} // default radius is 1 at construction
void SetRadius(unsigned int radius) void SetRadius(unsigned int radius)
{ {
m_Radius = radius; m_Radius = radius;
...@@ -63,9 +64,9 @@ public: ...@@ -63,9 +64,9 @@ public:
return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px); return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px);
} }
private: private:
unsigned int m_Radius;
// Equal to \f$ \frac{\pi}{2 m} \f$ // Equal to \f$ \frac{\pi}{2 m} \f$
double m_Factor; double m_Factor;
unsigned int m_Radius;
}; };
} //namespace Function } //namespace Function
......
...@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double> ...@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double>
class GaussianWindowFunction class GaussianWindowFunction
{ {
public: public:
GaussianWindowFunction(): m_Radius(1), m_Factor(-2.0 / CONST_PI) {} // default radius is 1 at construction
void SetRadius(unsigned int radius) void SetRadius(unsigned int radius)
{ {
m_Radius = radius; m_Radius = radius;
...@@ -63,8 +64,8 @@ public: ...@@ -63,8 +64,8 @@ public:
return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px); return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px);
} }
private: private:
double m_Factor;
unsigned int m_Radius; unsigned int m_Radius;
double m_Factor;
}; };
} //namespace Function } //namespace Function
......
...@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double> ...@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double>
class HammingWindowFunction class HammingWindowFunction
{ {
public: public:
HammingWindowFunction(): m_Radius(1), m_Factor(CONST_PI) {} // default radius is 1 at construction
void SetRadius(unsigned int radius) void SetRadius(unsigned int radius)
{ {
m_Radius = radius; m_Radius = radius;
...@@ -63,9 +64,9 @@ public: ...@@ -63,9 +64,9 @@ public:
return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px); return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px);
} }
private: private:
unsigned int m_Radius;
// Equal to \f$ \frac{\pi}{m} \f$ // Equal to \f$ \frac{\pi}{m} \f$
double m_Factor; double m_Factor;
unsigned int m_Radius;
}; };
} //namespace Function } //namespace Function
......
...@@ -43,6 +43,7 @@ template<class TInput = double, class TOutput = double> ...@@ -43,6 +43,7 @@ template<class TInput = double, class TOutput = double>
class LanczosWindowFunction class LanczosWindowFunction
{ {
public: public:
LanczosWindowFunction(): m_Radius(1), m_Factor(CONST_PI) {} // default factor is 1 at construction
void SetRadius(unsigned int radius) void SetRadius(unsigned int radius)
{ {
m_Radius = radius; m_Radius = radius;
...@@ -74,9 +75,9 @@ public: ...@@ -74,9 +75,9 @@ public:
return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px); return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px);
} }
private: private:
unsigned int m_Radius;
// Equal to \f$ \frac{\pi}{m} \f$ // Equal to \f$ \frac{\pi}{m} \f$
double m_Factor; double m_Factor;
unsigned int m_Radius;
}; };
} //namespace Function } //namespace Function
......
...@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double> ...@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double>
class WelchWindowFunction class WelchWindowFunction
{ {
public: public:
WelchWindowFunction() : m_Radius(1), m_Factor(1) {} // default radius is 1 at construction
void SetRadius(unsigned int radius) void SetRadius(unsigned int radius)
{ {
m_Radius = radius; m_Radius = radius;
...@@ -63,9 +64,9 @@ public: ...@@ -63,9 +64,9 @@ public:
return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px); return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px);
} }
private: private:
unsigned int m_Radius;
// Equal to \f$ \frac{1}{m^2} \f$ // Equal to \f$ \frac{1}{m^2} \f$
double m_Factor; double m_Factor;
unsigned int m_Radius;
}; };
} //namespace Function } //namespace Function
......
...@@ -32,7 +32,7 @@ namespace otb ...@@ -32,7 +32,7 @@ namespace otb
*/ */
template <class TInputPointSet, class TOutputPointSet> template <class TInputPointSet, class TOutputPointSet>
PointSetExtractROI<TInputPointSet, TOutputPointSet> PointSetExtractROI<TInputPointSet, TOutputPointSet>
::PointSetExtractROI() ::PointSetExtractROI() : m_StartX(0), m_StartY(0), m_SizeX(0), m_SizeY(0)
{ {
} }
......
...@@ -34,9 +34,8 @@ namespace otb ...@@ -34,9 +34,8 @@ namespace otb
*/ */
template <class TInputImage, class TOutputImage> template <class TInputImage, class TOutputImage>
EstimateInnerProductPCAImageFilter<TInputImage, TOutputImage> EstimateInnerProductPCAImageFilter<TInputImage, TOutputImage>
::EstimateInnerProductPCAImageFilter() ::EstimateInnerProductPCAImageFilter(): m_NumberOfPrincipalComponentsRequired(1), m_CenterData(true)
{ {
m_NumberOfPrincipalComponentsRequired = 1;
} }
/** /**
......
...@@ -36,6 +36,7 @@ InnerProductPCAImageFilter<TInputImage, TOutputImage> ...@@ -36,6 +36,7 @@ InnerProductPCAImageFilter<TInputImage, TOutputImage>
this->SetNthOutput(0, OutputImageType::New()); this->SetNthOutput(0, OutputImageType::New());
m_EstimatePCAFilter = EstimatePCAFilterType::New(); m_EstimatePCAFilter = EstimatePCAFilterType::New();
m_NormalizePCAFilter = NormalizePCAFilterType::New(); m_NormalizePCAFilter = NormalizePCAFilterType::New();
m_NumberOfPrincipalComponentsRequired = 1;
m_CenterData = true; m_CenterData = true;
m_GenerateMeanComponent = false; m_GenerateMeanComponent = false;
m_MeanFilter = MeanFilterType::New(); m_MeanFilter = MeanFilterType::New();
......
...@@ -36,14 +36,18 @@ namespace otb ...@@ -36,14 +36,18 @@ namespace otb
*/ */
template <class TInputImage, class TOutputImage, class TFunction> template <class TInputImage, class TOutputImage, class TFunction>
MultiChannelsPolarimetricSynthesisFilter<TInputImage, TOutputImage, TFunction> MultiChannelsPolarimetricSynthesisFilter<TInputImage, TOutputImage, TFunction>
::MultiChannelsPolarimetricSynthesisFilter() ::MultiChannelsPolarimetricSynthesisFilter():
m_PsiI(0.0),
m_KhiI(0.0),
m_PsiR(0.0),
m_KhiR(0.0),
m_Gain(1.0),
m_Mode(0),
m_EmissionH(false),
m_EmissionV(false)
{ {
this->SetNumberOfRequiredInputs(1); this->SetNumberOfRequiredInputs(1);
this->InPlaceOff(); this->InPlaceOff();
SetEmissionH(false);
SetEmissionV(false);
SetGain(1);
SetMode(0);
m_ArchitectureType = PolarimetricData::New(); m_ArchitectureType = PolarimetricData::New();
} }
......
...@@ -59,10 +59,12 @@ class SpatialRangeJointDomainTransform ...@@ -59,10 +59,12 @@ class SpatialRangeJointDomainTransform
public: public:
typedef double RealType; typedef double RealType;
SpatialRangeJointDomainTransform() SpatialRangeJointDomainTransform():
m_ImageDimension(0),
m_NumberOfComponentsPerPixel(0),
m_OutputSize(0)
{ {
} }
// ~SpatialRangeJointDomainTransform() {}
typename TOutputJointImage::PixelType operator()(const typename TInputImage::PixelType & inputPixel, typename TOutputJointImage::PixelType operator()(const typename TInputImage::PixelType & inputPixel,
const typename TInputImage::IndexType & index) const const typename TInputImage::IndexType & index) const
......
...@@ -155,11 +155,6 @@ GDALOverviewsBuilder ...@@ -155,11 +155,6 @@ GDALOverviewsBuilder
if( factor<=1 ) if( factor<=1 )
return 0; return 0;
assert( minSize>0 );
if( minSize<=0 )
return 0;
assert( !m_GDALDataset.IsNull() ); assert( !m_GDALDataset.IsNull() );
// unsigned int minSize = static_cast< unsigned int >( pow( factor, n ) ); // unsigned int minSize = static_cast< unsigned int >( pow( factor, n ) );
......
...@@ -43,7 +43,7 @@ void ...@@ -43,7 +43,7 @@ void
ScalarBufferToImageFileWriter<TBufferType, TOutputPixelType>::GenerateData() ScalarBufferToImageFileWriter<TBufferType, TOutputPixelType>::GenerateData()
{ {
// Check image parameters // Check image parameters
if( (m_ImageSize[0]==0) || (m_ImageSize[0]==0) ) if( (m_ImageSize[0]==0) || (m_ImageSize[1]==0) )
{ {
itkExceptionMacro("Invalid output image size, Size can't be null."); itkExceptionMacro("Invalid output image size, Size can't be null.");
} }
......
...@@ -188,9 +188,8 @@ int main(int ac, char* av[]) ...@@ -188,9 +188,8 @@ int main(int ac, char* av[])
} }
// This is a dummy main to be registered as a test for the otbTestMain // This is a dummy main to be registered as a test for the otbTestMain
int Execute(int argc, char * argv[]) int Execute(int, char * argv[])
{ {
argc -= 1;
argv += 1; argv += 1;
// Create the appropriate itk process // Create the appropriate itk process
itksysProcess * process = itksysProcess_New(); itksysProcess * process = itksysProcess_New();
......
...@@ -243,11 +243,6 @@ void ...@@ -243,11 +243,6 @@ void
MarkovRandomFieldFilter<TInputImage, TClassifiedImage> MarkovRandomFieldFilter<TInputImage, TClassifiedImage>
::Allocate() ::Allocate()
{ {
if (m_NumberOfClasses <= 0)
{
throw itk::ExceptionObject(__FILE__, __LINE__, "NumberOfClasses <= 0.", ITK_LOCATION);
}
//Set the output labelled and allocate the memory //Set the output labelled and allocate the memory
LabelledImagePointer outputPtr = this->GetOutput(); LabelledImagePointer outputPtr = this->GetOutput();
......
...@@ -260,7 +260,7 @@ DisparityMapMedianFilter< TInputImage, TOutputImage, TMask> ...@@ -260,7 +260,7 @@ DisparityMapMedianFilter< TInputImage, TOutputImage, TMask>
InputIt.SetLocation(outputIt.GetIndex()); InputIt.SetLocation(outputIt.GetIndex());
for (unsigned int i=0; i<InputIt.Size(); i++) for (unsigned int i=0; i<InputIt.Size(); i++)
{ {
if (!inputmaskPtr || (inputmaskPtr && MaskInputIt.GetPixel(i) != 0)) if (!inputmaskPtr || (MaskInputIt.GetPixel(i) != 0))
{ {
p++; p++;
pixels.push_back(InputIt.GetPixel(i)); pixels.push_back(InputIt.GetPixel(i));
...@@ -347,7 +347,7 @@ DisparityMapMedianFilter< TInputImage, TOutputImage, TMask> ...@@ -347,7 +347,7 @@ DisparityMapMedianFilter< TInputImage, TOutputImage, TMask>
MaskInputIt.SetLocation(outputIt.GetIndex()); MaskInputIt.SetLocation(outputIt.GetIndex());
} }
if ((!inputmaskPtr || (inputmaskPtr && MaskInputIt.GetCenterPixel() != 0)) && if ((!inputmaskPtr || (MaskInputIt.GetCenterPixel() != 0)) &&
std::fabs(InputIt.GetCenterPixel() - MedianIt.Get())>m_IncoherenceThreshold) std::fabs(InputIt.GetCenterPixel() - MedianIt.Get())>m_IncoherenceThreshold)
{ {
outputDisparityMapIt.Set(0.0); //Remove pixel from disparity map// outputDisparityMapIt.Set(0.0); //Remove pixel from disparity map//
......
...@@ -670,9 +670,9 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> ...@@ -670,9 +670,9 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor>
((tmpIndex[1] - this->m_GridIndex[1] + this->m_Step) % this->m_Step == 0)) ((tmpIndex[1] - this->m_GridIndex[1] + this->m_Step) % this->m_Step == 0))
{ {
// If the mask is present and valid // If the mask is present and valid
if(!inLeftMaskPtr || (inLeftMaskPtr && inLeftMaskIt.Get() > 0) ) if(!inLeftMaskPtr || (inLeftMaskIt.Get() > 0) )
{ {
if(!inRightMaskPtr || (inRightMaskPtr && inRightMaskIt.Get() > 0) ) if(!inRightMaskPtr || (inRightMaskIt.Get() > 0) )
{ {
int estimatedMinHDisp = m_MinimumHorizontalDisparity; int estimatedMinHDisp = m_MinimumHorizontalDisparity;
int estimatedMinVDisp = m_MinimumVerticalDisparity; int estimatedMinVDisp = m_MinimumVerticalDisparity;
......
...@@ -762,9 +762,9 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> ...@@ -762,9 +762,9 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor>
inRightMaskIt.SetIndex(curRightPos); inRightMaskIt.SetIndex(curRightPos);
} }
// check that the current positions are not masked // check that the current positions are not masked
if(!inLeftMaskPtr || (inLeftMaskPtr && inLeftMaskIt.Get() > 0) ) if(!inLeftMaskPtr || (inLeftMaskIt.Get() > 0) )
{ {
if(!inRightMaskPtr || (inRightMaskPtr && inRightMaskIt.Get() > 0) ) if(!inRightMaskPtr || (inRightMaskIt.Get() > 0) )
{ {
RegionType smallRightRegion; RegionType smallRightRegion;
smallRightRegion.SetIndex(0,curRightPos[0]-1); smallRightRegion.SetIndex(0,curRightPos[0]-1);
...@@ -1195,9 +1195,9 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> ...@@ -1195,9 +1195,9 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor>
inRightMaskIt.SetIndex(curRightPos); inRightMaskIt.SetIndex(curRightPos);
} }
// check that the current positions are not masked // check that the current positions are not masked
if(!inLeftMaskPtr || (inLeftMaskPtr && inLeftMaskIt.Get() > 0) ) if(!inLeftMaskPtr || (inLeftMaskIt.Get() > 0) )
{ {
if(!inRightMaskPtr || (inRightMaskPtr && inRightMaskIt.Get() > 0) ) if(!inRightMaskPtr || (inRightMaskIt.Get() > 0) )
{ {
RegionType smallRightRegion; RegionType smallRightRegion;
smallRightRegion.SetIndex(0,curRightPos[0]-1); smallRightRegion.SetIndex(0,curRightPos[0]-1);
...@@ -1696,9 +1696,9 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> ...@@ -1696,9 +1696,9 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor>
inRightMaskIt.SetIndex(curRightPos); inRightMaskIt.SetIndex(curRightPos);
} }
// check that the current positions are not masked // check that the current positions are not masked
if(!inLeftMaskPtr || (inLeftMaskPtr && inLeftMaskIt.Get() > 0) ) if(!inLeftMaskPtr || (inLeftMaskIt.Get() > 0) )
{ {
if(!inRightMaskPtr || (inRightMaskPtr && inRightMaskIt.Get() > 0) ) if(!inRightMaskPtr || (inRightMaskIt.Get() > 0) )
{ {
RegionType smallRightRegion; RegionType smallRightRegion;
smallRightRegion.SetIndex(0,curRightPos[0]-1); smallRightRegion.SetIndex(0,curRightPos[0]-1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment