diff --git a/Applications/Segmentation/otbMeanShiftSegmentation.cxx b/Applications/Segmentation/otbMeanShiftSegmentation.cxx index c8060e5fc1b8f1099c5fac6b676b7e2441941e62..a7ea6795e59eeecc51db5243eb36fa5ab47121e2 100644 --- a/Applications/Segmentation/otbMeanShiftSegmentation.cxx +++ b/Applications/Segmentation/otbMeanShiftSegmentation.cxx @@ -94,10 +94,14 @@ private: m_Ref = filter; - SetParameterOutputImage("fout", filter->GetOutput()); - SetParameterOutputImage("cout", filter->GetClusteredOutput()); - SetParameterOutputImage("lout", filter->GetLabeledClusteredOutput()); - SetParameterOutputImage("cbout", filter->GetClusterBoundariesOutput()); + if (IsParameterEnabled("fout") && HasValue("fout")) + SetParameterOutputImage("fout", filter->GetOutput()); + if (IsParameterEnabled("cout") && HasValue("cout")) + SetParameterOutputImage("cout", filter->GetClusteredOutput()); + if (IsParameterEnabled("lout") && HasValue("lout")) + SetParameterOutputImage("lout", filter->GetLabeledClusteredOutput()); + if (IsParameterEnabled("cbout") && HasValue("cbout")) + SetParameterOutputImage("cbout", filter->GetClusterBoundariesOutput()); } itk::LightObject::Pointer m_Ref;