}
// -------------------------------------------------------------------------
-int cpExtensions::Visualization::MPRActors::
-AddInputConnection( vtkAlgorithmOutput* aout )
+void cpExtensions::Visualization::MPRActors::
+SetInputConnection( vtkAlgorithmOutput* aout )
{
- for( unsigned int i = 0; i < 2; ++i )
- {
- for( unsigned int j = 0; j < 3; ++j )
- {
- this->Slices[ i ][ j ]->SetInputConnection( aout );
- this->Slices[ i ][ j ]->SetAxis( j );
+ this->Slices[ 0 ][ 0 ]->SetInputConnection( aout );
+ this->Slices[ 0 ][ 1 ]->SetInputConnection( aout );
+ this->Slices[ 0 ][ 2 ]->SetInputConnection( aout );
+ this->Slices[ 1 ][ 0 ]->SetInputConnection( aout );
+ this->Slices[ 1 ][ 1 ]->SetInputConnection( aout );
+ this->Slices[ 1 ][ 2 ]->SetInputConnection( aout );
+}
- } // rof
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+SetInputImage( vtkImageData* data )
+{
+ this->Slices[ 0 ][ 0 ]->SetInputImage( data );
+ this->Slices[ 0 ][ 1 ]->SetInputImage( data );
+ this->Slices[ 0 ][ 2 ]->SetInputImage( data );
+ this->Slices[ 1 ][ 0 ]->SetInputImage( data );
+ this->Slices[ 1 ][ 1 ]->SetInputImage( data );
+ this->Slices[ 1 ][ 2 ]->SetInputImage( data );
+}
- } // rof
- this->_CreateBoundingBox( );
- return( 0 );
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::MPRActors::
+AddBinaryConnection(
+ vtkAlgorithmOutput* aout,
+ const double& r, const double& g, const double& b
+ )
+{
+ this->Slices[ 0 ][ 0 ]->AddBinaryConnection( aout, r, g, b );
+ this->Slices[ 0 ][ 1 ]->AddBinaryConnection( aout, r, g, b );
+ this->Slices[ 0 ][ 2 ]->AddBinaryConnection( aout, r, g, b );
+ this->Slices[ 1 ][ 0 ]->AddBinaryConnection( aout, r, g, b );
+ this->Slices[ 1 ][ 1 ]->AddBinaryConnection( aout, r, g, b );
+ return( this->Slices[ 1 ][ 2 ]->AddBinaryConnection( aout, r, g, b ) );
}
// -------------------------------------------------------------------------
int cpExtensions::Visualization::MPRActors::
-AddInputData( vtkImageData* new_image )
+AddBinaryImage(
+ vtkImageData* data,
+ const double& r, const double& g, const double& b
+ )
{
- for( unsigned int i = 0; i < 2; ++i )
- {
- for( unsigned int j = 0; j < 3; ++j )
- {
- this->Slices[ i ][ j ]->SetInputImage( new_image );
- this->Slices[ i ][ j ]->SetAxis( j );
+ this->Slices[ 0 ][ 0 ]->AddBinaryImage( data, r, g, b );
+ this->Slices[ 0 ][ 1 ]->AddBinaryImage( data, r, g, b );
+ this->Slices[ 0 ][ 2 ]->AddBinaryImage( data, r, g, b );
+ this->Slices[ 1 ][ 0 ]->AddBinaryImage( data, r, g, b );
+ this->Slices[ 1 ][ 1 ]->AddBinaryImage( data, r, g, b );
+ return( this->Slices[ 1 ][ 2 ]->AddBinaryImage( data, r, g, b ) );
+}
- } // rof
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+Clear( )
+{
+ this->Slices[ 0 ][ 0 ]->Clear( );
+ this->Slices[ 0 ][ 1 ]->Clear( );
+ this->Slices[ 0 ][ 2 ]->Clear( );
+ this->Slices[ 1 ][ 0 ]->Clear( );
+ this->Slices[ 1 ][ 1 ]->Clear( );
+ this->Slices[ 1 ][ 2 ]->Clear( );
+}
- } // rof
- this->_CreateBoundingBox( );
- return( 0 );
+// -------------------------------------------------------------------------
+vtkImageData* cpExtensions::Visualization::MPRActors::
+GetInputImage( )
+{
+ return( this->Slices[ 0 ][ 0 ]->GetInputImage( ) );
+}
+
+// -------------------------------------------------------------------------
+const vtkImageData* cpExtensions::Visualization::MPRActors::
+GetInputImage( ) const
+{
+ return( this->Slices[ 0 ][ 0 ]->GetInputImage( ) );
}
// -------------------------------------------------------------------------
unsigned int cpExtensions::Visualization::MPRActors::
GetNumberOfImages( ) const
{
- /* TODO
- ImageBlender* blender = this->Slices[ 0 ][ 0 ]->GetBlender( );
- if( blender != NULL )
- return( blender->GetNumberOfImages( ) );
- else
- */
- return( 0 );
+ return( this->Slices[ 0 ][ 0 ]->GetNumberOfImages( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+SetInterpolate( bool v )
+{
+ this->Slices[ 0 ][ 0 ]->SetInterpolate( v );
+ this->Slices[ 0 ][ 1 ]->SetInterpolate( v );
+ this->Slices[ 0 ][ 2 ]->SetInterpolate( v );
+ this->Slices[ 1 ][ 0 ]->SetInterpolate( v );
+ this->Slices[ 1 ][ 1 ]->SetInterpolate( v );
+ this->Slices[ 1 ][ 2 ]->SetInterpolate( v );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+InterpolateOn( )
+{
+ this->SetInterpolate( true );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+InterpolateOff( )
+{
+ this->SetInterpolate( false );
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRActors::
PushActorsInto(
- vtkRenderWindow* x, vtkRenderWindow* y, vtkRenderWindow* z,
+ vtkRenderWindow* x,
+ vtkRenderWindow* y,
+ vtkRenderWindow* z,
vtkRenderWindow* w
)
{
this->Slices[ 1 ][ 1 ]->PushActorsInto( w, false );
this->Slices[ 1 ][ 2 ]->PushActorsInto( w, false );
- vtkRenderer* xren =
- ( x != NULL )? x->GetRenderers( )->GetFirstRenderer( ): NULL;
- vtkRenderer* yren =
- ( y != NULL )? y->GetRenderers( )->GetFirstRenderer( ): NULL;
- vtkRenderer* zren =
- ( z != NULL )? z->GetRenderers( )->GetFirstRenderer( ): NULL;
vtkRenderer* wren =
( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
-
- /* TODO
- if( xren != NULL )
- {
- xren->AddActor( this->Slices[ 0 ][ 1 ]->GetPlaneActor( ) );
- xren->AddActor( this->Slices[ 0 ][ 2 ]->GetPlaneActor( ) );
-
- } // fi
- if( yren != NULL )
- {
- yren->AddActor( this->Slices[ 0 ][ 0 ]->GetPlaneActor( ) );
- yren->AddActor( this->Slices[ 0 ][ 2 ]->GetPlaneActor( ) );
-
- } // fi
- if( zren != NULL )
- {
- zren->AddActor( this->Slices[ 0 ][ 0 ]->GetPlaneActor( ) );
- zren->AddActor( this->Slices[ 0 ][ 1 ]->GetPlaneActor( ) );
-
- } // fi
- */
if( wren != NULL )
- wren->AddActor( this->ImageOutlineActor );
+ wren->AddViewProp( this->ImageOutlineActor );
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRActors::
PopActorsFrom(
- vtkRenderWindow* x, vtkRenderWindow* y, vtkRenderWindow* z,
+ vtkRenderWindow* x,
+ vtkRenderWindow* y,
+ vtkRenderWindow* z,
vtkRenderWindow* w
)
{
vtkRenderer* wren =
( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
if( wren != NULL )
- wren->RemoveActor( this->ImageOutlineActor );
+ wren->RemoveViewProp( this->ImageOutlineActor );
+}
- this->Slices[ 0 ][ 0 ]->Clear( );
- this->Slices[ 0 ][ 1 ]->Clear( );
- this->Slices[ 0 ][ 2 ]->Clear( );
- this->Slices[ 1 ][ 0 ]->Clear( );
- this->Slices[ 1 ][ 1 ]->Clear( );
- this->Slices[ 1 ][ 2 ]->Clear( );
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRActors::
+GetMinWindow( ) const
+{
+ return( this->Slices[ 0 ][ 0 ]->GetMinWindow( ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRActors::
+GetMaxWindow( ) const
+{
+ return( this->Slices[ 0 ][ 0 ]->GetMaxWindow( ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRActors::
+GetMinLevel( ) const
+{
+ return( this->Slices[ 0 ][ 0 ]->GetMinLevel( ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRActors::
+GetMaxLevel( ) const
+{
+ return( this->Slices[ 0 ][ 0 ]->GetMaxLevel( ) );
}
// -------------------------------------------------------------------------
}
// -------------------------------------------------------------------------
-int cpExtensions::Visualization::MPRActors::
-GetSliceNumberMinValue( const int& axis ) const
+void cpExtensions::Visualization::MPRActors::
+SetWindow( double w )
{
- return( this->Slices[ 0 ][ axis ]->GetSliceNumberMinValue( ) );
+ this->Slices[ 0 ][ 0 ]->SetWindow( w );
+ this->Slices[ 0 ][ 1 ]->SetWindow( w );
+ this->Slices[ 0 ][ 2 ]->SetWindow( w );
+ this->Slices[ 1 ][ 0 ]->SetWindow( w );
+ this->Slices[ 1 ][ 1 ]->SetWindow( w );
+ this->Slices[ 1 ][ 2 ]->SetWindow( w );
}
// -------------------------------------------------------------------------
-int cpExtensions::Visualization::MPRActors::
-GetSliceNumberMaxValue( const int& axis ) const
+void cpExtensions::Visualization::MPRActors::
+SetLevel( double l )
{
- return( this->Slices[ 0 ][ axis ]->GetSliceNumberMaxValue( ) );
+ this->Slices[ 0 ][ 0 ]->SetLevel( l );
+ this->Slices[ 0 ][ 1 ]->SetLevel( l );
+ this->Slices[ 0 ][ 2 ]->SetLevel( l );
+ this->Slices[ 1 ][ 0 ]->SetLevel( l );
+ this->Slices[ 1 ][ 1 ]->SetLevel( l );
+ this->Slices[ 1 ][ 2 ]->SetLevel( l );
}
// -------------------------------------------------------------------------
-int cpExtensions::Visualization::MPRActors::
-GetSlice( const int& axis ) const
+void cpExtensions::Visualization::MPRActors::
+SetWindowLevel( double w, double l )
{
- return( this->Slices[ 0 ][ axis ]->GetSliceNumber( ) );
+ this->Slices[ 0 ][ 0 ]->SetWindowLevel( w, l );
+ this->Slices[ 0 ][ 1 ]->SetWindowLevel( w, l );
+ this->Slices[ 0 ][ 2 ]->SetWindowLevel( w, l );
+ this->Slices[ 1 ][ 0 ]->SetWindowLevel( w, l );
+ this->Slices[ 1 ][ 1 ]->SetWindowLevel( w, l );
+ this->Slices[ 1 ][ 2 ]->SetWindowLevel( w, l );
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRActors::
-SetSlice( const int& axis, const int& slice )
+ResetWindowLevel( )
{
- vtkImageData* image =
- dynamic_cast< vtkImageData* >( this->Slices[ 0 ][ 0 ]->GetInputImage( ) );
- if( image == NULL )
- return;
+ this->Slices[ 0 ][ 0 ]->ResetWindowLevel( );
+ this->Slices[ 0 ][ 1 ]->ResetWindowLevel( );
+ this->Slices[ 0 ][ 2 ]->ResetWindowLevel( );
+ this->Slices[ 1 ][ 0 ]->ResetWindowLevel( );
+ this->Slices[ 1 ][ 1 ]->ResetWindowLevel( );
+ this->Slices[ 1 ][ 2 ]->ResetWindowLevel( );
+}
- // Get image data extent
- int ext[ 6 ];
- image->GetExtent( ext );
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::MPRActors::
+GetSliceNumber( const int& axis ) const
+{
+ if( axis < 3 )
+ return( this->Slices[ 0 ][ axis ]->GetSliceNumber( ) );
+ else
+ return( -1 );
+}
- // Check if the slice is valid
- int real = slice;
- if( slice < ext[ axis << 1 ] )
- real = ext[ axis << 1 ];
- if( ext[ ( axis << 1 ) + 1 ] < slice )
- real = ext[ ( axis << 1 ) + 1 ];
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::MPRActors::
+GetSliceNumberMinValue( const int& axis ) const
+{
+ if( axis < 3 )
+ return( this->Slices[ 0 ][ axis ]->GetSliceNumberMinValue( ) );
+ else
+ return( -1 );
+}
- // Change slice
- this->Slices[ 0 ][ axis ]->SetSliceNumber( real );
- this->Slices[ 1 ][ axis ]->SetSliceNumber( real );
- this->Modified( );
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::MPRActors::
+GetSliceNumberMaxValue( const int& axis ) const
+{
+ if( axis < 3 )
+ return( this->Slices[ 0 ][ axis ]->GetSliceNumberMaxValue( ) );
+ else
+ return( -1 );
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRActors::
-SetSlice( const int& axis, const double& slice )
+SetSliceNumber( const int& axis, const int& slice )
{
- vtkImageData* image =
- dynamic_cast< vtkImageData* >( this->Slices[ 0 ][ 0 ]->GetInputImage( ) );
- if( image == NULL )
- return;
-
- double x[ 3 ] = { double( 0 ) };
- double pcoords[ 3 ];
- int ijk[ 3 ];
+ if( axis < 3 )
+ {
+ this->Slices[ 0 ][ axis ]->SetSliceNumber( slice );
+ this->Slices[ 1 ][ axis ]->SetSliceNumber( slice );
- x[ axis ] = slice;
- image->ComputeStructuredCoordinates( x, ijk, pcoords );
- this->SetSlice( axis, ijk[ axis ] );
+ } // fi
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRActors::
-ResetSlices( )
+SetSlice( const int& axis, double* pos )
{
- for( unsigned int i = 0; i < 2; ++i )
- for( unsigned int j = 0; j < 3; ++j )
- this->Slices[ i ][ j ]->SetSliceNumber(
- this->Slices[ i ][ j ]->GetSliceNumberMinValue( )
- );
+ if( axis < 3 )
+ {
+ this->Slices[ 0 ][ axis ]->SetSlice( pos );
+ this->Slices[ 1 ][ axis ]->SetSlice( pos );
+
+ } // fi
}
// -------------------------------------------------------------------------
if( actors == NULL )
return;
for( unsigned int j = 0; j < 3; ++j )
- {
if( actors->Slices[ 0 ][ j ]->GetAxis( ) != axis )
- {
- actors->Slices[ 0 ][ j ]->SetSlice( pos );
- actors->Slices[ 1 ][ j ]->SetSlice( pos );
- actors->Slices[ 0 ][ j ]->Render( 1e-3 );
- actors->Slices[ 1 ][ j ]->Render( 1e-3 );
-
- } // fi
-
- } // rof
+ actors->SetSlice( j, pos );
}
// -------------------------------------------------------------------------
MPRActors* actors = reinterpret_cast< MPRActors* >( data );
if( actors == NULL )
return;
-
- actors->Slices[ 0 ][ 0 ]->SetWindowLevel( window, level );
- actors->Slices[ 0 ][ 1 ]->SetWindowLevel( window, level );
- actors->Slices[ 0 ][ 2 ]->SetWindowLevel( window, level );
- actors->Slices[ 1 ][ 0 ]->SetWindowLevel( window, level );
- actors->Slices[ 1 ][ 1 ]->SetWindowLevel( window, level );
- actors->Slices[ 1 ][ 2 ]->SetWindowLevel( window, level );
-
- actors->Slices[ 0 ][ 0 ]->Render( 1e-3 );
- actors->Slices[ 0 ][ 1 ]->Render( 1e-3 );
- actors->Slices[ 0 ][ 2 ]->Render( 1e-3 );
- actors->Slices[ 1 ][ 0 ]->Render( 1e-3 );
- actors->Slices[ 1 ][ 1 ]->Render( 1e-3 );
- actors->Slices[ 1 ][ 2 ]->Render( 1e-3 );
+ actors->SetWindowLevel( window, level );
}
// -------------------------------------------------------------------------
MPRActors* actors = reinterpret_cast< MPRActors* >( data );
if( actors == NULL )
return;
- actors->Slices[ 0 ][ 0 ]->Render( 1e-3 );
- actors->Slices[ 0 ][ 1 ]->Render( 1e-3 );
- actors->Slices[ 0 ][ 2 ]->Render( 1e-3 );
- actors->Slices[ 1 ][ 0 ]->Render( 1e-3 );
- actors->Slices[ 1 ][ 1 ]->Render( 1e-3 );
- actors->Slices[ 1 ][ 2 ]->Render( 1e-3 );
}
// eof - $RCSfile$