this->Slices[ 0 ][ 0 ]->PushActorsInto( x, true );
this->Slices[ 0 ][ 1 ]->PushActorsInto( y, true );
this->Slices[ 0 ][ 2 ]->PushActorsInto( z, true );
+ this->Slices[ 1 ][ 0 ]->PushActorsInto( w, false );
+ this->Slices[ 1 ][ 1 ]->PushActorsInto( w, false );
+ this->Slices[ 1 ][ 2 ]->PushActorsInto( w, false );
- vtkRenderer* wren =
- ( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
- vtkRenderer* rends[ ] =
- {
- ( x != NULL )? x->GetRenderers( )->GetFirstRenderer( ): NULL,
- ( y != NULL )? y->GetRenderers( )->GetFirstRenderer( ): NULL,
- ( z != NULL )? z->GetRenderers( )->GetFirstRenderer( ): NULL
- };
- for( int i = 0; i < 3; ++i )
- {
- if( rends[ i ] != NULL )
- for( int j = 0; j < 3; ++j )
- if( i != j )
- rends[ i ]->AddActor( this->Slices[ 0 ][ j ]->GetPlaneActor( ) );
- if( wren != NULL )
- {
- for(
- unsigned int k = 0;
- k < this->Slices[ 1 ][ i ]->GetNumberOfImageActors( );
- ++k
- )
- wren->AddActor( this->Slices[ 1 ][ i ]->GetImageActor( k ) );
- wren->AddActor( this->Slices[ 1 ][ i ]->GetPlaneActor( ) );
+ /*
- } // fi
+ this->Slices[ 0 ][ 0 ]->PushActorsInto( y, false );
+ this->Slices[ 0 ][ 0 ]->PushActorsInto( z, false );
- } // rof
- if( wren != NULL )
- wren->AddActor( this->ImageOutlineActor );
+ this->Slices[ 0 ][ 1 ]->PushActorsInto( x, false );
+ this->Slices[ 0 ][ 1 ]->PushActorsInto( z, false );
- for( unsigned int j = 0; j < 3; ++j )
- {
- /* TODO
- ImageInteractorStyle* st =
- dynamic_cast< ImageInteractorStyle* >( this->Slices[ 0 ][ j ]->GetStyle( ) );
- if( w != NULL )
- st->AssociateInteractor( w->GetInteractor( ) );
- for( unsigned int l = 0; l < 3; ++l )
- if( j != l )
- st->AssociateInteractor(
- this->Slices[ 0 ][ l ]->GetStyle( )->GetInteractor( )
- );
- */
+ this->Slices[ 0 ][ 2 ]->PushActorsInto( x, false );
+ this->Slices[ 0 ][ 2 ]->PushActorsInto( y, false );
- } // rof
+ vtkRenderer* wren =
+ ( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
+ if( wren != NULL )
+ wren->AddActor( this->ImageOutlineActor );
+ */
}
// -------------------------------------------------------------------------
this->Slices[ 0 ][ 0 ]->PopActorsFrom( x );
this->Slices[ 0 ][ 1 ]->PopActorsFrom( y );
this->Slices[ 0 ][ 2 ]->PopActorsFrom( z );
+ this->Slices[ 1 ][ 0 ]->PopActorsFrom( w );
+ this->Slices[ 1 ][ 1 ]->PopActorsFrom( w );
+ this->Slices[ 1 ][ 2 ]->PopActorsFrom( w );
vtkRenderer* wren =
( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
- vtkRenderer* rends[ ] =
- {
- ( x != NULL )? x->GetRenderers( )->GetFirstRenderer( ): NULL,
- ( y != NULL )? y->GetRenderers( )->GetFirstRenderer( ): NULL,
- ( z != NULL )? z->GetRenderers( )->GetFirstRenderer( ): NULL
- };
- for( int i = 0; i < 3; ++i )
- {
- if( rends[ i ] != NULL )
- for( int j = 0; j < 3; ++j )
- if( i != j )
- rends[ i ]->RemoveActor( this->Slices[ 0 ][ j ]->GetPlaneActor( ) );
- if( wren != NULL )
- {
- for(
- unsigned int k = 0;
- k < this->Slices[ 1 ][ i ]->GetNumberOfImageActors( );
- ++k
- )
- wren->RemoveActor( this->Slices[ 1 ][ i ]->GetImageActor( k ) );
- wren->RemoveActor( this->Slices[ 1 ][ i ]->GetPlaneActor( ) );
-
- } // fi
-
- } // rof
if( wren != NULL )
wren->RemoveActor( this->ImageOutlineActor );
void cpExtensions::Visualization::MPRActors::
SetSlice( const int& axis, const int& slice )
{
- vtkImageData* image = this->_Image( 0 );
+ vtkImageData* image = this->Slices[ 0 ][ 0 ]->GetInputImage( 0 );
if( image == NULL )
return;
void cpExtensions::Visualization::MPRActors::
SetSlice( const int& axis, const double& slice )
{
- vtkImageData* image = this->_Image( 0 );
+ vtkImageData* image = this->Slices[ 0 ][ 0 ]->GetInputImage( 0 );
if( image == NULL )
return;
for( unsigned int j = 0; j < 3; ++j )
this->Slices[ i ][ j ] = vtkSmartPointer< ImageSliceActors >::New( );
- /*
- this->Slices[ 0 ][ 0 ]->AssociateSlice( this->Slices[ 1 ][ 0 ] );
- this->Slices[ 0 ][ 1 ]->AssociateSlice( this->Slices[ 1 ][ 1 ] );
- this->Slices[ 0 ][ 2 ]->AssociateSlice( this->Slices[ 1 ][ 2 ] );
- */
- /*
- this->Slices[ 0 ][ 0 ]->AddSlicesCommand( TSlicesCommand command, void* data );
- AddWindowLevelCommand( TWindowLevelCommand command, void* data );
- AddRenderCommand
- */
+ this->Slices[ 0 ][ 0 ]->AssociateSlice( this->Slices[ 1 ][ 0 ] );
+ this->Slices[ 0 ][ 1 ]->AssociateSlice( this->Slices[ 1 ][ 1 ] );
+ this->Slices[ 0 ][ 2 ]->AssociateSlice( this->Slices[ 1 ][ 2 ] );
- /* TODO
- this->Slices[ 0 ][ 0 ]->SetSlicesCommand( Self::_SetSlices, this );
- this->Slices[ 0 ][ 1 ]->SetSlicesCommand( Self::_SetSlices, this );
- this->Slices[ 0 ][ 2 ]->SetSlicesCommand( Self::_SetSlices, this );
- */
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::MPRActors::
-~MPRActors( )
-{
-}
-
-// -------------------------------------------------------------------------
-vtkImageData* cpExtensions::Visualization::MPRActors::
-_Image( unsigned int i ) const
-{
- /*
- if( i < this->ImageMaps.size( ) )
+ for( unsigned int i = 0; i < 3; ++ i )
{
- vtkAlgorithm* algo = this->ImageMaps[ i ]->GetInputAlgorithm( );
- vtkInformation* info = algo->GetOutputInformation( 0 );
- return(
- vtkImageData::SafeDownCast(
- info->Get( vtkDataObject::DATA_OBJECT( ) )
- )
+ this->Slices[ 0 ][ i ]->AddRenderCommand(
+ Self::_RenderCommand, this
);
- }
- else
- */
- return( NULL );
+ this->Slices[ 0 ][ i ]->AddWindowLevelCommand(
+ Self::_WindowLevelCommand, this
+ );
+ // this->Slices[ 0 ][ i ]->AddSlicesCommand( Self::_SlicesCommand, this );
+
+ } // rof
}
// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRActors::
-_Update( unsigned int i )
+cpExtensions::Visualization::MPRActors::
+~MPRActors( )
{
- /*
- // Check if the input has been configured
- vtkImageData* image = this->_Image( i );
- if( image == NULL )
- return;
- this->ImageMaps[ i ]->Update( );
-
- for( int j = 0; j < 2; ++j )
- {
- for( int k = 0; k < 3; ++k )
- {
- this->Slices[ j ][ k ]->AddInputConnection(
- this->ImageMaps[ i ]->GetOutputPort( ), k
- );
- this->Slices[ j ][ k ]->UpdateText( );
-
- // Add all of slice's props
- this->Slices[ j ][ k ]->InitTraversal( );
- vtkProp* prop = this->Slices[ j ][ k ]->GetNextProp( );
- while( prop != NULL )
- {
- this->AddItem( prop );
- prop = this->Slices[ j ][ k ]->GetNextProp( );
-
- } // elihw
-
- } // rof
-
- } // rof
-
- if( i == 0 )
- {
- // Create 3D outline
- double bb[ 6 ];
- image->GetBounds( bb );
-
- vtkSmartPointer< vtkOutlineSource > img_ol =
- vtkSmartPointer< vtkOutlineSource >::New( );
- img_ol->SetBounds( bb );
-
- vtkSmartPointer< vtkPolyDataMapper > img_ol_mapper =
- vtkSmartPointer< vtkPolyDataMapper >::New( );
- img_ol_mapper->SetInputConnection( img_ol->GetOutputPort( ) );
- this->ImageOutlineActor->SetMapper( img_ol_mapper );
- this->ImageOutlineActor->GetProperty( )->SetColor( 1, 1, 1 );
- this->ImageOutlineActor->GetProperty( )->SetLineWidth( 1 );
-
- this->AddItem( this->ImageOutlineActor );
-
- } // fi
- */
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRActors::
_WindowLevelCommand( double window, double level, void* data )
{
+ MPRActors* actors = reinterpret_cast< MPRActors* >( data );
+ if( actors == NULL )
+ return;
+ actors->Slices[ 0 ][ 0 ]->Render( );
+ actors->Slices[ 0 ][ 1 ]->Render( );
+ actors->Slices[ 0 ][ 2 ]->Render( );
+ actors->Slices[ 1 ][ 0 ]->Render( );
+ actors->Slices[ 1 ][ 1 ]->Render( );
+ actors->Slices[ 1 ][ 2 ]->Render( );
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRActors::
_RenderCommand( void* data )
{
+ MPRActors* actors = reinterpret_cast< MPRActors* >( data );
+ if( actors == NULL )
+ return;
+ actors->Slices[ 0 ][ 0 ]->Render( );
+ actors->Slices[ 0 ][ 1 ]->Render( );
+ actors->Slices[ 0 ][ 2 ]->Render( );
+ actors->Slices[ 1 ][ 0 ]->Render( );
+ actors->Slices[ 1 ][ 1 ]->Render( );
+ actors->Slices[ 1 ][ 2 ]->Render( );
}
// eof - $RCSfile$