Commit b9f39c5f authored by remicres's avatar remicres

Keep projection, origin, and spacing from the input image

parent 7762ef1f
...@@ -51,7 +51,8 @@ namespace otb ...@@ -51,7 +51,8 @@ namespace otb
SetDescription("This application allows to use the Generic Region Merging library (GRM) and provides currently 3 homogeneity criteria: Euclidean Distance, Full Lambda Schedule and Baatz & Schape criterion."); SetDescription("This application allows to use the Generic Region Merging library (GRM) and provides currently 3 homogeneity criteria: Euclidean Distance, Full Lambda Schedule and Baatz & Schape criterion.");
AddParameter(ParameterType_InputImage, "in", "Input Image"); AddParameter(ParameterType_InputImage, "in", "Input Image");
AddParameter(ParameterType_OutputImage, "out", "Ouput Label Image"); AddParameter(ParameterType_OutputImage, "out", "Ouput Label Image");
// AddParameter(ParameterType_OutputImage, "outrvb", "Ouput Label Image (RVB 8bits)");
AddParameter(ParameterType_Choice, "criterion", "Homogeneity criterion to use"); AddParameter(ParameterType_Choice, "criterion", "Homogeneity criterion to use");
AddChoice("criterion.bs", "Baatz & Schape"); AddChoice("criterion.bs", "Baatz & Schape");
...@@ -98,6 +99,11 @@ namespace otb ...@@ -98,6 +99,11 @@ namespace otb
const unsigned int niter = GetParameterInt("niter"); const unsigned int niter = GetParameterInt("niter");
const int speed = GetParameterInt("speed"); const int speed = GetParameterInt("speed");
// Output images
LabelImageType::Pointer labelImage = LabelImageType::New();
typedef otb::VectorImage<unsigned char, 2> RGBLabelImageType;
RGBLabelImageType::Pointer rvbLabelImage = RGBLabelImageType::New();
if(selectedCriterion == "bs") if(selectedCriterion == "bs")
{ {
const float cw = GetParameterFloat("cw"); const float cw = GetParameterFloat("cw");
...@@ -120,7 +126,8 @@ namespace otb ...@@ -120,7 +126,8 @@ namespace otb
segmenter.Update(); segmenter.Update();
SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput()); labelImage = segmenter.GetLabeledClusteredOutput();
// rvbLabelImage = segmenter.GetClusteredImageOutput();
} }
else if(selectedCriterion == "ed") else if(selectedCriterion == "ed")
{ {
...@@ -135,7 +142,8 @@ namespace otb ...@@ -135,7 +142,8 @@ namespace otb
segmenter.Update(); segmenter.Update();
SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput()); labelImage = segmenter.GetLabeledClusteredOutput();
// rvbLabelImage = segmenter.GetClusteredImageOutput();
} }
else if(selectedCriterion == "fls") else if(selectedCriterion == "fls")
{ {
...@@ -150,8 +158,22 @@ namespace otb ...@@ -150,8 +158,22 @@ namespace otb
segmenter.Update(); segmenter.Update();
SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput()); labelImage = segmenter.GetLabeledClusteredOutput();
rvbLabelImage = segmenter.GetClusteredImageOutput();
} }
// Set output image projection, origin and spacing for labelImage
labelImage->SetProjectionRef(image->GetProjectionRef());
labelImage->SetOrigin(image->GetOrigin());
labelImage->SetSpacing(image->GetSpacing());
SetParameterOutputImage<LabelImageType>("out", labelImage);
// // Set output image projection, origin and spacing for RVB labelImage
// rvbLabelImage->SetProjectionRef(image->GetProjectionRef());
// rvbLabelImage->SetOrigin(image->GetOrigin());
// rvbLabelImage->SetSpacing(image->GetSpacing());
// SetParameterOutputImage<RGBLabelImageType>("outrvb", rvbLabelImage);
} }
}; };
} // end of namespace Wrapper } // end of namespace Wrapper
......
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