X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FIO%2FImageReader.cxx;h=6068c88390f47c205978a09e4250e8c3cbb7482e;hb=91f750d8a54e87cdd626566aad3d80940ae041fd;hp=fec094476ad212fc25a3b08bf0c4eca793dc745c;hpb=d1d816d1eaf980d5cd266798b8f7a0bbb089a383;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/IO/ImageReader.cxx b/lib/cpPlugins/Plugins/IO/ImageReader.cxx index fec0944..6068c88 100644 --- a/lib/cpPlugins/Plugins/IO/ImageReader.cxx +++ b/lib/cpPlugins/Plugins/IO/ImageReader.cxx @@ -25,14 +25,13 @@ ExecConfigurationDialog( QWidget* parent ) dialog.setNameFilter( QFileDialog::tr( "All files (*)" ) ); if( dialog.exec( ) ) { - this->m_Parameters = this->m_DefaultParameters; QStringList names = dialog.selectedFiles( ); QStringList::const_iterator qIt = names.begin( ); for( ; qIt != names.end( ); ++qIt ) - this->m_Parameters.AddValueToStringList( + this->m_Parameters->AddToStringList( "FileNames", qIt->toStdString( ) ); - this->m_Parameters.SetValueAsBool( "VectorType", false ); + this->m_Parameters->SetBool( "VectorType", false ); r = true; } // fi @@ -47,17 +46,10 @@ cpPlugins::IO::ImageReader:: ImageReader( ) : Superclass( ) { - this->m_ClassName = "cpPlugins::IO::ImageReader"; - this->m_ClassCategory = "ImageReader"; + this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); - this->SetNumberOfOutputs( 1 ); - this->_MakeOutput< cpPlugins::Interface::Image >( 0 ); - - using namespace cpPlugins::Interface; - this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" ); - this->m_DefaultParameters.Configure( Parameters::Bool, "VectorType" ); - this->m_DefaultParameters.SetValueAsBool( "VectorType", false ); - this->m_Parameters = this->m_DefaultParameters; + this->m_Parameters->ConfigureAsStringList( "FileNames" ); + this->m_Parameters->ConfigureAsBool( "VectorType", false ); } // ------------------------------------------------------------------------- @@ -72,7 +64,7 @@ _GenerateData( ) { // Get filenames TStringList names; - this->m_Parameters.GetValueAsStringList( names, "FileNames" ); + this->m_Parameters->GetStringList( names, "FileNames" ); std::string r = ""; if( names.size( ) >= 1 ) @@ -347,7 +339,7 @@ template< class P, unsigned int D > std::string cpPlugins::IO::ImageReader:: _GD1( const TStringList& names ) { - if( this->m_Parameters.GetValueAsBool( "VectorType" ) ) + if( this->m_Parameters->GetBool( "VectorType" ) ) return( this->_RealGD< itk::VectorImage< P, D > >( names ) ); else return( this->_RealGD< itk::Image< P, D > >( names ) ); @@ -359,7 +351,7 @@ std::string cpPlugins::IO::ImageReader:: _RealGD( const TStringList& names ) { cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( 0 ); + this->GetOutput< cpPlugins::Interface::Image >( "Output" ); if( out == NULL ) return( "ImageReader: No output object properly created." ); @@ -374,11 +366,13 @@ _RealGD( const TStringList& names ) { reader->Update( ); out->SetITK< I >( reader->GetOutput( ) ); + out->SetName( names[ 0 ] ); } catch( itk::ExceptionObject& err ) { r = "ImageReader: " + std::string( err.GetDescription( ) ); out->SetITK< I >( NULL ); + out->SetName( "" ); } // yrt } @@ -398,11 +392,13 @@ _RealGD( const TStringList& names ) { reader->Update( ); out->SetITK< I >( reader->GetOutput( ) ); + out->SetName( *( ordered_names.begin( ) ) ); } catch( itk::ExceptionObject& err ) { r = "ImageReader: " + std::string( err.GetDescription( ) ); out->SetITK< I >( NULL ); + out->SetName( "" ); } // yrt }