-ClearInteractors( )
-{
- this->m_Interactors.clear( );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasImageReader( ) const
-{
- return( this->m_ImageReader.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasDicomSeriesReader( ) const
-{
- return( this->m_DicomSeriesReader.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasMeshReader( ) const
-{
- return( this->m_MeshReader.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasImageWriter( ) const
-{
- return( this->m_ImageWriter.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasMeshWriter( ) const
-{
- return( this->m_MeshWriter.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage( const std::string& fname, const std::string& parent )
-{
- std::vector< std::string > fnames;
- fnames.push_back( fname );
- return( this->ReadImage( fnames, parent ) );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage(
- const std::vector< std::string >& fnames, const std::string& parent
- )
-{
- // Check if object exists
- if( this->m_ImageReader.IsNull( ) )
- return( "" );
-
- // Configure object
- TParameters* params = this->m_ImageReader->GetParameters( );
- params->ClearStringList( "FileNames" );
- auto i = fnames.begin( );
- for( ; i != fnames.end( ); ++i )
- params->AddToStringList( "FileNames", *i );
-
- // Execute filter
- this->BlockWidget( );
- std::string err = this->m_ImageReader->Update( );
- this->UnblockWidget( );
-
- // Get result, if any
- if( err == "" )
- {
- TImage* image = this->m_ImageReader->GetOutput< TImage >( "Output" );
- this->m_ImageReader->DisconnectOutputs( );
-
- // Add newly added data
- if( this->_InsertNewData( image, parent ) )
- return( image->GetName( ) );
- else
- return( "" );
- }
- else
- {
-#ifdef cpPlugins_Interface_QT4
- if( this->m_Widget != NULL )
- QMessageBox::critical(
- this->m_Widget,
- QMessageBox::tr( "Error reading image." ),
- QMessageBox::tr( err.c_str( ) )
- );
-#else // cpPlugins_Interface_QT4
- std::cerr << "Error reading image: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
- return( "" );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage( const std::string& parent )
-{
- // Check if object exists
- if( this->m_ImageReader.IsNull( ) )
- return( "" );
-
- // Configure object
- TProcessObject::DialogResult dret =
- this->m_ImageReader->ExecConfigurationDialog( this->m_Widget );
- if( dret == TProcessObject::DialogResult_Cancel )
- return( "" );
-
- // Execute filter
- this->BlockWidget( );
- std::string err = this->m_ImageReader->Update( );
- this->UnblockWidget( );
-
- // Get result, if any
- if( err == "" )
- {
- TImage* image = this->m_ImageReader->GetOutput< TImage >( "Output" );
- this->m_ImageReader->DisconnectOutputs( );