+++ /dev/null
-#include <cpExtensions/Visualization/ImageSliceActors.h>
-#include <cpExtensions/Visualization/ImageOutlineActor.h>
-#include <cpExtensions/Visualization/LUTImageActor.h>
-#include <cpExtensions/Visualization/WindowLevelImageActor.h>
-
-#include <vtkImageData.h>
-#include <vtkPlane.h>
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageSliceActors::
-Self* cpExtensions::Visualization::ImageSliceActors::
-New( )
-{
- return( new Self( ) );
-}
-
-// -------------------------------------------------------------------------
-vtkImageData* cpExtensions::Visualization::ImageSliceActors::
-GetImage( )
-{
- if( this->m_WindowLevelImageActor.GetPointer( ) != NULL )
- return( this->m_WindowLevelImageActor->GetImage( ) );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const vtkImageData* cpExtensions::Visualization::ImageSliceActors::
-GetImage( ) const
-{
- if( this->m_WindowLevelImageActor.GetPointer( ) != NULL )
- return( this->m_WindowLevelImageActor->GetImage( ) );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::
-WindowLevelImageActor* cpExtensions::Visualization::ImageSliceActors::
-GetWindowLevelImageActor( )
-{
- return( this->m_WindowLevelImageActor.GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-const cpExtensions::Visualization::
-WindowLevelImageActor* cpExtensions::Visualization::ImageSliceActors::
-GetWindowLevelImageActor( ) const
-{
- return( this->m_WindowLevelImageActor.GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::
-LUTImageActor* cpExtensions::Visualization::ImageSliceActors::
-GetLUTImageActor( )
-{
- return( this->m_LUTImageActor.GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-const cpExtensions::Visualization::
-LUTImageActor* cpExtensions::Visualization::ImageSliceActors::
-GetLUTImageActor( ) const
-{
- return( this->m_LUTImageActor.GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::
-ImageOutlineActor* cpExtensions::Visualization::ImageSliceActors::
-GetImageOutlineActor( )
-{
- return( this->m_ImageOutlineActor.GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-const cpExtensions::Visualization::
-ImageOutlineActor* cpExtensions::Visualization::ImageSliceActors::
-GetImageOutlineActor( ) const
-{
- return( this->m_ImageOutlineActor.GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-int cpExtensions::Visualization::ImageSliceActors::
-GetOrientation( ) const
-{
- if( this->m_WindowLevelImageActor.GetPointer( ) != NULL )
- return( this->m_WindowLevelImageActor->GetOrientation( ) );
- else
- return( 0 );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-SetImage( vtkImageData* image, int orientation )
-{
- this->m_WindowLevelImageActor =
- vtkSmartPointer< WindowLevelImageActor >::New( );
- this->m_WindowLevelImageActor->SetImage( image );
- this->m_WindowLevelImageActor->SetOrientation( orientation );
- this->m_ImageOutlineActor = vtkSmartPointer< ImageOutlineActor >::New( );
- this->m_LUTImageActor = NULL;
-
- // Put an initial slice
- int ext[ 6 ];
- image->GetExtent( ext );
- this->SetSliceNumber(
- ext[ this->m_WindowLevelImageActor->GetOrientation( ) << 1 ]
- );
-
- // Update collection
- this->RemoveAllItems( );
- this->AddItem( this->m_ImageOutlineActor );
- this->AddItem( this->m_WindowLevelImageActor );
-}
-
-// -------------------------------------------------------------------------
-unsigned int cpExtensions::Visualization::ImageSliceActors::
-AddLUTImage( vtkImageData* image )
-{
- if( this->GetImage( ) != NULL )
- {
- if( this->m_LUTImageActor.GetPointer( ) == NULL )
- {
- this->m_LUTImageActor = vtkSmartPointer< LUTImageActor >::New( );
- this->m_LUTImageActor->SetOrientation( this->GetOrientation( ) );
- this->AddItem( this->m_LUTImageActor );
-
- } // fi
- this->m_LUTImageActor->AddImage( image );
- return( this->m_LUTImageActor->GetNumberOfImages( ) );
- }
- else
- return( 0 );
-}
-
-// -------------------------------------------------------------------------
-int cpExtensions::Visualization::ImageSliceActors::
-GetSliceNumber( ) const
-{
- return( this->m_WindowLevelImageActor->GetSliceNumber( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-SetSliceNumber( int slice )
-{
- this->m_WindowLevelImageActor->SetSliceNumber( slice );
- if( this->m_LUTImageActor.GetPointer( ) != NULL )
- this->m_LUTImageActor->SetSliceNumber( slice );
-
- double bounds[ 6 ];
- this->m_WindowLevelImageActor->GetImage( )->GetBounds( bounds );
- int o = this->m_WindowLevelImageActor->GetOrientation( );
- double p = this->m_WindowLevelImageActor->GetSlicePlane( )->GetOrigin( )[ o ];
- this->m_ImageOutlineActor->SetBounds( o, p, bounds );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageSliceActors::
-ImageSliceActors( )
- : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageSliceActors::
-~ImageSliceActors( )
-{
-}
-
-// eof - $RCSfile$