X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FBasicFilters%2FMacheteFilter.cxx;h=e8e9b101e8888c32f6c5d5769e4e2d574d3fdfc7;hb=a89305e04527ebe2e81d0d1a62bbe34e0d35a141;hp=f07b60e4e27832199c80d1a4cf7f6dad75d7cea0;hpb=51f6a14e2d16bd79de3cf82693275a0abaaf9007;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx index f07b60e..e8e9b10 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx @@ -1,8 +1,5 @@ #include "MacheteFilter.h" -#include -#include - #include #include #include @@ -72,27 +69,33 @@ accept( ) wdg->GetCenter( center ); wdg->GetNormal( normal ); - this->m_Filter->GetParameters( )->SetPoint( "PlaneCenter", 3, center ); - this->m_Filter->GetParameters( )->SetVector( "PlaneNormal", 3, normal ); + /* TODO + this->m_Filter->GetParameters( )->SetPoint( "PlaneCenter", 3, center ); + this->m_Filter->GetParameters( )->SetVector( "PlaneNormal", 3, normal ); + */ // Update filter - auto plugins = this->m_Filter->GetPlugins( ); - if( plugins != NULL ) - { - auto app = plugins->GetApplication( ); - if( app != NULL ) - app->UpdateActualFilter( ); - - } // fi + /* TODO + auto plugins = this->m_Filter->GetPlugins( ); + if( plugins != NULL ) + { + auto app = plugins->GetApplication( ); + if( app != NULL ) + app->UpdateActualFilter( ); + + } // fi + */ } // ------------------------------------------------------------------------- void cpPlugins::BasicFilters::MacheteFilter_Dialog:: reject( ) { + /* auto plugins = this->m_Filter->GetPlugins( ); if( plugins != NULL ) plugins->DeactivateFilter( ); + */ this->Superclass::reject( ); } @@ -109,6 +112,7 @@ ExecConfigurationDialog( QWidget* parent ) // Choose a valid 3D interactor vtkRenderWindowInteractor* iren = NULL; + /* TODO auto iIt = this->m_Interactors.begin( ); for( ; iIt != this->m_Interactors.end( ) && iren == NULL; ++iIt ) { @@ -120,13 +124,13 @@ ExecConfigurationDialog( QWidget* parent ) iren = *iIt; } // rof + */ if( iren == NULL ) - return( Self::DialogResult_Cancel ); - + return( false ); + // Get bounding box double bbox[ 6 ]; - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); bool input_found = false; if( image != NULL ) { @@ -134,8 +138,7 @@ ExecConfigurationDialog( QWidget* parent ) input_found = true; } // fi - cpPlugins::Interface::Mesh* mesh = - this->GetInput< cpPlugins::Interface::Mesh >( "Input" ); + auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" ); if( mesh != NULL ) { mesh->GetVTK< vtkPolyData >( )->GetBounds( bbox ); @@ -143,7 +146,7 @@ ExecConfigurationDialog( QWidget* parent ) } // fi if( !input_found ) - return( Self::DialogResult_Cancel ); + return( false ); // Create plane widget if( this->m_PlaneWidget != NULL ) @@ -179,9 +182,9 @@ ExecConfigurationDialog( QWidget* parent ) this->m_Dialog = new MacheteFilter_Dialog( NULL, this ); this->m_Dialog->show( ); - return( Self::DialogResult_Modal ); + return( true ); #else // cpPlugins_Interface_QT4 - return( Self::DialogResult_Cancel ); + return( false ); #endif // cpPlugins_Interface_QT4 } @@ -192,18 +195,13 @@ MacheteFilter( ) m_PlaneWidget( NULL ) { this->_AddInput( "Input" ); - this->_MakeOutput< cpPlugins::Interface::DataObject >( "PositiveOutput" ); - this->_MakeOutput< cpPlugins::Interface::DataObject >( "NegativeOutput" ); - - itk::Point< double, 3 > center; - itk::Vector< double, 3 > normal; + this->_AddOutput< cpPlugins::Interface::DataObject >( "PositiveOutput" ); + this->_AddOutput< cpPlugins::Interface::DataObject >( "NegativeOutput" ); - center.Fill( double( 0 ) ); - normal.Fill( double( 0 ) ); - normal[ 0 ] = double( 1 ); - - this->m_Parameters->ConfigureAsPoint( "PlaneCenter", 3, center ); - this->m_Parameters->ConfigureAsVector( "PlaneNormal", 3, normal ); + /* + this->m_Parameters->ConfigureAsPoint( "PlaneCenter" ); + this->m_Parameters->ConfigureAsVector( "PlaneNormal" ); + */ } // ------------------------------------------------------------------------- @@ -218,12 +216,10 @@ cpPlugins::BasicFilters::MacheteFilter:: std::string cpPlugins::BasicFilters::MacheteFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image != NULL ) return( this->_FromImage( image ) ); - cpPlugins::Interface::Mesh* mesh = - this->GetInput< cpPlugins::Interface::Mesh >( "Input" ); + auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" ); if( mesh == NULL ) return( this->_FromMesh( mesh ) ); return( "MacheteFilter: No valid input." ); @@ -267,12 +263,16 @@ _RealImage( itk::DataObject* dobj ) I* image = dynamic_cast< I* >( dobj ); + /* _TPoint c = this->m_Parameters->GetPoint< _TPoint >( "PlaneCenter", I::ImageDimension ); _TVector n = this->m_Parameters->GetVector< _TVector >( "PlaneNormal", I::ImageDimension ); + */ + _TPoint c; + _TVector n; typename _TPlane::Pointer plane = _TPlane::New( ); plane->SetCenter( c ); @@ -285,31 +285,25 @@ _RealImage( itk::DataObject* dobj ) filter->SetOutsideValue( _TPixel( 0 ) ); filter->Update( ); - // Get output names - auto pos_name = this->GetOutput< _TObj >( "PositiveOutput" )->GetName( ); - auto neg_name = this->GetOutput< _TObj >( "NegativeOutput" )->GetName( ); - // Connect outputs (and correct their types and names) - _TImage* pos_out = this->GetOutput< _TImage >( "PositiveOutput" ); + _TImage* pos_out = this->GetOutputData< _TImage >( "PositiveOutput" ); if( pos_out == NULL ) { - this->_MakeOutput< _TImage >( "PositiveOutput" ); - pos_out = this->GetOutput< _TImage >( "PositiveOutput" ); - pos_out->SetName( pos_name ); + this->_AddOutput< _TImage >( "PositiveOutput" ); + pos_out = this->GetOutputData< _TImage >( "PositiveOutput" ); } // fi - _TImage* neg_out = this->GetOutput< _TImage >( "NegativeOutput" ); + _TImage* neg_out = this->GetOutputData< _TImage >( "NegativeOutput" ); if( neg_out == NULL ) { - this->_MakeOutput< _TImage >( "NegativeOutput" ); - neg_out = this->GetOutput< _TImage >( "NegativeOutput" ); - neg_out->SetName( neg_name ); + this->_AddOutput< _TImage >( "NegativeOutput" ); + neg_out = this->GetOutputData< _TImage >( "NegativeOutput" ); } // fi // Assign outputs - pos_out->SetITK< I >( filter->GetPositiveOutput( ) ); - neg_out->SetITK< I >( filter->GetNegativeOutput( ) ); + pos_out->SetITK( filter->GetPositiveOutput( ) ); + neg_out->SetITK( filter->GetNegativeOutput( ) ); return( "" ); }