diff --git a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx index a0acd991663128b0aadacfe0f5799c52d9437d6f..e9f69a04c17f5367a9a00ea84b276e267782594f 100644 --- a/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx +++ b/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx @@ -368,6 +368,11 @@ CommandLineLauncher::LoadParameters() } dynamic_cast<OutputImageParameter *>(param.GetPointer())->SetPixelType( outPixType ); } + else if( values.size() != 1 && values.size() != 2 ) + { + std::cout<<"INVALIDNUMBEROFVALUE2: "<<paramKey<<" "<<values.size()<<std::endl; + return INVALIDNUMBEROFVALUE; + } } else if( values.size() != 1) { @@ -401,26 +406,7 @@ CommandLineLauncher::LoadParameters() } } - else - { - return WRONGPARAMETERVALUE; - } - - // Loop over each output image parameter - std::vector<std::string> paramList = m_Application->GetParametersKeys(true); - std::vector<std::string>::const_iterator it = paramList.begin(); - for (; it != paramList.end(); ++it) - { - if (m_Application->GetParameterType(*it) == ParameterType_OutputImage) - { - Parameter* param = m_Application->GetParameterByKey(*it); - OutputImageParameter* outputParam = dynamic_cast<OutputImageParameter*>(param); - outputParam->SetPixelType( outPixType ); - } - } - } - - return OKPARAM; + return OKPARAM; } @@ -431,8 +417,8 @@ CommandLineLauncher::LinkWatchers() // Link internall filters watcher for( unsigned int i=0; i<m_Application->GetInternalProcessList().size(); i++ ) { - StandardOneLineFilterWatcher * watch = new StandardOneLineFilterWatcher(m_Application->GetInternalProcessList()[i], m_Application->GetInternalProcessListName()[i]); - m_WatcherList.push_back( watch ); + StandardOneLineFilterWatcher * watch = new StandardOneLineFilterWatcher(m_Application->GetInternalProcessList()[i], m_Application->GetInternalProcessListName()[i]); + m_WatcherList.push_back( watch ); } // Link output image writers watchers @@ -440,16 +426,16 @@ CommandLineLauncher::LinkWatchers() std::vector<std::string>::const_iterator it = paramList.begin(); for (; it != paramList.end(); ++it) { - if (m_Application->GetParameterType(*it) == ParameterType_OutputImage) - { - Parameter* param = m_Application->GetParameterByKey(*it); - OutputImageParameter* outputParam = dynamic_cast<OutputImageParameter*> (param); - itk::OStringStream oss; - oss << "Writing " << param->GetName() << "..."; - - StandardOneLineFilterWatcher * watch = new StandardOneLineFilterWatcher(outputParam->GetWriter(), oss.str()); - m_WatcherList.push_back(watch); - } + if (m_Application->GetParameterType(*it) == ParameterType_OutputImage) + { + Parameter* param = m_Application->GetParameterByKey(*it); + OutputImageParameter* outputParam = dynamic_cast<OutputImageParameter*> (param); + itk::OStringStream oss; + oss << "Writing " << param->GetName() << "..."; + + StandardOneLineFilterWatcher * watch = new StandardOneLineFilterWatcher(outputParam->GetWriter(), oss.str()); + m_WatcherList.push_back(watch); + } } }