Commit b9f39c5f authored by remicres's avatar remicres

Keep projection, origin, and spacing from the input image

parent 7762ef1f
......@@ -52,6 +52,7 @@ namespace otb
AddParameter(ParameterType_InputImage, "in", "Input 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");
AddChoice("criterion.bs", "Baatz & Schape");
......@@ -98,6 +99,11 @@ namespace otb
const unsigned int niter = GetParameterInt("niter");
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")
{
const float cw = GetParameterFloat("cw");
......@@ -120,7 +126,8 @@ namespace otb
segmenter.Update();
SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
labelImage = segmenter.GetLabeledClusteredOutput();
// rvbLabelImage = segmenter.GetClusteredImageOutput();
}
else if(selectedCriterion == "ed")
{
......@@ -135,7 +142,8 @@ namespace otb
segmenter.Update();
SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
labelImage = segmenter.GetLabeledClusteredOutput();
// rvbLabelImage = segmenter.GetClusteredImageOutput();
}
else if(selectedCriterion == "fls")
{
......@@ -150,8 +158,22 @@ namespace otb
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
......
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