From 5281fb1eda049dd4ca455ec658dd7c74ebc8581c Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Thu, 15 Oct 2015 18:23:38 -0500 Subject: [PATCH] Minor refactoring and errors solved --- appli/examples/CMakeLists.txt | 2 +- .../examples/example_BaseInteractorStyle.cxx | 5 + appli/examples/example_Test_async.cxx | 4 +- appli/examples/example_View2DImage.cxx | 12 +- .../Visualization/ImageSliceActors.cxx | 375 +++++++++--------- .../Visualization/ImageSliceActors.h | 16 +- lib/cpExtensions/Visualization/MPRActors.cxx | 28 +- lib/cpExtensions/Visualization/MPRActors.h | 6 +- 8 files changed, 225 insertions(+), 223 deletions(-) diff --git a/appli/examples/CMakeLists.txt b/appli/examples/CMakeLists.txt index b762088..25b7d3c 100644 --- a/appli/examples/CMakeLists.txt +++ b/appli/examples/CMakeLists.txt @@ -28,7 +28,7 @@ SET( EXAMPLES_PROGRAMS_WITH_PLUGINS #example_ReadWriteImage #example_MPR - #example_View2DImage + example_View2DImage ##example_MarchingCubes ##example_OtsuFilter ##example_RGBImageToHSVChannels diff --git a/appli/examples/example_BaseInteractorStyle.cxx b/appli/examples/example_BaseInteractorStyle.cxx index 922511a..a8515d2 100644 --- a/appli/examples/example_BaseInteractorStyle.cxx +++ b/appli/examples/example_BaseInteractorStyle.cxx @@ -59,6 +59,11 @@ protected: virtual ~example_BaseInteractorStyle( ) { } + virtual bool _PickPosition( double pos[ 3 ] ) + { + return( true ); // Just testing... + } + private: // Purposely not implemented example_BaseInteractorStyle( const Self& ); diff --git a/appli/examples/example_Test_async.cxx b/appli/examples/example_Test_async.cxx index e3cfd99..fcd54cf 100644 --- a/appli/examples/example_Test_async.cxx +++ b/appli/examples/example_Test_async.cxx @@ -1,8 +1,10 @@ #include #include +#include #ifdef WIN32 #include #else +#include #endif #ifdef WIN32 @@ -73,4 +75,4 @@ int main() { return 0; -} \ No newline at end of file +} diff --git a/appli/examples/example_View2DImage.cxx b/appli/examples/example_View2DImage.cxx index c18ca50..4e7733b 100644 --- a/appli/examples/example_View2DImage.cxx +++ b/appli/examples/example_View2DImage.cxx @@ -58,10 +58,9 @@ int main( int argc, char* argv[] ) } // fi // Configure reader - TParameters reader_params = reader->GetDefaultParameters( ); + TParameters* reader_params = reader->GetParameters( ); for( int i = 2; i < argc; ++i ) - reader_params.AddValueToStringList( "FileNames", argv[ i ] ); - reader->SetParameters( reader_params ); + reader_params->AddToStringList( "FileNames", argv[ i ] ); // Execute pipeline std::string err = reader->Update( ); @@ -71,7 +70,7 @@ int main( int argc, char* argv[] ) return( 1 ); } // fi - TImage* image = reader->GetOutput< TImage >( 0 ); + TImage* image = reader->GetOutput< TImage >( "Output" ); // Configure visualization objects vtkSmartPointer< vtkRenderer > renderer = @@ -91,10 +90,7 @@ int main( int argc, char* argv[] ) // Create slice actors vtkSmartPointer< TSliceActors > image_actors = vtkSmartPointer< TSliceActors >::New( ); - image_actors->AddInputData( - image->GetVTK< vtkImageData >( ), 2, - TSliceActors::LUTType_WindowLevel - ); + image_actors->AddInputData( image->GetVTK< vtkImageData >( ), 2 ); image_actors->PushActorsInto( window ); // Begin interaction diff --git a/lib/cpExtensions/Visualization/ImageSliceActors.cxx b/lib/cpExtensions/Visualization/ImageSliceActors.cxx index 676f297..5892fe1 100644 --- a/lib/cpExtensions/Visualization/ImageSliceActors.cxx +++ b/lib/cpExtensions/Visualization/ImageSliceActors.cxx @@ -29,9 +29,19 @@ New( ) // ------------------------------------------------------------------------- void cpExtensions::Visualization::ImageSliceActors:: -AddCursorCommand( TCursorCommand command, void* data ) +AddSlicesCommand( TCursorCommand command, void* data ) { - this->m_CursorCommands.push_back( + this->m_SlicesCommands.push_back( + std::pair< TCursorCommand, void* >( command, data ) + ); + this->Modified( ); +} + +// ------------------------------------------------------------------------- +void cpExtensions::Visualization::ImageSliceActors:: +AddSeedCommand( TCursorCommand command, void* data ) +{ + this->m_SeedCommands.push_back( std::pair< TCursorCommand, void* >( command, data ) ); this->Modified( ); @@ -209,15 +219,6 @@ AssociateSlice( Self* other ) this->Modified( ); } -// ------------------------------------------------------------------------- -void cpExtensions::Visualization::ImageSliceActors:: -SetSlicesCommand( TCursorCommand cmd, void* data ) -{ - this->SlicesCommand = cmd; - this->SlicesData = data; - this->Modified( ); -} - // ------------------------------------------------------------------------- vtkInteractorStyle* cpExtensions::Visualization::ImageSliceActors:: GetStyle( ) @@ -244,23 +245,15 @@ PushActorsInto( vtkRenderWindow* window, bool force_style ) return; // Update style - if( force_style ) - { - this->_ConfigureStyle( ); + if( this->m_Style.GetPointer( ) != NULL && force_style ) rwi->SetInteractorStyle( this->m_Style ); - } // fi - // Update actors -# error USE vtkActorCollection interface - /* TODO - for( unsigned int n = 0; n < this->GetNumberOfImageActors( ); ++n ) - renderer->AddActor( this->GetImageActor( n ) ); - renderer->AddActor( this->m_CursorActor ); - renderer->AddActor( this->m_PlaneActor ); - renderer->AddActor( this->m_TextActor ); - renderer->Modified( ); - */ + vtkProp* prop; + this->InitTraversal( ); + while( prop = this->GetNextProp( ) ) + renderer->AddViewProp( prop ); + renderer->Modified( ); // Configure camera vtkCamera* camera = renderer->GetActiveCamera( ); @@ -302,15 +295,11 @@ PopActorsFrom( vtkRenderWindow* window ) if( renderer != NULL ) { // Update actors -# error USE vtkActorCollection interface - /* TODO - for( unsigned int n = 0; n < this->GetNumberOfImageActors( ); ++n ) - renderer->RemoveActor( this->GetImageActor( n ) ); - renderer->RemoveActor( this->m_CursorActor ); - renderer->RemoveActor( this->m_PlaneActor ); - renderer->RemoveActor( this->m_TextActor ); - renderer->Modified( ); - */ + vtkProp* prop; + this->InitTraversal( ); + while( prop = this->GetNextProp( ) ) + renderer->RemoveViewProp( prop ); + renderer->Modified( ); } // fi if( rwi != NULL ) @@ -405,11 +394,11 @@ AddActor( vtkActor* actor ) void cpExtensions::Visualization::ImageSliceActors:: SetInterpolate( bool v ) { - if( this->Interpolate != v ) + if( this->m_Interpolate != v ) { for( unsigned int i = 0; i < this->m_ImageActors.size( ); ++i ) this->m_ImageActors[ i ]->SetInterpolate( v ); - this->Interpolate = v; + this->m_Interpolate = v; this->Modified( ); } // fi @@ -535,26 +524,49 @@ GetImageMap( unsigned int id ) const return( NULL ); } +// ------------------------------------------------------------------------- +double cpExtensions::Visualization::ImageSliceActors:: +GetMinWindow( ) const +{ + return( this->m_MinWindow ); +} + +// ------------------------------------------------------------------------- +double cpExtensions::Visualization::ImageSliceActors:: +GetMaxWindow( ) const +{ + return( this->m_MaxWindow ); +} + +// ------------------------------------------------------------------------- +double cpExtensions::Visualization::ImageSliceActors:: +GetMinLevel( ) const +{ + return( this->m_MinLevel ); +} + +// ------------------------------------------------------------------------- +double cpExtensions::Visualization::ImageSliceActors:: +GetMaxLevel( ) const +{ + return( this->m_MaxLevel ); +} + // ------------------------------------------------------------------------- double cpExtensions::Visualization::ImageSliceActors:: GetWindow( ) const { - if( this->m_ImageMaps.size( ) > 0 ) - { - if( this->m_ImageMaps[ 0 ].GetPointer( ) != NULL ) - { - vtkWindowLevelLookupTable* lut = - dynamic_cast< vtkWindowLevelLookupTable* >( - this->m_ImageMaps[ 0 ]->GetLookupTable( ) - ); - if( lut != NULL ) - return( lut->GetWindow( ) ); - else - return( double( 0 ) ); - } - else - return( double( 0 ) ); - } + if( this->m_ImageMaps.size( ) == 0 ) + return( double( 0 ) ); + if( this->m_ImageMaps[ 0 ].GetPointer( ) == NULL ) + return( double( 0 ) ); + + vtkWindowLevelLookupTable* lut = + dynamic_cast< vtkWindowLevelLookupTable* >( + this->m_ImageMaps[ 0 ]->GetLookupTable( ) + ); + if( lut != NULL ) + return( lut->GetWindow( ) ); else return( double( 0 ) ); } @@ -563,22 +575,17 @@ GetWindow( ) const double cpExtensions::Visualization::ImageSliceActors:: GetLevel( ) const { - if( this->m_ImageMaps.size( ) > 0 ) - { - if( this->m_ImageMaps[ 0 ].GetPointer( ) != NULL ) - { - vtkWindowLevelLookupTable* lut = - dynamic_cast< vtkWindowLevelLookupTable* >( - this->m_ImageMaps[ 0 ]->GetLookupTable( ) - ); - if( lut != NULL ) - return( lut->GetLevel( ) ); - else - return( double( 0 ) ); - } - else - return( double( 0 ) ); - } + if( this->m_ImageMaps.size( ) == 0 ) + return( double( 0 ) ); + if( this->m_ImageMaps[ 0 ].GetPointer( ) == NULL ) + return( double( 0 ) ); + + vtkWindowLevelLookupTable* lut = + dynamic_cast< vtkWindowLevelLookupTable* >( + this->m_ImageMaps[ 0 ]->GetLookupTable( ) + ); + if( lut != NULL ) + return( lut->GetLevel( ) ); else return( double( 0 ) ); } @@ -587,114 +594,96 @@ GetLevel( ) const void cpExtensions::Visualization::ImageSliceActors:: SetWindow( double w ) { - if( this->m_ImageMaps.size( ) > 0 ) - { - if( this->m_ImageMaps[ 0 ].GetPointer( ) != NULL ) - { - vtkWindowLevelLookupTable* lut = - dynamic_cast< vtkWindowLevelLookupTable* >( - this->m_ImageMaps[ 0 ]->GetLookupTable( ) - ); - if( lut != NULL ) - { - /* TODO: Min and Max values are assigned 0!!! - if( w < this->MinWindow ) - w = this->MinWindow; - if( w > this->MaxWindow ) - w = this->MaxWindow; - */ - lut->SetWindow( w ); - lut->Build( ); - this->m_ImageMaps[ 0 ]->Modified( ); - this->Modified( ); - - } // fi - - } // fi + if( this->m_ImageMaps.size( ) == 0 ) + return; + if( this->m_ImageMaps[ 0 ].GetPointer( ) == NULL ) + return; + vtkWindowLevelLookupTable* lut = + dynamic_cast< vtkWindowLevelLookupTable* >( + this->m_ImageMaps[ 0 ]->GetLookupTable( ) + ); + if( lut == NULL ) + return; - } // fi + /* TODO: Min and Max values are assigned 0!!! + if( w < this->MinWindow ) + w = this->MinWindow; + if( w > this->MaxWindow ) + w = this->MaxWindow; + */ + lut->SetWindow( w ); + lut->Build( ); + this->m_ImageMaps[ 0 ]->Modified( ); + this->Modified( ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::ImageSliceActors:: SetLevel( double l ) { - if( this->m_ImageMaps.size( ) > 0 ) - { - if( this->m_ImageMaps[ 0 ].GetPointer( ) != NULL ) - { - vtkWindowLevelLookupTable* lut = - dynamic_cast< vtkWindowLevelLookupTable* >( - this->m_ImageMaps[ 0 ]->GetLookupTable( ) - ); - if( lut != NULL ) - { - /* TODO: Min and Max values are assigned 0!!! - if( l < this->MinLevel ) - l = this->MinLevel; - if( l > this->MaxLevel ) - l = this->MaxLevel; - */ - lut->SetLevel( l ); - lut->Build( ); - this->m_ImageMaps[ 0 ]->Modified( ); - this->Modified( ); - - } // fi - - } // fi + if( this->m_ImageMaps.size( ) == 0 ) + return; + if( this->m_ImageMaps[ 0 ].GetPointer( ) == NULL ) + return; + vtkWindowLevelLookupTable* lut = + dynamic_cast< vtkWindowLevelLookupTable* >( + this->m_ImageMaps[ 0 ]->GetLookupTable( ) + ); + if( lut == NULL ) + return; - } // fi + /* TODO: Min and Max values are assigned 0!!! + if( l < this->MinLevel ) + l = this->MinLevel; + if( l > this->MaxLevel ) + l = this->MaxLevel; + */ + lut->SetLevel( l ); + lut->Build( ); + this->m_ImageMaps[ 0 ]->Modified( ); + this->Modified( ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::ImageSliceActors:: SetWindowLevel( double w, double l ) { - if( this->m_ImageMaps.size( ) > 0 ) - { - if( this->m_ImageMaps[ 0 ].GetPointer( ) != NULL ) - { - vtkWindowLevelLookupTable* lut = - dynamic_cast< vtkWindowLevelLookupTable* >( - this->m_ImageMaps[ 0 ]->GetLookupTable( ) - ); - if( lut != NULL ) - { - /* TODO: Min and Max values are assigned 0!!! - std::cout << this->MinWindow << " " << this->MaxWindow << std::endl; - std::cout << this->MinLevel << " " << this->MaxLevel << std::endl; - std::cout << w << " " << l << " <-> " << std::ends; - if( w < this->MinWindow ) - w = this->MinWindow; - if( w > this->MaxWindow ) - w = this->MaxWindow; - if( l < this->MinLevel ) - l = this->MinLevel; - if( l > this->MaxLevel ) - l = this->MaxLevel; - std::cout << w << " " << l << std::endl; - */ - lut->SetWindow( w ); - lut->SetLevel( l ); - lut->Build( ); - this->m_ImageMaps[ 0 ]->Modified( ); - this->Modified( ); - - } // fi - - } // fi + if( this->m_ImageMaps.size( ) == 0 ) + return; + if( this->m_ImageMaps[ 0 ].GetPointer( ) == NULL ) + return; + vtkWindowLevelLookupTable* lut = + dynamic_cast< vtkWindowLevelLookupTable* >( + this->m_ImageMaps[ 0 ]->GetLookupTable( ) + ); + if( lut == NULL ) + return; - } // fi + /* TODO: Min and Max values are assigned 0!!! + if( w < this->MinWindow ) + w = this->MinWindow; + if( w > this->MaxWindow ) + w = this->MaxWindow; + if( l < this->MinLevel ) + l = this->MinLevel; + if( l > this->MaxLevel ) + l = this->MaxLevel; + */ + lut->SetWindow( w ); + lut->SetLevel( l ); + lut->Build( ); + this->m_ImageMaps[ 0 ]->Modified( ); + this->UpdateText( w, l ); + this->Modified( ); } // ------------------------------------------------------------------------- void cpExtensions::Visualization::ImageSliceActors:: ResetWindowLevel( ) { + static const double _2 = double( 2 ); this->SetWindowLevel( - this->MaxWindow, - ( this->MaxLevel + this->MinLevel ) / double( 2 ) + this->m_MaxWindow, ( this->m_MaxLevel + this->m_MinLevel ) / _2 ); } @@ -997,7 +986,6 @@ UpdateText( ) void cpExtensions::Visualization::ImageSliceActors:: UpdateText( double pos[ 3 ] ) { - /* TODO if( this->m_SliceMappers.size( ) > 0 ) { char axis; @@ -1054,7 +1042,6 @@ UpdateText( double pos[ 3 ] ) this->m_TextActor->SetInput( this->m_TextBuffer ); this->m_TextActor->Modified( ); this->Modified( ); - */ } // ------------------------------------------------------------------------- @@ -1085,11 +1072,10 @@ UpdateText( const double& w, const double& l ) cpExtensions::Visualization::ImageSliceActors:: ImageSliceActors( ) : Superclass( ), - Interpolate( false ) + m_Interpolate( false ) { this->Clear( ); - - this->SlicesCommand = NULL; + this->_ConfigureStyle( ); } // ------------------------------------------------------------------------- @@ -1143,10 +1129,10 @@ _ConfigureNewLUT( vtkImageData* data ) lut->Build( ); this->m_ImageMaps[ 0 ]->SetLookupTable( lut ); - this->MinWindow = double( 0 ); - this->MaxWindow = range[ 1 ] - range[ 0 ]; - this->MinLevel = range[ 0 ]; - this->MaxLevel = range[ 1 ]; + this->m_MinWindow = double( 0 ); + this->m_MaxWindow = range[ 1 ] - range[ 0 ]; + this->m_MinLevel = range[ 0 ]; + this->m_MaxLevel = range[ 1 ]; } else this->SetLookupTableAsColor( nImgs, 1, 0, 0 ); @@ -1171,7 +1157,7 @@ _ConfigureNewInput( int axis ) vtkSmartPointer< vtkImageActor >::New( ); this->m_ImageActors.push_back( actor ); actor->SetMapper( mapper ); - actor->SetInterpolate( this->Interpolate ); + actor->SetInterpolate( this->m_Interpolate ); actor->Modified( ); if( nImages == 0 ) @@ -1180,6 +1166,8 @@ _ConfigureNewInput( int axis ) if( nImages > 1 ) this->SetSliceNumber( this->GetSliceNumber( ) ); + else + this->SetSliceNumber( this->GetSliceNumberMaxValue( ) ); this->Modified( ); } @@ -1197,12 +1185,22 @@ _MouseMoveCommand( if( btn == ImageInteractorStyle::ButtonID_None ) { + actors->SetCursor( pos ); actors->UpdateText( pos ); + actors->GetStyle( )->GetInteractor( )->Render( ); } else if( btn == ImageInteractorStyle::ButtonID_Left ) { - if( !alt && ctr && !sft && actors->SlicesCommand != NULL ) - actors->SlicesCommand( pos, actors->GetAxis( ), actors->SlicesData ); + unsigned int nC = actors->m_SlicesCommands.size( ); + if( !alt && ctr && !sft && nC > 0 ) + { + for( unsigned int i = 0; i < nC; ++i ) + actors->m_SlicesCommands[ i ].first( + pos, actors->GetAxis( ), actors->m_SlicesCommands[ i ].second + ); + actors->GetStyle( )->GetInteractor( )->Render( ); + + } // fi } else if( btn == ImageInteractorStyle::ButtonID_Middle ) { @@ -1217,17 +1215,18 @@ _MouseMoveCommand( int a0 = actors->GetAxis( ); int a1 = ( a0 + 1 ) % 3; int a2 = ( a0 + 2 ) % 3; - double dx = pos[ a1 ] - actors->StartWindowLevelPos[ a1 ]; - double dy = pos[ a2 ] - actors->StartWindowLevelPos[ a2 ]; + double dx = pos[ a1 ] - actors->m_StartWindowLevelPos[ a1 ]; + double dy = pos[ a2 ] - actors->m_StartWindowLevelPos[ a2 ]; dx /= bounds[ ( a1 << 1 ) + 1 ] - bounds[ a1 << 1 ]; dy /= bounds[ ( a2 << 1 ) + 1 ] - bounds[ a2 << 1 ]; - dx *= actors->StartWindowLevel[ 0 ]; - dy *= actors->StartWindowLevel[ 1 ]; + dx *= actors->m_StartWindowLevel[ 0 ]; + dy *= actors->m_StartWindowLevel[ 1 ]; actors->SetWindowLevel( - actors->StartWindowLevel[ 0 ] + dx, - actors->StartWindowLevel[ 1 ] + dy + actors->m_StartWindowLevel[ 0 ] + dx, + actors->m_StartWindowLevel[ 1 ] + dy ); + actors->GetStyle( )->GetInteractor( )->Render( ); } // fi @@ -1246,11 +1245,11 @@ _MouseClickCommand( if( actors == NULL ) return; - actors->StartWindowLevelPos[ 0 ] = pos[ 0 ]; - actors->StartWindowLevelPos[ 1 ] = pos[ 1 ]; - actors->StartWindowLevelPos[ 2 ] = pos[ 2 ]; - actors->StartWindowLevel[ 0 ] = actors->GetWindow( ); - actors->StartWindowLevel[ 1 ] = actors->GetLevel( ); + actors->m_StartWindowLevelPos[ 0 ] = pos[ 0 ]; + actors->m_StartWindowLevelPos[ 1 ] = pos[ 1 ]; + actors->m_StartWindowLevelPos[ 2 ] = pos[ 2 ]; + actors->m_StartWindowLevel[ 0 ] = actors->GetWindow( ); + actors->m_StartWindowLevel[ 1 ] = actors->GetLevel( ); } // ------------------------------------------------------------------------- @@ -1267,17 +1266,14 @@ _MouseDoubleClickCommand( if( btn == ImageInteractorStyle::ButtonID_Left ) { - if( !alt && !ctr && !sft ) - actors->SetCursor( pos ); - else if( !alt && ctr && !sft && actors->SlicesCommand != NULL ) + unsigned int nC = actors->m_SeedCommands.size( ); + if( !alt && ctr && !sft && nC > 0 ) { - actors->SlicesCommand( pos, actors->GetAxis( ), actors->SlicesData ); - for( unsigned int i = 0; i < actors->m_CursorCommands.size( ); ++i ) - actors->m_CursorCommands[ i ].first( - pos, - actors->GetAxis( ), - actors->m_CursorCommands[ i ].second + for( unsigned int i = 0; i < nC; ++i ) + actors->m_SeedCommands[ i ].first( + pos, actors->GetAxis( ), actors->m_SeedCommands[ i ].second ); + actors->GetStyle( )->GetInteractor( )->Render( ); } // fi } @@ -1303,20 +1299,19 @@ _MouseWheelCommand( if( !alt && !ctr && !sft ) { actors->SetSliceNumber( actors->GetSliceNumber( ) + dir ); + actors->GetStyle( )->GetInteractor( )->Render( ); } else if( !alt && !ctr && sft ) { actors->SetSliceNumber( actors->GetSliceNumber( ) + ( dir * 10 ) ); + actors->GetStyle( )->GetInteractor( )->Render( ); } // fi } // ------------------------------------------------------------------------- void cpExtensions::Visualization::ImageSliceActors:: -_KeyCommand( - void* data, - const char& key - ) +_KeyCommand( void* data, const char& key ) { } diff --git a/lib/cpExtensions/Visualization/ImageSliceActors.h b/lib/cpExtensions/Visualization/ImageSliceActors.h index 21eef1e..96d4550 100644 --- a/lib/cpExtensions/Visualization/ImageSliceActors.h +++ b/lib/cpExtensions/Visualization/ImageSliceActors.h @@ -46,23 +46,18 @@ namespace cpExtensions public: vtkTypeMacro( ImageSliceActors, vtkPropCollection ); - vtkGetMacro( MinWindow, double ); - vtkGetMacro( MaxWindow, double ); - vtkGetMacro( MinLevel, double ); - vtkGetMacro( MaxLevel, double ); - public: // Creation static ImageSliceActors* New( ); - void AddCursorCommand( TCursorCommand command, void* data ); + void AddSlicesCommand( TCursorCommand command, void* data ); + void AddSeedCommand( TCursorCommand command, void* data ); void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 ); void AddInputData( vtkImageData* data, int axis = 2 ); void Clear( ); void AssociateSlice( Self* other ); - void SetSlicesCommand( TCursorCommand cmd, void* data ); vtkInteractorStyle* GetStyle( ); const vtkInteractorStyle* GetStyle( ) const; @@ -95,6 +90,10 @@ namespace cpExtensions vtkImageMapToColors* GetImageMap( unsigned int id ); const vtkImageMapToColors* GetImageMap( unsigned int id ) const; + double GetMinWindow( ) const; + double GetMaxWindow( ) const; + double GetMinLevel( ) const; + double GetMaxLevel( ) const; double GetWindow( ) const; double GetLevel( ) const; void SetWindow( double w ); @@ -172,7 +171,8 @@ namespace cpExtensions std::vector< vtkSmartPointer< Self > > m_AssociatedSlices; // Associated commands - std::vector< std::pair< TCursorCommand, void* > > m_CursorCommands; + std::vector< std::pair< TCursorCommand, void* > > m_SlicesCommands; + std::vector< std::pair< TCursorCommand, void* > > m_SeedCommands; // Other associated actors typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor; diff --git a/lib/cpExtensions/Visualization/MPRActors.cxx b/lib/cpExtensions/Visualization/MPRActors.cxx index a02c8bc..f755e45 100644 --- a/lib/cpExtensions/Visualization/MPRActors.cxx +++ b/lib/cpExtensions/Visualization/MPRActors.cxx @@ -244,15 +244,17 @@ PushActorsInto( for( unsigned int j = 0; j < 3; ++j ) { - 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( ) - ); + /* 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( ) + ); + */ } // rof } @@ -407,9 +409,11 @@ MPRActors( ) this->Slices[ 0 ][ 1 ]->AssociateSlice( this->Slices[ 1 ][ 1 ] ); this->Slices[ 0 ][ 2 ]->AssociateSlice( this->Slices[ 1 ][ 2 ] ); - this->Slices[ 0 ][ 0 ]->SetSlicesCommand( Self::_SetSlices, this ); - this->Slices[ 0 ][ 1 ]->SetSlicesCommand( Self::_SetSlices, this ); - this->Slices[ 0 ][ 2 ]->SetSlicesCommand( Self::_SetSlices, this ); + /* 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 ); + */ } // ------------------------------------------------------------------------- diff --git a/lib/cpExtensions/Visualization/MPRActors.h b/lib/cpExtensions/Visualization/MPRActors.h index 8b88fdc..2496780 100644 --- a/lib/cpExtensions/Visualization/MPRActors.h +++ b/lib/cpExtensions/Visualization/MPRActors.h @@ -32,9 +32,9 @@ namespace cpExtensions void AddCursorCommand( TCursorCommand command, void* data ) { - this->Slices[ 0 ][ 0 ]->AddCursorCommand( command, data ); - this->Slices[ 0 ][ 1 ]->AddCursorCommand( command, data ); - this->Slices[ 0 ][ 2 ]->AddCursorCommand( command, data ); + this->Slices[ 0 ][ 0 ]->AddSlicesCommand( command, data ); + this->Slices[ 0 ][ 1 ]->AddSlicesCommand( command, data ); + this->Slices[ 0 ][ 2 ]->AddSlicesCommand( command, data ); } ImageSliceActors* GetSliceActors( const int& i ) const; -- 2.47.1