X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FVisualization%2FImageSliceActors.cxx;h=6d67a66c62ee64f05e8bbaf8c020b5840c4dc463;hb=bbf5fdea58d522fe9385f8cb506100e062348fe6;hp=5722c583d608b0159ebe9537e61ca5fcbcb84909;hpb=f2f39f66027a98bd8dac50bade5618e0136bbefa;p=cpPlugins.git diff --git a/lib/cpExtensions/Visualization/ImageSliceActors.cxx b/lib/cpExtensions/Visualization/ImageSliceActors.cxx index 5722c58..6d67a66 100644 --- a/lib/cpExtensions/Visualization/ImageSliceActors.cxx +++ b/lib/cpExtensions/Visualization/ImageSliceActors.cxx @@ -1,569 +1,168 @@ #include +#include +#include +#include -#include - -#include -#include #include -#include #include -#include -#include -#include -#include -#include // ------------------------------------------------------------------------- -cpExtensions::Visualization::ImageSliceActors* cpExtensions::Visualization::ImageSliceActors:: +Self* cpExtensions::Visualization::ImageSliceActors:: New( ) { return( new Self( ) ); } // ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -AddInputConnection( vtkAlgorithmOutput* aout, int axis ) -{ - vtkSmartPointer< vtkImageSliceMapper > mapper = - vtkSmartPointer< vtkImageSliceMapper >::New( ); - this->SliceMappers.push_back( mapper ); - mapper->SetInputConnection( aout ); - this->_ConfigureNewInput( axis ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -AddInputData( vtkImageData* data, int axis ) -{ - vtkSmartPointer< vtkImageSliceMapper > mapper = - vtkSmartPointer< vtkImageSliceMapper >::New( ); - this->SliceMappers.push_back( mapper ); - mapper->SetInputData( data ); - this->_ConfigureNewInput( axis ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -Clear( ) -{ - // Unbind from container - this->RemoveAllItems( ); - - // Delete all images - this->SliceMappers.clear( ); - this->ImageActors.clear( ); - this->AssociatedActors.clear( ); - - // Reconfigure unique objects - this->PlaneFunction = vtkSmartPointer< vtkPlane >::New( ); - this->PlaneSource = vtkSmartPointer< vtkPolyData >::New( ); - this->PlaneMapper = vtkSmartPointer< vtkPolyDataMapper >::New( ); - this->TextActor = vtkSmartPointer< vtkTextActor >::New( ); - this->PlaneActor = vtkSmartPointer< vtkActor >::New( ); - this->TextBuffer[ 0 ] = '\0'; - - // Unique objects configuration - vtkSmartPointer< vtkPoints > plane_points = - vtkSmartPointer< vtkPoints >::New( ); - vtkSmartPointer< vtkCellArray > plane_lines = - vtkSmartPointer< vtkCellArray >::New( ); - - plane_points->InsertNextPoint( 0, 0, 0 ); - plane_points->InsertNextPoint( 0, 1, 0 ); - plane_points->InsertNextPoint( 1, 1, 0 ); - plane_points->InsertNextPoint( 1, 0, 0 ); - plane_lines->InsertNextCell( 5 ); - plane_lines->InsertCellPoint( 0 ); - plane_lines->InsertCellPoint( 1 ); - plane_lines->InsertCellPoint( 2 ); - plane_lines->InsertCellPoint( 3 ); - plane_lines->InsertCellPoint( 0 ); - this->PlaneSource->SetPoints( plane_points ); - this->PlaneSource->SetLines( plane_lines ); - - this->PlaneMapper->SetInputData( this->PlaneSource ); - this->PlaneActor->SetMapper( this->PlaneMapper ); - - this->TextActor->SetTextScaleModeToNone( ); - vtkTextProperty* textprop = this->TextActor->GetTextProperty( ); - textprop->SetColor( 1, 1, 1 ); - textprop->SetFontFamilyToCourier( ); - textprop->SetFontSize( 18 ); - textprop->BoldOff( ); - textprop->ItalicOff( ); - textprop->ShadowOff( ); - textprop->SetJustificationToLeft( ); - textprop->SetVerticalJustificationToBottom( ); - vtkCoordinate* coord = this->TextActor->GetPositionCoordinate( ); - coord->SetCoordinateSystemToNormalizedViewport( ); - coord->SetValue( 0.01, 0.01 ); -} - -// ------------------------------------------------------------------------- -vtkInteractorStyle* cpExtensions::Visualization::ImageSliceActors:: -GetStyle( ) -{ - return( this->Style.GetPointer( ) ); -} - -// ------------------------------------------------------------------------- -const vtkInteractorStyle* cpExtensions::Visualization::ImageSliceActors:: -GetStyle( ) const -{ - return( this->Style.GetPointer( ) ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -PushActorsInto( vtkRenderer* renderer ) +vtkImageData* cpExtensions::Visualization::ImageSliceActors:: +GetImage( ) { - unsigned int N = this->GetNumberOfImageActors( ); - for( unsigned int n = 0; n < N; ++n ) - renderer->AddActor( this->GetImageActor( n ) ); - renderer->AddActor( this->GetTextActor( ) ); - renderer->AddActor( this->GetPlaneActor( ) ); - renderer->Modified( ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -PopActorsFrom( vtkRenderer* renderer ) -{ - unsigned int N = this->GetNumberOfImageActors( ); - for( unsigned int n = 0; n < N; ++n ) - renderer->RemoveActor( this->GetImageActor( n ) ); - renderer->RemoveActor( this->GetTextActor( ) ); - renderer->RemoveActor( this->GetPlaneActor( ) ); - renderer->Modified( ); -} - -// ------------------------------------------------------------------------- -unsigned int cpExtensions::Visualization::ImageSliceActors:: -GetNumberOfImageActors( ) const -{ - return( this->ImageActors.size( ) ); -} - -// ------------------------------------------------------------------------- -vtkImageActor* cpExtensions::Visualization::ImageSliceActors:: -GetImageActor( unsigned int id ) -{ - if( id < this->ImageActors.size( ) ) - return( this->ImageActors[ id ] ); + if( this->m_WindowLevelImageActor.GetPointer( ) != NULL ) + return( this->m_WindowLevelImageActor->GetImage( ) ); else return( NULL ); } // ------------------------------------------------------------------------- -const vtkImageActor* cpExtensions::Visualization::ImageSliceActors:: -GetImageActor( unsigned int id ) const +const vtkImageData* cpExtensions::Visualization::ImageSliceActors:: +GetImage( ) const { - if( id < this->ImageActors.size( ) ) - return( this->ImageActors[ id ] ); + if( this->m_WindowLevelImageActor.GetPointer( ) != NULL ) + return( this->m_WindowLevelImageActor->GetImage( ) ); else return( NULL ); } // ------------------------------------------------------------------------- -vtkTextActor* cpExtensions::Visualization::ImageSliceActors:: -GetTextActor( ) -{ - return( this->TextActor ); -} - -// ------------------------------------------------------------------------- -const vtkTextActor* cpExtensions::Visualization::ImageSliceActors:: -GetTextActor( ) const +cpExtensions::Visualization:: +WindowLevelImageActor* cpExtensions::Visualization::ImageSliceActors:: +GetWindowLevelImageActor( ) { - return( this->TextActor ); + return( this->m_WindowLevelImageActor.GetPointer( ) ); } // ------------------------------------------------------------------------- -vtkActor* cpExtensions::Visualization::ImageSliceActors:: -GetPlaneActor( ) +const cpExtensions::Visualization:: +WindowLevelImageActor* cpExtensions::Visualization::ImageSliceActors:: +GetWindowLevelImageActor( ) const { - return( this->PlaneActor ); + return( this->m_WindowLevelImageActor.GetPointer( ) ); } // ------------------------------------------------------------------------- -const vtkActor* cpExtensions::Visualization::ImageSliceActors:: -GetPlaneActor( ) const +cpExtensions::Visualization:: +LUTImageActor* cpExtensions::Visualization::ImageSliceActors:: +GetLUTImageActor( ) { - return( this->PlaneActor ); + return( this->m_LUTImageActor.GetPointer( ) ); } // ------------------------------------------------------------------------- -vtkPlane* cpExtensions::Visualization::ImageSliceActors:: -GetPlaneFunction( ) +const cpExtensions::Visualization:: +LUTImageActor* cpExtensions::Visualization::ImageSliceActors:: +GetLUTImageActor( ) const { - return( this->PlaneFunction ); + return( this->m_LUTImageActor.GetPointer( ) ); } // ------------------------------------------------------------------------- -const vtkPlane* cpExtensions::Visualization::ImageSliceActors:: -GetPlaneFunction( ) const +cpExtensions::Visualization:: +ImageOutlineActor* cpExtensions::Visualization::ImageSliceActors:: +GetImageOutlineActor( ) { - return( this->PlaneFunction ); + return( this->m_ImageOutlineActor.GetPointer( ) ); } // ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -AddActor( vtkAlgorithm* algorithm, vtkActor* actor ) -{ - this->AssociatedActors.push_back( TAssociatedActor( algorithm, actor ) ); - this->AddItem( actor ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -AddActor( vtkActor* actor ) -{ - this->AddActor( NULL, actor ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -SetInterpolate( bool v ) -{ - if( this->Interpolate != v ) - { - for( unsigned int i = 0; i < this->ImageActors.size( ); ++i ) - this->ImageActors[ i ]->SetInterpolate( v ); - this->Interpolate = v; - this->Modified( ); - - } // fi -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -InterpolateOn( ) -{ - this->SetInterpolate( true ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -InterpolateOff( ) -{ - this->SetInterpolate( false ); -} - -// ------------------------------------------------------------------------- -double* cpExtensions::Visualization::ImageSliceActors:: -GetDisplayBounds( ) const +const cpExtensions::Visualization:: +ImageOutlineActor* cpExtensions::Visualization::ImageSliceActors:: +GetImageOutlineActor( ) const { - if( this->ImageActors.size( ) > 0 ) - return( this->ImageActors[ 0 ]->GetDisplayBounds( ) ); - else - return( NULL ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -GetDisplayBounds( double bounds[ 6 ] ) const -{ - if( this->ImageActors.size( ) == 0 ) - { - bounds[ 0 ] = bounds[ 2 ] = bounds[ 4 ] = double( -1 ); - bounds[ 1 ] = bounds[ 3 ] = bounds[ 5 ] = double( -1 ); - } - else - this->ImageActors[ 0 ]->GetDisplayBounds( bounds ); -} - -// ------------------------------------------------------------------------- -int cpExtensions::Visualization::ImageSliceActors:: -GetAxis( ) const -{ - if( this->SliceMappers.size( ) > 0 ) - return( this->SliceMappers[ 0 ]->GetOrientation( ) ); - else - return( -1 ); -} - -// ------------------------------------------------------------------------- -int cpExtensions::Visualization::ImageSliceActors:: -GetSliceNumber( ) const -{ - if( this->SliceMappers.size( ) > 0 ) - return( this->SliceMappers[ 0 ]->GetSliceNumber( ) ); - else - return( -1 ); + return( this->m_ImageOutlineActor.GetPointer( ) ); } // ------------------------------------------------------------------------- int cpExtensions::Visualization::ImageSliceActors:: -GetSliceNumberMinValue( ) const +GetOrientation( ) const { - if( this->SliceMappers.size( ) > 0 ) - return( this->SliceMappers[ 0 ]->GetSliceNumberMinValue( ) ); + if( this->m_WindowLevelImageActor.GetPointer( ) != NULL ) + return( this->m_WindowLevelImageActor->GetOrientation( ) ); else - return( -1 ); -} - -// ------------------------------------------------------------------------- -int cpExtensions::Visualization::ImageSliceActors:: -GetSliceNumberMaxValue( ) const -{ - if( this->SliceMappers.size( ) > 0 ) - return( this->SliceMappers[ 0 ]->GetSliceNumberMaxValue( ) ); - else - return( -1 ); + return( 0 ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::ImageSliceActors:: -SetSliceNumber( const int& slice ) +SetImage( vtkImageData* image, int orientation ) { - unsigned int nImages = this->SliceMappers.size( ); - if( nImages == 0 ) - return; + 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; - // Change visualization extent - for( unsigned int i = 0; i < nImages; ++i ) - { - this->SliceMappers[ i ]->SetSliceNumber( slice ); - this->SliceMappers[ i ]->Modified( ); - this->ImageActors[ i ]->Modified( ); - this->SliceMappers[ i ]->Update( ); - - } // rof - - // Compute plane - vtkAlgorithm* algo = this->SliceMappers[ 0 ]->GetInputAlgorithm( ); - vtkInformation* info = algo->GetOutputInformation( 0 ); + // Put an initial slice int ext[ 6 ]; - double ori[ 3 ], spac[ 3 ], pos[ 3 ]; - info->Get( vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT( ), ext ); - info->Get( vtkDataObject::ORIGIN( ), ori ); - info->Get( vtkDataObject::SPACING( ), spac ); - this->SliceMappers[ 0 ]->GetSlicePlane( )->GetOrigin( pos ); - - // Prevent obscuring voxels by offsetting the plane geometry - double xbnds[ ] = - { - ori[ 0 ] + ( spac[ 0 ] * double( ext[ 0 ] ) ), - ori[ 0 ] + ( spac[ 0 ] * double( ext[ 1 ] ) ) - }; - double ybnds[ ] = - { - ori[ 1 ] + ( spac[ 1 ] * double( ext[ 2 ] ) ), - ori[ 1 ] + ( spac[ 1 ] * double( ext[ 3 ] ) ) - }; - double zbnds[ ] = - { - ori[ 2 ] + ( spac[ 2 ] * double( ext[ 4 ] ) ), - ori[ 2 ] + ( spac[ 2 ] * double( ext[ 5 ] ) ) - }; - - if( spac[ 0 ] < double( 0 ) ) - { - double t = xbnds[ 0 ]; - xbnds[ 0 ] = xbnds[ 1 ]; - xbnds[ 1 ] = t; - - } // fi - if( spac[ 1 ] < double( 0 ) ) - { - double t = ybnds[ 0 ]; - ybnds[ 0 ] = ybnds[ 1 ]; - ybnds[ 1 ] = t; - - } // fi - if( spac[ 2 ] < double( 0 ) ) - { - double t = zbnds[ 0 ]; - zbnds[ 0 ] = zbnds[ 1 ]; - zbnds[ 1 ] = t; - - } // fi - - // Plane function origin - this->PlaneFunction->SetOrigin( pos ); - - // Configure visualization and implicit plane orientation - int axis = this->SliceMappers[ 0 ]->GetOrientation( ); - this->PlaneActor->GetProperty( )->SetRepresentationToWireframe( ); - this->PlaneActor->GetProperty( )->SetLineWidth( 2 ); - vtkPoints* plane_points = this->PlaneSource->GetPoints( ); - if( axis == 0 ) // YZ, x-normal - { - this->PlaneFunction->SetNormal( 1, 0, 0 ); - plane_points->SetPoint( 0, pos[ 0 ], ybnds[ 0 ], zbnds[ 0 ] ); - plane_points->SetPoint( 1, pos[ 0 ], ybnds[ 1 ], zbnds[ 0 ] ); - plane_points->SetPoint( 2, pos[ 0 ], ybnds[ 1 ], zbnds[ 1 ] ); - plane_points->SetPoint( 3, pos[ 0 ], ybnds[ 0 ], zbnds[ 1 ] ); - this->PlaneActor->GetProperty( )->SetColor( 1, 0, 0 ); - } - else if( axis == 1 ) // ZX, y-normal - { - this->PlaneFunction->SetNormal( 0, 1, 0 ); - plane_points->SetPoint( 0, xbnds[ 0 ], pos[ 1 ], zbnds[ 0 ] ); - plane_points->SetPoint( 1, xbnds[ 0 ], pos[ 1 ], zbnds[ 1 ] ); - plane_points->SetPoint( 2, xbnds[ 1 ], pos[ 1 ], zbnds[ 1 ] ); - plane_points->SetPoint( 3, xbnds[ 1 ], pos[ 1 ], zbnds[ 0 ] ); - this->PlaneActor->GetProperty( )->SetColor( 0, 1, 0 ); - } - else // XY, z-normal - { - this->PlaneFunction->SetNormal( 0, 0, 1 ); - plane_points->SetPoint( 0, xbnds[ 0 ], ybnds[ 0 ], pos[ 2 ] ); - plane_points->SetPoint( 1, xbnds[ 1 ], ybnds[ 0 ], pos[ 2 ] ); - plane_points->SetPoint( 2, xbnds[ 1 ], ybnds[ 1 ], pos[ 2 ] ); - plane_points->SetPoint( 3, xbnds[ 0 ], ybnds[ 1 ], pos[ 2 ] ); - this->PlaneActor->GetProperty( )->SetColor( 0, 0, 1 ); - - } // fi - this->PlaneFunction->Modified( ); - this->PlaneSource->Modified( ); - this->PlaneMapper->Modified( ); - this->PlaneActor->Modified( ); - - // Prepare other actors to update - /* TODO - for( unsigned int i = 0; i < this->OtherActors.size( ); ++i ) - { - if( this->OtherActors[ i ].first.GetPointer( ) != NULL ) - { - this->OtherActors[ i ].first->Modified( ); - this->OtherActors[ i ].first->Update( ); - - } // fi - - if( this->OtherActors[ i ].second.GetPointer( ) != NULL ) - { - this->OtherActors[ i ].second->GetMapper( )->Modified( ); - this->OtherActors[ i ].second->Modified( ); - - } // fi + image->GetExtent( ext ); + this->SetSliceNumber( + ext[ this->m_WindowLevelImageActor->GetOrientation( ) << 1 ] + ); - } // rof - - if( this->m_UpdateCommand != NULL ) - this->m_UpdateCommand( this->m_UpdateData ); - */ - - // Update text - this->UpdateText( ); + // Update collection + this->RemoveAllItems( ); + this->AddItem( this->m_ImageOutlineActor ); + this->AddItem( this->m_WindowLevelImageActor ); } // ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -UpdateText( ) +unsigned int cpExtensions::Visualization::ImageSliceActors:: +AddLUTImage( vtkImageData* image ) { - if( this->SliceMappers.size( ) > 0 ) + if( this->GetImage( ) != NULL ) { - char axis; - int axId = this->SliceMappers[ 0 ]->GetOrientation( ); - if ( axId == 0 ) axis = 'X'; - else if( axId == 1 ) axis = 'Y'; - else if( axId == 2 ) axis = 'Z'; + if( this->m_LUTImageActor.GetPointer( ) == NULL ) + { + this->m_LUTImageActor = vtkSmartPointer< LUTImageActor >::New( ); + this->m_LUTImageActor->SetOrientation( this->GetOrientation( ) ); + this->AddItem( this->m_LUTImageActor ); - std::sprintf( - this->TextBuffer, "Axis: %c (%d)", - axis, this->SliceMappers[ 0 ]->GetSliceNumber( ) - ); + } // fi + this->m_LUTImageActor->AddImage( image ); + return( this->m_LUTImageActor->GetNumberOfImages( ) ); } else - this->TextBuffer[ 0 ] = '\0'; - this->TextActor->SetInput( this->TextBuffer ); - this->TextActor->Modified( ); - this->Modified( ); + return( 0 ); } // ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -UpdateText( double pos[ 3 ] ) +int cpExtensions::Visualization::ImageSliceActors:: +GetSliceNumber( ) const { - if( this->SliceMappers.size( ) > 0 ) - { - char axis; - int axId = this->SliceMappers[ 0 ]->GetOrientation( ); - if ( axId == 0 ) axis = 'X'; - else if( axId == 1 ) axis = 'Y'; - else if( axId == 2 ) axis = 'Z'; - - vtkImageData* image = this->SliceMappers[ 0 ]->GetInput( ); - - int ijk[ 3 ]; - double pcoords[ 3 ]; - image->ComputeStructuredCoordinates( pos, ijk, pcoords ); - { - int nScl = image->GetNumberOfScalarComponents( ); - std::stringstream str; - str - << "[" << ijk[ 0 ] - << "," << ijk[ 1 ] - << "," << ijk[ 2 ] << "]=("; - str << - image->GetScalarComponentAsFloat( - ijk[ 0 ], ijk[ 1 ], ijk[ 2 ], 0 - ); - for( int n = 1; n < nScl; ++n ) - str - << " " - << image->GetScalarComponentAsFloat( - ijk[ 0 ], ijk[ 1 ], ijk[ 2 ], n - ); - str << ")"; - std::sprintf( - this->TextBuffer, "Axis: %c (%d) | Pixel %s", - axis, - this->SliceMappers[ 0 ]->GetSliceNumber( ), - str.str( ).c_str( ) - ); - - } // fi - } - else - this->TextBuffer[ 0 ] = '\0'; - this->TextActor->SetInput( this->TextBuffer ); - this->TextActor->Modified( ); - this->Modified( ); + return( this->m_WindowLevelImageActor->GetSliceNumber( ) ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::ImageSliceActors:: -UpdateText( const double& w, const double& l ) +SetSliceNumber( int slice ) { - if( this->SliceMappers.size( ) > 0 ) - { - char axis; - int axId = this->SliceMappers[ 0 ]->GetOrientation( ); - if ( axId == 0 ) axis = 'X'; - else if( axId == 1 ) axis = 'Y'; - else if( axId == 2 ) axis = 'Z'; + this->m_WindowLevelImageActor->SetSliceNumber( slice ); + if( this->m_LUTImageActor.GetPointer( ) != NULL ) + this->m_LUTImageActor->SetSliceNumber( slice ); - std::sprintf( - this->TextBuffer, "Axis: %c (%d) | W/L (%.2f/%.2f)", - axis, this->SliceMappers[ 0 ]->GetSliceNumber( ), w, l - ); - } - else - this->TextBuffer[ 0 ] = '\0'; - this->TextActor->SetInput( this->TextBuffer ); - this->TextActor->Modified( ); - this->Modified( ); + 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( ), - Interpolate( false ) + : Superclass( ) { - // Connect this view with a controller - this->Style = vtkSmartPointer< ImageInteractorStyle >::New( ); - this->Style->AssociateView( this ); - this->Style->SetMouseMoveCommand( Self::_MouseMoveCommand ); - this->Style->SetMouseClickCommand( Self::_MouseClickCommand ); - this->Style->SetMouseDoubleClickCommand( Self::_MouseDoubleClickCommand ); - this->Style->SetMouseWheelCommand( Self::_MouseWheelCommand ); - this->Style->SetKeyCommand( Self::_KeyCommand ); - - this->Clear( ); } // ------------------------------------------------------------------------- @@ -572,105 +171,4 @@ cpExtensions::Visualization::ImageSliceActors:: { } -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -_ConfigureNewInput( int axis ) -{ - unsigned int nImages = this->ImageActors.size( ); - - // Configure mapper - vtkImageSliceMapper* mapper = this->SliceMappers[ nImages ]; - if( nImages == 0 ) - mapper->SetOrientation( axis ); - else - mapper->SetOrientation( this->SliceMappers[ 0 ]->GetOrientation( ) ); - mapper->Update( ); - - // Create actor - vtkSmartPointer< vtkImageActor > actor = - vtkSmartPointer< vtkImageActor >::New( ); - this->ImageActors.push_back( actor ); - actor->SetMapper( mapper ); - actor->SetInterpolate( this->Interpolate ); - actor->Modified( ); - - if( nImages == 0 ) - { - this->AddItem( this->TextActor ); - this->AddItem( this->PlaneActor ); - this->Style->AssociateImageActor( actor ); - - } // fi - this->AddItem( actor ); - - if( nImages > 1 ) - this->SetSliceNumber( this->GetSliceNumber( ) ); - this->Modified( ); -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -_MouseMoveCommand( - void* data, - const ImageInteractorStyle::ButtonID& btn, double* pos, - bool alt, bool ctr, bool sft - ) -{ - ImageSliceActors* actors = reinterpret_cast< ImageSliceActors* >( data ); - if( actors == NULL ) - return; - - if( btn == ImageInteractorStyle::ButtonID_None ) - { - actors->UpdateText( pos ); - } - else if( btn == ImageInteractorStyle::ButtonID_Left ) - { - } - else if( btn == ImageInteractorStyle::ButtonID_Middle ) - { - } - else if( btn == ImageInteractorStyle::ButtonID_Right ) - { - } // fi -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -_MouseClickCommand( - void* data, - const ImageInteractorStyle::ButtonID& btn, double* pos, - bool alt, bool ctr, bool sft - ) -{ -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -_MouseDoubleClickCommand( - void* data, - const ImageInteractorStyle::ButtonID& btn, double* pos, - bool alt, bool ctr, bool sft - ) -{ -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -_MouseWheelCommand( - void* data, - const int& dir, bool alt, bool ctr, bool sft - ) -{ -} - -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -_KeyCommand( - void* data, - const char& key - ) -{ -} - // eof - $RCSfile$