]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/IO/ImageReader.cxx
...
[cpPlugins.git] / lib / cpPlugins / Plugins / IO / ImageReader.cxx
index fc747eb7348f910d36a04f936a10a9f8ee43fce4..cd0d6c9d41e26526596a9af595bc3e5c05f7a4ca 100644 (file)
@@ -4,60 +4,20 @@
 #include <itkImageFileReader.h>
 #include <itkImageSeriesReader.h>
 
-#ifdef cpPlugins_Interface_QT4
-#include <QFileDialog>
-#endif // cpPlugins_Interface_QT4
-
-// -------------------------------------------------------------------------
-bool cpPlugins::IO::ImageReader::
-ExecConfigurationDialog( QWidget* parent )
-{
-  bool r = false;
-
-#ifdef cpPlugins_Interface_QT4
-
-  QStringList filters;
-  filters
-    << "Image files (*.bmp *.png *.jpg *.jpeg *.dcm *.mhd *.nhdr *.nrrd *.tiff)"
-    << "Any files (*)";
-
-  std::vector< std::string > names;
-  this->m_Parameters->GetStringList( names, "FileNames" );
-  std::string name = ( names.size( ) > 0 )? names[ 0 ]: ".";
-
-  // Show dialog and check if it was accepted
-  QFileDialog dialog( parent );
-  dialog.setFileMode( QFileDialog::ExistingFiles );
-  dialog.setDirectory( QFileDialog::tr( name.c_str( ) ) );
-  dialog.setNameFilters( filters );
-  dialog.setAcceptMode( QFileDialog::AcceptOpen );
-  if( dialog.exec( ) )
-  {
-    QStringList names = dialog.selectedFiles( );
-    QStringList::const_iterator qIt = names.begin( );
-    for( ; qIt != names.end( ); ++qIt )
-      this->m_Parameters->AddToStringList(
-        "FileNames", qIt->toStdString( )
-        );
-    this->m_Parameters->SetBool( "VectorType", false );
-    r = true;
-
-  } // fi
-
-#endif // cpPlugins_Interface_QT4
-
-  return( r );
-}
-
 // -------------------------------------------------------------------------
 cpPlugins::IO::ImageReader::
 ImageReader( )
   : Superclass( )
 {
-  this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
+  this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
-  this->m_Parameters->ConfigureAsStringList( "FileNames" );
-  this->m_Parameters->ConfigureAsBool( "VectorType", false );
+  this->m_Parameters->ConfigureAsOpenFileNameList( "FileNames" );
+  this->m_Parameters->ConfigureAsBool( "VectorType" );
+  this->m_Parameters->SetBool( "VectorType", false );
+  this->m_Parameters->SetAcceptedFileExtensions(
+    "FileNames",
+    "Image files (*.bmp *.png *.jpg *.jpeg *.dcm *.mhd *.nhdr *.nrrd *.tiff)"
+    );
 }
 
 // -------------------------------------------------------------------------
@@ -71,8 +31,7 @@ std::string cpPlugins::IO::ImageReader::
 _GenerateData( )
 {
   // Get filenames
-  TStringList names;
-  this->m_Parameters->GetStringList( names, "FileNames" );
+  TStringList names = this->m_Parameters->GetOpenFileNameList( "FileNames" );
 
   std::string r = "";
   if( names.size( ) >= 1 )
@@ -105,7 +64,7 @@ _GenerateData( )
       r = "ImageReader: Could not CreateImageIO for \"" + names[ 0 ] + "\"";
   }
   else
-    r = "No image files given";
+    r = "ImageReader: No image files given";
   return( r );
 }
 
@@ -358,8 +317,7 @@ template< class I >
 std::string cpPlugins::IO::ImageReader::
 _RealGD( const TStringList& names )
 {
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
   if( out == NULL )
     return( "ImageReader: No output object properly created." );