- this->m_Data.erase( iIt );
-
- // Get children
- std::vector< std::string > to_erase;
- auto tIt = this->m_Tree.begin( );
- for( ; tIt != this->m_Tree.end( ); ++tIt )
- if( tIt->second == name )
- to_erase.push_back( tIt->first );
-
- // Delete from tree
- tIt = this->m_Tree.find( name );
- if( tIt != this->m_Tree.end( ) )
- this->m_Tree.erase( tIt );
-
- // Recursive erase
- auto dIt = to_erase.begin( );
- for( ; dIt != to_erase.end( ); ++dIt )
- this->DeleteData( *dIt );
-
- // Delete from tree widget
- /* TODO
- QTreeWidgetItem* item = this->_FindItemInTree( name );
- if( item != NULL )
- this->m_UI->LoadedData->removeItemWidget( item, 0 );
- */
-
- // Reset main image, just in case
- if( this->m_Data.size( ) == 0 )
- this->m_MainImage = "";
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::
-DeleteAllData( )
-{
- this->m_MPRObjects->Clear( );
- this->m_Data.clear( );
- this->m_Tree.clear( );
- // TODO: this->m_UI->LoadedData->clear( );
- this->m_MainImage = "";
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::
-SetDataColor(
- const std::string& name, const double& r, const double& g, const double& b
- )
-{
- /*
- auto iIt = this->m_Data.find( name );
- if( iIt == this->m_Data.end( ) )
- return;
-
- if( iIt->second.Tag == Data::IMAGE )
- {
- }
- else if( iIt->second.Tag == Data::MESH )
- {
- } // fi
- */
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::
-ShowData( const std::string& name )
-{
- auto iIt = this->m_Data.find( name );
- if( iIt == this->m_Data.end( ) )
- return;
-
- if( iIt->second.Tag == Data::IMAGE )
- {
- if( name == this->m_MainImage )
- this->m_MPRObjects->SetInputImage( iIt->second.Image );
- else
- {
- unsigned int i = ( this->m_MPRObjects->GetNumberOfImages( ) - 1 ) % 8;
- this->m_MPRObjects->AddBinaryImage(
- iIt->second.Image,
- Self::cm_Colors[ i ][ 0 ],
- Self::cm_Colors[ i ][ 1 ],
- Self::cm_Colors[ i ][ 2 ]
- );
- }
- this->m_MPRObjects->Show( );
- }
- else if( iIt->second.Tag == Data::MESH )
- {
- vtkRenderer* ren =
- this->m_VTK[ 3 ]->GetRenderWindow( )->
- GetRenderers( )->GetFirstRenderer( );
- if( ren == NULL )
- return;
- ren->AddActor( iIt->second.GetMeshActor( ) );
- this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::
-HideData( const std::string& name )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::
-SetWindowLevel( const double& w, const double& l )
-{
- this->m_MPRObjects->SetWindowLevel( w, l );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::QT::SimpleMPRWidget::
-GetWindow( ) const
-{
- return( this->m_MPRObjects->GetWindow( ) );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::QT::SimpleMPRWidget::
-GetLevel( ) const
-{
- return( this->m_MPRObjects->GetLevel( ) );
-}
-
-// -------------------------------------------------------------------------
-vtkRenderWindowInteractor* cpExtensions::QT::SimpleMPRWidget::
-GetInteractor( unsigned int i )
-{
- if( i < 4 )
- {
- if( this->m_VTK[ i ] != NULL )
- return( this->m_VTK[ i ]->GetInteractor( ) );
- else
- return( NULL );
- }
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-/*
- bool cpExtensions::QT::SimpleMPRWidget::
- ShowImage(
- vtkImageData* image,
- const std::string& name,
- const std::string& parent
- )
- {
- // Update tree view
- QTreeWidgetItem* new_item = this->_UpdateTreeItem( name, parent );
- if( new_item == NULL )
- return( false );
-
- // Associate new data
- this->m_Images[ name ] = image;
- this->m_Tree[ name ] = parent;
-
- // Show image and return
- this->m_MPRObjects->AddImage( image );
- return( true );
- }
-
- // -------------------------------------------------------------------------
- bool cpExtensions::QT::SimpleMPRWidget::
- ShowImage(
- vtkImageData* image,
- const std::string& name,
- const std::string& parent,
- const double& r, const double& g, const double& b
- )
- {
- // Update tree view
- QTreeWidgetItem* new_item = this->_UpdateTreeItem( name, parent );
- if( new_item == NULL )
- return( false );
-
- // Associate new data
- this->m_Images[ name ] = image;
- this->m_Tree[ name ] = parent;
-
- // Show image and return
- this->m_MPRObjects->AddImage( image );
- return( true );
- }
-
- // -------------------------------------------------------------------------
- bool cpExtensions::QT::SimpleMPRWidget::
- ShowMesh(
- vtkPolyData* mesh,
- const std::string& name,
- const std::string& parent
- )
- {
- // Update tree view
- QTreeWidgetItem* new_item = this->_UpdateTreeItem( name, parent );
- if( new_item == NULL )
- return( false );
-
- // Associate new data
- PolyDataActor* actor = new PolyDataActor( mesh );
- this->m_Meshes[ name ] = actor;
- this->m_Tree[ name ] = parent;
-
- // Show mesh
- this->_Add3DActor( actor->Actor );
- return( true );
- }
-
- // -------------------------------------------------------------------------
- bool cpExtensions::QT::SimpleMPRWidget::
- ShowMesh(
- vtkPolyData* mesh,
- const std::string& name,
- const std::string& parent,
- const double& r, const double& g, const double& b
- )
- {
- return false;
- }
-
- // -------------------------------------------------------------------------
- void cpExtensions::QT::SimpleMPRWidget::
- ClearAll( )
- {
- this->m_MPRObjects->ClearAll( );
- this->m_Images.clear( );
- this->m_Meshes.clear( );
- }
-*/
-
-// -------------------------------------------------------------------------
-std::string cpExtensions::QT::SimpleMPRWidget::
-GetSelectedData( ) const
-{
- /* TODO
- QTreeWidgetItem* item = this->m_UI->LoadedData->currentItem( );
- if( item != NULL )
- return( item->text( 0 ).toStdString( ) );
- else
- */
- return( "" );
-}
-
-// -------------------------------------------------------------------------
-/* TODO
-QTreeWidgetItem* cpExtensions::QT::SimpleMPRWidget::
-_FindItemInTree( const std::string& name ) const
-{
- QList< QTreeWidgetItem* > items =
- this->m_UI->LoadedData->findItems(
- name.c_str( ), Qt::MatchExactly | Qt::MatchRecursive