X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FBaseMPRWidget.cxx;h=052e374f51c879794a222e1cf336e59eecca1a66;hb=f654620df52b811be7bd263a1775c93d29c69a65;hp=1bf778f1b7cbf729351060892fd26ddce6ecbd2a;hpb=2e9a8218ec2792eb36b62731e2ae0c7dbb9ef436;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/BaseMPRWidget.cxx b/lib/cpPlugins/Interface/BaseMPRWidget.cxx index 1bf778f..052e374 100644 --- a/lib/cpPlugins/Interface/BaseMPRWidget.cxx +++ b/lib/cpPlugins/Interface/BaseMPRWidget.cxx @@ -9,6 +9,19 @@ #include #include +double cpPlugins::Interface::BaseMPRWidget:: +cm_Colors[ 8 ][ 3 ] = +{ + { 1.0, 0.0, 0.0 }, + { 0.0, 1.0, 0.0 }, + { 0.0, 0.0, 1.0 }, + { 0.0, 1.0, 1.0 }, + { 1.0, 0.0, 1.0 }, + { 1.0, 1.0, 0.0 }, + { 1.0, 0.5, 0.0 }, + { 1.0, 0.0, 0.5 } +}; + // ------------------------------------------------------------------------- cpPlugins::Interface::BaseMPRWidget:: BaseMPRWidget( QWidget* parent ) @@ -82,6 +95,13 @@ AddData( return( false ); } +// ------------------------------------------------------------------------- +const std::string& cpPlugins::Interface::BaseMPRWidget:: +GetMainImage( ) const +{ + return( this->m_MainImage ); +} + // ------------------------------------------------------------------------- bool cpPlugins::Interface::BaseMPRWidget:: SetMainImage( const std::string& name ) @@ -143,7 +163,7 @@ DeleteData( const std::string& name ) void cpPlugins::Interface::BaseMPRWidget:: DeleteAllData( ) { - this->m_MPRObjects->ClearAll( ); + this->m_MPRObjects->Clear( ); this->m_Data.clear( ); this->m_Tree.clear( ); this->m_UI->LoadedData->clear( ); @@ -180,7 +200,19 @@ ShowData( const std::string& name ) if( iIt->second.Tag == Data::IMAGE ) { - this->m_MPRObjects->AddImage( iIt->second.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 ) { @@ -323,7 +355,9 @@ QTreeWidgetItem* cpPlugins::Interface::BaseMPRWidget:: _FindItemInTree( const std::string& name ) const { QList< QTreeWidgetItem* > items = - this->m_UI->LoadedData->findItems( name.c_str( ), Qt::MatchExactly ); + this->m_UI->LoadedData->findItems( + name.c_str( ), Qt::MatchExactly | Qt::MatchRecursive + ); if( items.size( ) > 0 ) return( items[ 0 ] ); else