]> Creatis software - bbtk.git/commitdiff
#3267 BBTK Feature New Normal - VectorFilterString Box
authorEduardo DAVILA <davila@localhost.localdomain>
Tue, 25 Jun 2019 08:58:52 +0000 (10:58 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Tue, 25 Jun 2019 08:58:52 +0000 (10:58 +0200)
packages/std/src/bbstdVectorFilterString.cxx [new file with mode: 0644]
packages/std/src/bbstdVectorFilterString.h [new file with mode: 0644]
packages/vtk/src/bbvtkPolyDataToActor.cxx
packages/vtk/src/bbvtkSphereSource.xml

diff --git a/packages/std/src/bbstdVectorFilterString.cxx b/packages/std/src/bbstdVectorFilterString.cxx
new file mode 100644 (file)
index 0000000..23adb9d
--- /dev/null
@@ -0,0 +1,128 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbstdVectorFilterString.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,VectorFilterString)
+BBTK_BLACK_BOX_IMPLEMENTATION(VectorFilterString,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+
+void VectorFilterString::ConnectionRepetitions( std::vector<std::string> vIn,std::vector<std::string> *vOut  )
+{
+       int i,size=vIn.size();
+       int itmp=0, acum=0;
+       std::string stmp;
+       for( i=0;i<size;i++)
+       {
+               if (vIn[i].compare( vIn[itmp])==0) 
+               {
+                       acum++;
+               } else {
+                       itmp=i;
+                       vOut->push_back(std::to_string(acum));
+                       acum=1;
+               }
+       } // for
+       vOut->push_back(std::to_string(acum));
+}
+
+void VectorFilterString::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+
+//    bbSetOutputOut( bbGetInputIn() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+  
+       if (bbGetInputType()==0) 
+       {
+               std::vector<std::string> vOut0;
+               std::vector<std::string> vOut1;
+               std::vector<std::string> vOut2;
+               std::vector<std::string> vOut3;
+               std::vector<std::string> vOut4;
+               std::vector<std::string> vOut5;
+               std::vector<std::string> vOut6;
+               std::vector<std::string> vOut7;
+               std::vector<std::string> vOut8;
+               std::vector<std::string> vOut9;
+               ConnectionRepetitions( bbGetInputIn0() , &vOut0 );
+               ConnectionRepetitions( bbGetInputIn1() , &vOut1 );
+               ConnectionRepetitions( bbGetInputIn2() , &vOut2 );
+               ConnectionRepetitions( bbGetInputIn3() , &vOut3 );
+               ConnectionRepetitions( bbGetInputIn4() , &vOut4 );
+               ConnectionRepetitions( bbGetInputIn5() , &vOut5 );
+               ConnectionRepetitions( bbGetInputIn6() , &vOut6 );
+               ConnectionRepetitions( bbGetInputIn7() , &vOut7 );
+               ConnectionRepetitions( bbGetInputIn8() , &vOut8 );
+               ConnectionRepetitions( bbGetInputIn9() , &vOut9 );
+               bbSetOutputOut0( vOut0 );
+               bbSetOutputOut1( vOut1 );
+               bbSetOutputOut2( vOut2 );
+               bbSetOutputOut3( vOut3 );
+               bbSetOutputOut4( vOut4 );
+               bbSetOutputOut5( vOut5 );
+               bbSetOutputOut6( vOut6 );
+               bbSetOutputOut7( vOut7 );
+               bbSetOutputOut8( vOut8 );
+               bbSetOutputOut9( vOut9 );
+       }
+
+       
+
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void VectorFilterString::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputType(0);
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void VectorFilterString::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void VectorFilterString::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbstd
+
+
diff --git a/packages/std/src/bbstdVectorFilterString.h b/packages/std/src/bbstdVectorFilterString.h
new file mode 100644 (file)
index 0000000..dd61882
--- /dev/null
@@ -0,0 +1,91 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbstdVectorFilterString_h_INCLUDED__
+#define __bbstdVectorFilterString_h_INCLUDED__
+
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT VectorFilterString
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(VectorFilterString,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+  BBTK_DECLARE_INPUT(In0,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(In1,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(In2,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(In3,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(In4,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(In5,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(In6,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(In7,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(In8,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(In9,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(Type,int);
+
+  BBTK_DECLARE_OUTPUT(Out0,std::vector<std::string>);
+  BBTK_DECLARE_OUTPUT(Out1,std::vector<std::string>);
+  BBTK_DECLARE_OUTPUT(Out2,std::vector<std::string>);
+  BBTK_DECLARE_OUTPUT(Out3,std::vector<std::string>);
+  BBTK_DECLARE_OUTPUT(Out4,std::vector<std::string>);
+  BBTK_DECLARE_OUTPUT(Out5,std::vector<std::string>);
+  BBTK_DECLARE_OUTPUT(Out6,std::vector<std::string>);
+  BBTK_DECLARE_OUTPUT(Out7,std::vector<std::string>);
+  BBTK_DECLARE_OUTPUT(Out8,std::vector<std::string>);
+  BBTK_DECLARE_OUTPUT(Out9,std::vector<std::string>);
+  BBTK_PROCESS(Process);
+  void Process();
+
+void ConnectionRepetitions( std::vector<std::string> vIn,std::vector<std::string> *vOut );
+
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorFilterString,bbtk::AtomicBlackBox);
+  BBTK_NAME("VectorFilterString");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+
+  BBTK_INPUT(VectorFilterString,In0,"Input vector",std::vector<std::string>,"");
+  BBTK_INPUT(VectorFilterString,In1,"Input vector",std::vector<std::string>,"");
+  BBTK_INPUT(VectorFilterString,In2,"Input vector",std::vector<std::string>,"");
+  BBTK_INPUT(VectorFilterString,In3,"Input vector",std::vector<std::string>,"");
+  BBTK_INPUT(VectorFilterString,In4,"Input vector",std::vector<std::string>,"");
+  BBTK_INPUT(VectorFilterString,In5,"Input vector",std::vector<std::string>,"");
+  BBTK_INPUT(VectorFilterString,In6,"Input vector",std::vector<std::string>,"");
+  BBTK_INPUT(VectorFilterString,In7,"Input vector",std::vector<std::string>,"");
+  BBTK_INPUT(VectorFilterString,In8,"Input vector",std::vector<std::string>,"");
+  BBTK_INPUT(VectorFilterString,In9,"Input vector",std::vector<std::string>,"");
+  BBTK_INPUT(VectorFilterString,Type,"(Default 0)  0:count connected repetitions",int,"");
+
+  BBTK_OUTPUT(VectorFilterString,Out0,"First output",std::vector<std::string>,"");
+  BBTK_OUTPUT(VectorFilterString,Out1,"First output",std::vector<std::string>,"");
+  BBTK_OUTPUT(VectorFilterString,Out2,"First output",std::vector<std::string>,"");
+  BBTK_OUTPUT(VectorFilterString,Out3,"First output",std::vector<std::string>,"");
+  BBTK_OUTPUT(VectorFilterString,Out4,"First output",std::vector<std::string>,"");
+  BBTK_OUTPUT(VectorFilterString,Out5,"First output",std::vector<std::string>,"");
+  BBTK_OUTPUT(VectorFilterString,Out6,"First output",std::vector<std::string>,"");
+  BBTK_OUTPUT(VectorFilterString,Out7,"First output",std::vector<std::string>,"");
+  BBTK_OUTPUT(VectorFilterString,Out8,"First output",std::vector<std::string>,"");
+  BBTK_OUTPUT(VectorFilterString,Out9,"First output",std::vector<std::string>,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(VectorFilterString);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+}
+// EO namespace bbstd
+
+#endif // __bbstdVectorFilterString_h_INCLUDED__
+
index ba441439b4cb99b5466141ac7029ceb69ec2b190..569bcb25b0832dad19bc1e3dc9f4a38ab9cd4687 100644 (file)
 
 #include "vtkProperty.h"
 #include "vtkLinearTransform.h"
+#include "vtkCleanPolyData.h"
 
 #include "bbvtkPolyDataToActor.h"
 #include "bbvtkPackage.h"
 
+#include "vtkRenderWindow.h"
 
 namespace bbvtk
 {
@@ -107,13 +109,32 @@ namespace bbvtk
        void PolyDataToActor::DoProcess()
        {
 
+printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
+printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
+printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
+printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
+printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
+printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
+printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
+printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ...  Clean this code in the correct part ..........\n");
+//https://stackoverflow.com/questions/47528086/problems-with-rendering-transparent-objects-in-vtk
+//https://itk.org/Wiki/VTK/Depth_Peeling
+bbGetInputRenderer()->SetUseDepthPeeling(1);
+bbGetInputRenderer()->SetOcclusionRatio(0.1);
+bbGetInputRenderer()->SetMaximumNumberOfPeels(100);
+bbGetInputRenderer()->GetRenderWindow()->SetMultiSamples(0);
+bbGetInputRenderer()->GetRenderWindow()->SetAlphaBitPlanes(1);
+
+
                if (bbGetInputActive()==true)
                {
+
+
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
                         polydatamapper->SetInput( bbGetInputIn() );
 #else
-                        polydatamapper->SetInputData( bbGetInputIn() );
+                        polydatamapper->SetInputData( bbGetInputIn() );  
 #endif
 
                         vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
index c526c82bd8b303fcd26d1c5c7bf73b455a119379..50d2bc117075c8d263918371d06db47c41ac3a57 100644 (file)
@@ -39,6 +39,9 @@ if (bbGetInputActive()==true)
 <defaultValues><PRE>
   bbSetInputActive(true);
   bbSetInputRadius(10);
+  bbSetInputCenterX(0);
+  bbSetInputCenterY(0);
+  bbSetInputCenterZ(0);
   bbSetInputPhiResolution(10);
   bbSetInputThetaResolution(10);
 </PRE></defaultValues>