]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx
...
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / MacheteFilter.cxx
index 916d2ed1e84823475e238c3aacd72d81fbecaaed..82449b388a4d45f7f8a69c8c65bbacef684af206 100644 (file)
@@ -1,8 +1,5 @@
 #include "MacheteFilter.h"
 
-#include <cpPlugins/Interface/BaseApplication.h>
-#include <cpPlugins/Interface/Plugins.h>
-
 #include <cpPlugins/Interface/DataObject.h>
 #include <cpPlugins/Interface/Image.h>
 #include <cpPlugins/Interface/Mesh.h>
@@ -27,7 +24,7 @@ cpPlugins::BasicFilters::MacheteFilter_Dialog::
 MacheteFilter_Dialog(
   QWidget* parent, MacheteFilter* filter, Qt::WindowFlags f
   )
-  : QDialog( parent, f ),
+  : QDialog( parent, f | Qt::WindowStaysOnTopHint ),
     m_Filter( filter )
 {
   this->m_Title = new QLabel( this );
@@ -71,26 +68,37 @@ accept( )
   double center[ 3 ], normal[ 3 ];
   wdg->GetCenter( center );
   wdg->GetNormal( normal );
-  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( );
+  /* TODO
+     this->m_Filter->GetParameters( )->SetPoint( "PlaneCenter", 3, center );
+     this->m_Filter->GetParameters( )->SetVector( "PlaneNormal", 3, normal );
+  */
 
-  } // fi
+  // Update filter
+  /* 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( )
 {
-  std::cout << "reject" << std::endl;
+  /*
+  auto plugins = this->m_Filter->GetPlugins( );
+  if( plugins != NULL )
+    plugins->DeactivateFilter( );
+  */
+  this->Superclass::reject( );
 }
+
 #endif // cpPlugins_Interface_QT4
 
 // -------------------------------------------------------------------------
@@ -116,8 +124,8 @@ ExecConfigurationDialog( QWidget* parent )
     
   } // rof
   if( iren == NULL )
-    return( Self::DialogResult_Cancel );
-
+    return( false );
+  
   // Get bounding box
   double bbox[ 6 ];
   cpPlugins::Interface::Image* image =
@@ -138,7 +146,7 @@ ExecConfigurationDialog( QWidget* parent )
 
   } // fi
   if( !input_found )
-    return( Self::DialogResult_Cancel );
+    return( false );
 
   // Create plane widget
   if( this->m_PlaneWidget != NULL )
@@ -174,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
 }
 
@@ -187,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;
-
-  center.Fill( double( 0 ) );
-  normal.Fill( double( 0 ) );
-  normal[ 0 ] = double( 1 );
+  this->_AddOutput< cpPlugins::Interface::DataObject >( "PositiveOutput" );
+  this->_AddOutput< cpPlugins::Interface::DataObject >( "NegativeOutput" );
 
-  this->m_Parameters->ConfigureAsPoint( "PlaneCenter", 3, center );
-  this->m_Parameters->ConfigureAsVector( "PlaneNormal", 3, normal );
+  /*
+  this->m_Parameters->ConfigureAsPoint( "PlaneCenter" );
+  this->m_Parameters->ConfigureAsVector( "PlaneNormal" );
+  */
 }
 
 // -------------------------------------------------------------------------
@@ -262,12 +265,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 );
@@ -288,7 +295,7 @@ _RealImage( itk::DataObject* dobj )
   _TImage* pos_out = this->GetOutput< _TImage >( "PositiveOutput" );
   if( pos_out == NULL )
   {
-    this->_MakeOutput< _TImage >( "PositiveOutput" );
+    this->_AddOutput< _TImage >( "PositiveOutput" );
     pos_out = this->GetOutput< _TImage >( "PositiveOutput" );
     pos_out->SetName( pos_name );
 
@@ -296,7 +303,7 @@ _RealImage( itk::DataObject* dobj )
   _TImage* neg_out = this->GetOutput< _TImage >( "NegativeOutput" );
   if( neg_out == NULL )
   {
-    this->_MakeOutput< _TImage >( "NegativeOutput" );
+    this->_AddOutput< _TImage >( "NegativeOutput" );
     neg_out = this->GetOutput< _TImage >( "NegativeOutput" );
     neg_out->SetName( neg_name );