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:
}
protected:
CurlFileDescriptorResource(){}
CurlFileDescriptorResource(): m_File(nullptr) {}
~CurlFileDescriptorResource() override
{
......@@ -195,9 +195,9 @@ protected:
private:
FILE * m_File;
// prevent copying and assignment; not implemented
CurlFileDescriptorResource (const CurlFileDescriptorResource &);
CurlFileDescriptorResource & operator= (const CurlFileDescriptorResource &);
// prevent copying and assignment
CurlFileDescriptorResource (const CurlFileDescriptorResource &) = delete;
CurlFileDescriptorResource & operator= (const CurlFileDescriptorResource &) = delete;
}; //end of class FileResource
#endif // OTB_USE_CURL
......
......@@ -123,7 +123,7 @@ public:
const RegionType& region) override;
protected:
ImageRegionTileMapSplitter() : m_AlignStep(256){}
ImageRegionTileMapSplitter() : m_SplitsPerDimension{0}, m_AlignStep(256) {}
~ImageRegionTileMapSplitter() override {}
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
......
......@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double>
class BlackmanWindowFunction
{
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)
{
m_Radius = radius;
......@@ -95,8 +96,7 @@ template<class TInputImage, class TBoundaryCondition = itk::ConstantBoundaryCond
double, class TInputInterpolator = double, class TOutputInterpolator = double>
class ITK_EXPORT WindowedSincInterpolateImageBlackmanFunction :
public WindowedSincInterpolateImageFunctionBase<TInputImage,
typename Function::BlackmanWindowFunction<TInputInterpolator,
TOutputInterpolator>,
typename Function::BlackmanWindowFunction<TInputInterpolator, TOutputInterpolator>,
TBoundaryCondition,
TCoordRep>
{
......
......@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double>
class CosineWindowFunction
{
public:
CosineWindowFunction(): m_Radius(1), m_Factor(CONST_PI / 2.0) {} // default radius is 1 at construction
void SetRadius(unsigned int radius)
{
m_Radius = radius;
......@@ -63,9 +64,9 @@ public:
return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px);
}
private:
unsigned int m_Radius;
// Equal to \f$ \frac{\pi}{2 m} \f$
double m_Factor;
unsigned int m_Radius;
};
} //namespace Function
......
......@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double>
class GaussianWindowFunction
{
public:
GaussianWindowFunction(): m_Radius(1), m_Factor(-2.0 / CONST_PI) {} // default radius is 1 at construction
void SetRadius(unsigned int radius)
{
m_Radius = radius;
......@@ -63,8 +64,8 @@ public:
return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px);
}
private:
double m_Factor;
unsigned int m_Radius;
double m_Factor;
};
} //namespace Function
......
......@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double>
class HammingWindowFunction
{
public:
HammingWindowFunction(): m_Radius(1), m_Factor(CONST_PI) {} // default radius is 1 at construction
void SetRadius(unsigned int radius)
{
m_Radius = radius;
......@@ -63,9 +64,9 @@ public:
return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px);
}
private:
unsigned int m_Radius;
// Equal to \f$ \frac{\pi}{m} \f$
double m_Factor;
unsigned int m_Radius;
};
} //namespace Function
......
......@@ -43,6 +43,7 @@ template<class TInput = double, class TOutput = double>
class LanczosWindowFunction
{
public:
LanczosWindowFunction(): m_Radius(1), m_Factor(CONST_PI) {} // default factor is 1 at construction
void SetRadius(unsigned int radius)
{
m_Radius = radius;
......@@ -74,9 +75,9 @@ public:
return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px);
}
private:
unsigned int m_Radius;
// Equal to \f$ \frac{\pi}{m} \f$
double m_Factor;
unsigned int m_Radius;
};
} //namespace Function
......
......@@ -41,6 +41,7 @@ template<class TInput = double, class TOutput = double>
class WelchWindowFunction
{
public:
WelchWindowFunction() : m_Radius(1), m_Factor(1) {} // default radius is 1 at construction
void SetRadius(unsigned int radius)
{
m_Radius = radius;
......@@ -63,9 +64,9 @@ public:
return (x == 0.0) ? static_cast<TOutput>(temp) : static_cast<TOutput>(temp * std::sin(px) / px);
}
private:
unsigned int m_Radius;
// Equal to \f$ \frac{1}{m^2} \f$
double m_Factor;
unsigned int m_Radius;
};
} //namespace Function
......
......@@ -32,7 +32,7 @@ namespace otb
*/
template <class TInputPointSet, class TOutputPointSet>
PointSetExtractROI<TInputPointSet, TOutputPointSet>
::PointSetExtractROI()
::PointSetExtractROI() : m_StartX(0), m_StartY(0), m_SizeX(0), m_SizeY(0)
{
}
......
......@@ -34,9 +34,8 @@ namespace otb
*/
template <class TInputImage, class TOutputImage>
EstimateInnerProductPCAImageFilter<TInputImage, TOutputImage>
::EstimateInnerProductPCAImageFilter()
::EstimateInnerProductPCAImageFilter(): m_NumberOfPrincipalComponentsRequired(1), m_CenterData(true)
{
m_NumberOfPrincipalComponentsRequired = 1;
}
/**
......
......@@ -36,6 +36,7 @@ InnerProductPCAImageFilter<TInputImage, TOutputImage>
this->SetNthOutput(0, OutputImageType::New());
m_EstimatePCAFilter = EstimatePCAFilterType::New();
m_NormalizePCAFilter = NormalizePCAFilterType::New();
m_NumberOfPrincipalComponentsRequired = 1;
m_CenterData = true;
m_GenerateMeanComponent = false;
m_MeanFilter = MeanFilterType::New();
......
......@@ -36,14 +36,18 @@ namespace otb
*/
template <class TInputImage, class TOutputImage, class 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->InPlaceOff();
SetEmissionH(false);
SetEmissionV(false);
SetGain(1);
SetMode(0);
m_ArchitectureType = PolarimetricData::New();
}
......
......@@ -59,10 +59,12 @@ class SpatialRangeJointDomainTransform
public:
typedef double RealType;
SpatialRangeJointDomainTransform()
SpatialRangeJointDomainTransform():
m_ImageDimension(0),
m_NumberOfComponentsPerPixel(0),
m_OutputSize(0)
{
}
// ~SpatialRangeJointDomainTransform() {}
typename TOutputJointImage::PixelType operator()(const typename TInputImage::PixelType & inputPixel,
const typename TInputImage::IndexType & index) const
......
......@@ -155,11 +155,6 @@ GDALOverviewsBuilder
if( factor<=1 )
return 0;
assert( minSize>0 );
if( minSize<=0 )
return 0;
assert( !m_GDALDataset.IsNull() );
// unsigned int minSize = static_cast< unsigned int >( pow( factor, n ) );
......
......@@ -43,7 +43,7 @@ void
ScalarBufferToImageFileWriter<TBufferType, TOutputPixelType>::GenerateData()
{
// 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.");
}
......
......@@ -188,9 +188,8 @@ int main(int ac, char* av[])
}
// 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;
// Create the appropriate itk process
itksysProcess * process = itksysProcess_New();
......
......@@ -243,11 +243,6 @@ void
MarkovRandomFieldFilter<TInputImage, TClassifiedImage>
::Allocate()
{
if (m_NumberOfClasses <= 0)
{
throw itk::ExceptionObject(__FILE__, __LINE__, "NumberOfClasses <= 0.", ITK_LOCATION);
}
//Set the output labelled and allocate the memory
LabelledImagePointer outputPtr = this->GetOutput();
......
......@@ -260,7 +260,7 @@ DisparityMapMedianFilter< TInputImage, TOutputImage, TMask>
InputIt.SetLocation(outputIt.GetIndex());
for (unsigned int i=0; i<InputIt.Size(); i++)
{
if (!inputmaskPtr || (inputmaskPtr && MaskInputIt.GetPixel(i) != 0))
if (!inputmaskPtr || (MaskInputIt.GetPixel(i) != 0))
{
p++;
pixels.push_back(InputIt.GetPixel(i));
......@@ -347,7 +347,7 @@ DisparityMapMedianFilter< TInputImage, TOutputImage, TMask>
MaskInputIt.SetLocation(outputIt.GetIndex());
}
if ((!inputmaskPtr || (inputmaskPtr && MaskInputIt.GetCenterPixel() != 0)) &&
if ((!inputmaskPtr || (MaskInputIt.GetCenterPixel() != 0)) &&
std::fabs(InputIt.GetCenterPixel() - MedianIt.Get())>m_IncoherenceThreshold)
{
outputDisparityMapIt.Set(0.0); //Remove pixel from disparity map//
......
......@@ -670,9 +670,9 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor>
((tmpIndex[1] - this->m_GridIndex[1] + this->m_Step) % this->m_Step == 0))
{
// 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 estimatedMinVDisp = m_MinimumVerticalDisparity;
......
......@@ -762,9 +762,9 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor>
inRightMaskIt.SetIndex(curRightPos);
}
// 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;
smallRightRegion.SetIndex(0,curRightPos[0]-1);
......@@ -1195,9 +1195,9 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor>
inRightMaskIt.SetIndex(curRightPos);
}
// 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;
smallRightRegion.SetIndex(0,curRightPos[0]-1);
......@@ -1696,9 +1696,9 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor>
inRightMaskIt.SetIndex(curRightPos);
}
// 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;
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