]> Creatis software - bbtk.git/commitdiff
#2445 BBTK Feature New Normal - Block Propogation pipeline MagicBox
authordavila <eduardo.davila@creatis.insa-lyon.fr>
Wed, 27 Aug 2014 07:27:37 +0000 (09:27 +0200)
committerdavila <eduardo.davila@creatis.insa-lyon.fr>
Wed, 27 Aug 2014 07:27:37 +0000 (09:27 +0200)
kernel/src/bbtkBlackBox.h
packages/std/src/bbstdMagicBox.cxx
packages/std/src/bbstdMagicBox.h
packages/vtk/src/bbvtkSphereSource.xml

index adddc294c0f355d03f4d1e2966bfbeb5c6fd0b84..17f59999f2296b6ab9159df9a75917298f139007 100644 (file)
@@ -488,7 +488,7 @@ namespace bbtk
 
     //==================================================================
     /// Computes the final IOStatus of inputs and outputs after processing
-    void bbComputePostProcessStatus();
+virtual    void bbComputePostProcessStatus();
     //@}
     //==================================================================
 
@@ -567,17 +567,13 @@ namespace bbtk
     //@{
 
     /// Connects the input <name> to the connection c
-    virtual void bbConnectInput( const std::string& name,
-                                Connection* c);
+    virtual void bbConnectInput( const std::string& name, Connection* c);
     /// Connects the output <name> to the connection c
-    virtual void bbConnectOutput( const std::string& name,
-                                 Connection* c);
+    virtual void bbConnectOutput( const std::string& name, Connection* c);
     /// Disconnects the input <name> from the connection c
-    virtual void bbDisconnectInput( const std::string& name,
-                                   Connection* c);
+    virtual void bbDisconnectInput( const std::string& name, Connection* c);
     /// Disconnects the output <name> from the connection c
-    virtual void bbDisconnectOutput( const std::string& name,
-                                    Connection* c);
+    virtual void bbDisconnectOutput( const std::string& name, Connection* c);
     //@}
     //==================================================================
 
@@ -590,8 +586,6 @@ namespace bbtk
     /// Sets the bbmExecuting bool returned by bbGetExecuting
     void bbSetExecuting(bool b) { bbmExecuting = b; }
 
-  protected:
-
     //==================================================================
   protected:
 
index 0bf4ed69ab845bd41912a1b535d2a1e60b8b473a..8b99a75219af0edcd96c3fb5461637a20debd010 100644 (file)
@@ -41,21 +41,50 @@ using namespace bbtk;
 namespace bbstd
 {
 
+       void MagicBox::bbComputePostProcessStatus()
+       {
+       AtomicBlackBox::bbComputePostProcessStatus();
+
+       if (bbGetInputActive()==false)
+       {
+printf("EED MagicBox::bbComputePostProcessStatus 1\n");
+               // Update the output statuses
+               IOStatus new_output_status = UPTODATE;
+               OutputConnectorMapType::iterator o;
+               for ( o = bbGetOutputConnectorMap().begin(); o!= bbGetOutputConnectorMap().end(); ++o) 
+               {
+                       o->second->SetStatus(new_output_status);
+               } // for o
+       } // if
+
+  }
+
 
   void MagicBox::bbUserSetDefaultValues()
   {
+       bbSetInputActive(true);
   }
+
   void MagicBox::bbUserInitializeProcessing() 
   { 
   }
+
   void  MagicBox::bbUserFinalizeProcessing() 
   {
   }
+
   void MagicBox::DoProcess()
   { 
-printf("EED MagicBox::DoProcess Start\n");
-    bbSetOutputOut( bbGetInputIn() );
+       if (bbGetInputActive()==true)
+       {
+printf("EED MagicBox::DoProcess Start %p\n", this);
+               bbSetOutputOut( bbGetInputIn() );
 printf("EED MagicBox::DoProcess End\n");
+       } // Active
+   else 
+       {
+      printf("EED MagicBox::DoProcess FALSE\n");
+       }
   }
 
   BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,MagicBox);
index 47d7c9c40fbe8b5b5360fc168937c5b922a1d035..1f3b6e4ed6d6553b4a9fbd6b7323767def46e511 100644 (file)
@@ -50,9 +50,12 @@ namespace bbstd
   {
     BBTK_BLACK_BOX_INTERFACE(MagicBox,bbtk::AtomicBlackBox);
     BBTK_DECLARE_INPUT(In,bbtk::Data);
+    BBTK_DECLARE_INPUT(Active,bool);
     BBTK_DECLARE_OUTPUT(Out,bbtk::Data);
     BBTK_PROCESS(DoProcess);
     void DoProcess();
+
+    virtual void bbComputePostProcessStatus();
  };
   //==================================================================
   
@@ -114,6 +117,9 @@ namespace bbstd
     (&MagicBox::bbGetInputIn),
     new MagicBoxSetFunctor (&MagicBox::bbSetInputIn) ) );
 
+  BBTK_INPUT(MagicBox, Active, "Active True/False (default True)",bool,"");  
+
+
   AddOutputDescriptor
   (new bbtk::AtomicBlackBoxOutputDescriptor
    (typeid(MagicBoxDescriptor),
index 270713136d9ef33c16a168fbaa1bfcc9bba64c5b..463fca033660643d7873fc5932cd6c315c2c7aaa 100644 (file)
@@ -10,6 +10,7 @@
 <vtkobject>vtkSphereSource</vtkobject>
 
 <output name="Out" type="vtkPolyData*" description="Output Sphere" special="vtk output"/>
+<input name="Active" type="bool" description="Active True/False (default True)"/>
 <input name="CenterX" type="double" description="Center X coord"/>
 <input name="CenterY" type="double" description="Center Y coord"/>
 <input name="CenterZ" type="double" description="Center Z coord"/>
 <process>
 <PRE>
  
+if (bbGetInputActive()==true)
+{
 
-bbGetVtkObject()->SetCenter(bbGetInputCenterX(), 
-          bbGetInputCenterY(), 
-          bbGetInputCenterZ());
-//bbGetVtkObject()->SetPhiResolution(bbGetInputPhiResolution());
-//bbGetVtkObject()->SetThetaResolution(bbGetInputThetaResolution());
-//bbGetVtkObject()->SetRadius(bbGetInputRadius());
-//printf("EED box vtk:SphereSource theta=%d  phi=%d\n", bbGetInputThetaResolution() , bbGetInputPhiResolution());
+       bbGetVtkObject()->SetCenter(bbGetInputCenterX(), bbGetInputCenterY(), bbGetInputCenterZ());
+   //bbGetVtkObject()->SetPhiResolution(bbGetInputPhiResolution());
+   //bbGetVtkObject()->SetThetaResolution(bbGetInputThetaResolution());
+   //bbGetVtkObject()->SetRadius(bbGetInputRadius());
+   //printf("EED box vtk:SphereSource theta=%d  phi=%d\n", bbGetInputThetaResolution() , bbGetInputPhiResolution());
+       bbGetVtkObject()->Update();
+}
 
-bbGetVtkObject()->Update();
 </PRE>
 </process>
 
 
+<defaultValues><PRE>
+  bbSetInputActive(true);
+</PRE></defaultValues>
+
 </blackbox>