]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 30 Sep 2016 13:28:26 +0000 (08:28 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 30 Sep 2016 13:28:26 +0000 (08:28 -0500)
plugins/Widgets/SeedWidget.cxx

index 646c7b063afd0d4f8c2a534f6353c60ea97bd204..2b11821b4189fab71521836e7cb128a12bf9dab9 100644 (file)
 // This callback is responsible for changing update time
 namespace cpPluginsWidgets
 {
-    /**
-     */
-     class SeedWidgetCallback
-      : public vtkCommand
-       {
-       public:
-       static SeedWidgetCallback* New( )
-       { return( new SeedWidgetCallback ); }
-       virtual void Execute( vtkObject* caller, unsigned long id, void* data )
-       {
-        /*
-       typedef cpPluginsWidgets::SeedWidget::TImageActor _TImageActor;
-       auto actor = dynamic_cast< _TImageActor* >( caller );
-*/
-/*
-       if( id == vtkCommand::InteractionEvent && actor != NULL )
-       {
-       int slice = actor->GetSliceNumber( );
-       if( this->Data->ActualWidgetId != slice )
-       {
-       this->Data->Widgets[ this->Data->ActualWidgetId ]->EnabledOff( );
-       this->Data->Widgets[ slice ]->EnabledOn( );
-       this->Data->ActualWidgetId = slice;
-
-       } // fi
-       }
-       else
-*/
-   //       id == vtkCommand::CursorChangedEvent ||
+  /**
+   */
+  class SeedWidgetCallback
+    : public vtkCommand
+  {
+  public:
+    static SeedWidgetCallback* New( )
+      { return( new SeedWidgetCallback ); }
+    virtual void Execute( vtkObject* caller, unsigned long id, void* data )
+      {
+        /* TODO
+          typedef cpPluginsWidgets::SeedWidget::TImageActor _TImageActor;
+          auto actor = dynamic_cast< _TImageActor* >( caller );
+        */
+        /* TODO
+           if( id == vtkCommand::InteractionEvent && actor != NULL )
+           {
+           int slice = actor->GetSliceNumber( );
+           if( this->Data->ActualWidgetId != slice )
+           {
+           this->Data->Widgets[ this->Data->ActualWidgetId ]->EnabledOff( );
+           this->Data->Widgets[ slice ]->EnabledOn( );
+           this->Data->ActualWidgetId = slice;
+           } // fi
+           }
+           else
+        */
+        //       id == vtkCommand::CursorChangedEvent ||
         if( id == vtkCommand::PlacePointEvent )
         {
           auto wdg = dynamic_cast< cpExtensions::Interaction::SeedWidget* >( caller );
@@ -52,8 +51,8 @@ namespace cpPluginsWidgets
           {
             auto rep =
               dynamic_cast< vtkSeedRepresentation* >(
-                 wdg->GetRepresentation( )
-                 );
+                wdg->GetRepresentation( )
+                );
             if( rep != NULL )
             {
               unsigned long nSeeds = rep->GetNumberOfSeeds( );
@@ -65,44 +64,46 @@ namespace cpPluginsWidgets
                 Seeds->GetPoints( )->InsertNextPoint( pos );
                 Seeds->GetVerts( )->InsertNextCell( 1 );
                 Seeds->GetVerts( )->InsertCellPoint( nSeeds - 1 );
-              }
-             } // fi
-
-
-          }
-       }
-     }
 
-       protected:
-       SeedWidgetCallback( )
-       : vtkCommand( ),
-         Seeds( NULL )
-/*
-       ,
-       Widget( NULL ),
-       Data( NULL )
-       */
-       { }
-       virtual ~SeedWidgetCallback( ) { }
-     public:
-      vtkPolyData* Seeds;
-  /*
-       public:
-       SeedWidget* Widget;
-       SeedWidget::TWidgetData* Data;
-       */
-       };
-
-  } // ecapseman
+              } // fi
+
+            } // fi
+
+          } // fi
+
+        } // fi
+      }
+
+  protected:
+    SeedWidgetCallback( )
+      : vtkCommand( ),
+        Seeds( NULL )
+                      /*
+                        ,
+                        Widget( NULL ),
+                        Data( NULL )
+                      */
+      { }
+    virtual ~SeedWidgetCallback( ) { }
+  public:
+    vtkPolyData* Seeds;
+    /*
+      public:
+      SeedWidget* Widget;
+      SeedWidget::TWidgetData* Data;
+    */
+  };
+
+} // ecapseman
 
 // -------------------------------------------------------------------------
 cpPluginsWidgets::SeedWidget::
 SeedWidget( )
   : Superclass( )
