From: eduardo.davila@creatis.insa-lyon.fr Date: Tue, 31 Oct 2023 12:04:44 +0000 (+0100) Subject: #3498 Export to Python code for 3DSlicer X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8ba18df584ba0a409fb042663be9fa76ccb0e0b0;p=bbtk.git #3498 Export to Python code for 3DSlicer --- diff --git a/kernel/appli/bbs2cpp/bbs2.cxx b/kernel/appli/bbs2cpp/bbs2.cxx index e0b303c..305efbf 100644 --- a/kernel/appli/bbs2cpp/bbs2.cxx +++ b/kernel/appli/bbs2cpp/bbs2.cxx @@ -86,16 +86,21 @@ int main(int argc, char* argv[]) I->InterpretFile(argv[1]); std::vector pythonBBTK= ((bbtk::InterpreterPython*)(I.get()))->pythonBBTK ; FILE *ff=fopen(file.c_str(),"w+"); + fprintf(ff,"\n" ); fprintf(ff,"from bbtk.bbtkBlackBox import *\n" ); + fprintf(ff,"\n" ); fprintf(ff,"class %s:\n",fileBase.c_str() ); + fprintf(ff,"\n" ); + fprintf(ff," def __init__(self):\n" ); + fprintf(ff," self.mCBpy = ComplexBlackBox('appliTest03')\n" ); + fprintf(ff,"\n" ); fprintf(ff," def Run(self):\n" ); - fprintf(ff," mCBpy = ComplexBlackBox('%s')\n",fileBase.c_str()); int i,size=pythonBBTK.size(); for (i=0; ipythonBBTK.push_back(code); } //========================================================================= - //========================================================================= /// sets the input of the box with the value void InterpreterPython::commandSet(const std::string &box,const std::string &input,const std::string &value) // virtual @@ -121,7 +117,6 @@ namespace bbtk } //========================================================================= - //========================================================================= void InterpreterPython::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual { diff --git a/packages/std/src/bbstdFilesFromDirectory.h b/packages/std/src/bbstdFilesFromDirectory.h index f3b8671..3ba18ea 100644 --- a/packages/std/src/bbstdFilesFromDirectory.h +++ b/packages/std/src/bbstdFilesFromDirectory.h @@ -67,7 +67,7 @@ namespace bbstd BBTK_BEGIN_DESCRIBE_BLACK_BOX(FilesFromDirectory,bbtk::AtomicBlackBox); BBTK_NAME("FilesFromDirectory"); BBTK_AUTHOR("jpr@creatis.univ-lyon1.fr"); - BBTK_DESCRIPTION("returns the fullPathNames of the files in a Directory"); + BBTK_DESCRIPTION("returns the fullPathNames of the files in a Directory (C++,Python)"); BBTK_CATEGORY(""); BBTK_INPUT(FilesFromDirectory,Active,"(default true) Active true/false ",bool,"");