return;
// Show outputs
-#error ACA VOY
for( auto oIt = outputs.begin( ); oIt != outputs.end( ); ++oIt )
std::cout << *oIt << std::endl;
} // fi
// Begin interaction
- image_actors->ResetCamera( );
+ renderer->ResetCamera( );
window->Render( );
interactor->Start( );
image_actors->PushActorsInto( window );
// Begin interaction
- image_actors->ResetCamera( );
+ renderer->ResetCamera( );
window->Render( );
interactor->Start( );
} // rof
} // rof
- this->Superclass::RequestData( request, inputVector, outputVector );
+ return(
+ this->Superclass::RequestData( request, inputVector, outputVector )
+ );
}
// -------------------------------------------------------------------------
this->m_ImageActor->Modified( );
this->m_BlenderActor->Modified( );
this->Modified( );
- this->ResetCamera( );
}
// -------------------------------------------------------------------------
} // fi
} // fi
- this->ResetCamera( );
- rwi->Render( );
+ renderer->ResetCamera( );
}
// -------------------------------------------------------------------------
renderer->RemoveViewProp( this->m_TextActor );
renderer->RemoveViewProp( this->m_Axis1Actor );
renderer->RemoveViewProp( this->m_Axis2Actor );
- if( rwi != NULL )
- rwi->Render( );
} // fi
}
}
// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-Render( const double& t )
+cpExtensions::Visualization::ImageSliceActors::
+ImageSliceActors( )
+ : Superclass( ),
+ m_Window( NULL ),
+ m_Interpolate( false )
{
- if( this->m_Window != NULL )
- {
- vtkRenderer* renderer =
- this->m_Window->GetRenderers( )->GetFirstRenderer( );
- if( renderer != NULL )
- renderer->SetAllocatedRenderTime( t );
- this->m_Window->Render( );
+ this->Clear( );
+ this->_ConfigureStyle( );
+}
- } // fi
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::ImageSliceActors::
+~ImageSliceActors( )
+{
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::ImageSliceActors::
-ResetCamera( )
+_Render( )
{
if( this->m_Window == NULL )
return;
vtkRenderer* renderer =
this->m_Window->GetRenderers( )->GetFirstRenderer( );
- if( renderer != NULL )
- renderer->ResetCamera( this->m_VisibleBounds );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageSliceActors::
-ImageSliceActors( )
- : Superclass( ),
- m_Window( NULL ),
- m_Interpolate( false )
-{
- this->Clear( );
- this->_ConfigureStyle( );
+ if( renderer == NULL )
+ return;
+ renderer->SetAllocatedRenderTime( 1e-3 );
+ this->m_Window->Render( );
}
// -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageSliceActors::
-~ImageSliceActors( )
+void cpExtensions::Visualization::ImageSliceActors::
+_ResetCamera( )
{
+ if( this->m_Window == NULL )
+ return;
+ vtkRenderer* renderer =
+ this->m_Window->GetRenderers( )->GetFirstRenderer( );
+ if( renderer == NULL )
+ return;
+ renderer->ResetCamera( );
}
// -------------------------------------------------------------------------
// Just show the pixel information
actors->SetCursor( pos );
actors->UpdateText( pos );
- actors->Render( 1e-3 );
+ actors->_Render( );
}
else if( btn == TStyle::ButtonID_Left )
{
{
// Show axes in current renderer
actors->SetAxesCursor( pos );
+ actors->_Render( );
// Interactively move slices
auto i = actors->m_SlicesCommands.begin( );
for( ; i != actors->m_SlicesCommands.end( ); ++i )
i->first( pos, actors->GetAxis( ), i->second );
- actors->Render( 1e-3 );
} // fi
}
dx += actors->m_StartWindowLevel[ 0 ];
dy += actors->m_StartWindowLevel[ 1 ];
actors->SetWindowLevel( dx, dy );
- actors->Render( 1e-3 );
+ actors->_Render( );
// Associate objects
auto i = actors->m_WindowLevelCommands.begin( );
if( slice > actors->GetSliceNumberMaxValue( ) )
slice = actors->GetSliceNumberMaxValue( );
actors->SetSliceNumber( slice );
+ actors->_Render( );
auto a = actors->m_AssociatedSlices.begin( );
for( ; a != actors->m_AssociatedSlices.end( ); ++a )
- {
( *a )->SetSliceNumber( slice );
- ( *a )->Render( 1e-3 );
-
- } // rof
- actors->Render( 1e-3 );
// Associate objects
auto i = actors->m_RenderCommands.begin( );
{
case 'r': case 'R':
{
- actors->ResetCamera( );
- actors->Render( 1e-3 );
+ actors->_ResetCamera( );
+ actors->_Render( );
// Associate objects
auto i = actors->m_RenderCommands.begin( );
case 'w': case 'W':
{
actors->ResetWindowLevel( );
- actors->Render( 1e-3 );
+ actors->_Render( );
// Associate objects
auto i = actors->m_RenderCommands.begin( );
actors->ResetCursor( );
actors->m_CursorActor->VisibilityOn( );
- actors->Render( 1e-3 );
+ actors->_Render( );
}
// -------------------------------------------------------------------------
actors->ResetCursor( );
actors->m_CursorActor->VisibilityOff( );
- actors->Render( 1e-3 );
+ actors->_Render( );
}
// eof - $RCSfile$
void UpdateText( double pos[ 3 ] );
void UpdateText( const double& w, const double& l );
- void Render( const double& t );
- void ResetCamera( );
-
protected:
ImageSliceActors( );
virtual ~ImageSliceActors( );
+ void _Render( );
+ void _ResetCamera( );
void _ConfigureStyle( );
void _ConfigureInputImage( );
void _ConfigureBinaryImage(
}
// -------------------------------------------------------------------------
-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( ) );
}
// -------------------------------------------------------------------------
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
)
{
vtkRenderer* wren =
( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
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$
ImageSliceActors* GetSliceActors( const int& i ) const;
- int AddInputConnection( vtkAlgorithmOutput* aout );
- int AddInputData( vtkImageData* new_image );
+ void SetInputConnection( vtkAlgorithmOutput* aout );
+ void SetInputImage( vtkImageData* data );
+ int AddBinaryConnection(
+ vtkAlgorithmOutput* aout,
+ const double& r, const double& g, const double& b
+ );
+ int AddBinaryImage(
+ vtkImageData* data,
+ const double& r, const double& g, const double& b
+ );
+ void Clear( );
+
+ vtkImageData* GetInputImage( );
+ const vtkImageData* GetInputImage( ) const;
+
unsigned int GetNumberOfImages( ) const;
+ void SetInterpolate( bool v );
+ void InterpolateOn( );
+ void InterpolateOff( );
+
void PushActorsInto(
vtkRenderWindow* x,
vtkRenderWindow* y,
vtkRenderWindow* w
);
+ double GetMinWindow( ) const;
+ double GetMaxWindow( ) const;
+ double GetMinLevel( ) const;
+ double GetMaxLevel( ) const;
double GetWindow( );
double GetLevel( );
+ void SetWindow( double w );
+ void SetLevel( double l );
+ void SetWindowLevel( double w, double l );
+ void ResetWindowLevel( );
// Slice access
+ int GetSliceNumber( const int& axis ) const;
int GetSliceNumberMinValue( const int& axis ) const;
int GetSliceNumberMaxValue( const int& axis ) const;
- int GetSlice( const int& axis ) const;
- void SetSlice( const int& axis, const int& slice );
- void SetSlice( const int& axis, const double& slice );
- void ResetSlices( );
+ void SetSliceNumber( const int& axis, const int& slice );
+ void SetSlice( const int& axis, double* pos );
protected:
MPRActors( );
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRObjects::
SetRenderWindows(
- vtkRenderWindow* wx, vtkRenderWindow* wy,
- vtkRenderWindow* wz, vtkRenderWindow* w3D
+ vtkRenderWindow* x, vtkRenderWindow* y,
+ vtkRenderWindow* z, vtkRenderWindow* w
)
{
- this->m_Windows[ 0 ] = wx;
- this->m_Windows[ 1 ] = wy;
- this->m_Windows[ 2 ] = wz;
- this->m_Windows[ 3 ] = w3D;
+ this->m_Windows[ 0 ] = x;
+ this->m_Windows[ 1 ] = y;
+ this->m_Windows[ 2 ] = z;
+ this->m_Windows[ 3 ] = w;
// Prepare 2D renderers
for( int i = 0; i < 4; ++i )
{
- if( this->m_Windows[ i ] == NULL )
+ // Create renderer, if render window exists
+ if( this->m_Windows[ i ] != NULL )
{
+ this->m_Renderers[ i ] = vtkSmartPointer< vtkRenderer >::New( );
+ this->m_Renderers[ i ]->SetBackground( 0.3, 0.3, 0.3 );
+ this->m_Windows[ i ]->AddRenderer( this->m_Renderers[ i ] );
+ }
+ else
this->m_Renderers[ i ] = NULL;
- continue;
+
+ } // rof
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+SetInputConnection( vtkAlgorithmOutput* aout )
+{
+ this->m_MPRActors->SetInputConnection( aout );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+SetInputImage( vtkImageData* data )
+{
+ this->m_MPRActors->SetInputImage( data );
+}
+
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::MPRObjects::
+AddBinaryConnection(
+ vtkAlgorithmOutput* aout,
+ const double& r, const double& g, const double& b
+ )
+{
+ return( this->m_MPRActors->AddBinaryConnection( aout, r, g, b ) );
+}
+
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::MPRObjects::
+AddBinaryImage(
+ vtkImageData* data,
+ const double& r, const double& g, const double& b
+ )
+{
+ return( this->m_MPRActors->AddBinaryImage( data, r, g, b ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+Clear( )
+{
+ this->m_MPRActors->Clear( );
+}
+
+// -------------------------------------------------------------------------
+vtkImageData* cpExtensions::Visualization::MPRObjects::
+GetInputImage( )
+{
+ return( this->m_MPRActors->GetInputImage( ) );
+}
+
+// -------------------------------------------------------------------------
+const vtkImageData* cpExtensions::Visualization::MPRObjects::
+GetInputImage( ) const
+{
+ return( this->m_MPRActors->GetInputImage( ) );
+}
+
+// -------------------------------------------------------------------------
+unsigned int cpExtensions::Visualization::MPRObjects::
+GetNumberOfImages( ) const
+{
+ return( this->m_MPRActors->GetNumberOfImages( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+SetInterpolate( bool v )
+{
+ this->m_MPRActors->SetInterpolate( v );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+InterpolateOn( )
+{
+ this->m_MPRActors->InterpolateOn( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+InterpolateOff( )
+{
+ this->m_MPRActors->InterpolateOff( );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRObjects::
+GetMinWindow( ) const
+{
+ return( this->m_MPRActors->GetMinWindow( ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRObjects::
+GetMaxWindow( ) const
+{
+ return( this->m_MPRActors->GetMaxWindow( ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRObjects::
+GetMinLevel( ) const
+{
+ return( this->m_MPRActors->GetMinLevel( ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRObjects::
+GetMaxLevel( ) const
+{
+ return( this->m_MPRActors->GetMaxLevel( ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRObjects::
+GetWindow( ) const
+{
+ return( this->m_MPRActors->GetWindow( ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::MPRObjects::
+GetLevel( ) const
+{
+ return( this->m_MPRActors->GetLevel( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+SetWindow( double w )
+{
+ this->m_MPRActors->SetWindow( w );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+SetLevel( double l )
+{
+ this->m_MPRActors->SetLevel( l );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+SetWindowLevel( double w, double l )
+{
+ this->m_MPRActors->SetWindowLevel( w, l );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+ResetWindowLevel( )
+{
+ this->m_MPRActors->ResetWindowLevel( );
+}
+
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::MPRObjects::
+GetSliceNumber( const int& axis ) const
+{
+ return( this->m_MPRActors->GetSliceNumber( axis ) );
+}
+
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::MPRObjects::
+GetSliceNumberMinValue( const int& axis ) const
+{
+ return( this->m_MPRActors->GetSliceNumberMinValue( axis ) );
+}
+
+// -------------------------------------------------------------------------
+int cpExtensions::Visualization::MPRObjects::
+GetSliceNumberMaxValue( const int& axis ) const
+{
+ return( this->m_MPRActors->GetSliceNumberMaxValue( axis ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+SetSliceNumber( const int& axis, const int& slice )
+{
+ this->m_MPRActors->SetSliceNumber( axis, slice );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+SetSlice( const int& axis, double* pos )
+{
+ this->m_MPRActors->SetSlice( axis, pos );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+Render( const double& t )
+{
+ this->Render( 0, t );
+ this->Render( 1, t );
+ this->Render( 2, t );
+ this->Render( 3, t );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+Render( const int& axis, const double& t )
+{
+ if( axis < 4 )
+ {
+ if( this->m_Windows[ axis ].GetPointer( ) != NULL )
+ {
+ if( this->m_Renderers[ axis ].GetPointer( ) != NULL )
+ this->m_Renderers[ axis ]->SetAllocatedRenderTime( t );
+ this->m_Windows[ axis ]->Render( );
} // fi
- // Create renderer, if render window exists
- this->m_Renderers[ i ] = vtkSmartPointer< vtkRenderer >::New( );
- this->m_Renderers[ i ]->SetBackground( 0.1, 0.3, 0.8 );
- this->m_Windows[ i ]->AddRenderer( this->m_Renderers[ i ] );
+ } // fi
+}
- } // rof
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+ResetCamera( const int& axis )
+{
+ if( axis < 4 )
+ if( this->m_Renderers[ axis ].GetPointer( ) != NULL )
+ this->m_Renderers[ axis ]->ResetCamera( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+ResetCameras( )
+{
+ this->ResetCamera( 0 );
+ this->ResetCamera( 1 );
+ this->ResetCamera( 2 );
+ this->ResetCamera( 3 );
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::MPRObjects::
+MPRObjects( )
+ : vtkObject( )
+{
+ this->m_MPRActors = vtkSmartPointer< MPRActors >::New( );
+}
- // Create 3D renderer
- if( this->m_Windows[ 3 ] != NULL )
- this->m_Renderers[ 3 ]->SetBackground( 0.2, 0.2, 0.2 );
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::MPRObjects::
+~MPRObjects( )
+{
+}
+
+
+
+
+/*
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+SetRenderWindows(
+ vtkRenderWindow* wx, vtkRenderWindow* wy,
+ vtkRenderWindow* wz, vtkRenderWindow* w3D
+ )
+{
}
// -------------------------------------------------------------------------
~MPRObjects( )
{
}
+*/
// eof - $RCSfile$
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
+// -------------------------------------------------------------------------
+#define cpExtensions_MPRObjects_Renderer( DIR ) \
+ inline vtkRenderer* Get##DIR##Renderer( ) \
+ { return( this->m_Renderers[ Self::MPRDirections_##DIR ] ); } \
+ inline const vtkRenderer* Get##DIR##Renderer( ) const \
+ { return( this->m_Renderers[ Self::MPRDirections_##DIR ] ); }
+
namespace cpExtensions
{
namespace Visualization
typedef MPRActors::TEnterCommand TEnterCommand;
typedef MPRActors::TLeaveCommand TLeaveCommand;
+ enum MPRDirections
+ {
+ MPRDirections_X = 0,
+ MPRDirections_Y = 1,
+ MPRDirections_Z = 2,
+ MPRDirections_W = 3
+ };
+
public:
vtkTypeMacro( MPRObjects, vtkObject );
+ cpExtensions_MPRObjects_Renderer( X );
+ cpExtensions_MPRObjects_Renderer( Y );
+ cpExtensions_MPRObjects_Renderer( Z );
+ cpExtensions_MPRObjects_Renderer( W );
+
public:
// Creation
static MPRObjects* New( );
+ // Association
void SetRenderWindows(
- vtkRenderWindow* wx, vtkRenderWindow* wy,
- vtkRenderWindow* wz, vtkRenderWindow* w3D
+ vtkRenderWindow* x, vtkRenderWindow* y,
+ vtkRenderWindow* z, vtkRenderWindow* w
+ );
+
+ void SetInputConnection( vtkAlgorithmOutput* aout );
+ void SetInputImage( vtkImageData* data );
+ int AddBinaryConnection(
+ vtkAlgorithmOutput* aout,
+ const double& r, const double& g, const double& b
);
- void AddImage( vtkImageData* image );
+ int AddBinaryImage(
+ vtkImageData* data,
+ const double& r, const double& g, const double& b
+ );
+ void Clear( );
+
+ vtkImageData* GetInputImage( );
+ const vtkImageData* GetInputImage( ) const;
unsigned int GetNumberOfImages( ) const;
- void ClearAll( );
- void ResetCamera( const int& id );
- void ResetCameras( );
- void Render( const int& id, const double& t );
- void RenderAll( const double& t );
- vtkRenderer* GetXRenderer( );
- vtkRenderer* GetYRenderer( );
- vtkRenderer* GetZRenderer( );
- vtkRenderer* Get3DRenderer( );
- const vtkRenderer* GetXRenderer( ) const;
- const vtkRenderer* GetYRenderer( ) const;
- const vtkRenderer* GetZRenderer( ) const;
- const vtkRenderer* Get3DRenderer( ) const;
-
- MPRActors* GetMPRActors( );
- const MPRActors* GetMPRActors( ) const;
+ void SetInterpolate( bool v );
+ void InterpolateOn( );
+ void InterpolateOff( );
+ double GetMinWindow( ) const;
+ double GetMaxWindow( ) const;
+ double GetMinLevel( ) const;
+ double GetMaxLevel( ) const;
double GetWindow( ) const;
double GetLevel( ) const;
+ void SetWindow( double w );
+ void SetLevel( double l );
+ void SetWindowLevel( double w, double l );
+ void ResetWindowLevel( );
+
+ int GetSliceNumber( const int& axis ) const;
+ int GetSliceNumberMinValue( const int& axis ) const;
+ int GetSliceNumberMaxValue( const int& axis ) const;
+ void SetSliceNumber( const int& axis, const int& slice );
+ void SetSlice( const int& axis, double* pos );
+
+ void Render( const double& t );
+ void Render( const int& axis, const double& t );
+ void ResetCamera( const int& axis );
+ void ResetCameras( );
protected:
MPRObjects( );
void cpPlugins::Interface::BaseMPRWidget::
DeleteAllData( )
{
- this->m_MPRObjects->ClearAll( );
+ this->m_MPRObjects->Clear( );
this->m_Data.clear( );
this->m_Tree.clear( );
this->m_UI->LoadedData->clear( );
if( iIt->second.Tag == Data::IMAGE )
{
- this->m_MPRObjects->AddImage( iIt->second.Image );
+ // TODO: this->m_MPRObjects->AddImage( iIt->second.Image );
+#error ACA VOY
}
else if( iIt->second.Tag == Data::MESH )
{