- } // fi
-
- // Execute filter
- return( this->_ReadData( parent ) );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadDicomSeries( const std::string& parent )
-{
- // Load source
- this->_ActivateIOFilter( "DicomSeriesReader" );
-
- // Try to configure source
- if( this->ConfigureActiveFilter( ) == TProcessObject::DialogResult_Cancel )
- {
- this->DeactivateFilter( );
- return( "" );
-
- } // fi
-
- // Execute filter
- return( this->_ReadData( parent ) );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadMesh( const std::string& fname, const std::string& parent )
-{
- // Load source
- this->_ActivateIOFilter( "MeshReader" );
-
- // Configure reader
- TParameters* params = this->GetActiveFilterParameters( );
- params->SetString( "FileName", fname );
-
- // Execute filter
- return( this->_ReadData( parent ) );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadMesh( const std::string& parent )
-{
- // Load source
- this->_ActivateIOFilter( "MeshReader" );
-
- // Try to configure source
- if( this->ConfigureActiveFilter( ) == TProcessObject::DialogResult_Cancel )
- {
- this->DeactivateFilter( );
- return( "" );
-
- } // fi
-
- // Execute filter
- return( this->_ReadData( parent ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteDataObject( const std::string& fname, const std::string& name )
-{
- typedef cpPlugins::Interface::Image _TImage;
- typedef cpPlugins::Interface::Mesh _TMesh;
-
- // Activate sink
- TDataObject* obj = this->GetData< TDataObject >( name );
- if( dynamic_cast< cpPlugins::Interface::Image* >( obj ) != NULL )
- this->_ActivateIOFilter( "ImageWriter" );
- else if( dynamic_cast< cpPlugins::Interface::Mesh* >( obj ) != NULL )
- this->_ActivateIOFilter( "MeshWriter" );
- else
- {
- this->DeactivateFilter( );
- return( false );
-
- } // fi
-
- // Configure writer
- TParameters* params = this->GetActiveFilterParameters( );
- params->SetString( "FileName", fname );
-
- // Execute filter
- return( this->_WriteData( name ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteDataObject( const std::string& name )
-{
- typedef cpPlugins::Interface::Image _TImage;
- typedef cpPlugins::Interface::Mesh _TMesh;
-
- // Activate sink
- TDataObject* obj = this->GetData< TDataObject >( name );
- if( dynamic_cast< cpPlugins::Interface::Image* >( obj ) != NULL )
- this->_ActivateIOFilter( "ImageWriter" );
- else if( dynamic_cast< cpPlugins::Interface::Mesh* >( obj ) != NULL )
- this->_ActivateIOFilter( "MeshWriter" );
- else
- {
- this->DeactivateFilter( );
- return( false );
-
- } // fi
-
- // Try to configure source
- if( this->ConfigureActiveFilter( ) == TProcessObject::DialogResult_Cancel )
- {
- this->DeactivateFilter( );
- return( false );
-
- } // fi
-
- // Execute filter
- return( this->_WriteData( name ) );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-ClearDataObjects( )
-{
- this->m_DataObjects.clear( );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-DeleteDataObject( const std::string& name )
-{
- // Find and delete object
- auto oIt = this->m_DataObjects.find( name );
- if( oIt == this->m_DataObjects.end( ) )
- return;
- this->m_DataObjects.erase( oIt );
-
- // Delete children
- TStringContainer children;
- this->GetChildren( children, name );
- auto cIt = children.begin( );
- for( ; cIt != children.end( ); ++cIt )
- this->DeleteDataObject( *cIt );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-GetDataObjects( TStringContainer& names )
-{
- names.clear( );
- auto oIt = this->m_DataObjects.begin( );
- for( ; oIt != this->m_DataObjects.end( ); ++oIt )
- names.insert( oIt->first );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-GetParent( const std::string& name ) const
-{
- // Find and delete object
- auto oIt = this->m_DataObjects.find( name );
- if( oIt != this->m_DataObjects.end( ) )
- return( oIt->second.first );
- else
- return( "" );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-GetChildren( TStringContainer& names, const std::string& name ) const
-{
- names.clear( );
- auto oIt = this->m_DataObjects.begin( );
- for( ; oIt != this->m_DataObjects.end( ); ++oIt )
- if( oIt->second.first == name )
- names.insert( oIt->first );