From e6c0b2253f3eb65edaade43a281cfd2bc6c12ff0 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Mon, 15 Dec 2014 15:47:51 +0100 Subject: [PATCH] Some bugs --- cmake/cpPluginsConfig.cmake.in | 11 +++++++++ .../Extensions/Visualization/MPRActors.cxx | 24 +++++++++++++++++-- .../Visualization/MPRWithDifferentWindows.cxx | 17 +++++++++++++ .../Visualization/MPRWithDifferentWindows.h | 1 + 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/cmake/cpPluginsConfig.cmake.in b/cmake/cpPluginsConfig.cmake.in index a31bc50..23f0a89 100644 --- a/cmake/cpPluginsConfig.cmake.in +++ b/cmake/cpPluginsConfig.cmake.in @@ -47,6 +47,16 @@ FIND_LIBRARY( @CMAKE_INSTALL_PREFIX@/lib ) +FIND_LIBRARY( + cpPlugins_Extensions_LIBRARY_NAME + cpPlugins_Extensions + PATHS + /usr/lib + /usr/local/lib + @PROJECT_BINARY_DIR@ + @CMAKE_INSTALL_PREFIX@/lib + ) + FIND_LIBRARY( cpPlugins_LIBRARY_NAME cpPlugins @@ -66,6 +76,7 @@ SET( SET( cpPlugins_Interface_LIBRARIES ${cpPlugins_Interface_LIBRARY_NAME} + ${cpPlugins_Extensions_LIBRARY_NAME} ) SET( cpPlugins_LIBRARIES diff --git a/lib/cpPlugins/Extensions/Visualization/MPRActors.cxx b/lib/cpPlugins/Extensions/Visualization/MPRActors.cxx index b833278..e16ba0a 100644 --- a/lib/cpPlugins/Extensions/Visualization/MPRActors.cxx +++ b/lib/cpPlugins/Extensions/Visualization/MPRActors.cxx @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -40,10 +41,10 @@ SetInputData( vtkImageData* image ) for( int i = 0; i < 3; ++i ) { - Slices[ i ]->SetInputConnection( + this->Slices[ i ]->SetInputConnection( this->ImageToWindowLevel->GetOutputPort( ), i ); - Slices[ i ]->UpdateText( this->GetWindow( ), this->GetLevel( ) ); + this->Slices[ i ]->UpdateText( this->GetWindow( ), this->GetLevel( ) ); } // rof @@ -139,6 +140,25 @@ SetInputData( vtkImageData* image ) void cpPlugins::Extensions::Visualization::MPRActors:: SetSegmentationData( vtkImageData* segmentation ) { + double range[ 2 ]; + this->Segmentation = segmentation; + this->Segmentation->GetScalarRange( range ); + + vtkSmartPointer< vtkLookupTable > lut = + vtkSmartPointer< vtkLookupTable >::New( ); + lut->SetNumberOfTableValues( 2 ); + lut->SetTableRange( range ); + lut->SetTableValue( 0, 0, 0, 0, 0 ); + lut->SetTableValue( 1, 1, 0, 0, 0.4 ); + + this->SegmentationToColors->SetInputData( this->Segmentation ); + this->SegmentationToColors->SetLookupTable( lut ); + this->SegmentationToColors->Update( ); + + for( int i = 0; i < 3; ++i ) + this->Slices[ i ]->SetSegmentationConnection( + this->SegmentationToColors->GetOutputPort( ) + ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.cxx b/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.cxx index f66c258..e271631 100644 --- a/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.cxx +++ b/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.cxx @@ -89,6 +89,23 @@ SetImage( vtkImageData* image ) this->RenderAll( ); } +// ------------------------------------------------------------------------- +void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows:: +SetSegmentation( vtkImageData* image ) +{ + this->m_MPRActors->SetSegmentationData( image ); + this->m_MPRActors->PushDataInto( + this->m_Renderers[ 0 ], + this->m_Renderers[ 1 ], + this->m_Renderers[ 2 ], + this->m_Renderers[ 3 ] + ); + + this->Render( 0 ); + this->Render( 1 ); + this->Render( 2 ); +} + // ------------------------------------------------------------------------- void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows:: ResetCamera( const int& id ) diff --git a/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h b/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h index 152ea99..bf15f04 100644 --- a/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h +++ b/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h @@ -35,6 +35,7 @@ namespace cpPlugins virtual ~MPRWithDifferentWindows( ); void SetImage( vtkImageData* image ); + void SetSegmentation( vtkImageData* image ); void ResetCamera( const int& id ); void ResetCameras( ); -- 2.47.1