From e50bc0fcfedc22eef90e5b1bff7a856f84ce2882 Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Tue, 11 Oct 2011 11:47:01 +0200
Subject: [PATCH] BUG: keep a reference on the extract filter

---
 .../Classification/otbImageSVMClassifier.cxx         | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Applications/Classification/otbImageSVMClassifier.cxx b/Applications/Classification/otbImageSVMClassifier.cxx
index f28ecc476e..5ba1c6f4b4 100644
--- a/Applications/Classification/otbImageSVMClassifier.cxx
+++ b/Applications/Classification/otbImageSVMClassifier.cxx
@@ -154,12 +154,12 @@ private:
       otbAppLogINFO("Using input mask");
       // Load mask image and cast into LabeledImageType
       FloatVectorImageType::Pointer inMask = GetParameterImage("mask");
-      ExtractImageFilterType::Pointer extract = ExtractImageFilterType::New();
-      extract->SetInput( inMask );
-      extract->SetChannel(0);
-      extract->UpdateOutputInformation();
+      m_Extract = ExtractImageFilterType::New();
+      m_Extract->SetInput( inMask );
+      m_Extract->SetChannel(0);
+      m_Extract->UpdateOutputInformation();
       
-      m_ClassificationFilter->SetInputMask(extract->GetOutput());
+      m_ClassificationFilter->SetInputMask(m_Extract->GetOutput());
       }
 
     SetParameterOutputImage<UInt8ImageType>("out", m_ClassificationFilter->GetOutput());
@@ -168,7 +168,7 @@ private:
   ClassificationFilterType::Pointer m_ClassificationFilter;
   ModelPointerType m_ModelSVM;
   RescalerType::Pointer m_Rescaler;
-  CastImageFilterType::Pointer m_FinalCast;
+  ExtractImageFilterType::Pointer m_Extract;
 };
 
 
-- 
GitLab