]> Creatis software - bbtk.git/commitdiff
Merge branch 'wt-version'
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 6 Oct 2015 09:08:44 +0000 (11:08 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 6 Oct 2015 09:08:44 +0000 (11:08 +0200)
20 files changed:
kernel/src/bbtkBlackBox.h
kernel/src/bbtkInterpreter.h
kernel/src/bbtkInterpreterVirtual.cxx
kernel/src/bbtkInterpreterVirtual.h
kernel/src/bbtkKW.h
kernel/src/bbtkPackage.cxx
kernel/src/bbtkQt.h
kernel/src/bbtkWx.h
kernel/src/bbtkWxGUIScriptingInterface.cxx
packages/std/src/bbstdMathOperation.cxx [new file with mode: 0644]
packages/std/src/bbstdMathOperation.h [new file with mode: 0644]
packages/std/src/bbstdReadColumnsString.cxx
packages/std/src/bbstdReadColumnsString.h
packages/std/src/bbstdWriteColumnsString.cxx [new file with mode: 0644]
packages/std/src/bbstdWriteColumnsString.h [new file with mode: 0644]
packages/toolsbbtk/bbs/boxes/ApplyMaskWithTransparence.bbg [new file with mode: 0644]
packages/toolsbbtk/bbs/boxes/ApplyMaskWithTransparence.bbs [new file with mode: 0644]
packages/vtk/src/bbvtkSurfaceTexture.cxx
packages/vtk/src/bbvtkUnaryOperations.cxx
packages/vtk/src/bbvtkUnaryOperations.h

index 17f59999f2296b6ab9159df9a75917298f139007..7ce4db38bf19210d33a0864711746d94a4198165 100644 (file)
@@ -56,7 +56,7 @@
 #include <set>
 
 // Signal/slot mechanism for output change events
-#include <boost/signal.hpp>
+#include <boost/signals2/signal.hpp>
 #include <boost/bind.hpp>
 
 
@@ -84,8 +84,8 @@ namespace bbtk
     //==================================================================
     // Types
     //==================================================================
-    typedef boost::signals::trackable OutputChangeObserverType;
-    typedef boost::signal<void (bbtk::BlackBox::Pointer,
+    typedef boost::signals2::trackable OutputChangeObserverType;
+    typedef boost::signals2::signal<void (bbtk::BlackBox::Pointer,
                                const std::string&,
                                IOStatus)>  OutputChangeSignalType;
     typedef OutputChangeSignalType::slot_function_type
index 8c0e14446bc072f3da6a7609b1eba02900144f11..e518cfdc4eae35d3966ea80ea0a14a3971215298 100644 (file)
@@ -54,9 +54,6 @@
 #include <fstream>
 #include <deque>
 
-// Signal/slot mechanism for 'break' commands
-//#include <boost/signal.hpp>
-//#include <boost/bind.hpp>
 
 namespace bbtk
 {
@@ -65,82 +62,10 @@ namespace bbtk
   class WxConsole;
 #endif
   
-/* EED Borrame 
-  //=======================================================================
-  class BBTK_EXPORT InterpreterUser
-  {
-  public: 
-    InterpreterUser() {}
-    virtual ~InterpreterUser() {}
-
-    virtual bool InterpreterUserHasOwnHtmlPageViewer() { return false; }
-    virtual void InterpreterUserViewHtmlPage(const std::string&) {}
-  };
-  //=======================================================================
-*/
        
 
-/* EED Borrame
-  //=======================================================================
-  class BBTK_EXPORT InterpreterException : public Exception
-  {
-  public:
-    InterpreterException( const std::string& message,
-                     bool in_script_file,
-                     const std::string& script_file,
-                     int script_line 
-                     );
-    InterpreterException( const Exception& excep,
-                     bool in_script_file,
-                     const std::string& script_file,
-                     int script_line 
-                     );
-    ~InterpreterException() throw() {}
-
-    bool IsInScriptFile() const { return mInScriptFile; }
-    const std::string& GetScriptFile() const { return mScriptFile; }
-    int GetScriptLine() const { return mScriptLine; }
-  private:
-    bool mInScriptFile;
-    std::string mScriptFile;
-    int mScriptLine;
-  };
-  //=======================================================================
-*/
-       
        
        
-  /*
-  //=======================================================================
-  // The "Quit" exception
-  class BBTK_EXPORT QuitException : public InterpreterError
-  {
-  public:
-    QuitException( bool in_script_file,
-                  const std::string& script_file,
-                  int script_line 
-                  )
-      : InterpreterError("QUIT",in_script_file,script_file,script_line) 
-    {}
-    ~QuitException() throw() {}
-  };
-  //=======================================================================
-  const std::string BREAK("BREAK");
-  //=======================================================================
-  // The "Break" exception
-  class BBTK_EXPORT BreakException : public InterpreterError
-  {
-  public:
-    BreakException( bool in_script_file,
-                   std::string script_file,
-                   int script_line 
-                   )
-      : InterpreterError(BREAK,in_script_file,script_file,script_line) 
-    { std::cout << "BUILDING BREAK"<<std::endl; }
-    ~BreakException() throw() {}
-  };
-  //=======================================================================
-  */
 
   //=======================================================================
   class BBTK_EXPORT Interpreter : public InterpreterVirtual
@@ -151,32 +76,6 @@ namespace bbtk
     static Pointer New(const std::string& cpp_file = "");
     static Pointer New(VirtualExec::Pointer);
 
-/* EED Borrame   
-    typedef enum 
-      {
-       Interpreter_OK,
-       Interpreter_ERROR,
-       Interpreter_QUIT,
-       Interpreter_BREAK,
-      }
-      ExitStatus;
-
-    /// Runs the interpretation of a file
-    ExitStatus InterpretFile( const std::string& filename, bool source = false);
-
-    /// Runs the interpretation of a buffer and deletes it !
-    ExitStatus InterpretBuffer( std::stringstream* buffer );
-
-    /// Runs the interpretation of a command
-    ExitStatus InterpretLine( const std::string& line );
-
-    /// Runs the interpretation of the currently open streams
-    ExitStatus InterpretCurrentStreams();
-
-    /// Launches a command line interpreter (with a prompt)
-    void CommandLineInterpreter();
-*/
-
 
     /// Sets the inputs of the workspace :
     /// the map is passed as is to the Executer
@@ -196,22 +95,6 @@ namespace bbtk
 
     void SetDialogMode(DialogModeType t) { mVirtualExecuter->SetDialogMode(t);}
 
-/*EED Borrame    
-    /// Sets the bool that indicates wether we are in command line context
-    void SetCommandLine(bool v = true) { mCommandLine = v; }
-
-    void SetThrow(bool b) { mThrow = b; }
-#ifdef USE_WXWIDGETS
-    /// Sets the user of the interpreter (if any)
-    void SetUser(InterpreterUser* c) { mUser = c; }
-    /// Gets the InterpreterUser of this 
-    InterpreterUser* GetUser() { return mUser; }
-    /// Gets the InterpreterUser of this (const)
-    const InterpreterUser* GetUser() const { return mUser; }
-
-#endif
- */
 
     /// Gets the Executer 
     VirtualExec::Pointer GetExecuter() const { return mVirtualExecuter; }
@@ -228,83 +111,6 @@ namespace bbtk
 
   protected:
 
-/* EED Borrame   
-    /// The enumeration of command codes == Command name
-    typedef enum
-    {
-      cBreak, // LG 12/12/08 : Stops the current script execution (if not exec frozen) - used in tutorial + debugging 
-      cClear, // LG 12/12/08 : Clears the current complex black box (e.g. workspace) - used in tours
-      cNew,
-      cDelete,
-      cConnect,
-      cExec,
-      cPackage,
-      cEndPackage,
-      cDefine,
-      cEndDefine,
-      cInput,
-      cOutput,
-      cSet,
-      cConfig,  // JPR
-      cReset,   // EED
-      cAuthor, 
-      cCategory, // JPR
-      cDescription,
-      cHelp,
-      cMessage,
-      cInclude,
-      cQuit,
-      cLoad,
-      cUnload,
-      cGraph,
-      cPrint,
-      cIndex,
-      cKind, // LG
-      cNewGUI, // LG
-      cWorkspace, // LG
-      cDebug // LG
-    } CommandCodeType;
-
-    /// The structure storing the informations on a command 
-    typedef struct 
-    {
-      std::string keyword;
-      int argmin, argmax;
-      CommandCodeType code;
-      std::string syntax;
-      std::string help;
-    } CommandInfoType;
-
-    /// The type of dictionnary of commands 
-    typedef std::map<std::string,CommandInfoType> CommandDictType;
-
-
-    /// Interprets a line 
-    void DoInterpretLine( const std::string& line ); //, bool &insideComment );
-
-    /// Reads a line from prompt
-    void GetLineFromPrompt( std::string& line );
-
-    /// Splits a line into words
-    void SplitLine ( const std::string& line,
-                     std::vector<std::string>& words );
-
-    /// Executes the right action depending on the command name
-    void InterpretCommand( const std::vector<std::string>& words,
-                           CommandInfoType& info );
-
-    /// Switch to the interpretation of a file
-    void SwitchToFile( const std::string& filename, bool source = false );
-
-   /// Switch to the interpretation of a stringstream
-    void SwitchToStream( std::stringstream* stream );
-
-    /// Closes the currently open file
-    void CloseCurrentFile();
-
-    /// Closes all open files
-    void CloseAllFiles();
-*/
          
     /// Resets all
     virtual void commandReset();
@@ -331,20 +137,14 @@ namespace bbtk
     virtual void commandIndex(const std::string& filename, 
               const std::string& type = "Initials");
 
-/*EED Borrame    
-    ///
-    void FindCommandsWithPrefix( char* buf,
-                                int n,
-                                std::vector<std::string>& commands );
-*/
          
     /// Creates and connects the piece of pipeline which defines a GUI 
     /// for the box box. 
     /// Define it as a complex box type with name instanceName+"Type"
     /// The instance is called instanceName
     /// and connected to the existing pipeline
-      virtual void commandNewGUI(const std::string& box,const std::string& instanceName);
-      virtual void commandDebug(const std::string& arg);
+     virtual void commandNewGUI(const std::string& box,const std::string& instanceName);
+     virtual void commandDebug(const std::string& arg);
          virtual void commandNew(const std::string &boxType,const std::string &boxName);
          virtual void commandDelete(const std::string &boxName);
          virtual void commandConnection(const std::string &nodeFrom,const std::string &outputLabel,const std::string &nodeTo,const std::string &inputLabel);
@@ -383,12 +183,7 @@ namespace bbtk
                  
     void Init(VirtualExec::Pointer, const std::string& cpp_file);
 
-/*EED  Borrame 
-    /// Opens the file fullPathScriptName 
-    /// includeScriptName is the name as given to the include command 
-    void LoadScript( std::string fullPathScriptName,
-                    std::string includeScriptName);
-*/  
+
     //==================================================================
     // ATTRIBUTES
 
@@ -396,49 +191,6 @@ namespace bbtk
     bbtk::VirtualExec::Pointer mVirtualExecuter;
     bbtk::Executer::WeakPointer mRealExecuter;
 
-/*EED Borrame    
-    /// The user of  the interpreter (0 if none)
-    bbtk::InterpreterUser* mUser;
-    /// Vector of open files / buffers (can be stringstream)
-    std::vector<std::istream*> mFile;
-
-    /// Vector of names of open files with full path (as open)
-    std::vector<std::string> mFileName;
-
-    /// Vector of names of files which have been open 
-    /// before (and may closed then which are no more in mFileName)
-    /// with full path (as open)
-    std::vector<std::string> mFileNameHistory;
-
-    /// Vector of names of open files as given to the include command
-    std::vector<std::string> mIncludeFileName;
-
-    /// Stores the current line number in each open file
-    std::vector<int> mLine;
-
-    /// The dictionnary of commands
-    CommandDictType mCommandDict;
-
-    /// Are we in a command line context ?
-    bool mCommandLine;
-
-    /// Are we inside a commented-out zone ?
-    bool mInsideComment;
-    
-    /// The current interpreter status
-    ExitStatus mStatus;
-
-    /// The history of commands
-    std::deque< char* > mHistory;
-
-    int bufferNb;
-    
-    bool mThrow;
-
-    /// The break signal
-    //    BreakSignalType mBreakSignal;
- */
 
   protected:
          ~Interpreter();
index 58552fc160db1b8ee27dd2a1a0ebd7577d1fbcc3..8d27b3290dd51134d6cbe9c578ca4d5805942d3a 100644 (file)
@@ -890,19 +890,19 @@ namespace bbtk
 
     // break and quit commands
     if ((command.code==cBreak) || (command.code==cQuit))
-      {
-       bool in_script = false;
-       std::string file("");
-       int line = 0;
-
-       if (mFileName.size()) 
-         {
-           std::ifstream* fs = dynamic_cast<std::ifstream*>(mFile.back());
-           if (fs!=0) in_script = true;          
-           file = mFileName.back();
-           line = mLine.back();
-         } 
-       if (command.code==cBreak)
+    {
+//EED-Borrame  bool in_script = false;
+//EED-Borrame  std::string file("");
+//EED-Borrame  int line = 0;
+
+//EED-Borrame  if (mFileName.size()) 
+//EED-Borrame    {
+//EED-Borrame      std::ifstream* fs = dynamic_cast<std::ifstream*>(mFile.back());
+//EED-Borrame      if (fs!=0) in_script = true;          
+//EED-Borrame      file = mFileName.back();
+//EED-Borrame      line = mLine.back();
+//EED-Borrame    } 
+         if (command.code==cBreak)
          {
            /*
            std::cout << "BreakException(" 
@@ -913,15 +913,13 @@ namespace bbtk
                  commandBreak();
 //EED Borrame      bbtkError("break");//,in_script,file,line);
            //      throw BreakException(in_script,file,line);
-         }       
-       else 
-         {
+         } else {
                  commandQuit();
 //EED Borrame      bbtkError("quit");//,in_script,file,line);
              //throw QuitException(in_script,file,line);
-         }
-       return;
-      }   
+         } // cBreak
+         return;
+   } // cBreak  cQuit  
 //std::cout<<" mVirtualExecuter->Create(words[1],words[2]); "<<line<<std::endl;
     // other cammands
 
index eedfe03b6f9b895b33b7864ee602ce677c1a25f1..8370cc2b3025926aa6202000644fd87780521bcb 100644 (file)
@@ -58,7 +58,7 @@
 #include <deque>
 
 // Signal/slot mechanism for 'break' commands
-#include <boost/signal.hpp>
+//#include <boost/signals2/signal.hpp>
 #include <boost/bind.hpp>
 
 namespace bbtk
index b07c9ed7beb3b0418e953cea4bd99d425bcd1083..c3400806991c9d0cf8283acd5ff5b0dbea857155 100644 (file)
@@ -59,7 +59,7 @@
 // SIGNAL/SLOT MECHANISM 
 // FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION 
 // BBTKKWSIG
-#include <boost/signal.hpp>
+#include <boost/signals2/signal.hpp>
 #include <boost/bind.hpp>
 // \BBTKKWSIG
 //===========================================================================
@@ -81,8 +81,8 @@ namespace bbtk
   {    
   public:
     // BBTKKWSIG
-    typedef boost::signals::trackable SignalObserver;
-    typedef boost::signal<void ()>  Signal_type;
+    typedef boost::signals2::signals::trackable SignalObserver;
+    typedef boost::signals2::signal<void ()>  Signal_type;
     typedef Signal_type::slot_function_type Slot_function_type;
     // \BBTKKWSIG
     
index 7cf93fc1f68996148cc88650b00e0016dc294a7d..91cdb518372b220f124b1de33af8dc5c22c8912a 100644 (file)
@@ -398,6 +398,7 @@ namespace bbtk
     bbtkDebugMessage("package",3,"* Symbol ["<<getvername
                     <<"] found"<<std::endl);
     // version matches ?
+
     if (getbbtkversion() != bbtk::GetVersion())
       {
        bbtkMessage("package",0,
index 0b6e94864fd68765f0ba837eebf98889c62c30d1..c5dddc31ff5954ecf19a1362c9b743aa8e1b916a 100644 (file)
@@ -42,9 +42,9 @@
 // SIGNAL/SLOT MECHANISM 
 // FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION 
 // BBTKWXSIG
-#include <boost/signal.hpp>
+#include <boost/signals2/signal.hpp>
 #include <boost/bind.hpp>
-typedef boost::signals::trackable SignalObserver;
+//typedef boost::signals2::signal::trackable SignalObserver;
 // \BBTKWXSIG
 //===========================================================================
 
@@ -88,7 +88,7 @@ namespace bbtk
     // BBTKWXSIG
     // The keyword 'signals' is also a macro in qt
     //    typedef boost::signals::trackable SignalObserver;
-    typedef boost::signal<void ()>  Signal_type;
+    typedef boost::signals2::signal<void ()>  Signal_type;
     typedef Signal_type::slot_function_type Slot_function_type;
     // \BBTKWXSIG
 
index 7b306658649dbc8a373009979db58a1e7acb9967..52eca34bd2365486c8308aeb7ecd4835cf86353b 100644 (file)
@@ -77,7 +77,7 @@ typedef void wxBusyCursor;
 // SIGNAL/SLOT MECHANISM 
 // FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION 
 // BBTKWXSIG
-#include <boost/signal.hpp>
+#include <boost/signals2/signal.hpp>
 #include <boost/bind.hpp>
 // \BBTKWXSIG
 //===========================================================================
@@ -99,8 +99,8 @@ namespace bbtk
   {    
   public:
     // BBTKWXSIG
-    typedef boost::signals::trackable SignalObserver;
-    typedef boost::signal<void ()>  Signal_type;
+    typedef boost::signals2::trackable SignalObserver;
+    typedef boost::signals2::signal<void ()>  Signal_type;
     typedef Signal_type::slot_function_type Slot_function_type;
     // \BBTKWXSIG
 
index 9e8e57dbe5732772b25494f9ad15dfa167bccf49..4425cc80e7b865e5ddb0ea000b83a67d7aa30f06 100644 (file)
@@ -871,7 +871,7 @@ std::cout << "==================================================================
 
                        printf("EED WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked cc %s \n",commandPath.c_str() );
                        // cleanning path
-                       while (commandPath.rfind("\\\\")!=-1 )
+                       while ((int)commandPath.rfind("\\\\")!=-1 )
                        {
                                commandPath.erase( commandPath.rfind("\\\\") , 1 );
                        printf("EED WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked cc %s \n",commandPath.c_str() );
diff --git a/packages/std/src/bbstdMathOperation.cxx b/packages/std/src/bbstdMathOperation.cxx
new file mode 100644 (file)
index 0000000..be243d7
--- /dev/null
@@ -0,0 +1,121 @@
+//===== 
+// 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 "bbstdMathOperation.h"
+#include "bbstdPackage.h"
+
+#include <math.h>
+#include <stdlib.h>
+#include <time.h>
+
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,MathOperation)
+BBTK_BLACK_BOX_IMPLEMENTATION(MathOperation,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 MathOperation::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')
+
+        if (firsttime==true)
+        {
+               firsttime=false;
+      /* initialize random seed: */ 
+      srand (time(NULL));
+               if (bbGetInputType()==7) acum=bbGetInputIn1();
+        }
+
+    if (bbGetInputType()==0) bbSetOutputOut( bbGetInputIn1() +  bbGetInputIn2() );
+    if (bbGetInputType()==1) bbSetOutputOut( bbGetInputIn1() -  bbGetInputIn2() );
+    if (bbGetInputType()==2) bbSetOutputOut( bbGetInputIn1() *  bbGetInputIn2() );
+
+    if (bbGetInputType()==3)
+    {
+                        if (bbGetInputIn2()!=0)  bbSetOutputOut( bbGetInputIn1() /  bbGetInputIn2() );
+              else  bbSetOutputOut( 99999999 );
+    }
+
+    if (bbGetInputType()==4) bbSetOutputOut( sqrt( bbGetInputIn1() ) );
+
+    if (bbGetInputType()==5)
+        {
+                                if (bbGetInputIn2()>0)  bbSetOutputOut( log( bbGetInputIn1() ) );
+              else  bbSetOutputOut( -99999999 );
+        }
+
+    if (bbGetInputType()==6) bbSetOutputOut( exp( bbGetInputIn1() ) );
+    if (bbGetInputType()==7)
+        {
+                bbSetOutputOut( acum );
+                acum++;
+       if (acum>bbGetInputIn2()) acum=bbGetInputIn1();
+        }
+    if (bbGetInputType()==8) bbSetOutputOut( rand() %  (int) (bbGetInputIn2()-bbGetInputIn1()) +  bbGetInputIn1() );
+    if (bbGetInputType()==9) bbSetOutputOut( sin( bbGetInputIn1() ) );
+    if (bbGetInputType()==10) bbSetOutputOut( cos( bbGetInputIn1() ) );
+    if (bbGetInputType()==11) bbSetOutputOut( tan( bbGetInputIn1() ) );
+    if (bbGetInputType()==12) bbSetOutputOut( asin( bbGetInputIn1() ) );
+    if (bbGetInputType()==13) bbSetOutputOut( acos( bbGetInputIn1() ) );
+    if (bbGetInputType()==14) bbSetOutputOut( atan( bbGetInputIn1() ) );
+    if (bbGetInputType()==15) bbSetOutputOut( atan2( bbGetInputIn1(),bbGetInputIn2() ) );
+}
+//===== 
+// 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 MathOperation::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputIn1(0);
+   bbSetInputIn2(0);
+   bbSetInputType(0);
+
+   firsttime=true;
+   acum=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 MathOperation::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 MathOperation::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/bbstdMathOperation.h b/packages/std/src/bbstdMathOperation.h
new file mode 100644 (file)
index 0000000..7ab7eb0
--- /dev/null
@@ -0,0 +1,54 @@
+//===== 
+// 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 __bbstdMathOperation_h_INCLUDED__
+#define __bbstdMathOperation_h_INCLUDED__
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT MathOperation
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(MathOperation,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(In1,double);
+  BBTK_DECLARE_INPUT(In2,double);
+  BBTK_DECLARE_INPUT(Type,int);
+  BBTK_DECLARE_OUTPUT(Out,double);
+  BBTK_PROCESS(Process);
+  void Process();
+
+  bool firsttime;
+  double acum;
+
+//===== 
+// 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(MathOperation,bbtk::AtomicBlackBox);
+  BBTK_NAME("MathOperation");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+  BBTK_INPUT(MathOperation,In1,"First input",double,"");
+  BBTK_INPUT(MathOperation,In2,"Second input",double,"");
+  BBTK_INPUT(MathOperation,Type,"Type (defalult 0): 0  adition (default), 1 sustraction In1+In2, 2 multiplication In1*In2, 3 divisiuon In1/In2, 4 sqrt In1, 5 log In1, 6 exp In1, 7 incremental int [In1..In2], 8 random int [In1..In2], 9 sin In1, 10 cos In1, 11 tan In1, 12 asin In 1, 13 acos In1, 14 atan In1, 15 atan2 In1,In2 ",int,"");
+
+  BBTK_OUTPUT(MathOperation,Out,"Output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(MathOperation);
+//===== 
+// 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 // __bbstdMathOperation_h_INCLUDED__
+
index 6d9cfe5f3c37b055e60f7449ff3b18648660deb7..afcd636ac19ec6afaa37115cfe629624771fbd22 100644 (file)
@@ -55,12 +55,18 @@ void ReadColumnsString::Process()
                tlst.push_back( new std::vector<std::string> );
        }       
        
+       int iSkipLines;
        int numberOfLines = 0;
-       char tmpValue[50];
+       char tmpValue[500];
        std::vector<std::string> *vecData;
        FILE *ff1 = fopen( bbGetInputFileName().c_str() , "r+" );
        if (ff1!=NULL)
        {
+               for (iSkipLines=0;iSkipLines<bbGetInputSkipLines(); iSkipLines++ )
+      {
+         fgets( tmpValue , 500, ff1 ); 
+      }
+
                while (!feof(ff1))
                {
                        for( i=0 ;  i<bbGetInputDimension() ; i++)
@@ -99,6 +105,7 @@ void ReadColumnsString::bbUserSetDefaultValues()
 
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
+       bbSetInputSkipLines(0); 
        bbSetInputDimension(1); 
        bbSetInputFileName(""); 
   
index 09197bc3dd011e47c8811b882ce390d3e71a06ea..47f18e97d3594519ec4c12d65bc525766a0515fa 100644 (file)
@@ -46,6 +46,7 @@ class bbstd_EXPORT ReadColumnsString
 // 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(FileName,std::string);
+       BBTK_DECLARE_INPUT(SkipLines,int);      
        BBTK_DECLARE_INPUT(Dimension,int);      
        
        BBTK_DECLARE_OUTPUT(lstData1,std::vector<std::string> );
@@ -72,6 +73,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReadColumnsString,bbtk::AtomicBlackBox);
        BBTK_DESCRIPTION("Read Columns from a text file");
        BBTK_CATEGORY("read/write");
        BBTK_INPUT(ReadColumnsString,FileName,"File name of Points",std::string,"");
+       BBTK_INPUT(ReadColumnsString,SkipLines,"(default 0) - Number of lines to be skipe before read data",int,"");
        BBTK_INPUT(ReadColumnsString,Dimension,"(default 1) - The number of columns of the file",int,"");
        
        BBTK_OUTPUT(ReadColumnsString,lstData1,"vector of data",std::vector<std::string>,"");
diff --git a/packages/std/src/bbstdWriteColumnsString.cxx b/packages/std/src/bbstdWriteColumnsString.cxx
new file mode 100644 (file)
index 0000000..05b760b
--- /dev/null
@@ -0,0 +1,142 @@
+//===== 
+// 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 "bbstdWriteColumnsString.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,WriteColumnsString)
+BBTK_BLACK_BOX_IMPLEMENTATION(WriteColumnsString,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 WriteColumnsString::Process()
+{
+
+       std::cout << "MLER WriteColumnsString::Process Start " << std::endl;
+       
+
+       std::ofstream write_fi;
+       write_fi.open(bbGetInputFileName().c_str());
+       
+       std::vector<std::string> headers = bbGetInputHeaders(); //Headers Input
+       bool onHeaders = bbGetInputOnHeaders();
+
+
+       std::vector<std::vector<std::string> > values;
+
+       values.push_back(bbGetInputlstData1());
+       values.push_back(bbGetInputlstData2());
+       values.push_back(bbGetInputlstData3());
+       values.push_back(bbGetInputlstData4());
+       values.push_back(bbGetInputlstData5());
+       values.push_back(bbGetInputlstData6());
+       values.push_back(bbGetInputlstData7());
+       values.push_back(bbGetInputlstData8());
+       values.push_back(bbGetInputlstData9());
+
+       std::vector<std::vector<std::string> >::iterator it;
+
+       std::cout << "values size"<<values.size()<< std::endl;
+       for(it = values.begin() ; it != values.end() ; )
+       {
+               if((*it).empty())
+               {
+                       it = values.erase(it);
+               }else
+               {
+                       it++;
+               }
+       }
+       std::cout << "values size"<<values.size()<< std::endl;
+       
+       if(write_fi.is_open())
+       {       
+               if(onHeaders == true) // If onHeaders is true, the file is write with Headers.
+               {
+                       //Add each header input write to file
+                       for(unsigned int i=0 ;i< headers.size(); i++ )
+                       {
+                               if(i==(headers.size()-1))
+                               {
+                                       write_fi << headers[i] << "\n";
+                               }else{
+                                       write_fi << headers[i] << "\t";
+                               }
+
+                       }//for headersSize
+               }
+
+               unsigned int colSize = values[0].size();
+
+               for(unsigned int j=0;j<colSize;j++)
+               {
+                       for(unsigned int i=0;i<values.size();i++)
+                       {
+                               if(i==(values.size()-1))
+                               {
+                                       write_fi << values[i][j] << "\n";
+                               }else{
+                                       write_fi << values[i][j] << "\t";
+                               }
+
+                       }
+                       
+               }
+               
+               
+       }// if write_fi.is_open()
+       else
+       {
+               std::cout<<"No es posible abrir"<<std::endl;
+       }//else
+
+       write_fi.close();
+
+       bbSetOutputOutFileName(bbGetInputFileName().c_str());
+
+       std::cout << "MLER WriteColumnsString::End Process " << std::endl;
+  
+}
+//===== 
+// 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 WriteColumnsString::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputFileName("");     
+   bbSetInputFileName("true");
+  
+}
+//===== 
+// 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 WriteColumnsString::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 WriteColumnsString::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/bbstdWriteColumnsString.h b/packages/std/src/bbstdWriteColumnsString.h
new file mode 100644 (file)
index 0000000..08e54bf
--- /dev/null
@@ -0,0 +1,72 @@
+//===== 
+// 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 __bbstdWriteColumnsString_h_INCLUDED__
+#define __bbstdWriteColumnsString_h_INCLUDED__
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT WriteColumnsString :
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(WriteColumnsString,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(FileName,std::string);
+  BBTK_DECLARE_INPUT(Headers,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(OnHeaders,bool);
+
+
+  BBTK_DECLARE_INPUT(lstData1,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData2,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData3,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData4,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData5,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData6,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData7,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData8,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData9,std::vector<std::string> );
+
+  BBTK_DECLARE_OUTPUT(OutFileName,std::string);
+  BBTK_PROCESS(Process);
+  void Process();
+//===== 
+// 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(WriteColumnsString,bbtk::AtomicBlackBox);
+BBTK_NAME("WriteColumnsString");
+BBTK_AUTHOR("Monica ESPINOSA");
+BBTK_DESCRIPTION("Write Columns to file");
+BBTK_CATEGORY("read/write");
+
+BBTK_INPUT(WriteColumnsString,FileName,"File name",std::string,"");
+BBTK_INPUT(WriteColumnsString,Headers,"Headers of Columns",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,OnHeaders,"On Headers / Off Headers",bool,"");
+
+BBTK_INPUT(WriteColumnsString,lstData1,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData2,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData3,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData4,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData5,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData6,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData7,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData8,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData9,"vector of data",std::vector<std::string>,"");
+
+BBTK_OUTPUT(WriteColumnsString,OutFileName,"File Name",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(WriteColumnsString);
+//===== 
+// 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 // __bbstdWriteColumnsString_h_INCLUDED__
+
diff --git a/packages/toolsbbtk/bbs/boxes/ApplyMaskWithTransparence.bbg b/packages/toolsbbtk/bbs/boxes/ApplyMaskWithTransparence.bbg
new file mode 100644 (file)
index 0000000..75a1e87
--- /dev/null
@@ -0,0 +1,170 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/creaTools/creatools_source/bbtk/packages/toolsbbtk/bbs/boxes/ApplyMaskWithTransparence.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:TRUE
+COMPLEXBOXNAME:ApplyMaskWithTransparence
+PACKAGENAME:toolsbbtk
+COMPLEXOUTPUTS:1
+COMPLEX_PORT
+OutImage
+-71.833968:-77.907690:-900.000000
+FIN_COMPLEX_PORT
+COMPLEXINPUTS:2
+COMPLEX_PORT
+maskImage
+-155.945750:140.976519:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+Image
+-52.261663:144.599262:-900.000000
+FIN_COMPLEX_PORT
+BOXES:12
+BOX
+vtk:BinaryOperations:Box06
+ISEXEC:FALSE
+-21.965422:21.398218:-900.000000
+23.609578:11.398218:-900.000000
+PORT
+Operation:"2"
+FIN_BOX
+BOX
+vtk:ImageVtkProperties:Box16
+ISEXEC:FALSE
+-89.759228:16.979477:-900.000000
+-44.184228:6.979477:-900.000000
+FIN_BOX
+BOX
+vtk:BinaryOperations:Box20
+ISEXEC:FALSE
+-74.625874:-54.714389:-900.000000
+-29.050874:-64.714389:-900.000000
+FIN_BOX
+BOX
+std:GetVectorFloatElement:Box22
+ISEXEC:FALSE
+-112.217901:-2.482812:-900.000000
+-41.042901:-12.482812:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+vtk:RescaleSlopeIntercept:Box23
+ISEXEC:FALSE
+-177.610123:18.460663:-900.000000
+-106.435123:8.460663:-900.000000
+PORT
+OutputFormat:"VTK_DOUBLE"
+PORT
+Type:"1"
+FIN_BOX
+BOX
+vtk:UnaryOperations:Box24
+ISEXEC:FALSE
+-142.749404:-25.417995:-900.000000
+-97.174404:-35.417995:-900.000000
+PORT
+InConstant:"1"
+PORT
+Operation:"11"
+FIN_BOX
+BOX
+vtk:vtkImageDataPointerRelay:Box18
+ISEXEC:FALSE
+-171.782936:117.774432:-900.000000
+-100.607936:107.774432:-900.000000
+FIN_BOX
+BOX
+vtk:vtkImageDataPointerRelay:Box19
+ISEXEC:FALSE
+-53.355388:100.244903:-900.000000
+17.819612:90.244903:-900.000000
+FIN_BOX
+BOX
+vtk:UnaryOperations:Box09
+ISEXEC:FALSE
+-157.853849:61.413786:-900.000000
+-112.278849:51.413786:-900.000000
+PORT
+Operation:"3"
+FIN_BOX
+BOX
+vtk:ImageVtkProperties:Box10
+ISEXEC:FALSE
+-152.556320:102.747202:-900.000000
+-106.981320:92.747202:-900.000000
+FIN_BOX
+BOX
+std:GetVectorFloatElement:Box11
+ISEXEC:FALSE
+-149.145811:85.700627:-900.000000
+-77.970811:75.700627:-900.000000
+PORT
+I:"1"
+FIN_BOX
+BOX
+vtk:RescaleSlopeIntercept:Box12
+ISEXEC:FALSE
+-160.936834:45.783197:-900.000000
+-89.761834:35.783197:-900.000000
+PORT
+OutputFormat:"VTK_DOUBLE"
+FIN_BOX
+CONNECTIONS:17
+CONNECTION
+Box16:MinMax:Box22:In
+NumberOfControlPoints:0
+CONNECTION
+Box23:Out:Box24:In1
+NumberOfControlPoints:0
+CONNECTION
+Box22:Out:Box24:NewValue
+NumberOfControlPoints:0
+CONNECTION
+Box06:Out:Box20:In2
+NumberOfControlPoints:0
+CONNECTION
+Box24:Out:Box20:In1
+NumberOfControlPoints:0
+CONNECTION
+maskImage:maskImage:Box18:In
+NumberOfControlPoints:0
+CONNECTION
+Image:Image:Box19:In
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box16:In
+NumberOfControlPoints:0
+CONNECTION
+Box19:Out:Box06:In2
+NumberOfControlPoints:0
+CONNECTION
+Box20:Out:OutImage:OutImage
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box10:In
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:Box09:In1
+NumberOfControlPoints:0
+CONNECTION
+Box10:MinMax:Box11:In
+NumberOfControlPoints:0
+CONNECTION
+Box11:Out:Box09:InConstant
+NumberOfControlPoints:0
+CONNECTION
+Box09:Out:Box12:In
+NumberOfControlPoints:0
+CONNECTION
+Box12:Out:Box23:In
+NumberOfControlPoints:0
+CONNECTION
+Box12:Out:Box06:In1
+NumberOfControlPoints:0
+APP_END
diff --git a/packages/toolsbbtk/bbs/boxes/ApplyMaskWithTransparence.bbs b/packages/toolsbbtk/bbs/boxes/ApplyMaskWithTransparence.bbs
new file mode 100644 (file)
index 0000000..da86c15
--- /dev/null
@@ -0,0 +1,76 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+# - /home/davila/Creatis/creaTools/creatools_source/bbtk/packages/toolsbbtk/bbs/boxes/ApplyMaskWithTransparence.bbs
+# ----------------------------------
+
+include std
+include itkvtk
+include vtk
+include std
+
+define ApplyMaskWithTransparence toolsbbtk
+
+author "Author ??"
+description "Description ??"
+
+category "<VOID>"
+
+new BinaryOperations Box06
+  set Box06.Operation "2"
+
+new ImageVtkProperties Box16
+
+new BinaryOperations Box20
+
+new GetVectorFloatElement Box22
+  set Box22.I "0"
+
+new RescaleSlopeIntercept Box23
+  set Box23.OutputFormat "VTK_DOUBLE"
+  set Box23.Type "1"
+
+new UnaryOperations Box24
+  set Box24.InConstant "1"
+  set Box24.Operation "11"
+
+new vtkImageDataPointerRelay Box18
+
+new vtkImageDataPointerRelay Box19
+
+new UnaryOperations Box09
+  set Box09.Operation "3"
+
+new ImageVtkProperties Box10
+
+new GetVectorFloatElement Box11
+  set Box11.I "1"
+
+new RescaleSlopeIntercept Box12
+  set Box12.OutputFormat "VTK_DOUBLE"
+
+
+connect Box16.MinMax Box22.In
+connect Box23.Out Box24.In1
+connect Box22.Out Box24.NewValue
+connect Box06.Out Box20.In2
+connect Box24.Out Box20.In1
+connect Box19.Out Box16.In
+connect Box19.Out Box06.In2
+connect Box18.Out Box10.In
+connect Box18.Out Box09.In1
+connect Box10.MinMax Box11.In
+connect Box11.Out Box09.InConstant
+connect Box09.Out Box12.In
+connect Box12.Out Box23.In
+connect Box12.Out Box06.In1
+
+# Complex input ports
+input maskImage Box18.In " "
+input Image Box19.In " "
+
+# Complex output ports
+output OutImage Box20.Out " "
+
+message    
+
+endefine
index 12d32b03aeed898588478a3b1bc4693d72755962..f9f0139004ab1225690dc7d02e298cf080b962a6 100644 (file)
@@ -77,11 +77,6 @@ printf("EED SurfaceTexture::Process Start\n");
 
        }
 
-
-
-       
-
-
        bbGetInputMesh()->GetPointData()->SetScalars(colors);
 
        if (bbGetInputColorType()==1)
@@ -101,7 +96,7 @@ printf("EED SurfaceTexture::Process Start\n");
                bbGetInputTransform()->Update();
        }
        
-       unsigned short gl; 
+       double gl; 
        double p1[3];
        double p2[3];
        double dcolor[3];
@@ -145,9 +140,9 @@ void SurfaceTexture::bbUserSetDefaultValues()
        bbSetInputColorWindow(500);
        bbSetInputTransform(NULL);
   
-       firsttime               = true;
-       colors                  = NULL;
-       colorLookupTable        = NULL;
+       firsttime                               = true;
+       colors                                  = NULL;
+       colorLookupTable                = NULL;
        colorLookupTableWL      = NULL;
 }
 //===== 
index 4f62f1a0665746406f8e7e53963fbe531b307b07..706949fe06a2c00025ac4e0ea0d301489264561e 100644 (file)
@@ -57,20 +57,19 @@ void UnaryOperations::Process()
        ope->SetInput1((vtkDataObject*)bbGetInputIn1());
 
 
-       ope->SetConstantK( bbGetInputInConstant() );
-//     ope->SetConstantC(bbGetInputInConstant());
-
        switch (bbGetInputOperation())
        {
                case 0:
+                               ope->SetConstantC( bbGetInputInConstant() );
                                ope->SetOperationToAddConstant();
 
                break;
                case 1:
-                               ope->SetConstantK( -1.0 * bbGetInputInConstant() );
+                               ope->SetConstantC( -1.0 * bbGetInputInConstant() );
                                ope->SetOperationToAddConstant();
                break;
                case 2:
+                               ope->SetConstantK( bbGetInputInConstant() );
                                ope->SetOperationToMultiplyByK();
 printf("EED UnaryOperations::Process()  2 \n");
 
@@ -84,20 +83,16 @@ printf("EED UnaryOperations::Process()  3 \n");
                         ope->SetOperationToInvert();
                break;
                case 5:
-
                                ope->SetOperationToSin();
                break;
                case 6:
-
                        ope->SetOperationToCos();
 
                break;
                case 7:
-
                                ope->SetOperationToExp();
                break;
                case 8:
-
                                ope->SetOperationToLog();
                break;
                case 9:
@@ -106,21 +101,14 @@ printf("EED UnaryOperations::Process()  3 \n");
                case 10:
                         ope->SetOperationToSquareRoot();
                break;
+               case 11:
+                        ope->SetConstantC( bbGetInputInConstant() );
+                        ope->SetConstantK( bbGetInputNewValue() );
+                        ope->SetOperationToReplaceCByK();
+               break;
 
 
                        
-/* EED 21Juin 2011 Borrame
-               case 10:
-                       substractWithMinimum();
-                       bbSetOutputOut(constante);
-                       return;
-               break;
-               case 11:
-                       MultiplyBy();
-                       bbSetOutputOut(constante);
-                       return;
-               break;
-*/  
                        
                default:
                        std::cout << "Invalid Operation" << std::endl;
@@ -137,73 +125,6 @@ printf("EED UnaryOperations::Process()  3 \n");
 
 }
 
-/* Borrame Eduardo - Juan Pablo
-void UnaryOperations::crearPredeterminado()
-{
-       int ext[6];
-       vtkImageData* inicial = bbGetInputIn1();
-
-
-       if (constante == NULL)
-       {
-               inicial->GetExtent(ext);
-               constante = vtkImageData::New();
-               constante->SetExtent(ext);
-               constante->SetScalarType(inicial->GetScalarType());
-               constante->AllocateScalars();
-               constante->Update();
-       }
-
-       for (int i=ext[0]; i<=ext[1]; i++)
-       {
-               for (int j=ext[2]; j<=ext[3]; j++)
-               {
-                       for (int k=ext[4]; k<=ext[5]; k++)
-                       {
-                               unsigned short* value = (unsigned short*)constante->GetScalarPointer(i,j,k);
-                               *value = bbGetInputInConstant();
-                       }
-               }
-       }
-}
-*/
-
-
-void UnaryOperations::substractWithMinimum()
-{
-       int ext[6];
-       double spc[3];
-       vtkImageData* inicial = bbGetInputIn1();
-
-
-       if (constante == NULL)
-       {
-               inicial->GetExtent(ext);
-               inicial->GetSpacing(spc);
-               constante = vtkImageData::New();
-               constante->SetExtent(ext);
-               constante->SetSpacing(spc);
-               constante->SetOrigin(inicial->GetOrigin());
-               constante->SetScalarType(inicial->GetScalarType());
-               constante->AllocateScalars();
-               constante->Update();
-       }
-
-       for (int i=ext[0]; i<=ext[1]; i++)
-       {
-               for (int j=ext[2]; j<=ext[3]; j++)
-               {
-                       for (int k=ext[4]; k<=ext[5]; k++)
-                       {
-                               double temp1 = lector.getPixelValue(i,j,k,inicial);
-                               double temp = temp1 - bbGetInputInConstant();
-                               if (temp < 0)
-                                       temp = 0;
-                               lector.setPixelValue(i,j,k,constante,temp);
-                       }
-               }
-       }
-}
 
 
 void UnaryOperations::bbUserSetDefaultValues()
@@ -214,6 +135,7 @@ void UnaryOperations::bbUserSetDefaultValues()
    bbSetInputIn1(NULL);
    bbSetOutputOut(NULL);
    bbSetInputInConstant(0);
+   bbSetInputNewValue(0);
    bbSetInputOperation(0);
    ope = vtkImageMathematics::New();
    constante = NULL;
index 82e372ffaf0f3d63079d2a7b31646a4ad55065f1..9ef8725c95a69884896610e0d4823952c0bb7f18 100644 (file)
@@ -53,6 +53,7 @@ class bbvtk_EXPORT UnaryOperations
   BBTK_DECLARE_INPUT(In1,vtkImageData*);
   BBTK_DECLARE_INPUT(Operation,int);
   BBTK_DECLARE_INPUT(InConstant,double);
+  BBTK_DECLARE_INPUT(NewValue,double);
   BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
   BBTK_PROCESS(Process);
   void Process();
@@ -74,7 +75,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(UnaryOperations,bbtk::AtomicBlackBox);
   BBTK_CATEGORY("filtre");
   BBTK_INPUT(UnaryOperations,In1,"Image to be operated",vtkImageData*,"");
   BBTK_INPUT(UnaryOperations,InConstant,"Constant that will be used in the operations.",double,"0 default");
-  BBTK_INPUT(UnaryOperations,Operation,"0:Add (Default), 1:subtract, 2:multiply, 3:divide, 4:invert, 5:sin, 6:cos, 7:exp, 8:log, 9:abs????, 10:SquareRoot",int,"Addition default");
+  BBTK_INPUT(UnaryOperations,NewValue,"InConstant replace by NewValue",double,"0 default");
+  BBTK_INPUT(UnaryOperations,Operation,"0:Add (Default), 1:subtract, 2:multiply, 3:divide, 4:invert, 5:sin, 6:cos, 7:exp, 8:log, 9:abs????, 10:SquareRoot, 11:ReplaceByContant",int,"Addition default");
   BBTK_OUTPUT(UnaryOperations,Out,"",vtkImageData*,"");
 BBTK_END_DESCRIBE_BLACK_BOX(UnaryOperations);
 }