Commit 9404203f26304d8894da1de953cf6fb6ad03eb6d

Authored by Pierre Lassalle
1 parent 60b9057a
Exists in master

Remove LabelImageWriter

Showing 2 changed files with 4 additions and 23 deletions   Show diff stats
CMakeLists.txt
... ... @@ -21,10 +21,6 @@ else()
21 21 message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
22 22 endif()
23 23  
24   -#set(GRM_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
25   -
26   -#include_directories(${GRM_INCLUDE_DIR})
27   -
28 24 project(OTBGRM)
29 25  
30 26 set(OTBGRM_LIBRARIES OTBGRM)
... ...
app/GenericRegionMerging.cxx
... ... @@ -34,6 +34,7 @@ namespace otb
34 34 {
35 35 public:
36 36 typedef GenericRegionMerging Self;
  37 + typedef Application SuperClass;
37 38 typedef itk::SmartPointer<Self> Pointer;
38 39  
39 40 typedef FloatVectorImageType ImageType;
... ... @@ -83,15 +84,11 @@ namespace otb
83 84 void DoExecute()
84 85 {
85 86  
86   -
87 87 // Mandatory parameters
88 88 // Input Image
89 89 ImageType::Pointer image = GetParameterImage("in");
90 90 image->Update();
91 91  
92   - // Output label file name.
93   - const std::string labelImageFileName = GetParameterString("out");
94   -
95 92 // Criterion selected
96 93 const std::string selectedCriterion = GetParameterString("criterion");
97 94  
... ... @@ -101,8 +98,6 @@ namespace otb
101 98 const unsigned int niter = GetParameterInt("niter");
102 99 const int speed = GetParameterInt("speed");
103 100  
104   - typedef otb::ImageFileWriter<LabelImageType> LabelImageWriter;
105   -
106 101 if(selectedCriterion == "bs")
107 102 {
108 103 const float cw = GetParameterFloat("cw");
... ... @@ -125,11 +120,7 @@ namespace otb
125 120  
126 121 segmenter.Update();
127 122  
128   -
129   - LabelImageWriter::Pointer labelWriter = LabelImageWriter::New();
130   - labelWriter->SetFileName(labelImageFileName);
131   - labelWriter->SetInput(segmenter.GetLabeledClusteredOutput());
132   - labelWriter->Update();
  123 + SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
133 124 }
134 125 else if(selectedCriterion == "ed")
135 126 {
... ... @@ -144,10 +135,7 @@ namespace otb
144 135  
145 136 segmenter.Update();
146 137  
147   - LabelImageWriter::Pointer labelWriter = LabelImageWriter::New();
148   - labelWriter->SetFileName(labelImageFileName);
149   - labelWriter->SetInput(segmenter.GetLabeledClusteredOutput());
150   - labelWriter->Update();
  138 + SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
151 139 }
152 140 else if(selectedCriterion == "fls")
153 141 {
... ... @@ -162,10 +150,7 @@ namespace otb
162 150  
163 151 segmenter.Update();
164 152  
165   - LabelImageWriter::Pointer labelWriter = LabelImageWriter::New();
166   - labelWriter->SetFileName(labelImageFileName);
167   - labelWriter->SetInput(segmenter.GetLabeledClusteredOutput());
168   - labelWriter->Update();
  153 + SetParameterOutputImage<LabelImageType>("out", segmenter.GetLabeledClusteredOutput());
169 154 }
170 155 }
171 156 };
... ...