From 8ba18df584ba0a409fb042663be9fa76ccb0e0b0 Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Tue, 31 Oct 2023 13:04:44 +0100 Subject: [PATCH] #3498 Export to Python code for 3DSlicer --- kernel/appli/bbs2cpp/bbs2.cxx | 11 ++++++++--- kernel/src/bbtkInterpreterPython.cxx | 9 ++------- packages/std/src/bbstdFilesFromDirectory.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) 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,""); -- 2.45.1