return; \
TImage* image = this->m_Plugins.GetData< TImage >( name ); \
this->m_UI->MPR->AddData( image, name, "" ); \
+ this->m_UI->MPR->SetMainImage( name ); \
this->m_UI->MPR->ShowData( name ); \
} \
catch( std::exception& err ) \
this->m_BlenderActor->GetProperty( )->SetLookupTable( this->m_BlenderLUT );
this->m_BlenderActor->GetProperty( )->UseLookupTableScalarRangeOn( );
- // Remove associated objects
- this->m_AssociatedSlices.clear( );
-
// White cursor
vtkSmartPointer< vtkPoints > cursor_points =
vtkSmartPointer< vtkPoints >::New( );
this->Modified( );
}
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageSliceActors::
-ImageSliceActors( )
- : Superclass( ),
- m_Window( NULL ),
- m_Interpolate( false )
-{
- this->Clear( );
- this->_ConfigureStyle( );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::Visualization::ImageSliceActors::
-~ImageSliceActors( )
-{
-}
-
// -------------------------------------------------------------------------
void cpExtensions::Visualization::ImageSliceActors::
-_Render( )
+Render( )
{
if( this->m_Window == NULL )
return;
// -------------------------------------------------------------------------
void cpExtensions::Visualization::ImageSliceActors::
-_ResetCamera( )
+ResetCamera( )
{
if( this->m_Window == NULL )
return;
renderer->ResetCamera( );
}
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::ImageSliceActors::
+ImageSliceActors( )
+ : Superclass( ),
+ m_Window( NULL ),
+ m_Interpolate( false )
+{
+ this->Clear( );
+ this->_ConfigureStyle( );
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::ImageSliceActors::
+~ImageSliceActors( )
+{
+}
+
// -------------------------------------------------------------------------
void cpExtensions::Visualization::ImageSliceActors::
_ConfigureStyle( )
// Just show the pixel information
actors->SetCursor( pos );
actors->UpdateText( pos );
- actors->_Render( );
+ actors->Render( );
}
else if( btn == TStyle::ButtonID_Left )
{
{
// Show axes in current renderer
actors->SetAxesCursor( pos );
- actors->_Render( );
+ actors->Render( );
// Interactively move slices
auto i = actors->m_SlicesCommands.begin( );
dx += actors->m_StartWindowLevel[ 0 ];
dy += actors->m_StartWindowLevel[ 1 ];
actors->SetWindowLevel( dx, dy );
- actors->_Render( );
+ actors->Render( );
// Associate objects
auto i = actors->m_WindowLevelCommands.begin( );
if( slice > actors->GetSliceNumberMaxValue( ) )
slice = actors->GetSliceNumberMaxValue( );
actors->SetSliceNumber( slice );
- actors->_Render( );
+ actors->Render( );
auto a = actors->m_AssociatedSlices.begin( );
for( ; a != actors->m_AssociatedSlices.end( ); ++a )
{
case 'r': case 'R':
{
- actors->_ResetCamera( );
- actors->_Render( );
+ actors->ResetCamera( );
+ actors->Render( );
// Associate objects
auto i = actors->m_RenderCommands.begin( );
case 'w': case 'W':
{
actors->ResetWindowLevel( );
- actors->_Render( );
+ actors->Render( );
// Associate objects
auto i = actors->m_RenderCommands.begin( );
actors->ResetCursor( );
actors->m_CursorActor->VisibilityOn( );
- actors->_Render( );
+ actors->Render( );
}
// -------------------------------------------------------------------------
actors->ResetCursor( );
actors->m_CursorActor->VisibilityOff( );
- actors->_Render( );
+ actors->Render( );
}
// eof - $RCSfile$
typedef void ( *TSlicesCommand )( double*, int, void* );
typedef void ( *TWindowLevelCommand )( double, double, void* );
typedef TVoidCommand TRenderCommand;
+ typedef TSlicesCommand TCursorAxesCommand;
typedef cpExtensions::Visualization::ImageBlender TBlender;
cpExtensions_BaseInteractorStyle_Commands( Slices );
cpExtensions_BaseInteractorStyle_Commands( WindowLevel );
cpExtensions_BaseInteractorStyle_Commands( Render );
+ cpExtensions_BaseInteractorStyle_Commands( CursorAxes );
public:
// Creation
void UpdateText( double pos[ 3 ] );
void UpdateText( const double& w, const double& l );
+ void Render( );
+ void ResetCamera( );
+
protected:
ImageSliceActors( );
virtual ~ImageSliceActors( );
- void _Render( );
- void _ResetCamera( );
void _ConfigureStyle( );
void _ConfigureInputImage( );
void _ConfigureBinaryImage(
void cpExtensions::Visualization::MPRActors::
SetInputConnection( vtkAlgorithmOutput* aout )
{
- 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 );
+ for( int i = 0; i < 2; ++i )
+ {
+ for( int j = 0; j < 3; ++j )
+ {
+ this->Slices[ i ][ j ]->SetInputConnection( aout );
+ this->Slices[ i ][ j ]->SetAxis( j );
+
+ } // rof
+
+ } // rof
+ this->_CreateBoundingBox( );
}
// -------------------------------------------------------------------------
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 );
+ for( int i = 0; i < 2; ++i )
+ {
+ for( int j = 0; j < 3; ++j )
+ {
+ this->Slices[ i ][ j ]->SetInputImage( data );
+ this->Slices[ i ][ j ]->SetAxis( j );
+
+ } // rof
+
+ } // rof
+ this->_CreateBoundingBox( );
}
// -------------------------------------------------------------------------
vtkRenderer* wren =
( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
if( wren != NULL )
+ {
wren->AddViewProp( this->ImageOutlineActor );
+ wren->AddViewProp( this->Slices[ 1 ][ 0 ]->GetPlaneActor( ) );
+ wren->AddViewProp( this->Slices[ 1 ][ 1 ]->GetPlaneActor( ) );
+ wren->AddViewProp( this->Slices[ 1 ][ 2 ]->GetPlaneActor( ) );
+
+ } // fi
}
// -------------------------------------------------------------------------
vtkRenderer* wren =
( w != NULL )? w->GetRenderers( )->GetFirstRenderer( ): NULL;
if( wren != NULL )
+ {
wren->RemoveViewProp( this->ImageOutlineActor );
+ wren->RemoveViewProp( this->Slices[ 1 ][ 0 ]->GetPlaneActor( ) );
+ wren->RemoveViewProp( this->Slices[ 1 ][ 1 ]->GetPlaneActor( ) );
+ wren->RemoveViewProp( this->Slices[ 1 ][ 2 ]->GetPlaneActor( ) );
+
+ } // fi
}
// -------------------------------------------------------------------------
} // fi
}
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+Render( const int& axis )
+{
+ if( axis < 3 )
+ {
+ this->Slices[ 0 ][ axis ]->Render( );
+ this->Slices[ 1 ][ axis ]->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+Render( )
+{
+ this->Render( 0 );
+ this->Render( 1 );
+ this->Render( 2 );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+ResetCamera( const int& axis )
+{
+ if( axis < 3 )
+ this->Slices[ 0 ][ axis ]->ResetCamera( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+ResetCameras( )
+{
+ this->ResetCamera( 0 );
+ this->ResetCamera( 1 );
+ this->ResetCamera( 2 );
+}
+
// -------------------------------------------------------------------------
cpExtensions::Visualization::MPRActors::
MPRActors( )
if( actors == NULL )
return;
for( unsigned int j = 0; j < 3; ++j )
+ {
if( actors->Slices[ 0 ][ j ]->GetAxis( ) != axis )
+ {
actors->SetSlice( j, pos );
+ actors->Render( j );
+
+ } // fi
+
+ } // rof
}
// -------------------------------------------------------------------------
if( actors == NULL )
return;
actors->SetWindowLevel( window, level );
+ actors->Render( );
}
// -------------------------------------------------------------------------
MPRActors* actors = reinterpret_cast< MPRActors* >( data );
if( actors == NULL )
return;
+ actors->Render( );
}
// eof - $RCSfile$
void SetSliceNumber( const int& axis, const int& slice );
void SetSlice( const int& axis, double* pos );
+ // Rendering controls
+ void Render( const int& axis );
+ void Render( );
+ void ResetCamera( const int& axis );
+ void ResetCameras( );
+
protected:
MPRActors( );
virtual ~MPRActors( );
return( this->m_MPRActors->AddBinaryImage( data, r, g, b ) );
}
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+Show( )
+{
+ this->m_MPRActors->PushActorsInto(
+ this->m_Windows[ 0 ],
+ this->m_Windows[ 1 ],
+ this->m_Windows[ 2 ],
+ this->m_Windows[ 3 ]
+ );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+Hide( )
+{
+}
+
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRObjects::
Clear( )
vtkImageData* data,
const double& r, const double& g, const double& b
);
+ void Show( );
+ void Hide( );
void Clear( );
vtkImageData* GetInputImage( );
if( iIt->second.Tag == Data::IMAGE )
{
- // TODO: this->m_MPRObjects->AddImage( iIt->second.Image );
-#error ACA VOY
+ if( name == this->m_MainImage )
+ this->m_MPRObjects->SetInputImage( iIt->second.Image );
+ else
+ this->m_MPRObjects->AddBinaryImage( iIt->second.Image, 1, 0, 0 );
+ this->m_MPRObjects->Show( );
}
else if( iIt->second.Tag == Data::MESH )
{