diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.cxx b/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.cxx index 005d6b1b71d3041883ecf66caed71aa2117294ee..6acf887d0aa8fdbbd1d730bf7ba866d0fe97b082 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.cxx +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.cxx @@ -17,7 +17,6 @@ =========================================================================*/ #include "otbWrapperQtWidgetModel.h" #include "otbWrapperOutputImageParameter.h" -#include "itkImageFileWriter.h" namespace otb { @@ -41,27 +40,9 @@ void QtWidgetModel::NotifyUpdate() m_Application->UpdateParameters(); } -void QtWidgetModel::Execute() +void QtWidgetModel::ExecuteAndWriteOutput() { - m_Application->Execute(); - - ParameterGroup* params = m_Application->GetParameterList(); - for (unsigned int i = 0; i < params->GetNumberOfParameters(); ++i) - { - Parameter* p = params->GetParameterByIndex( i ); - - OutputImageParameter* pAsOutputImage = dynamic_cast<OutputImageParameter*>(p); - if ( pAsOutputImage != 0 ) - { - VectorImageType* image = pAsOutputImage->GetValue(); - typedef itk::ImageFileWriter<VectorImageType> WriterType; - - WriterType::Pointer writer = WriterType::New(); - writer->SetInput(image); - writer->SetFileName(pAsOutputImage->GetFileName()); - writer->Update(); - } - } + m_Application->ExecuteAndWriteOutput(); } } diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h b/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h index 2dcf589992d6b899c5495546ca6d45db991f3cc1..98ee11c1e486a6f939df3ba3a02b2c904c4acff3 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h @@ -48,7 +48,7 @@ protected slots: void NotifyUpdate(); // slot called when execution is requested - void Execute(); + void ExecuteAndWriteOutput(); private: QtWidgetModel(const QtWidgetModel&); //purposely not implemented diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx b/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx index 597f8793e5af3c4c07252ed2117adc4989480da9..4a94986292c414a2995450a3dcab1664034800be 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx @@ -127,7 +127,7 @@ QWidget* QtWidgetView::CreateFooter() //m_ExecButton->setStyleSheet("border-style: none"); m_ExecButton->setDefault(true); m_ExecButton->setText(QObject::tr("Execute")); - connect( m_ExecButton, SIGNAL(clicked()), m_Model, SLOT(Execute()) ); + connect( m_ExecButton, SIGNAL(clicked()), m_Model, SLOT(ExecuteAndWriteOutput()) ); m_QuitButton = new QPushButton(footerGroup); m_QuitButton->setText(QObject::tr("Quit"));