+++ /dev/null
-#include <cpExtensions/Visualization/WindowLevelImageActor.h>
-#include <cpExtensions/Visualization/ImageSliceMapper.h>
-
-#include <vtkImageData.h>
-#include <vtkImageProperty.h>
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::WindowLevelImageActor::
-Self* cpExtensions::Visualization::WindowLevelImageActor::
-New( )
-{
- return( new Self( ) );
-}
-
-// -------------------------------------------------------------------------
-vtkImageData* cpExtensions::Visualization::WindowLevelImageActor::
-GetImage( )
-{
- return( this->m_Mapper->GetInput( ) );
-}
-
-// -------------------------------------------------------------------------
-const vtkImageData* cpExtensions::Visualization::WindowLevelImageActor::
-GetImage( ) const
-{
- return( this->m_Mapper->GetInput( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-SetImage( vtkImageData* image )
-{
- this->m_Mapper->SetInputData( image );
- this->ResetRange( );
- this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::Visualization::WindowLevelImageActor::
-GetLevel( ) const
-{
- Self* self = const_cast< Self* >( this );
- return( self->GetProperty( )->GetColorLevel( ) );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::Visualization::WindowLevelImageActor::
-GetWindow( ) const
-{
- Self* self = const_cast< Self* >( this );
- return( self->GetProperty( )->GetColorWindow( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-GetWindowLevel( double wl[ 2 ] ) const
-{
- Self* self = const_cast< Self* >( this );
- wl[ 0 ] = self->GetProperty( )->GetColorWindow( );
- wl[ 1 ] = self->GetProperty( )->GetColorLevel( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-ResetWindowLevel( )
-{
- this->SetWindowLevel(
- ( this->m_Range[ 1 ] - this->m_Range[ 0 ] ),
- ( this->m_Range[ 1 ] + this->m_Range[ 0 ] ) / double( 2 )
- );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-SetLevel( double l )
-{
- double ol = this->GetProperty( )->GetColorLevel( );
- if( l != ol && this->m_Range[ 0 ] <= l && l <= this->m_Range[ 1 ] )
- {
- this->GetProperty( )->SetColorLevel( l );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-SetWindow( double w )
-{
- double mw = this->m_Range[ 1 ] - this->m_Range[ 0 ];
- double ow = this->GetProperty( )->GetColorWindow( );
- if( w != ow && double( 0 ) <= w && w <= mw )
- {
- this->GetProperty( )->SetColorWindow( w );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-SetWindowLevel( double w, double l )
-{
- this->SetWindow( w );
- this->SetLevel( l );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-SetWindowLevel( double wl[ 2 ] )
-{
- this->SetWindow( wl[ 0 ] );
- this->SetLevel( wl[ 1 ] );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::Visualization::WindowLevelImageActor::
-GetMinimum( ) const
-{
- return( this->m_Range[ 0 ] );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::Visualization::WindowLevelImageActor::
-GetMaximum( ) const
-{
- return( this->m_Range[ 0 ] );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-GetRange( double r[ 2 ] ) const
-{
- r[ 0 ] = this->m_Range[ 0 ];
- r[ 1 ] = this->m_Range[ 1 ];
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-ResetRange( )
-{
- this->GetImage( )->GetScalarRange( this->m_Range );
- this->ResetWindowLevel( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-SetMinimum( double a )
-{
- if( this->m_Range[ 0 ] != a )
- {
- this->m_Range[ 0 ] = a;
- this->ResetWindowLevel( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-SetMaximum( double b )
-{
- if( this->m_Range[ 1 ] != b )
- {
- this->m_Range[ 1 ] = b;
- this->ResetWindowLevel( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-SetRange( double a, double b )
-{
- this->SetMinimum( a );
- this->SetMaximum( b );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::WindowLevelImageActor::
-SetRange( double r[ 2 ] )
-{
- this->SetMinimum( r[ 0 ] );
- this->SetMaximum( r[ 1 ] );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::WindowLevelImageActor::
-WindowLevelImageActor( )
- : Superclass( )
-{
- this->m_Range[ 0 ] = this->m_Range[ 1 ] = double( 0 );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::WindowLevelImageActor::
-~WindowLevelImageActor( )
-{
-}
-
-// eof - $RCSfile$