Skip to content
Snippets Groups Projects
Commit 7d9f82f9 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

ENH: added parameters for radius

parent f5f6a261
No related branches found
No related tags found
No related merge requests found
......@@ -73,11 +73,31 @@ private:
SetParameterDescription("out","Output Rx score image");
MandatoryOn("out");
AddParameter(ParameterType_Int, "irx", "X Internal radius");
SetParameterDescription("irx", "Internal radius in pixel along the X axis");
SetDefaultParameterInt("irx", 1);
AddParameter(ParameterType_Int, "iry", "Y Internal radius");
SetParameterDescription("iry","Internal radius in pixel along the Y axis");
SetDefaultParameterInt("iry", 1);
AddParameter(ParameterType_Int, "erx", "X External radius");
SetParameterDescription("erx","External radius in pixel");
SetDefaultParameterInt("erx", 3);
AddParameter(ParameterType_Int, "ery", "Y External radius");
SetParameterDescription("ery","External radius in pixel");
SetDefaultParameterInt("ery", 3);
AddRAMParameter();
// Doc example parameter settings
SetDocExampleParameterValue("in", "cupriteSubHsi.tif");
SetDocExampleParameterValue("out", "LocalRxScore.tif");
SetDocExampleParameterValue("irx", "1");
SetDocExampleParameterValue("iry", "1");
SetDocExampleParameterValue("erx", "3");
SetDocExampleParameterValue("ery", "3");
SetOfficialDocLink();
}
......@@ -97,10 +117,10 @@ private:
auto detector = LocalRxDetectorFilterType::New();
detector->SetInput(inputImage);
//TODO this should be app parameters
unsigned int externalRadius = 3;
unsigned int internalRadius = 1;
// the radius are the same along x and y for the filter
unsigned int externalRadius = GetParameterInt("erx");
unsigned int internalRadius = GetParameterInt("irx");
detector->SetInternalRadius(internalRadius);
detector->SetExternalRadius(externalRadius);
......@@ -113,10 +133,13 @@ private:
#else
localRxDetectionFunctor<double> detectorFunctor;
detectorFunctor.SetInternalRadius(1);
auto localRxDetectionFunctorFilter = otb::NewFunctorFilter(detectorFunctor ,{{3,3}});
detectorFunctor.SetInternalRadius(GetParameterInt("irx"), GetParameterInt("iry"));
auto localRxDetectionFunctorFilter = otb::NewFunctorFilter
(detectorFunctor ,{{GetParameterInt("erx"),GetParameterInt("ery")}});
localRxDetectionFunctorFilter->SetVariadicInputs(inputImage);
//localRxDetectionFunctorFilter->Update();
SetParameterOutputImage("out", localRxDetectionFunctorFilter->GetOutput());
RegisterPipeline();
#endif
......
......@@ -129,22 +129,28 @@ public:
typedef typename CovarianceCalculatorType::MatrixType MatrixType;
private:
int m_InternalRadius;
int m_InternalRadiusX;
int m_InternalRadiusY;
public:
localRxDetectionFunctor():m_InternalRadius(1){};
localRxDetectionFunctor() : m_InternalRadiusX(1), m_InternalRadiusY(1) {};
void SetInternalRadius(int internalRadius)
void SetInternalRadius(int internalRadiusX, int internalRadiusY)
{
m_InternalRadius = internalRadius;
m_InternalRadiusX = internalRadiusX;
m_InternalRadiusY = internalRadiusY;
};
int GetInternalRadius()
int GetInternalRadiusX()
{
return m_InternalRadius;
return m_InternalRadiusX;
};
int GetInternalRadiusY()
{
return m_InternalRadiusY;
};
auto operator()(const itk::Neighborhood<itk::VariableLengthVector<T>> & in) const
{
......@@ -164,7 +170,7 @@ public:
for (int x = -static_cast<int>(externalRadius[0]); x <= static_cast<int>(externalRadius[0]); x++)
{
off[0] = x;
if ((abs(x) > m_InternalRadius) || (abs(y) > m_InternalRadius))
if ((abs(x) > m_InternalRadiusX) || (abs(y) > m_InternalRadiusY))
{//std::cout << in[off] << std::endl;
listSample->PushBack(in[off] );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment