X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FIO%2FImageReader.cxx;h=c093e210b3d103ded7a434714a0a1d8b738c7336;hb=1b600247da314fe62d007ca8a0ce24d0006931f4;hp=a7c6687c199b1cbc9c80f8695f4843e3971f1f41;hpb=c0627ed97baf80b6751379801fc4d5c377b45467;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/IO/ImageReader.cxx b/lib/cpPlugins/Plugins/IO/ImageReader.cxx index a7c6687..c093e21 100644 --- a/lib/cpPlugins/Plugins/IO/ImageReader.cxx +++ b/lib/cpPlugins/Plugins/IO/ImageReader.cxx @@ -4,61 +4,63 @@ #include #include -#ifdef cpPlugins_Interface_QT4 -#include -#endif // cpPlugins_Interface_QT4 +/* TODO + #ifdef cpPlugins_Interface_QT4 + #include + #endif // cpPlugins_Interface_QT4 -// ------------------------------------------------------------------------- -cpPlugins::IO::ImageReader:: -DialogResult cpPlugins::IO::ImageReader:: -ExecConfigurationDialog( QWidget* parent ) -{ - DialogResult r = Self::DialogResult_Cancel; + // ------------------------------------------------------------------------- + cpPlugins::IO::ImageReader:: + DialogResult cpPlugins::IO::ImageReader:: + ExecConfigurationDialog( QWidget* parent ) + { + DialogResult r = Self::DialogResult_Cancel; -#ifdef cpPlugins_Interface_QT4 + #ifdef cpPlugins_Interface_QT4 - QStringList filters; - filters - << "Image files (*.bmp *.png *.jpg *.jpeg *.dcm *.mhd *.nhdr *.nrrd *.tiff)" - << "Any files (*)"; + 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 ]: "."; + TStringList names = this->m_Parameters->GetFileNameList( "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 = Self::DialogResult_NoModal; + // 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 = Self::DialogResult_NoModal; - } // fi + } // fi -#endif // cpPlugins_Interface_QT4 + #endif // cpPlugins_Interface_QT4 - return( r ); -} + 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 ); } // ------------------------------------------------------------------------- @@ -72,8 +74,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 ) @@ -106,7 +107,7 @@ _GenerateData( ) r = "ImageReader: Could not CreateImageIO for \"" + names[ 0 ] + "\""; } else - r = "No image files given"; + r = "ImageReader: No image files given"; return( r ); } @@ -359,8 +360,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." );