Skip to content
Snippets Groups Projects
Commit 37e846ef authored by Julien Michel's avatar Julien Michel
Browse files

ENH: Adding binsizey and binstepy parameters to allow for anisotropic...

ENH: Adding binsizey and binstepy parameters to allow for anisotropic behaviour of the geobins mode of HomologousPointsExtraction application
parent 7dd4acd9
No related branches found
No related tags found
No related merge requests found
...@@ -147,16 +147,27 @@ private: ...@@ -147,16 +147,27 @@ private:
AddChoice("mode.geobins","Search keypoints in small spatial bins regularly spread accross first image"); AddChoice("mode.geobins","Search keypoints in small spatial bins regularly spread accross first image");
SetParameterDescription("mode.geobins","This method allows to retrieve a set of tie points regulary spread accross image 1. Corresponding bins in image 2 are retrieved using sensor and geographical information if available."); SetParameterDescription("mode.geobins","This method allows to retrieve a set of tie points regulary spread accross image 1. Corresponding bins in image 2 are retrieved using sensor and geographical information if available.");
AddParameter(ParameterType_Int,"mode.geobins.binsize","Size of bin"); AddParameter(ParameterType_Int,"mode.geobins.binsize","Size of bin");
SetParameterDescription("mode.geobins.binsize","Radius of the spatial bin in pixels"); SetParameterDescription("mode.geobins.binsize","Radius of the spatial bin in pixels");
SetDefaultParameterInt("mode.geobins.binsize",256); SetDefaultParameterInt("mode.geobins.binsize",256);
SetMinimumParameterIntValue("mode.geobins.binsize",1); SetMinimumParameterIntValue("mode.geobins.binsize",1);
AddParameter(ParameterType_Int,"mode.geobins.binsizey","Size of bin (y direction)");
SetParameterDescription("mode.geobins.binsizey","Radius of the spatial bin in pixels (y direction). If not set, the mode.geobins.binsize value is used.");
SetMinimumParameterIntValue("mode.geobins.binsizey",1);
MandatoryOff("mode.geobins.binsizey");
AddParameter(ParameterType_Int,"mode.geobins.binstep","Steps between bins"); AddParameter(ParameterType_Int,"mode.geobins.binstep","Steps between bins");
SetParameterDescription("mode.geobins.binstep","Steps between bins in pixels"); SetParameterDescription("mode.geobins.binstep","Steps between bins in pixels");
SetDefaultParameterInt("mode.geobins.binstep",256); SetDefaultParameterInt("mode.geobins.binstep",256);
SetMinimumParameterIntValue("mode.geobins.binstep",1); SetMinimumParameterIntValue("mode.geobins.binstep",1);
AddParameter(ParameterType_Int,"mode.geobins.binstepy","Steps between bins (y direction)");
SetParameterDescription("mode.geobins.binstepy","Steps between bins in pixels (y direction). If not set, the mode.geobins.binstep value is used.");
SetMinimumParameterIntValue("mode.geobins.binstepy",1);
MandatoryOff("mode.geobins.binstepy");
AddParameter(ParameterType_Float,"precision","Estimated precision of the colocalisation function (in pixels)."); AddParameter(ParameterType_Float,"precision","Estimated precision of the colocalisation function (in pixels).");
SetParameterDescription("precision","Estimated precision of the colocalisation function in pixels"); SetParameterDescription("precision","Estimated precision of the colocalisation function in pixels");
SetDefaultParameterFloat("precision",0.); SetDefaultParameterFloat("precision",0.);
...@@ -360,10 +371,24 @@ private: ...@@ -360,10 +371,24 @@ private:
{ {
// Compute binning on first image // Compute binning on first image
FloatImageType::SizeType size = this->GetParameterImage("in1")->GetLargestPossibleRegion().GetSize(); FloatImageType::SizeType size = this->GetParameterImage("in1")->GetLargestPossibleRegion().GetSize();
unsigned int bin_size = GetParameterInt("mode.geobins.binsize"); unsigned int bin_size_x = GetParameterInt("mode.geobins.binsize");
unsigned int bin_step = GetParameterInt("mode.geobins.binstep"); unsigned int bin_size_y = bin_size_x;
unsigned int nb_bins_x = size[0]/(bin_size + bin_step);
unsigned int nb_bins_y = size[1]/(bin_size + bin_step); if(IsParameterEnabled("mode.geobins.binsizey"))
{
bin_size_y = GetParameterInt("mode.geobins.binsizey");
}
unsigned int bin_step_x = GetParameterInt("mode.geobins.binstep");
unsigned int bin_step_y = bin_step_x;
if(IsParameterEnabled("mode.geobins.binstepy"))
{
bin_step_y = GetParameterInt("mode.geobins.binstepy");
}
unsigned int nb_bins_x = size[0]/(bin_size_x + bin_step_x);
unsigned int nb_bins_y = size[1]/(bin_size_y + bin_step_y);
FloatImageType::SpacingType spacing1 = this->GetParameterImage("in1")->GetSpacing(); FloatImageType::SpacingType spacing1 = this->GetParameterImage("in1")->GetSpacing();
FloatImageType::PointType origin1 = this->GetParameterImage("in1")->GetOrigin(); FloatImageType::PointType origin1 = this->GetParameterImage("in1")->GetOrigin();
...@@ -374,8 +399,8 @@ private: ...@@ -374,8 +399,8 @@ private:
{ {
for(unsigned int j = 0; j<nb_bins_y; ++j) for(unsigned int j = 0; j<nb_bins_y; ++j)
{ {
unsigned int startx = bin_step/2 + i*(bin_size + bin_step); unsigned int startx = bin_step_x/2 + i*(bin_size_x + bin_step_x);
unsigned int starty = bin_step/2 + j*(bin_size + bin_step); unsigned int starty = bin_step_y/2 + j*(bin_size_y + bin_step_y);
FloatImageType::SizeType size1; FloatImageType::SizeType size1;
...@@ -384,8 +409,8 @@ private: ...@@ -384,8 +409,8 @@ private:
index1[0]=startx; index1[0]=startx;
index1[1]=starty; index1[1]=starty;
size1[0] = bin_size; size1[0] = bin_size_x;
size1[1] = bin_size; size1[1] = bin_size_y;
region1.SetIndex(index1); region1.SetIndex(index1);
region1.SetSize(size1); region1.SetSize(size1);
...@@ -405,14 +430,14 @@ private: ...@@ -405,14 +430,14 @@ private:
ul1[0] = origin1[0] + startx * spacing1[0]; ul1[0] = origin1[0] + startx * spacing1[0];
ul1[1] = origin1[1] + starty * spacing1[1]; ul1[1] = origin1[1] + starty * spacing1[1];
ur1[0] = origin1[0] + (startx+bin_size) * spacing1[0]; ur1[0] = origin1[0] + (startx+bin_size_x) * spacing1[0];
ur1[1] = origin1[1] + starty * spacing1[1]; ur1[1] = origin1[1] + starty * spacing1[1];
lr1[0] = origin1[0] + (startx+bin_size) * spacing1[0]; lr1[0] = origin1[0] + (startx+bin_size_x) * spacing1[0];
lr1[1] = origin1[1] + (starty+bin_size) * spacing1[1]; lr1[1] = origin1[1] + (starty+bin_size_y) * spacing1[1];
ll1[0] = origin1[0] + (startx) * spacing1[0]; ll1[0] = origin1[0] + (startx) * spacing1[0];
ll1[1] = origin1[1] + (starty+bin_size) * spacing1[1]; ll1[1] = origin1[1] + (starty+bin_size_x) * spacing1[1];
p1 = rsTransform->TransformPoint(ul1); p1 = rsTransform->TransformPoint(ul1);
p2 = rsTransform->TransformPoint(ur1); p2 = rsTransform->TransformPoint(ur1);
......
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