-  /* TODO
-     ,
-     m_Configured( false )
-  */
+          /* TODO
+             ,
+             m_Configured( false )
+          */
 {
   typedef cpPlugins::BaseObjects::DataObject _TData;
   typedef cpPlugins::DataObjects::Mesh _TMesh;
@@ -291,49 +292,49 @@ _GD0_Image( vtkImageData* image )
   {
     auto cb = vtkSmartPointer< SeedWidgetCallback >::New( );
     cb->Seeds = this->GetOutputData< vtkPolyData >( "Output" );
-     this->m_Command = cb;
+    this->m_Command = cb;
 
-  for(
-    auto inIt = this->m_Interactors.begin( );
-    inIt != this->m_Interactors.end( );
-    ++inIt
-    )
-  {
-    auto rends = ( *inIt )->GetRenderWindow( )->GetRenderers( );
-    std::set< TImageActor* > all_props;
-    if( rends != NULL )
+    for(
+      auto inIt = this->m_Interactors.begin( );
+      inIt != this->m_Interactors.end( );
+      ++inIt
+      )
     {
-      rends->InitTraversal( );
-      while( vtkRenderer* ren = rends->GetNextItem( ) )
+      auto rends = ( *inIt )->GetRenderWindow( )->GetRenderers( );
+      std::set< TImageActor* > all_props;
+      if( rends != NULL )
       {
-        auto props = ren->GetViewProps( );
-        props->InitTraversal( );
-        while( vtkProp* p = props->GetNextProp( ) )
+        rends->InitTraversal( );
+        while( vtkRenderer* ren = rends->GetNextItem( ) )
         {
-          auto image_actor = dynamic_cast< TImageActor* >( p );
-          if( image_actor != NULL )
+          auto props = ren->GetViewProps( );
+          props->InitTraversal( );
+          while( vtkProp* p = props->GetNextProp( ) )
           {
-            if( image_actor->GetImage( ) == image )
-            all_props.insert( image_actor );
+            auto image_actor = dynamic_cast< TImageActor* >( p );
+            if( image_actor != NULL )
+            {
+              if( image_actor->GetImage( ) == image )
+                all_props.insert( image_actor );
 
-          }
+            }
 
+          } // elihw
         } // elihw
-      } // elihw
 
-    } // fi
-    if( all_props.size( ) == 1 )
-    {
-     this->m_Data[ *inIt ] =
-       new TWidgetData( this, *( all_props.begin( ) ), *inIt, this->m_Command );
-    }
+      } // fi
+      if( all_props.size( ) == 1 )
+      {
+        this->m_Data[ *inIt ] =
+          new TWidgetData( this, *( all_props.begin( ) ), *inIt, this->m_Command );
+      }
 
-  } // rof
-}
-else
-{
-  // akjhdaksjhd
-}
+    } // rof
+  }
+  else
+  {
+    // akjhdaksjhd
+  }
 
 }
 
@@ -348,11 +349,11 @@ TWidgetData(
 {
   auto cb = dynamic_cast< SeedWidgetCallback* >( cmd );
 /*
-     auto cb = vtkSmartPointer< SeedWidgetCallback >::New( );
-     cb->Widget = seedWidget;
-     cb->Data = this;
-     this->Command = cb;
-     actor->AddObserver( vtkCommand::InteractionEvent, cb );
+  auto cb = vtkSmartPointer< SeedWidgetCallback >::New( );
+  cb->Widget = seedWidget;
+  cb->Data = this;
+  this->Command = cb;
+  actor->AddObserver( vtkCommand::InteractionEvent, cb );
 */
   /* TODO
      auto image = actor->GetImage( );