Commit de9faf3c7d5e953f98682e38a6f1336b62ac6180

Authored by Pierre Lassalle
1 parent a9711386
Exists in master

Add projection information to label image (Remi cresson update)

Showing 1 changed file with 18 additions and 3 deletions   Show diff stats
app/GenericRegionMerging.cxx
... ... @@ -98,6 +98,11 @@ namespace otb
98 98 const unsigned int niter = GetParameterInt("niter");
99 99 const int speed = GetParameterInt("speed");
100 100  
  101 + // Output images
  102 + LabelImageType::Pointer labelImage = LabelImageType::New();
  103 + typedef otb::VectorImage<unsigned char, 2> RGBLabelImageType;
  104 + RGBLabelImageType::Pointer rvbLabelImage = RGBLabelImageType::New();
  105 +
101 106 if(selectedCriterion == "bs")
102 107 {
103 108 const float cw = GetParameterFloat("cw");
... ... @@ -120,7 +125,9 @@ namespace otb
120 125  
121 126 segmenter.Update();
122 127  
123   - SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
  128 +
  129 + labelImage = segmenter.GetLabeledClusteredOutput();
  130 + //SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
124 131 }
125 132 else if(selectedCriterion == "ed")
126 133 {
... ... @@ -135,7 +142,8 @@ namespace otb
135 142  
136 143 segmenter.Update();
137 144  
138   - SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
  145 + labelImage = segmenter.GetLabeledClusteredOutput();
  146 + //SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
139 147 }
140 148 else if(selectedCriterion == "fls")
141 149 {
... ... @@ -150,8 +158,15 @@ namespace otb
150 158  
151 159 segmenter.Update();
152 160  
153   - SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
  161 + labelImage = segmenter.GetLabeledClusteredOutput();
  162 + //SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
154 163 }
  164 +
  165 + // Set output image projection, origin and spacing for labelImage
  166 + labelImage->SetProjectionRef(image->GetProjectionRef());
  167 + labelImage->SetOrigin(image->GetOrigin());
  168 + labelImage->SetSpacing(image->GetSpacing());
  169 + SetParameterOutputImage<LabelImageType>("out", labelImage);
155 170 }
156 171 };
157 172 } // end of namespace Wrapper
... ...