From 878705ae4eab58fc442c37bee7a2ea5124311b66 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Mon, 12 Sep 2016 20:52:58 -0500 Subject: [PATCH] Some minor visualization bugs. --- .../Algorithms/GradientImageFunctionBase.hxx | 2 +- lib/cpExtensions/QT/MPR3DWidget.cxx | 8 ++++ .../Visualization/MPR3DActors.cxx | 44 +++++++++++++++++++ lib/cpExtensions/Visualization/MPR3DActors.h | 5 +++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/lib/cpExtensions/Algorithms/GradientImageFunctionBase.hxx b/lib/cpExtensions/Algorithms/GradientImageFunctionBase.hxx index 95681bd..a858650 100644 --- a/lib/cpExtensions/Algorithms/GradientImageFunctionBase.hxx +++ b/lib/cpExtensions/Algorithms/GradientImageFunctionBase.hxx @@ -36,7 +36,7 @@ EvaluateAtIndex( const TIndex& i ) const if( eval ) return( this->_Evaluate( i ) ); else - return( TOutput( 0 ) ); + return( TOutput( -1 ) ); } // ------------------------------------------------------------------------- diff --git a/lib/cpExtensions/QT/MPR3DWidget.cxx b/lib/cpExtensions/QT/MPR3DWidget.cxx index 3d5d508..f0331c0 100644 --- a/lib/cpExtensions/QT/MPR3DWidget.cxx +++ b/lib/cpExtensions/QT/MPR3DWidget.cxx @@ -121,24 +121,32 @@ SetSlicesNumbers( int x, int y, int z ) void cpExtensions::QT::MPR3DWidget:: SetScalarRange( double r[ 2 ] ) { + this->m_Actors->SetScalarRange( r ); + this->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetWindowLevel( double wl[ 2 ] ) { + this->m_Actors->SetWindowLevel( wl ); + this->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetImageOpacity( double o ) { + this->m_Actors->SetImageOpacity( o ); + this->Render( ); } // ------------------------------------------------------------------------- void cpExtensions::QT::MPR3DWidget:: SetImageInterpolation( unsigned char i ) { + this->m_Actors->SetImageInterpolation( i ); + this->Render( ); } #endif // cpExtensions_QT4 diff --git a/lib/cpExtensions/Visualization/MPR3DActors.cxx b/lib/cpExtensions/Visualization/MPR3DActors.cxx index 1c0d325..a63e272 100644 --- a/lib/cpExtensions/Visualization/MPR3DActors.cxx +++ b/lib/cpExtensions/Visualization/MPR3DActors.cxx @@ -3,6 +3,7 @@ #include #include #include +#include #include // ------------------------------------------------------------------------- @@ -127,6 +128,49 @@ AddMesh( vtkPolyData* mesh ) return( actor.GetActor( ) ); } +// ------------------------------------------------------------------------- +void cpExtensions::Visualization::MPR3DActors:: +SetScalarRange( double r[ 2 ] ) +{ + this->m_Slices[ 0 ]-> + GetWindowLevelImageActor( )->ConfigureWindowLevel( r[ 0 ], r[ 1 ] ); + this->m_Slices[ 1 ]-> + GetWindowLevelImageActor( )->ConfigureWindowLevel( r[ 0 ], r[ 1 ] ); + this->m_Slices[ 2 ]-> + GetWindowLevelImageActor( )->ConfigureWindowLevel( r[ 0 ], r[ 1 ] ); +} + +// ------------------------------------------------------------------------- +void cpExtensions::Visualization::MPR3DActors:: +SetWindowLevel( double wl[ 2 ] ) +{ + this->m_Slices[ 0 ]-> + GetWindowLevelImageActor( )->SetWindowLevel( wl[ 0 ], wl[ 1 ] ); + this->m_Slices[ 1 ]-> + GetWindowLevelImageActor( )->SetWindowLevel( wl[ 0 ], wl[ 1 ] ); + this->m_Slices[ 2 ]-> + GetWindowLevelImageActor( )->SetWindowLevel( wl[ 0 ], wl[ 1 ] ); +} + +// ------------------------------------------------------------------------- +void cpExtensions::Visualization::MPR3DActors:: +SetImageOpacity( double o ) +{ + this->m_Slices[ 0 ]->GetWindowLevelImageActor( )-> + GetProperty( )->SetOpacity( o ); + this->m_Slices[ 1 ]->GetWindowLevelImageActor( )-> + GetProperty( )->SetOpacity( o ); + this->m_Slices[ 2 ]->GetWindowLevelImageActor( )-> + GetProperty( )->SetOpacity( o ); +} + +// ------------------------------------------------------------------------- +void cpExtensions::Visualization::MPR3DActors:: +SetImageInterpolation( unsigned char i ) +{ + // TODO +} + // ------------------------------------------------------------------------- cpExtensions::Visualization::MPR3DActors:: MPR3DActors( ) diff --git a/lib/cpExtensions/Visualization/MPR3DActors.h b/lib/cpExtensions/Visualization/MPR3DActors.h index bc02490..07c41ba 100644 --- a/lib/cpExtensions/Visualization/MPR3DActors.h +++ b/lib/cpExtensions/Visualization/MPR3DActors.h @@ -57,6 +57,11 @@ namespace cpExtensions virtual vtkActor* AddMesh( vtkPolyData* mesh ); + void SetScalarRange( double r[ 2 ] ); + void SetWindowLevel( double wl[ 2 ] ); + void SetImageOpacity( double o ); + void SetImageInterpolation( unsigned char i ); + protected: MPR3DActors( ); virtual ~MPR3DActors( ); -- 2.45.1