X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FIO%2FImageReader.cxx;h=900940bfcaf97c7a9d0e22149e1a56065d55b700;hb=7e29f3aec097ba1bff1894fed6eb1094276c5b72;hp=c093e210b3d103ded7a434714a0a1d8b738c7336;hpb=1b600247da314fe62d007ca8a0ce24d0006931f4;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/IO/ImageReader.cxx b/lib/cpPlugins/Plugins/IO/ImageReader.cxx index c093e21..900940b 100644 --- a/lib/cpPlugins/Plugins/IO/ImageReader.cxx +++ b/lib/cpPlugins/Plugins/IO/ImageReader.cxx @@ -4,53 +4,6 @@ #include #include -/* 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; - - #ifdef cpPlugins_Interface_QT4 - - QStringList filters; - filters - << "Image files (*.bmp *.png *.jpg *.jpeg *.dcm *.mhd *.nhdr *.nrrd *.tiff)" - << "Any files (*)"; - - 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; - - } // fi - - #endif // cpPlugins_Interface_QT4 - - return( r ); - } -*/ - // ------------------------------------------------------------------------- cpPlugins::IO::ImageReader:: ImageReader( ) @@ -61,6 +14,10 @@ ImageReader( ) 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)" + ); } // ------------------------------------------------------------------------- @@ -361,9 +318,6 @@ std::string cpPlugins::IO::ImageReader:: _RealGD( const TStringList& names ) { auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); - if( out == NULL ) - return( "ImageReader: No output object properly created." ); - std::string r = ""; if( names.size( ) == 1 ) { @@ -374,14 +328,12 @@ _RealGD( const TStringList& names ) try { reader->Update( ); - out->SetITK< I >( reader->GetOutput( ) ); - out->SetName( names[ 0 ] ); + out->SetITK( reader->GetOutput( ) ); } catch( itk::ExceptionObject& err ) { r = "ImageReader: " + std::string( err.GetDescription( ) ); - out->SetITK< I >( NULL ); - out->SetName( "" ); + out->SetITK( NULL ); } // yrt } @@ -395,14 +347,12 @@ _RealGD( const TStringList& names ) try { reader->Update( ); - out->SetITK< I >( reader->GetOutput( ) ); - out->SetName( names[ 0 ] ); + out->SetITK( reader->GetOutput( ) ); } catch( itk::ExceptionObject& err ) { r = "ImageReader: " + std::string( err.GetDescription( ) ); - out->SetITK< I >( NULL ); - out->SetName( "" ); + out->SetITK( NULL ); } // yrt }