]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/IO/ImageReader.cxx
Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/cpPlugins
[cpPlugins.git] / lib / cpPlugins / Plugins / IO / ImageReader.cxx
index fec094476ad212fc25a3b08bf0c4eca793dc745c..48deb00a14d2f7fa5648465c8a435ec2b5def9a1 100644 (file)
@@ -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,11 @@ cpPlugins::IO::ImageReader::
 ImageReader( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::IO::ImageReader";
-  this->m_ClassCategory = "ImageReader";
-
   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 +65,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 +340,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 ) );
@@ -374,11 +367,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 +393,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
   }