-SET(SOURCES bbs2cpp )
-SET(EXENAME bbs2cpp )
+SET(SOURCES bbs2 )
+SET(EXENAME bbs2 )
#IF(BBTK_USE_WXWIDGETS AND WIN32)
# ADD_EXECUTABLE(${EXENAME} WIN32 ${SOURCES})
=========================================================================*/
+#include <stdio.h>
+
#include "bbtkInterpreter.h"
+#include "bbtkInterpreterPy.h"
#include "bbtkUtilities.h"
int main(int argc, char* argv[])
{
- if (argc<2) return 1;
-
- std::string file,path;
- file = bbtk::Utilities::ExtractScriptName(argv[1],path);
- file += ".h";
- bbtk::Interpreter::Pointer I = bbtk::Interpreter::New(file);
-
- I->SetThrow(true);
-
- try
+ if (argc<3)
{
- I->InterpretFile(argv[1]);
- }
- catch (bbtk::Exception e)
- {
- e.Print();
+ printf("bbs2 <filename.bbs> <cxx|py>\n");
+ return 1;
}
+ std::string file,path;
+ std::string extention( argv[2] );
+ file = bbtk::Utilities::ExtractScriptName(argv[1],path);
+ file += std::string(".")+extention;
+ if ( extention.compare("cxx")==0)
+ {
+ printf("bbs -> cxx\n");
+ bbtk::Interpreter::Pointer I = bbtk::Interpreter::New(file);
+ I->SetThrow(true);
+ try
+ {
+ I->InterpretFile(argv[1]);
+ } catch (bbtk::Exception e) {
+ e.Print();
+ } // try
+ } // if cxx
+
+ if ( extention.compare("py")==0)
+ {
+ printf("bbs -> py\n");
+ bbtk::InterpreterPy::Pointer I = bbtk::InterpreterPy::New();
+ I->SetThrow(true);
+ try
+ {
+ I->InterpretFile(argv[1]);
+ std::vector<std::string> pythonBBTK= ((bbtk::InterpreterPy*)(I.get()))->pythonBBTK ;
+ FILE *ff=fopen(file.c_str(),"w+");
+ fprintf(ff,"from bbtk.bbtkBlackBox import *\n" );
+ fprintf(ff,"class appliTest02:\n" );
+ fprintf(ff," def Run(self):\n" );
+ fprintf(ff," mCB = ComplexBlackBox('appliTest02')\n");
+ int i,size=pythonBBTK.size();
+ for (i=0; i<size;i++)
+ {
+ fprintf(ff," mCB.%s\n", pythonBBTK[i].c_str() );
+ }// for i
+ fprintf(ff," mCB.Execute()\n" );
+ fclose(ff);
+ } catch (bbtk::Exception e) {
+ e.Print();
+ } // try
+ } // py
+
return 0;
}
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Santé)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+ */
+
+/*=========================================================================
+Program: bbtk
+Module: $RCSfile$
+Language: C++
+Date: $Date$
+Version: $Revision$
+=========================================================================*/
+
+
+/**
+ * \file
+ * \brief Class bbtk::BBPInterpreter
+ */
+
+
+#include "bbtkInterpreterPy.h"
+
+#include "bbtkExecuter.h"
+#include "bbtkMessageManager.h"
+#include "bbtkFactory.h"
+#include "bbtkUtilities.h"
+
+namespace bbtk
+{
+
+ //=========================================================================
+ InterpreterPy::Pointer InterpreterPy::New()
+ {
+ return MakePointer( new InterpreterPy() );
+ }
+ //=========================================================================
+
+
+
+ //=========================================================================
+ InterpreterPy::InterpreterPy()
+ {
+ bbtk::InterpreterVirtual::Init();
+ }
+ //=========================================================================
+
+ //=========================================================================
+ InterpreterPy::~InterpreterPy()
+ {
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ /// Creates a new black box in current complex box
+ void InterpreterPy::commandNew( const std::string& boxType, const std::string& boxName) // virtual
+ {
+ int pos = boxType.find( std::string(":") );
+ std::string boxTypeTmp=boxType;
+ boxTypeTmp.replace(pos,1,"_");
+ // ex: mCB.New( bbtkBlackBox.std_ConcatString("Box10") )
+ std::string code("New( "+boxTypeTmp+"('"+boxName+"') )");
+ this->pythonBBTK.push_back(code);
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ /// Connects the output boxOutput to the input boxInput
+ void InterpreterPy::commandConnection (const std::string &boxfrom,
+ const std::string &output,
+ const std::string &boxto,
+ const std::string &input) // virtual
+ {
+ //ex: mCB.Connection( "Box10" , "Out", "Box11", "In")
+ std::string code("Connection('"+boxfrom+"','"+output+"','"+boxto+"','"+input+"')");
+ this->pythonBBTK.push_back(code);
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void InterpreterPy::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string &help)
+ {
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void InterpreterPy::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string &help)
+ {
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ /// sets the input of the box with the value
+ void InterpreterPy::commandSet(const std::string &box,const std::string &input,const std::string &value) // virtual
+ {
+ //ex: mCB.Set("Box10","In2","/hola.mhd")
+ std::string code("Set('"+box+"','"+input+"','"+value+"')");
+ this->pythonBBTK.push_back(code);
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ void InterpreterPy::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual
+ {
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ void InterpreterPy::commandEndDefine() // virtual
+ {
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ void InterpreterPy::commandExec(const std::string &word) // virtual
+ {
+ //Ex: mCB.AddToExecutableLst("Box13")
+ std::string code("AddToExecutableLst('"+word+"')");
+ this->pythonBBTK.push_back(code);
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ void InterpreterPy::commandAuthor(const std::string &author) // virtual
+ {
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void InterpreterPy::commandCategory(const std::string &categorytype) // virtual
+ {
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void InterpreterPy::commandDescription(const std::string &description) // virtual
+ {
+ }
+ //=========================================================================
+
+} // EO namespace bbtk
+
+// EOF
+
--- /dev/null
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Santé)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
+
+/*=========================================================================
+Program: bbtk
+Module: $RCSfile$
+Language: C++
+Date: $Date$
+Version: $Revision$
+=========================================================================*/
+
+
+#ifndef __bbtkBBPInterpreter_h__
+#define __bbtkBBPInterpreter_h__
+
+//Includes bbtk
+#include "bbtkInterpreterVirtual.h"
+
+//Includes std
+#include <iostream>
+#include <set>
+
+
+//#include "bbtkSystem.h"
+//#include "bbtkComplexBlackBox.h"
+
+namespace bbtk
+{
+ class BBTK_EXPORT InterpreterPy : public InterpreterVirtual
+ {
+ public:
+ static Pointer New();
+ InterpreterPy();
+ ~InterpreterPy();
+
+ //Public methods
+
+ virtual void commandNew( const std::string& boxType, const std::string& boxName);
+
+ virtual void commandConnection (const std::string &boxfrom,
+ const std::string &output,
+ const std::string &boxto,
+ const std::string &input);
+ virtual void commandSet(const std::string &box,const std::string &input,const std::string &value);
+
+
+ virtual void commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename);
+ virtual void commandEndDefine();
+
+ virtual void commandExec(const std::string &word);
+
+ virtual void commandAuthor(const std::string &author);
+ virtual void commandCategory(const std::string &categorytype);
+ virtual void commandDescription(const std::string &description);
+
+ virtual void commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string &help);
+ virtual void commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string &help);
+
+ std::vector<std::string> pythonBBTK;
+
+ private:
+
+ //Private Attributes
+
+ //Private Methods
+
+ protected:
+
+ //Protected Attributes
+
+ //Protected methods
+
+ };
+}
+// namespace bbtk
+#endif
+
BBTK_NAME("ConcatStrings");
BBTK_AUTHOR("jean-pierre.roux@creatis.insa-lyon.fr");
BBTK_CATEGORY("misc");
- BBTK_DESCRIPTION("String concatenation");
+ BBTK_DESCRIPTION("String concatenation (C++,Python)");
BBTK_INPUT(ConcatStrings,In1, "String 1", std::string,"");
BBTK_INPUT(ConcatStrings,In2, "String 2", std::string,"");
BBTK_INPUT(ConcatStrings,In3, "String 3", std::string,"");
<blackbox name="Div">
<author>laurent.guigues@creatis.insa-lyon.fr</author>
- <description>Divides its inputs</description>
+ <description>Divides its inputs (C++,Python)</description>
<category>math</category>
<input name="In1" type="double" description="Numerator"/>
BBTK_BEGIN_DESCRIBE_BLACK_BOX(MarchingCubes,bbtk::AtomicBlackBox);
BBTK_NAME("MarchingCubes");
BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
- BBTK_DESCRIPTION("Extracts an iso-surface of an image using the marching cubes algorithm (bbfication of vtkMarchingCubes)");
+ BBTK_DESCRIPTION("Extracts an iso-surface of an image using the marching cubes algorithm (bbfication of vtkMarchingCubes) (C++,Python)");
BBTK_CATEGORY("image;mesh");
BBTK_INPUT(MarchingCubes,Active,"Active true/false (default true)",bool,"");
BBTK_BEGIN_DESCRIBE_BLACK_BOX(MetaImageReader,bbtk::AtomicBlackBox);
BBTK_NAME("MetaImageReader");
BBTK_AUTHOR("Info-Dev");
- BBTK_DESCRIPTION("No Description.");
+ BBTK_DESCRIPTION("No Description. (C++,Python)");
BBTK_CATEGORY("empty");
BBTK_INPUT(MetaImageReader,In,"File Name",std::string,"");
vtkPolyDataMapper *polydatamapper;
vtkActor *vtkactor;
-
BBTK_BLACK_BOX_INTERFACE(PolyDataToActor,bbtk::AtomicBlackBox);
BBTK_DECLARE_INPUT(Active,bool);
BBTK_BEGIN_DESCRIBE_BLACK_BOX(PolyDataToActor,bbtk::AtomicBlackBox);
BBTK_NAME("PolyDataToActor");
BBTK_AUTHOR("eduardo.davila at creatis.insa-lyon.fr");
- BBTK_DESCRIPTION("takes a vtkPolyData object to insert into a 3D scene (e.g. a Viewer3D)");
+ BBTK_DESCRIPTION("takes a vtkPolyData object to insert into a 3D scene (e.g. a Viewer3D) (C++,Python)");
typedef std::vector<double> vectorcolour;
BBTK_CATEGORY("3D object creator");
BBTK_INPUT(PolyDataToActor,In,"Input image",vtkPolyData*,"");
BBTK_NAME("Slider");
BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
// Already inserted for any WxBlackBox BBTK_CATEGORY("widget");
- BBTK_DESCRIPTION("Slider widget (wxSlider)");
+ BBTK_DESCRIPTION("Slider widget (wxSlider) (C++,Python)");
BBTK_INPUT(Slider,In, "Initial position of the slider (default 0)", int, "");
BBTK_INPUT(Slider,Min, "Minimum value of the slider (default 0)", int, "");
BBTK_INPUT(Slider,Max, "Maximum value of the slider (default 500)", int, "");