std::string command;
-#ifdef __APPLE__
- command = "source ~/.bashrc ; " + command;
-#endif
+//#ifdef __APPLE__
+// command = "source ~/.bashrc ; " + command;
+//#endif
#if defined(WIN32)
command = "\"";
#endif
+ command = "source ~/.bashrc_CreaTools ; " + command;
command += ConfigurationFile::GetInstance().Get_bin_path();
command += ConfigurationFile::GetInstance().Get_file_separator();
command += "bbRegeneratePackageDoc";
command = "";
-#ifdef __APPLE__
- command = "source ~/.bashrc ; " + command;
-#endif
+//#ifdef __APPLE__
+// command = "source ~/.bashrc ; " + command;
+//#endif
#if defined(WIN32)
command = "\"";
#endif
+ command = "source ~/.bashrc_CreaTools ; " + command;
command += ConfigurationFile::GetInstance().Get_bin_path();
command += ConfigurationFile::GetInstance().Get_file_separator();
command += "bbRegenerateBoxesLists";
#!/bin/bash
# compiles bbs files
-source ~/.bashrc
+source ~/.bashrc_CreaTools
if [ $# -lt 1 ]
then
//See http://www.wxwindows.org/faqgtk.htm#locale
setlocale(LC_NUMERIC, "C");
#endif
-
if (cmd.quiet) bbtk::MessageManager::SetMessageLevel("max",0);
if (cmd.debug) bbtk::MessageManager::SetMessageLevel("all",9);
-
-
//Borrame
//printf ("EED bbi wxBBIApp::OnInit .....................\n");
//cmd.input_file.push_back("/home/davila/Borrame/testwt.bbs");
-
bbtk::WxGUIConsole *I = new bbtk::WxGUIConsole(0,_T("bbi"),wxSize(800,600));
SetTopWindow(I);
if (cmd.console) I->Show(true);
-
-
I->SetInputs(cmd.param_map);
-
bool help_on_script = cmd.help && (cmd.input_file.size() > 0);
if (help_on_script) I->SetNoExecMode(true);
if (cmd.graphical_dialog) I->SetDialogMode(bbtk::VirtualExec::GraphicalDialog);
if (cmd.text_dialog) I->SetDialogMode(bbtk::VirtualExec::TextDialog);
-
std::vector<std::string>::const_iterator i;
bool error = false;
-
-
- for (i=cmd.input_file.begin(); i!=cmd.input_file.end(); ++i)
- {
+ //EED 2025-01-20 Create sync mechanism windows
+ bbtk::BlackBox::bbGlobalSetInConstruction(true);
+ for (i=cmd.input_file.begin(); i!=cmd.input_file.end(); ++i)
+ {
error = ! I->InterpretFile(*i);
if (error) break;
- }
+ }
+ //EED 2025-01-20 Create sync mechanism windows
+ bbtk::BlackBox::bbGlobalSetInConstruction(false);
bool show_on_error = error && ! cmd.no_console;
if (show_on_error) I->Show();
-
I->SetNoExecMode(false);
-
if (help_on_script)
- {
- std::string package;
+ {
+ std::string package;
I->GetInterpreter()->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",package,false);
- }
-
-
+ }
/*
std::cout << "soe="<<show_on_error <<std::endl;
std::cout << "con="<<console<<std::endl;
{
I->Close();
// std::cout << "I->Close"<<std::endl;
- }
- else
+ } else
{
// std::cout << "!I->Close"<<std::endl;
}
-
// std::cout << "EO OnInit"<<std::endl;
-
return true;
-
}
//==========================================================================
I->InterpretFile(argv[1]);
std::vector<std::string> javascriptBBTK= ((bbtk::InterpreterJavaScript*)(I.get()))->javascriptBBTK ;
FILE *ff=fopen(file.c_str(),"w+");
- fprintf(ff,"import * as bbtk from './bbtk.js' \n" );
//clean this code
+// fprintf(ff,"import * as bbtk from './bbtk.js' \n" );
// fprintf(ff,"export class %s{\n",fileBase.c_str() );
- fprintf(ff," Run(){\n" );
+// fprintf(ff," Run(){\n" );
//clean this code
// fprintf(ff," let mCBjs = new bbtk.ComplexBlackBox('%s')\n",fileBase.c_str());
int i,size=javascriptBBTK.size();
for (i=0; i<size;i++)
{
- fprintf(ff," mCBjs.%s\n", javascriptBBTK[i].c_str() );
+ // fprintf(ff," mCBjs.%s\n", javascriptBBTK[i].c_str() );
+ fprintf(ff,"%s\n", javascriptBBTK[i].c_str() );
}// for i
- fprintf(ff," mCBjs.Execute()\n" );
- fprintf(ff," } \n" );
- fprintf(ff,"} \n" );
+// fprintf(ff," mCBjs.Execute()\n" );
+// fprintf(ff," } \n" );
+// fprintf(ff,"} \n" );
fclose(ff);
} catch (bbtk::Exception e) {
e.Print();
#---------------------------------------------------------------------------
# Package dependencies
+
+IF(${BBTK_PACKAGE_NAME}_USE_OPENMP)
+ SET(USE_OPENMP ON CACHE BOOL "Use OPENMP" FORCE)
+ SET(${BBTK_PACKAGE_NAME}_LIBS
+ ${${BBTK_PACKAGE_NAME}_LIBS}
+ ${OpenMP_libomp_LIBRARY_crea}
+ )
+ LINK_DIRECTORIES( /opt/local/lib/libomp )
+ENDIF(${BBTK_PACKAGE_NAME}_USE_VTK)
+
IF(${BBTK_PACKAGE_NAME}_USE_VTK)
SET(USE_VTK ON CACHE BOOL "Use VTK" FORCE)
SET(${BBTK_PACKAGE_NAME}_LIBS
ADD_CUSTOM_COMMAND(
OUTPUT ${BBFY_CXX_OUT}
COMMAND
- export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} && echo $ENV{LD_LIBRARY_PATH} && source ~/.bashrc && ${BBTK_BBFY} ${xmlfile} ${BBTK_PACKAGE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/ -q
+ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} && echo $ENV{LD_LIBRARY_PATH} && source ~/.bashrc_CreaTools && ${BBTK_BBFY} ${xmlfile} ${BBTK_PACKAGE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/ -q
DEPENDS ${xmlfile}
${BBTK_BBFY_DEPENDENCY}
)
ELSE(WIN32)
SET(LD_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}:${LIBRARY_OUTPUT_PATH}")
ADD_CUSTOM_TARGET( bb${BBTK_PACKAGE_NAME}.bbp ALL
- COMMAND source ~/.bashrc && ${BBTK_BBPCONFIGURATOR} ${CMAKE_CURRENT_SOURCE_DIR}/../bbs/boxes/ ${BBTK_PACKAGE_NAME} ${BBTK_BBS_BUILD_PATH}/
+ COMMAND source ~/.bashrc_CreaTools && ${BBTK_BBPCONFIGURATOR} ${CMAKE_CURRENT_SOURCE_DIR}/../bbs/boxes/ ${BBTK_PACKAGE_NAME} ${BBTK_BBS_BUILD_PATH}/
)
add_dependencies( bb${BBTK_PACKAGE_NAME}.bbp bbpConfigurator )
ENDIF(WIN32)
otherwise package documentation will not be generated. \\
-Then update your environment variable LD\_LIBRARY\_PATH (in .bashrc if
+Then update your environment variable LD\_LIBRARY\_PATH (in .bashrc_CreaTools if
you are using bash), to add the path to the shared library
\texttt{libbb\emph{YourNewPackageName}.so}
namespace bbtk
{
-
-
-
-
-
//=========================================================
/// Abstract class used by the any class to store values
class anyplaceholder
Version: $Revision: 1.56 $
=========================================================================*/
-
-
/**
* \file
* \brief Class bbtk::BlackBox : abstract black-box interface.
#include "bbtkWxBlackBox.h"
#include "bbtkWx.h"
+#include <chrono>
#include <fstream>
-//#include <vector>
+/*
+// EED: This was tested in MacOs.
+
+#include <execinfo.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+void print_trace()
+{
+ void *array[10];
+ char **strings;
+ int size, i;
+ size = backtrace (array, 10);
+ strings = backtrace_symbols (array, size);
+ if (strings != NULL)
+ {
+ printf ("Obtained %d stack frames.\n", size);
+ for (i = 0; i < size; i++)
+ printf ("%s\n", strings[i]);
+ }
+ free (strings);
+}
+*/
namespace bbtk
{
+ static int bbmgInConstruction = 0;
static bool bbmgSomeBoxExecuting = false;
static bool bbmgFreezeExecution = false;
static std::set<BlackBox::WeakPointer> bbmgExecutionList;
}
//=========================================================================
-
//=========================================================================
BlackBox::~BlackBox()
{
}
//=========================================================================
-
-
//=========================================================================
std::string BlackBox::bbGetFullName() const
{
}
//=========================================================================
-
-
//=========================================================================
std::string BlackBox::bbGetNameWithParent() const
{
"=> BlackBox::bbSignalOutputModification("
<<reaction<<")"
<<"]"<<std::endl);
-
- OutputConnectorMapType::iterator i;
- for ( i = bbGetOutputConnectorMap().begin();
- i != bbGetOutputConnectorMap().end(); ++i)
- {
- // std::cout << "Stat = "
- //<<GetIOStatusString(i->second->GetStatus())
- // <<std::endl;
- // LG : CANNOT SIGNAL ONLY WHEN UPTODATE
- // See bbtkSampleOutputObserver
- // if (i->second->GetStatus()==UPTODATE)
- // {
- i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
- // }
- } // for
-
- if (reaction) bbGlobalProcessExecutionList();
-
+ if (bbGlobalGetInConstruction()==false)
+ {
+ OutputConnectorMapType::iterator i;
+ for ( i = bbGetOutputConnectorMap().begin();
+ i != bbGetOutputConnectorMap().end(); ++i)
+ {
+ // std::cout << "Stat = "
+ //<<GetIOStatusString(i->second->GetStatus())
+ // <<std::endl;
+ // LG : CANNOT SIGNAL ONLY WHEN UPTODATE
+ // See bbtkSampleOutputObserver
+ // if (i->second->GetStatus()==UPTODATE)
+ // {
+ i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
+ // }
+ } // for
+
+ if (reaction = true)
+ {
+ bbGlobalProcessExecutionList();
+ } // if reaction
+ } // if bbGlobalGetInConstruction()
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSignalOutputModification()"
<<std::endl);
"=> BlackBox::bbSignalOutputModification("
<<output<<","<<reaction<<")"
<<std::endl);
-
- OutputConnectorMapType::iterator i =
- bbGetOutputConnectorMap().find(output);
-
-
- if ( i == bbGetOutputConnectorMap().end() )
- {
- bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<output<<") : unknown output");
- }
-
- // if (i->second->GetStatus()==UPTODATE)
- // {
- i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
- // Has to notify the output "BoxChange" also
- if (output != "BoxChange")
- {
- i = bbGetOutputConnectorMap().find("BoxChange");
- if ( i != bbGetOutputConnectorMap().end() )
- {
- i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
- }
- }
- if (reaction) bbGlobalProcessExecutionList();
- // }
-
+ if (bbGlobalGetInConstruction()==false)
+ {
+ OutputConnectorMapType::iterator i =
+ bbGetOutputConnectorMap().find(output);
+ if ( i == bbGetOutputConnectorMap().end() )
+ {
+ bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<output<<") : unknown output");
+ }
+ // if (i->second->GetStatus()==UPTODATE)
+ // {
+ i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
+ // Has to notify the output "BoxChange" also
+ if (output != "BoxChange")
+ {
+ i = bbGetOutputConnectorMap().find("BoxChange");
+ if ( i != bbGetOutputConnectorMap().end() )
+ {
+ i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
+ }
+ }
+ if (reaction=true)
+ {
+ bbGlobalProcessExecutionList();
+ } // if reaction
+ // }
+ } // if bbGlobalGetInConstruction()
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSignalOutputModification("
<<output<<")"
<<std::endl);
}
- //=========================================================================
- //=========================================================================
+ //=========================================================================
+
+ //=========================================================================
void BlackBox::bbSignalOutputModification(const std::vector<std::string>& output,
bool reaction)
{
bbtkBlackBoxDebugMessage("change",5,
"=> BlackBox::bbSignalOutputModification(vector of outputs)"
<<std::endl);
- OutputConnectorMapType::iterator i;
- std::vector<std::string>::const_iterator o;
- bool changed = false;
- for (o=output.begin();o!=output.end();++o)
+
+ if (bbGlobalGetInConstruction()==false)
{
- // the output "BoxChange" must be signaled **AFTER** all others
- if (*o == "BoxChange") continue;
- // Look for the connector
- i = bbGetOutputConnectorMap().find(*o);
- if ( i == bbGetOutputConnectorMap().end() )
- {
- bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<*o<<") : unknown output");
- }
-
- // if (i->second->GetStatus()==UPTODATE)
- // {
- i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
- changed = true;
- // }
- }
- // Has to notify the output "BoxChange" also
- i = bbGetOutputConnectorMap().find("BoxChange");
- if ( changed && (i != bbGetOutputConnectorMap().end()))
- {
- // if (i->second->GetStatus()==UPTODATE)
- // {
- i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
- if (reaction) bbGlobalProcessExecutionList();
- // }
- }
-
+
+ OutputConnectorMapType::iterator i;
+ std::vector<std::string>::const_iterator o;
+ bool changed = false;
+ for (o=output.begin();o!=output.end();++o)
+ {
+ // the output "BoxChange" must be signaled **AFTER** all others
+ if (*o == "BoxChange") continue;
+ // Look for the connector
+ i = bbGetOutputConnectorMap().find(*o);
+ if ( i == bbGetOutputConnectorMap().end() )
+ {
+ bbtkError("BlackBox["<<bbGetFullName()<<"]::bbSignalOutputModification("<<*o<<") : unknown output");
+ }
+
+ // if (i->second->GetStatus()==UPTODATE)
+ // {
+ i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
+ changed = true;
+ // }
+ }
+ // Has to notify the output "BoxChange" also
+ i = bbGetOutputConnectorMap().find("BoxChange");
+ if ( changed && (i != bbGetOutputConnectorMap().end()))
+ {
+ // if (i->second->GetStatus()==UPTODATE)
+ // {
+ i->second->SignalChange(GetThisPointer<BlackBox>(),i->first);
+ if (reaction) bbGlobalProcessExecutionList();
+ // }
+ } // if changed
+ } // if inConstruction
bbtkBlackBoxDebugMessage("change",5,
"<= BlackBox::bbSignalOutputModification(vector of outputs)"
<<std::endl);
/// Main processing method of the box.
void BlackBox::bbExecute(bool force)
{
+
bbtkBlackBoxDebugMessage("process",2,
"=> BlackBox::bbExecute("<<(int)force<<")"
<<std::endl);
-
+
// If already executing : return
/*
if (bbGetExecuting())
{
bbLetRecursiveExecuteManualMode = true;
}
-
-
- // Calls the main recursive execution method
- bbRecursiveExecute(Connection::Pointer());
-
+
+ // Calls the main recursive execution method
+ bbRecursiveExecute(Connection::Pointer());
if ( bbBoxProcessModeIsManual() )
{
bbLetRecursiveExecuteManualMode = false;
}
-
-
+
bbtkBlackBoxDebugMessage("process",2,
"<= BlackBox::bbExecute()"
<<std::endl);
+
+
}
//=========================================================================
)
{
-//printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
-
+// printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
+
//auto start = std::chrono::high_resolution_clock::now();
this->bbProcess();
//auto stop = std::chrono::high_resolution_clock::now();
-//auto duration = duration_cast<std::chrono::microseconds>(stop - start);
+//auto duration = std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
//printf("EED BlackBox::bbRecursiveExecute bbProcess time= %ld %s \n", duration.count() , bbGetFullName().c_str() );
-//printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() );
+// printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() );
} // Manual analysis
// Shows the window if the black box has one
this->bbShowWindow();
-
-
bbtkBlackBoxDebugMessage("process",3,
"<= BlackBox::bbRecursiveExecute()"
<<std::endl);
-
bbSetExecuting(false);
bbGlobalSetSomeBoxExecuting(wasExecuting);
-
+
return;
}
//=========================================================================
}
//=========================================================================
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
//=========================================================================
void BlackBox::bbWriteDotInputOutputName(FILE *ff,bool inputoutput,int detail, int level)
{
}
//=========================================================================
+//EED 2025-01-20 Create sync mechanism windows
+bool BlackBox::bbGlobalGetInConstruction()
+{
+ if (bbmgInConstruction>0) return true;
+ return false;
+}
-
+void BlackBox::bbGlobalSetInConstruction(bool b)
+{
+ if (b==true) {
+ bbmgInConstruction++;
+ } else {
+ bbmgInConstruction--;
+ }
+}
} // EO namespace bbtk
Version: $Revision: 1.34 $
=========================================================================*/
-
-
/**
* \file
* \brief Class bbtk::BlackBox : abstract black-box interface.
#include <boost/bind.hpp>
#include <boost/signals2/signal.hpp>
-
#define bbtkBlackBoxMessage(key,level,mess) \
bbtkMessage(key,level,"["<<bbGetTypeName()<<":"<<bbGetName()<<"] "<<mess)
#define bbtkBlackBoxDebugMessage(key,level,mess) \
{
BBTK_ABSTRACT_OBJECT_INTERFACE(BlackBox);
-
public:
-
//==================================================================
// Types
//==================================================================
InputConnectorMapType;
//==================================================================
-
//==================================================================
/// @name Pipeline processing methods
/// Methods which participate to pipeline processing.
//@}
//==================================================================
-
-
-
-
//==================================================================
/// Returns a pointer on a clone of the box with name <name>
virtual BlackBox::Pointer bbClone(const std::string& name) = 0;
//==================================================================
-
//==================================================================
/// @name General accessors
/// Methods which give access to general informations on the box
const std::string& bbGetTypeName() const
{ return bbGetDescriptor()->GetTypeName(); }
-
/// Returns the name of the BlackBox (instance)
const std::string& bbGetName() const { return bbmName; }
//@}
//==================================================================
-
-
//==================================================================
/// @name Inputs/Outputs related methods
/// Methods related to the box inputs and outputs
/// Gets the data of the input called <name> as a string using an Adaptor if possible (else returns empty string)
std::string bbGetInputAsString( const std::string &input);
-
/// Sets the data of the input called <name>.
/// If update_time is false then does not update ChangeTime of input
virtual void bbSetInput( const std::string &name, Data data,
void* data,
bool update_time = true) =0;
-
/// Returns true iff the BlackBox has an output of name label
virtual bool bbHasOutput(const std::string& label) const;
/// Gets the output type of a given label
/// Sets the data of the output called <name>
virtual void bbSetOutput( const std::string &name, Data data) = 0;
-
/// Returns the input connectors map
InputConnectorMapType& bbGetInputConnectorMap()
{ return mInputConnectorMap; }
const BlackBoxInputConnector& bbGetInputConnector(const std::string& n) const
{ return *(mInputConnectorMap.find(n)->second); }
-
/// Returns the output connectors map
OutputConnectorMapType& bbGetOutputConnectorMap()
{ return mOutputConnectorMap; }
/// Prints the Help on the BlackBox type
virtual void bbGetHelp(bool full=true) const;
-
-
//==================================================================
/// @name Output signals / observers related methods
/// Methods related to signals emitted by outputs and the
OutputChangeCallbackType f);
//==================================================================
-
//==================================================================
/// Signals that the BlackBox outputs have been modified
/// (without marking the box as MODIFIED because its output state is ok : don't care if you understand : use it !).
//==================================================================
//@}
-
-
-
-
-
//==================================================================
/// @name Common inputs / outputs to all boxes
//@{
bool relative_link )
{}
-
//==================================================================
/// @name Window related methods
//@{
//@}
//JCP 09-06-09
+
+ static bool bbGlobalGetInConstruction();
+ static void bbGlobalSetInConstruction(bool b);
protected:
-
//==================================================================
/// @name User redefinable methods
/// Virtual methods which can be redefined by inherited classes
// @}
//==================================================================
-
//==================================================================
/// Write Graphviz-dot description in file.
BlackBox(BlackBox& from, const std::string &name);
//==================================================================
-
-
//==================================================================
/// @name Pipeline processing methods
/// Methods which participate to pipeline processing.
IOStatus bbUpdateInputs();
//==================================================================
-
//==================================================================
/// Actual CreateWindow method (vitual)
/// Overloaded in AtomicBlacBox and descendants
}
//==================================================================
-
//==================================================================
/// Actual processing method (vitual)
/// Overloaded in AtomicBlacBox and descendants
//@}
//==================================================================
-
//==================================================================
/// Signals that the input whose connector is c has changed
/// and propagates the info downward
IOStatus s);
//==================================================================
-
-
//==================================================================
/// @name Box con(des)struction / initi(fin)alization methods
//@{
/// (like a constructor does)
virtual void bbRecursiveInitializeProcessing() {}
-
/// Abstract prototype of the method which
/// calls bbUserFinalizeProcessing for its own class and then
/// recursively calls itself for the parent black box.
//==================================================================
protected:
-
//==================================================================
/// Black box objects have a special deleter
/// which must take care of releasing the descriptor
return 0; }
//==================================================================
-
//==================================================================
private:
//==================================================================
BlackBox::WeakPointer bbmParent;
//==================================================================
-
//==================================================================
// ATTRIBUTES
/// Map that contains the output connectors of the black box
InputConnectorMapType mInputConnectorMap;
//==================================================================
-
bool bbLetRecursiveExecuteManualMode;
};
// Class BlackBox
-
/// Convenient macro to create output observer callbacks (freehand functions) from object and method pointer (see samples/SampleOutputObserver)
#define BBTK_MAKE_OUTPUT_OBSERVER(OBJECT,METHOD) \
boost::bind( METHOD, OBJECT, _1, _2, _3)
bbtkBlackBoxDebugMessage("process",2,
"**> ComplexBlackBox::bbExecute()"
<<std::endl);
-
-
Wx::BusyCursor wait;
-
if (mExecutionList.size() != 0)
{
-
std::vector<std::string>::const_iterator i;
for (i=mExecutionList.begin();
i!=mExecutionList.end();
++i)
- {
- bbtkBlackBoxDebugMessage("process",3," -> Executing '"<<*i<<"'"<<std::endl);
- mBlackBoxMap[*i]->bbExecute(force);
- }
- }
- else
- {
- std::map<std::string, BlackBox::Pointer>::iterator i;
- for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end(); ++i)
- {
- i->second->bbExecute(force);
- }
- }
+ {
+ bbtkBlackBoxDebugMessage("process",3," -> Executing '"<<*i<<"'"<<std::endl);
+ mBlackBoxMap[*i]->bbExecute(force);
+ } // for i
+ } else {
+ std::map<std::string, BlackBox::Pointer>::iterator i;
+ for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end(); ++i)
+ {
+ i->second->bbExecute(force);
+ } // for i
+ }
bbtkBlackBoxDebugMessage("process",2,
"<** ComplexBlackBox::bbExecute()"
<<std::endl);
-
}
//==================================================================
<<std::endl);
mExecutionList.push_back( name );
-
-
}
//==================================================================
{
GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(nodeName)->bbExecute(true);
}
- }
- else
- {
+ } else {
GetCurrentDescriptor()->AddToExecutionList(nodeName) ;
}
}
{
int pos = boxType.find( std::string(":") );
std::string boxTypeTmp=boxType;
- boxTypeTmp.replace(pos,1,"_");
+ boxTypeTmp.replace(pos,1,".");
// ex: mCB.New( bbtkBlackBox.std_ConcatString("Box10") )
- std::string code("New( new bbtk."+boxTypeTmp+"('"+boxName+"') )");
+ std::string code(" this.New( new bbtk.bb"+boxTypeTmp+"('"+boxName+"') )");
this->javascriptBBTK.push_back(code);
}
//=========================================================================
const std::string &input) // virtual
{
//ex: mCB.Connection( "Box10" , "Out", "Box11", "In")
- std::string code("Connection('"+boxfrom+"','"+output+"','"+boxto+"','"+input+"')");
+ std::string code(" this.Connection('"+boxfrom+"','"+output+"','"+boxto+"','"+input+"')");
this->javascriptBBTK.push_back(code);
}
//=========================================================================
//=========================================================================
void InterpreterJavaScript::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string &help)
{
+ std::string code(" this.DECLARE_INPUT('"+name+"','"+box+"."+input+"')");
+ this->javascriptBBTK.push_back(code);
+
}
//=========================================================================
//=========================================================================
void InterpreterJavaScript::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string &help)
{
+ std::string code(" this.DECLARE_OUTPUT('"+name+"','"+box+"."+output+"')");
+ this->javascriptBBTK.push_back(code);
}
//=========================================================================
void InterpreterJavaScript::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+"')");
+ std::string code(" this.Set('"+box+"','"+input+"','"+value+"')");
this->javascriptBBTK.push_back(code);
}
//=========================================================================
//=========================================================================
void InterpreterJavaScript::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual
{
+ // fprintf(ff,"import * as bbtk from './bbtk.js' \n" );
+
+
+
+
+ this->javascriptBBTK.push_back(" ");
+ this->javascriptBBTK.push_back("import * as bbtk from '/bbtk/bbtk.js' ");
+ this->javascriptBBTK.push_back(" ");
+// this->javascriptBBTK.push_back("export class "+pack+"_"+name+" extends bbtk.bbkernel.ComplexBlackBox {");
+ this->javascriptBBTK.push_back("export class "+name+" extends bbtk.bbkernel.ComplexBlackBox {");
+ this->javascriptBBTK.push_back(" ");
+ this->javascriptBBTK.push_back(" constructor(nameBox) {");
+ this->javascriptBBTK.push_back(" super(nameBox)");
+ this->javascriptBBTK.push_back(" this.Init()");
+ this->javascriptBBTK.push_back(" }");
+ this->javascriptBBTK.push_back(" ");
+ this->javascriptBBTK.push_back(" async Init() {");
+/*
+ this->javascriptBBTK.push_back(" ");
+ this->javascriptBBTK.push_back("from bbtk.bbtkBlackBox import *");
+ this->javascriptBBTK.push_back(" ");
+ this->javascriptBBTK.push_back("class "+pack+"_"+name+"(ComplexBlackBox):");
+ this->javascriptBBTK.push_back(" ");
+ this->javascriptBBTK.push_back(" def __init__(self, nameBox):");
+ this->javascriptBBTK.push_back(" super().__init__(nameBox)");
+ this->javascriptBBTK.push_back(" self.Init()");
+ this->javascriptBBTK.push_back(" ");
+ this->javascriptBBTK.push_back(" def Init(self):");
+*/
}
//=========================================================================
//=========================================================================
void InterpreterJavaScript::commandEndDefine() // virtual
{
+ this->javascriptBBTK.push_back(" } // Init ");
+ this->javascriptBBTK.push_back("} // class");
}
//=========================================================================
void InterpreterJavaScript::commandExec(const std::string &word) // virtual
{
//Ex: mCB.AddToExecutableLst("Box13")
- std::string code("AddToExecutableLst('"+word+"')");
+ std::string code(" this.AddToExecutableLst('"+word+"')");
this->javascriptBBTK.push_back(code);
}
//=========================================================================
{
int pos = boxType.find( std::string(":") );
std::string boxTypeTmp=boxType;
- boxTypeTmp.replace(pos,1,"_");
+ boxTypeTmp.replace(pos,1,".");
// ex: mCB.New( bbtkBlackBox.std_ConcatString("Box10") )
- std::string code(" self.New( "+boxTypeTmp+"('"+boxName+"') )");
+ std::string code(" self.New( bbtk.bb"+boxTypeTmp+"('"+boxName+"') )");
this->pythonBBTK.push_back(code);
}
//=========================================================================
//=========================================================================
void InterpreterPython::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual
{
-
this->pythonBBTK.push_back(" ");
- this->pythonBBTK.push_back("from bbtk.bbtkBlackBox import *");
+
+//EED2024-07-29
+// this->pythonBBTK.push_back("from bbtk.bbtkBlackBox import *");
+// this->pythonBBTK.push_back(" ");
+// this->pythonBBTK.push_back("class "+pack+"_"+name+"(ComplexBlackBox):");
+ this->pythonBBTK.push_back("import bbtk.bbtk as bbtk");
this->pythonBBTK.push_back(" ");
- this->pythonBBTK.push_back("class "+pack+"_"+name+"(ComplexBlackBox):");
+ this->pythonBBTK.push_back("class "+name+"(bbtk.bbkernel.ComplexBlackBox):");
+
this->pythonBBTK.push_back(" ");
this->pythonBBTK.push_back(" def __init__(self, nameBox):");
this->pythonBBTK.push_back(" super().__init__(nameBox)");
this->pythonBBTK.push_back(" self.Init()");
this->pythonBBTK.push_back(" ");
this->pythonBBTK.push_back(" def Init(self):");
-
}
//=========================================================================
{
bbtkDebugMessage("interpreter",4,"==> InterpreterVirtual::InterpretFile(\""<<filename<<"\")"<<std::endl);
- bool exm = mCommandLine;
- mCommandLine = false;
+ bool exm = mCommandLine;
+ mCommandLine = false;
try
{
bbtkDebugMessage("interpreter",4,
"==> InterpreterVirtual::InterpretCurrentStreams()"<<std::endl);
- while (mFile.size()>0)
+ while (mFile.size()>0)
{
while (!mFile.back()->eof()) {
mLine.back()++;
{
commandMessage();
//EED Borrame mVirtualExecuter->HelpMessages();
- }
- else
- {
+ } else {
commandMessage(words[1],words[2]);
//EED Borrame sscanf(words[2].c_str(),"%d",&level);
//EED Borrame mVirtualExecuter->SetMessageLevel(words[1],level);
}
return;
- }
- else
- {
+ } else {
bbtkMessage("echo",2,line<<std::endl);
}
oter=ter;
ter.c_lflag &= ~ECHO;
ter.c_lflag &= ~ICANON;
- ter.c_cc[VMIN]=1;
- ter.c_cc[VTIME]=0;
+ ter.c_cc[VMIN] = 1;
+ ter.c_cc[VTIME] = 0;
tcsetattr(0,TCSANOW,&ter);
#endif
- mCommandLine = true;
- bool again = true;
- // bool insideComment = false; // for multiline comment
- mInsideComment = false;
- do
+ mCommandLine = true;
+ bool again = true;
+ // bool insideComment = false; // for multiline comment
+ mInsideComment = false;
+ do
{
try
{
BBTK_DECLARE_INPUT(WinWidth,int);
BBTK_DECLARE_INPUT(WinHeight,int);
BBTK_DECLARE_INPUT(WinDialog,bool);
+ BBTK_DECLARE_INPUT(WinMaximized,bool);
BBTK_DECLARE_INPUT(WinHide,Void);
BBTK_DECLARE_INPUT(WinClose,Void);
BBTK_DECLARE_OUTPUT(Widget,Widget*);
bool bbIsShown();
//==================================================================
-
//==================================================================
/// User callback for creating the widget associated to the box
/// ** Must be defined ** in user classes
}
//==================================================================
-
protected:
void bbSetShown(bool);
BBTK_NAME("WidgetBlackBox_"+HumanTypeName<T>());
// BBTK_DESCRIPTION("Widget box. The inputs marked with (*) are only used if the widget is not inserted in another widget.\n");
BBTK_CATEGORY("widget");
- BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinTitle,
- "Title of the window (*)",
- std::string);
- BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinWidth,
- "Width of the window (* : only used if the widget is not connected to a Layout box)",int);
- BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinHeight,
- "Height of the window (*)",int);
- BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinDialog,
- "Set to 'true' to create a dialog window, i.e. which blocks the pipeline until it is closed (modal) (*)",bool);
- BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinHide,
- "Any signal received hides the window (*)",Void);
- BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinClose,
- "Any signal received closes the window (*)",Void);
+ BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinTitle,"Title of the window (*)",std::string);
+ BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinWidth,"Width of the window (* : only used if the widget is not connected to a Layout box)",int);
+ BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinHeight,"Height of the window (*)",int);
+ BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinDialog,"Set to 'true' to create a dialog window, i.e. which blocks the pipeline until it is closed (modal) (*)",bool);
+ BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinHide,"Any signal received hides the window (*)",Void);
+ BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinClose,"Any signal received closes the window (*)",Void);
+ BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinMaximized,"Start Application Maximazed",bool);
typedef typename WidgetBlackBox<T>::WidgetPointer WidgetPointer;
BBTK_TEMPLATE_OUTPUT(WidgetBlackBox,Widget,"Output widget",WidgetPointer);
BBTK_END_DESCRIBE_BLACK_BOX(WidgetBlackBox);
//=================================================================
-
-
-
-
-
-
-
-
} //namespace bbtk
// template code inclusion
Version: $Revision: 1.7 $
=========================================================================*/
-
-
/**
* \file
* \brief
*/
-
-
//#include "bbtkWidgetBlackBoxWindow.h"
#include "bbtkBlackBoxOutputConnector.h"
-
namespace bbtk
{
bbSetInputWinTitle(bbGetName());
bbSetInputWinWidth(800);
bbSetInputWinHeight(800);
+ bbSetInputWinMaximized(false);
bbSetInputWinDialog(false);
bbSetOutputWidget(0);
}
//==================================================================
void WtBlackBox::bbShowWindow()
- {
- if ((bbmWindow) && (!bbIsShown()))
+{
+ if ((bbmWindow) && (!bbIsShown()))
{
- bbtkBlackBoxDebugMessage("widget",3,"==> WtBlackBox::bbShowWindow()"
- <<std::endl);
- if (bbGetInputWinDialog())
- {
- // ((WxDialog*)bbmWindow)->ShowModal();
- }
- else
- {
- // There is not such a thing like show becouse it is a webapp
- // bbGetWindow()->Show();
- // WWt::CreateWtAppIfNeeded();
-
-
- Wt::WRun(WtBlackBox::wtServerData::argc,
- WtBlackBox::wtServerData::argv,
- &createApplication);
-
-
- bbSetShown(true);
- }
- }
+ bbtkBlackBoxDebugMessage("widget",3,"==> WtBlackBox::bbShowWindow()"
+ <<std::endl);
+ if (bbGetInputWinDialog())
+ {
+ // ((WxDialog*)bbmWindow)->ShowModal();
+ } else {
+ // There is not such a thing like show becouse it is a webapp
+ // bbGetWindow()->Show();
+ // WWt::CreateWtAppIfNeeded();
+ Wt::WRun(WtBlackBox::wtServerData::argc,
+ WtBlackBox::wtServerData::argv,
+ &createApplication);
+ bbSetShown(true);
+ } // if WinDialog
+ } // if bbmWindow && !bbIsShown
}
- //==================================================================
+ //==================================================================
//==================================================================
void WtBlackBox::bbDestroyWindow()
Version: $Revision: 1.45 $
=========================================================================*/
-
-
#ifdef _USE_WXWIDGETS_
/**
~WxFrame();
void OnCloseWindow(wxCloseEvent& event);
-
WxBlackBox::WeakPointer mBox;
DECLARE_EVENT_TABLE();
wxSYSTEM_MENU |
wxCLOSE_BOX |
wxMAXIMIZE_BOX |
- wxMINIMIZE_BOX |
- wxCAPTION
- ),
+ wxMINIMIZE_BOX | wxFRAME_FLOAT_ON_PARENT |
+ wxCAPTION
+ ),
mBox(b)
{
bbtkDebugMessage("widget",9,"["<<b->bbGetName()<<"] WxFrame()"
Layout();
}
//==================================================================
+
//==================================================================
WxFrame::~WxFrame()
- {
-
-printf("EED WxFrame::~WxFrame\n");
-
+ {
+printf("EED WxFrame::~WxFrame\n");
if (mBox.lock())
{
bbtkDebugMessage("widget",9,"["<<mBox.lock()->bbGetName()
wxSize size);
~WxDialog();
void OnCloseWindow(wxCloseEvent& event);
-
-
WxBlackBox::WeakPointer mBox;
DECLARE_EVENT_TABLE();
wxDefaultPosition,
size,
wxRESIZE_BORDER |
- wxSYSTEM_MENU |
+// wxSYSTEM_MENU |
wxCLOSE_BOX |
wxMAXIMIZE_BOX |
- wxMINIMIZE_BOX |
- wxCAPTION
+ wxMINIMIZE_BOX | wxSTAY_ON_TOP |
+ wxCAPTION
),
mBox(b)
{
std2wx( ConstructWinTitle() ),
wxSize( bbGetInputWinWidth() ,
bbGetInputWinHeight() ) );
- w->Show(false);
+ w->Show(false);
// w->ShowModal();
- }
+ }
//=========================================================================
//==================================================================
std2wx( ConstructWinTitle() ),
wxSize( bbGetInputWinWidth() ,
bbGetInputWinHeight() ) );
- w->Show();
-
-
+ w->SetFocus(); // focus on my window
+ w->Raise(); // bring window to front
+ w->Show(true);
}
//==================================================================
void WxBlackBox::bbShowWindow()
{
if ((bbmWindow) && (!bbIsShown()))
- {
- bbtkBlackBoxDebugMessage("widget",3,"==> WxBlackBox::bbShowWindow()"
- <<std::endl);
- if (bbGetInputWinDialog())
- {
- ((WxDialog*)bbmWindow)->ShowModal();
- }
- else
- {
- bbGetWindow()->Show();
- bbSetShown(true);
- }
- } // if
-
-
+ {
+
+ //Try Maximized Window
+ if (bbGetInputWinMaximized()==true)
+ {
+ wxWindow *ww = bbGetOutputWidget();
+ while (ww->GetParent()!=NULL)
+ {
+ ww = ww->GetParent();
+ } // while
+ wxFrame *f = (wxFrame*)ww;
+ // f->Iconize(false);
+ f->Maximize(true);
+ // f->Raise();
+ // f->Show(true);
+ // f->SetFocus();
+ }// if WinMaximized
+
+
+
+ bbtkBlackBoxDebugMessage("widget",3,"==> WxBlackBox::bbShowWindow()" <<std::endl);
+ if (bbGetInputWinDialog())
+ {
+ ((WxDialog*)bbmWindow)->ShowModal();
+ } else {
+ bbGetWindow()->Show();
+ bbSetShown(true);
+ } // if Dialog
+
+ } // if Window shown
}
//==================================================================
- //==================================================================
+
+ //==================================================================
void WxBlackBox::bbDestroyWindow()
{
bbtkBlackBoxDebugMessage("widget",3,"==> WxBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
Version: $Revision: 1.33 $
========================================================================*/
-
-
/**
* \brief Short description in one line
*
* \brief
*/
-
#ifdef USE_WXWIDGETS
-
#ifndef __bbtkWxBlackBox_h__
#define __bbtkWxBlackBox_h__
-
-
#include "bbtkWidgetBlackBox.h"
#include "bbtkWx.h"
-
namespace bbtk
{
-
-
//==================================================================
/// Widget black boxes
//EED 10/06/2009 /*BBTK_EXPORT*/
public:
BBTK_BLACK_BOX_INTERFACE(WxBlackBox,bbtk::WidgetBlackBox<wxWindow>);
-
// protected:
-
public:
//==================================================================
virtual void bbCreateFrameWindow();
//==================================================================
-
//==================================================================
wxWindow* bbGetWindow() { return bbmWindow; }
void bbSetWindow(wxWindow*) ;
bool bbWindowIsCreated() { return (bbGetWindow() != 0); }
//==================================================================
-
//==================================================================
virtual void bbShowWindow();
//==================================================================
-
- //==================================================================
+
+ //==================================================================
virtual void bbDestroyWindow();
//==================================================================
virtual std::string ConstructWinTitle();
private:
-
wxWindow* bbmWindow;
-
};
//=================================================================
-
//=================================================================
// WxBlackBoxDescriptor declaration
class WxBlackBoxDescriptor : public WidgetBlackBoxDescriptor<wxWindow>
BBTK_END_DESCRIBE_BLACK_BOX(WxBlackBox);
//=================================================================
-
} //namespace bbtk
#endif //__bbtkWxBlackBox_h__
}
} // for i
sh = GDCM_NAME_SPACE::SerieHelper::New();
+ sh->SetDropDuplicatePositions( bbGetInputDropDuplicatePositions() );
l = &lstFiles;
sh->ImagePositionPatientOrdering( l );
} else{
bbSetInputIn(init);
bbSetInputReadRaw(true);
bbSetInputRespectSerieUID(true);
+ bbSetInputDropDuplicatePositions(true);
//reader=NULL; /// \TODO fixme JPR
}
BBTK_BLACK_BOX_INTERFACE(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox);
- BBTK_DECLARE_INPUT(In , std::vector<std::string>);
- BBTK_DECLARE_INPUT(IPPSort , bool);
- BBTK_DECLARE_INPUT(DicomTags , std::vector<std::string>);
- BBTK_DECLARE_INPUT(ReadRaw , bool);
- BBTK_DECLARE_INPUT(RespectSerieUID, bool);
-
- BBTK_DECLARE_OUTPUT(Out , vtkImageData *);
- BBTK_DECLARE_OUTPUT(OutFileNames , std::vector<std::string>);
- BBTK_DECLARE_OUTPUT(IPP , std::vector<double>);
- BBTK_DECLARE_OUTPUT(IOP , std::vector<double>);
- BBTK_DECLARE_OUTPUT(PixelSpacing , std::vector<double>);
- BBTK_DECLARE_OUTPUT(DicomInfo , VectorMapInfoDicom);
+ BBTK_DECLARE_INPUT(In , std::vector<std::string>);
+ BBTK_DECLARE_INPUT(IPPSort , bool);
+ BBTK_DECLARE_INPUT(DicomTags , std::vector<std::string>);
+ BBTK_DECLARE_INPUT(ReadRaw , bool);
+ BBTK_DECLARE_INPUT(RespectSerieUID , bool);
+ BBTK_DECLARE_INPUT(DropDuplicatePositions , bool);
+
+ BBTK_DECLARE_OUTPUT(Out , vtkImageData *);
+ BBTK_DECLARE_OUTPUT(OutFileNames , std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(IPP , std::vector<double>);
+ BBTK_DECLARE_OUTPUT(IOP , std::vector<double>);
+ BBTK_DECLARE_OUTPUT(PixelSpacing , std::vector<double>);
+ BBTK_DECLARE_OUTPUT(DicomInfo , VectorMapInfoDicom);
BBTK_PROCESS(Process);
void Process();
BBTK_DESCRIPTION("Get Dicom info from a File Set (a list of Dicom image file names) and read (as a vtkImageData)");
BBTK_CATEGORY("");
- BBTK_INPUT(GetXCoherentInfoGdcmReader,In ,"List of Dicom image file names", std::vector<std::string>,"");
- BBTK_INPUT(GetXCoherentInfoGdcmReader,IPPSort ,"Sort on Image Position Patient", bool,"");
- BBTK_INPUT(GetXCoherentInfoGdcmReader,DicomTags ,"Dicom Tags (vector of Dicom tags ex: D0028_0030 D0020_0037)", std::vector<std::string>,"");
- BBTK_INPUT(GetXCoherentInfoGdcmReader,ReadRaw ,"(default true) false: not read raw just dicom tags", bool,"");
- BBTK_INPUT(GetXCoherentInfoGdcmReader,RespectSerieUID ,"(default true) Respect Serie UID to be read", bool,"");
-
- BBTK_OUTPUT(GetXCoherentInfoGdcmReader,Out ,"Output image" , vtkImageData *,"");
- BBTK_OUTPUT(GetXCoherentInfoGdcmReader,OutFileNames ,"List of the files in the good order" , std::vector<std::string>,"");
- BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP ,"Image Position (Patient)" , std::vector<double>,"");
- BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IOP ,"Image Orientation (Patient)" , std::vector<double>,"");
- BBTK_OUTPUT(GetXCoherentInfoGdcmReader,PixelSpacing ,"Pixel Spacing" , std::vector<double>,"");
- BBTK_OUTPUT(GetXCoherentInfoGdcmReader,DicomInfo ,"vector of maps of Dicom tags" , VectorMapInfoDicom,"");
+ BBTK_INPUT(GetXCoherentInfoGdcmReader,In ,"List of Dicom image file names", std::vector<std::string>,"");
+ BBTK_INPUT(GetXCoherentInfoGdcmReader,IPPSort ,"Sort on Image Position Patient", bool,"");
+ BBTK_INPUT(GetXCoherentInfoGdcmReader,DicomTags ,"Dicom Tags (vector of Dicom tags ex: D0028_0030 D0020_0037)", std::vector<std::string>,"");
+ BBTK_INPUT(GetXCoherentInfoGdcmReader,ReadRaw ,"(default true) false: not read raw just dicom tags", bool,"");
+ BBTK_INPUT(GetXCoherentInfoGdcmReader,RespectSerieUID ,"(default true) Respect Serie UID to be read", bool,"");
+ BBTK_INPUT(GetXCoherentInfoGdcmReader,DropDuplicatePositions ,"(default true) Drop slices with Duplicate Positions", bool,"");
+
+
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,Out ,"Output image" , vtkImageData *,"");
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,OutFileNames ,"List of the files in the good order" , std::vector<std::string>,"");
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP ,"Image Position (Patient)" , std::vector<double>,"");
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IOP ,"Image Orientation (Patient)" , std::vector<double>,"");
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,PixelSpacing ,"Pixel Spacing" , std::vector<double>,"");
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,DicomInfo ,"vector of maps of Dicom tags" , VectorMapInfoDicom,"");
BBTK_END_DESCRIBE_BLACK_BOX(GetXCoherentInfoGdcmReader);
} // EO namespace bbgdcmvtk
# SET(${BBTK_PACKAGE_NAME}_USE_GDCM2 ON)
# SET(${BBTK_PACKAGE_NAME}_USE_GSMIS ON)
# SET(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS ON)
+SET(${BBTK_PACKAGE_NAME}_USE_OPENMP ON)
+
#===========================================================================
#===========================================================================
../std/src
# The path to the build tree folder is needed to find bbstd_EXPORT.h
${PROJECT_BINARY_DIR}/packages/std/src
+
+ /opt/local/include/libomp
+
)
#===========================================================================
bbSetOutputOut ( itk::ImageRegion<Dimension>(I,S) );
}
-}
-// eo namespace
+}// eo namespace
#endif
typename itkWriterType::Pointer writer = itkWriterType::New();
writer->SetInput(bbGetInputIn().unsafe_get<const itkImageType*>());
writer->SetFileName(bbGetInputFilename().c_str());
-
+ writer->SetUseCompression(true);
+
try { writer->Update(); }
catch( std::exception & e )
{
//=================================================================
-}
-//namespace bbitk
+}//namespace bbitk
+
#endif
#endif // _USE_ITK_
# - automatically handled libraries or packages : wx, vtk... (see above)
# - the dirs automatically set by other libraries found by FIND_PACKAGE
../itk/src
+ /opt/local/include/libomp
+
)
#===========================================================================
namespace bbkw
{
-
-
-
-
class LayoutSplit : public bbtk::KWBlackBox
{
-
BBTK_BLACK_BOX_INTERFACE(LayoutSplit,bbtk::KWBlackBox);
BBTK_DECLARE_INPUT(Widget1,vtkKWWidget*);
BBTK_DECLARE_INPUT(Widget2,vtkKWWidget*);
BBTK_DECLARE_INPUT(Proportion,int);
BBTK_PROCESS(Process);
BBTK_CREATE_KWWIDGET(CreateWidget);
- void CreateWidget(vtkKWFrame*);
-
- void Process();
+ void CreateWidget(vtkKWFrame*);
+ void Process();
protected:
- virtual void bbUserConstructor();
-
+ virtual void bbUserConstructor();
};
-
//=================================================================
// BlackBox description
BBTK_BEGIN_DESCRIBE_BLACK_BOX(LayoutSplit,bbtk::KWBlackBox);
BBTK_INPUT(LayoutSplit,Widget1,"Upper or left widget",vtkKWWidget*,"");
BBTK_INPUT(LayoutSplit,Widget2,"Lower or right widget",vtkKWWidget*,"");
BBTK_INPUT(LayoutSplit,Orientation,"Orientation (default H), 0=H=HORIZONTAL , 1=V=VERTICAL",std::string,"");
- BBTK_INPUT(LayoutSplit,Proportion,"Proportion (in percent) of the first children in the window",int,"");
+ BBTK_INPUT(LayoutSplit,Proportion,"Proportion (in percent) of the first children in the window",int,"");
BBTK_END_DESCRIBE_BLACK_BOX(LayoutSplit);
//=================================================================
}
Version: $Revision: 1.4 $
=========================================================================*/
-
-
-
/**
* \file
* \brief
*/
-
#ifdef USE_QT
#include "bbqtLayoutLine.h"
void LayoutSplit::Process()
{
+ printf("EED LayoutSplit::Process start\n");
+ printf("EED LayoutSplit::Process end\n");
}
void LayoutSplit::CreateWidget(QWidget* parent)
{
+ printf("EED LayoutSplit::CreateWidget\n");
Qt::Orientation ori;
if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
"0|H|HORIZONTAL")==true)
// when window is shown
void LayoutSplit::OnShowWidget()
{
+ printf("EED LayoutSplit::OnShowWidget\n");
/*
bbUserOnShowWidget("Widget1");
bbUserOnShowWidget("Widget2");
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.6 BBG BlackBox Diagram file
+# - /Users/davila/Creatis/C23/creatools_source/bbtk/packages/std/bbs/appli/exampleEncrypting.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+EXPORTFORMAT:0
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:8
+BOX
+std:Encrypting:Box00
+ISEXEC:FALSE
+0.698659:41.492586:-900.000000
+22.348659:38.992586:-900.000000
+PORT
+Mode:"1"
+FIN_BOX
+BOX
+wx:OutputText:Box01
+ISEXEC:FALSE
+3.959068:15.642200:-900.000000
+25.629068:13.142200:-900.000000
+FIN_BOX
+BOX
+wx:LayoutLine:Box02
+ISEXEC:TRUE
+-19.562454:1.824276:-900.000000
+13.757546:-0.675724:-900.000000
+FIN_BOX
+BOX
+wx:OutputText:Box03
+ISEXEC:FALSE
+-19.380378:15.587155:-900.000000
+2.289622:13.087155:-900.000000
+FIN_BOX
+BOX
+std:Encrypting:Box04
+ISEXEC:FALSE
+4.839803:32.044457:-900.000000
+26.489803:29.544457:-900.000000
+PORT
+Mode:"2"
+FIN_BOX
+BOX
+std:ConcatStrings:Box05
+ISEXEC:FALSE
+-28.179249:56.863085:-900.000000
+-5.419249:54.363085:-900.000000
+PORT
+In1:"hola eduardo 1972 COLOMBIA kz"
+FIN_BOX
+BOX
+wx:OutputText:Box06
+ISEXEC:FALSE
+-44.660543:15.687367:-900.000000
+-22.990543:13.187367:-900.000000
+FIN_BOX
+BOX
+std:ConcatStrings:Box07
+ISEXEC:FALSE
+18.087507:57.639373:-900.000000
+40.847507:55.139373:-900.000000
+PORT
+In1:"3"
+FIN_BOX
+CONNECTIONS:10
+CONNECTION
+Box05:Out:Box00:In
+NumberOfControlPoints:0
+CONNECTION
+Box00:Out:Box03:In
+NumberOfControlPoints:0
+CONNECTION
+Box00:Out:Box04:In
+NumberOfControlPoints:0
+CONNECTION
+Box04:Out:Box01:In
+NumberOfControlPoints:0
+CONNECTION
+Box01:Widget:Box02:Widget3
+NumberOfControlPoints:0
+CONNECTION
+Box03:Widget:Box02:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box06:In
+NumberOfControlPoints:0
+CONNECTION
+Box06:Widget:Box02:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box07:Out:Box00:Type
+NumberOfControlPoints:0
+CONNECTION
+Box07:Out:Box04:Type
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.6 BBS BlackBox Script
+# - /Users/davila/Creatis/C23/creatools_source/bbtk/packages/std/bbs/appli/exampleEncrypting.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include std
+include wx
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new std:Encrypting Box00
+ set Box00.Mode "1"
+
+new wx:OutputText Box01
+
+new wx:LayoutLine Box02
+
+new wx:OutputText Box03
+
+new std:Encrypting Box04
+ set Box04.Mode "2"
+
+new std:ConcatStrings Box05
+ set Box05.In1 "hola eduardo 1972 COLOMBIA kz"
+
+new wx:OutputText Box06
+
+new std:ConcatStrings Box07
+ set Box07.In1 "3"
+
+
+connect Box05.Out Box00.In
+
+connect Box00.Out Box03.In
+
+connect Box00.Out Box04.In
+
+connect Box04.Out Box01.In
+
+connect Box01.Widget Box02.Widget3
+
+connect Box03.Widget Box02.Widget2
+
+connect Box05.Out Box06.In
+
+connect Box06.Widget Box02.Widget1
+
+connect Box07.Out Box00.Type
+
+connect Box07.Out Box04.Type
+
+
+
+# Complex input ports
+exec Box02
<blackbox name="Add">
<author>laurent.guigues@creatis.insa-lyon.fr </author>
- <description>Adds its inputs </description>
+ <description>(C++,Python) Adds its inputs </description>
<category>math </category>
<input name="In1" type="double" description="First number to add"/>
<blackbox name="Div">
<author>laurent.guigues@creatis.insa-lyon.fr</author>
- <description>(C++,Python) Divides its inputs</description>
+ <description>(C++,Python,JavaScript) Divides its inputs</description>
<category>math</category>
<input name="In1" type="double" description="Numerator"/>
--- /dev/null
+//=====
+// 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 "bbstdEncrypting.h"
+#include "bbstdPackage.h"
+
+#include "bbtkBlackBoxInputConnector.h"
+
+
+#include <iostream>
+#include <string>
+
+
+namespace bbstd
+{
+
+class Connection;
+
+//
+//
+// https://stackoverflow.com/questions/66380465/c-encoding-decoding
+//
+//
+
+class encryptor
+{
+public:
+ virtual std::string encode(std::string original) = 0;
+ virtual std::string decode(std::string secret) = 0;
+};
+
+class shift_encryptor : public encryptor
+{
+ int shift;
+
+public:
+ shift_encryptor(int shift)
+ {
+ // Your code starts here
+ this->shift = shift;
+ // Your code ends here
+ }
+
+ std::string encode(std::string original)
+ {
+ // Your code starts here
+
+ char c_original[73] = {
+ ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
+ 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
+ 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
+ '3', '4', '5', '6', '7', '8', '9', '.', ',', ':',
+ ';', '@', '*', '$', '/', '-', '_', 'A', 'B', 'C',
+ 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ 'X', 'Y', 'Z' };
+
+
+
+ this->shift = this->shift % 73;
+
+ std::string original_result = "";
+ for (int i = 0; i < original.length(); i++)
+ {
+ int c_index = 0;
+ for (int j = 0; j < sizeof(c_original); j++)
+ {
+ if (original[i] == c_original[j])
+ {
+ c_index = j;
+ break;
+ }
+ }
+ int final_index = c_index + this->shift;
+ if (final_index > sizeof(c_original) - 1)
+ final_index -= sizeof(c_original);
+ original_result += c_original[final_index];
+ }
+ return original_result;
+ // Your code ends here
+ }
+
+ std::string decode(std::string secret)
+ {
+ // Your code starts here
+ char c_secret[73] = {
+ ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
+ 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
+ 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
+ '3', '4', '5', '6', '7', '8', '9', '.', ',', ':',
+ ';', '@', '*', '$', '/', '-', '_', 'A', 'B', 'C',
+ 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ 'X', 'Y', 'Z' };
+
+
+
+ this->shift = this->shift % 73;
+
+ std::string secret_result = "";
+ for (int i = 0; i < secret.length(); i++)
+ {
+ int c_index = 0;
+ for (int j = 0; j < sizeof(c_secret); j++)
+ {
+ if (secret[i] == c_secret[j])
+ {
+ c_index = j;
+ break;
+ }
+ }
+ int final_index = c_index - this->shift;
+ if (final_index < 0)
+ final_index += sizeof(c_secret);
+ secret_result += c_secret[final_index];
+ }
+ return secret_result;
+ // Your code ends here
+ }
+};
+
+class cypher_encryptor : public encryptor
+{
+ std::string cypher;
+public:
+ cypher_encryptor(std::string cypher)
+ {
+ // Your code starts here
+ this->cypher = cypher;
+ // Your code ends here
+ }
+ std::string encode(std::string original)
+ {
+ // Your code starts here
+ char c_original[73] = {
+ ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
+ 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
+ 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
+ '3', '4', '5', '6', '7', '8', '9', '.', ',', ':',
+ ';', '@', '*', '$', '/', '-', '_', 'A', 'B', 'C',
+ 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ 'X', 'Y', 'Z' };
+
+ std::string original_result = "";
+ for (int i = 0; i < original.length(); i++)
+ {
+ int c_index = 0;
+ for (int j = 0; j < this->cypher.length(); j++)
+ {
+ if (original[i] == this->cypher[j])
+ {
+ c_index = j;
+ break;
+ }
+ }
+ original_result += c_original[c_index];
+ }
+ return original_result;
+ // Your code ends here
+ }
+
+ std::string decode(std::string secret)
+ {
+ // Your code starts here
+ char c_secret[73] = {
+ ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
+ 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
+ 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
+ '3', '4', '5', '6', '7', '8', '9', '.', ',', ':',
+ ';', '@', '*', '$', '/', '-', '_', 'A', 'B', 'C',
+ 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ 'X', 'Y', 'Z' };
+
+ std::string secret_result = "";
+ for (int i = 0; i < secret.length(); i++)
+ {
+ int c_index = 0;
+ for (int j = 0; j < sizeof(c_secret); j++)
+ {
+ if (secret[i] == c_secret[j])
+ {
+ c_index = j;
+ break;
+ }
+ }
+ secret_result += this->cypher[c_index];
+ }
+ return secret_result;
+ // Your code ends here
+ }
+};
+
+
+std::string encryptDecrypt(std::string toEncrypt) {
+ char key[5] = {'K', 'C', 'Q','e','r'}; //Any chars will work
+ std::string output = toEncrypt;
+
+ for (int i = 0; i < toEncrypt.size(); i++)
+ output[i] = toEncrypt[i] ^ key[i % (sizeof(key) / sizeof(char))];
+
+ return output;
+}
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,Encrypting)
+BBTK_BLACK_BOX_IMPLEMENTATION(Encrypting,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 Encrypting::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() );
+
+ if (bbGetInputType()==1)
+ {
+ shift_encryptor* shiftTest = new shift_encryptor(9);
+ if (bbGetInputMode()==1)
+ {
+ bbSetOutputOut ( shiftTest->encode( bbGetInputIn() ) );
+ }
+ if (bbGetInputMode()==2)
+ {
+ bbSetOutputOut ( shiftTest->decode( bbGetInputIn() ) );
+ }
+ }
+ if (bbGetInputType()==2)
+ {
+ cypher_encryptor* crypter = new cypher_encryptor("04dw51CeVD23 67W89XYZASTBEfyhazlvjnktbogrumcpiqxs.,:;@*$/-_OHIPKLQRUJGMNF");
+ if (bbGetInputMode()==1)
+ {
+ bbSetOutputOut ( crypter->encode( bbGetInputIn() ) );
+ }
+ if (bbGetInputMode()==2)
+ {
+ bbSetOutputOut ( crypter->decode( bbGetInputIn() ) );
+ }
+ }
+
+ if (bbGetInputType()==3)
+ {
+ if ((bbGetInputMode()==1) ||(bbGetInputMode()==2) )
+ {
+ bbSetOutputOut ( encryptDecrypt( bbGetInputIn() ) );
+ }
+ }
+
+ if (bbGetInputType()==4)
+ {
+ InputConnectorMapType::iterator i = bbGetInputConnectorMap().find("In");
+ bbtk::Connection *c = i->second->GetConnection();
+ int idchar1 = 0;
+ int idchar2 = 8;
+ int idcode = 8;
+ if (c!=NULL)
+ {
+ int pos = c->GetBlackBoxFrom()->bbGetFullName().find("<");
+ std::string idstr1 = c->GetBlackBoxFrom()->bbGetFullName().substr(pos-2,2);
+ idchar1 = std::stoi( idstr1 );
+ std::string idstr2 = c->GetBlackBoxFrom()->bbGetFullName().substr(pos-1,1);
+ idchar2 = idstr2.at(0);
+ idcode = idchar1 + idchar2;
+ }
+
+ shift_encryptor* shiftTest = new shift_encryptor(idcode);
+ cypher_encryptor* crypter = new cypher_encryptor("04dw51CeVD23 67W89XYZASTBEfyhazlvjnktbogrumcpiqxs.,:;@*$/-_OHIPKLQRUJGMNF");
+ if (bbGetInputMode()==1)
+ {
+ bbSetOutputOut ( shiftTest->encode( crypter->encode( bbGetInputIn() )) );
+ } // if
+ if (bbGetInputMode()==2)
+ {
+ bbSetOutputOut ( crypter->decode( shiftTest->decode( bbGetInputIn() )) );
+ } // if
+ }
+
+
+ /*
+ encodeResult = shiftTest->encode("hello world");
+ std::cout << "shift encode result == " << encodeResult << std::endl;
+
+ decodeResult = shiftTest->decode("lipps${svph");
+ std::cout << "shift encode result == " << decodeResult << std::endl;
+
+ // string encodeResult = shiftTest->en
+
+ cypher_encryptor* crypterTest = new cypher_encryptor("efyhadwzlvjnktbogrumcpiqxs");
+
+# encodeResult = crypterTest->encode("heyj fvmpe");
+ std::cout << "encryptor encode result == " << encodeResult << std::endl;
+ decodeResult = crypterTest->decode("me emt shevyp wtjp ihls ftssjkt");
+ std::cout << "encryptor decode result == " << decodeResult << 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 Encrypting::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputIn("");
+ bbSetInputMode(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 Encrypting::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 Encrypting::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbstd
+
+
--- /dev/null
+//=====
+// 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 __bbstdEncrypting_h_INCLUDED__
+#define __bbstdEncrypting_h_INCLUDED__
+
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT Encrypting
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(Encrypting,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(In,std::string);
+ BBTK_DECLARE_INPUT(Mode,int);
+ BBTK_DECLARE_INPUT(Type,int);
+ BBTK_DECLARE_OUTPUT(Out,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(Encrypting,bbtk::AtomicBlackBox);
+ BBTK_NAME("Encrypting");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(Encrypting,In,"Input string",std::string,"");
+ BBTK_INPUT(Encrypting,Mode,"(default 0) 0:Nothing Type1: 0_Nothing 1_Encode 2_Decode Type2: 0_Nothing 1_Encode 2_Decode Type3: 0_Nothing 1:EncodeDecode",int,"");
+ BBTK_INPUT(Encrypting,Type,"(default 0) 0:Nothing 1:shiftTest(LowerCase) 2:cypher_encryptor(LowerCase) 3:EncodeDecode 4:EncodeDecode2",int,"");
+ BBTK_OUTPUT(Encrypting,Out,"Output string",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(Encrypting);
+//=====
+// 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 // __bbstdEncrypting_h_INCLUDED__
+
#ifdef __APPLE__
- ccommand = "source ~/.bashrc ; " + ccommand;
+ ccommand = "source ~/.bashrc_CreaTools ; " + ccommand;
#endif
if (bbGetInputVerbose()==true)
BBTK_NAME("Get"+bbtk::HumanTypeName<std::vector<T> >()+"Element");
BBTK_AUTHOR("info-dev@creatis.insa-lyon.fr");
// BBTK_DEFAULT_ADAPTOR();
- BBTK_DESCRIPTION("(C++,Python) Gets the i-th element from the input vector ("+bbtk::TypeName<std::vector<T> >());
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) Gets the i-th element from the input vector ("+bbtk::TypeName<std::vector<T> >());
typedef std::vector<T> Tvector;
BBTK_TEMPLATE_INPUT(GetVectorElement, In,"Input",Tvector);
BBTK_TEMPLATE_INPUT(GetVectorElement, I, "iElement (default 0)",int);
BBTK_NAME("MagicBox");
BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
BBTK_CATEGORY("misc");
- BBTK_DESCRIPTION("(C++,Python) Takes *any kind* of data and copies it to its output. Is a magic box as any box output can be plugged into it and its output can be plugged into any other box input (dynamic type checking, see below), hence it can be put between **any** two boxes. Type matching between its output and the input of the box(es) to which it is connected is made at *run-time*. The pipeline will be executed if the data types : i) match exactly ii) can be transformed by an adaptor iii) are related pointers, i.e. if the output pointer can be upcasted (static_cast) or downcasted (dynamic_cast) to an input type pointer (see the bbtk::any output connection rule in the guide for details). Important uses of the MagicBox are : 1) performing run-time pointer cast, either upward or backward an object hierarchy 2) perform data adaptation (adaptor creation) at run-time vs. pipeline creation time.");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) Takes *any kind* of data and copies it to its output. Is a magic box as any box output can be plugged into it and its output can be plugged into any other box input (dynamic type checking, see below), hence it can be put between **any** two boxes. Type matching between its output and the input of the box(es) to which it is connected is made at *run-time*. The pipeline will be executed if the data types : i) match exactly ii) can be transformed by an adaptor iii) are related pointers, i.e. if the output pointer can be upcasted (static_cast) or downcasted (dynamic_cast) to an input type pointer (see the bbtk::any output connection rule in the guide for details). Important uses of the MagicBox are : 1) performing run-time pointer cast, either upward or backward an object hierarchy 2) perform data adaptation (adaptor creation) at run-time vs. pipeline creation time.");
AddInputDescriptor
(new bbtk::AtomicBlackBoxInputDescriptor
(&MagicBox::bbGetInputIn),
new MagicBoxSetFunctor (&MagicBox::bbSetInputIn) ) );
- BBTK_INPUT(MagicBox, Active, "Active True/False (default True)",bool,"");
+ BBTK_INPUT(MagicBox, Active, "(default True) Active True/False",bool,"");
AddOutputDescriptor
<blackbox name="MultipleInputs">
<author>laurent.guigues@creatis.insa-lyon.fr</author>
- <description>(C++,Python) This box has multiple Void inputs and one Void output. Hence it relays any input modification to its output. It is usefull to plug different BoxChange outputs into the same BoxExecute input.</description>
+ <description>(C++,Python,JavaScript) This box has multiple Void inputs and one Void output. Hence it relays any input modification to its output. It is usefull to plug different BoxChange outputs into the same BoxExecute input.</description>
<category>misc</category>
<input name="In1" type="bbtk::Void" description="Input 1"/>
}
fclose(ff1);
} else { // else ff1
- printf("bbcreaMaracasVisuReadAxisTree3D::Process ...Error... reading file InputFileName_Points>%s", bbGetInputFileName().c_str() );
- } //ff1
+ printf("ReadColumnsDouble::Process ...Error... reading file InputFileName_Points:%s\n", bbGetInputFileName().c_str() );
+ } //ff1
i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); }
i=2; if (i<=bbGetInputDimension()) { bbSetOutputlstData2( *(tlst[i-1]) ); }
}
fclose(ff1);
} else { // else ff1
- printf("ReadColumnsDouble::Process ...Error... reading file FileName <%s>\n", bbGetInputFileName().c_str() );
+ printf("ReadColumnsDouble::Process ...Error... reading file FileName:%s\n", bbGetInputFileName().c_str() );
} //ff1
i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); }
i=2; if (i<=bbGetInputDimension()) { bbSetOutputlstData2( *(tlst[i-1]) ); }
#include "bbstdReadColumnsString.h"
#include "bbstdPackage.h"
-
#include<vector>
namespace bbstd
{
fgets( tmpValue , 500, ff1 );
}
-
while (!feof(ff1))
{
for( i=0 ; i<bbGetInputDimension() ; i++)
}
fclose(ff1);
} else { // else ff1
- printf("bbcreaMaracasVisuReadAxisTree3D::Process ...Error... reading file InputFileName_Points>%s", bbGetInputFileName().c_str() );
- } //ff1
-
+ printf("ReadColumnsString::Process ...Error... reading file InputFileName_Points:%s\n", bbGetInputFileName().c_str() );
+ } //ff1
i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); }
i=2; if (i<=bbGetInputDimension()) { bbSetOutputlstData2( *(tlst[i-1]) ); }
i=3; if (i<=bbGetInputDimension()) { bbSetOutputlstData3( *(tlst[i-1]) ); }
i=7; if (i<=bbGetInputDimension()) { bbSetOutputlstData7( *(tlst[i-1]) ); }
i=8; if (i<=bbGetInputDimension()) { bbSetOutputlstData8( *(tlst[i-1]) ); }
i=9; if (i<=bbGetInputDimension()) { bbSetOutputlstData9( *(tlst[i-1]) ); }
-
}
-//=====
+
+//=====
// 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 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("");
-
+ bbSetInputFileName("");
}
-//=====
+
+//=====
// 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 ReadColumnsString::bbUserInitializeProcessing()
{
-
// THE INITIALIZATION METHOD BODY :
// Here does nothing
// but this is where you should allocate the internal/output pointers
-// if any
-
-
+// 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 ReadColumnsString::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
}
-}
-// EO namespace bbstd
+
+}// EO namespace bbstd
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReadLinesString,bbtk::AtomicBlackBox);
BBTK_NAME("ReadLinesString");
BBTK_AUTHOR("Info-Dev");
- BBTK_DESCRIPTION("No Description.");
+ BBTK_DESCRIPTION("(C++,JavaScipt) No Description.");
BBTK_CATEGORY("empty");
BBTK_INPUT(ReadLinesString,FileName,"FileName",std::string,"");
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReplaceCleanString,bbtk::AtomicBlackBox);
BBTK_NAME("ReplaceCleanString");
BBTK_AUTHOR("InfoDev");
- BBTK_DESCRIPTION("No Description.");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) No Description.");
BBTK_CATEGORY("empty");
BBTK_INPUT(ReplaceCleanString,In,"Input string",std::string,"");
BBTK_INPUT(ReplaceCleanString,Replace,"New string to be put",std::string,"");
BBTK_BEGIN_DESCRIBE_BLACK_BOX(SplitFilePathVector,bbtk::AtomicBlackBox);
BBTK_NAME("SplitFilePathVector");
BBTK_AUTHOR("Info-Dev");
- BBTK_DESCRIPTION("No Description.");
+ BBTK_DESCRIPTION("(C++,JavaScript) No Description.");
BBTK_CATEGORY("empty");
BBTK_INPUT(SplitFilePathVector,In,"PathFileName",std::vector<std::string>,"");
// Template specialization of DoIt
template <> void StringTo<bool> ::DoIt()
{
- if ( (bbGetInputIn()=="true") ||
+ if ( (bbGetInputIn()=="true") ||
(bbGetInputIn()=="TRUE") ||
(bbGetInputIn()=="True") ||
(bbGetInputIn()=="1") )
{
- bbSetOutputOut(true);
- }
- else if ( (bbGetInputIn()=="false") ||
- (bbGetInputIn()=="FALSE") ||
- (bbGetInputIn()=="False") ||
- (bbGetInputIn()=="0") )
+ bbSetOutputOut(true);
+ } else if ( (bbGetInputIn()=="false") ||
+ (bbGetInputIn()=="FALSE") ||
+ (bbGetInputIn()=="False") ||
+ (bbGetInputIn()=="0") )
{
- bbSetOutputOut(false);
- }
- else
- {
- bbtkError("cannot convert '"<<bbGetInputIn()<<"' to a bool");
+ bbSetOutputOut(false);
+ } else {
+ printf("EED StringTo box cannot convert >>%s<<\n", bbGetInputIn().c_str() );
+// bbtkError("cannot convert '"<<bbGetInputIn()<<"' to a bool");
+ bbSetOutputOut(true);
+
}
+ printf("EED StringTo 5\n");
}
// Template specialization of DoIt
Out2[j]=In2[iBack];
} // for i
} // Type 7
- if (bbGetInputType()==8) // order all vectors using as base the vector In0
+ if (bbGetInputType()==8) // order all vectors using as base the vector InK
{
+ int k=0;
+ if (bbGetInputk1().size()==1) k=bbGetInputk1()[0];
double tmp;
int i,j,ii,sizeII;
sizeII=pLstVec.size();
{
for (j=i;j<size;j++)
{
- if ((*pLstVecOut[0])[j] <= (*pLstVecOut[0])[i] )
+ if ((*pLstVecOut[k])[j] <= (*pLstVecOut[k])[i] ) /// <<< k element to be order
{
for (ii=0;ii<sizeII;ii++)
{
} // if k1 not empty
}
} // Type 14
+ if (bbGetInputType()==15) // 15 swhitch element in a point k1=0 yz, k1=1 nothing k2=2 xz
+ {
+ double x,y,z;
+ double xx,yy,zz;
+ std::vector<double> k1 =bbGetInputk1();
+ if ( (In0.size()==3) && (k1.size()==1 ) )
+ {
+ if (k1[0]==0) {
+ Out0.push_back( In0[0] ); // x
+ Out0.push_back( In0[2] ); // z
+ Out0.push_back( In0[1] ); // y
+ }
+ if (k1[0]==1) {
+ Out0.push_back( In0[0] ); // x
+ Out0.push_back( In0[1] ); // y
+ Out0.push_back( In0[2] ); // z
+ }
+ if (k1[0]==2) {
+ Out0.push_back( In0[2] ); // z
+ Out0.push_back( In0[1] ); // y
+ Out0.push_back( In0[0] ); // x
+ }
+ } // if In0.size and k1.size
+ } // Type 15
+ if (bbGetInputType()==16) // 16 switch In0 and In1 (k1=1 nothing, k0 swhich)
+ {
+ if (bbGetInputk1().size()==1)
+ {
+ if (bbGetInputk1()[0] == 0)
+ {
+ Out0 = In0;
+ Out1 = In1;
+ } // if k1 == 0
+ if (bbGetInputk1()[0] == 1)
+ {
+ Out0 = In1;
+ Out1 = In0;
+ } // if k1 == 1
+ } // if size k1 == 1
+ } // if Type 16
+
+
bbSetOutputOut0( Out0 );
bbSetOutputOut1( Out1 );
bbSetOutputOut2( Out2 );
BBTK_AUTHOR("InfoDev");
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
- BBTK_INPUT(VectorFilterDouble,Type,"default (0) 0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition k1, 4=Substraction k1, 5=Multilication k1, 6=Division k1, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 , 9=Invert Vectors, 10=Nearest Point in the vector. In3PointXYZ In0LstX In1LstY In2LstZ (Out0-index Out1-PointXYZ), 11=Mul Spacing (K1[spcX,spcY,spcZ]=Spacing), 12=Div Spacing (K1[spcX,spcY,spcZ]=Spacing), 13=Distance pointIn0 and pontIn1, 14=Select specific segments [k1] in In0=lstPx In1=lstPy In2=lstPz In3=lstIndex (if k1 empty all segments are selected) ",int,"");
- BBTK_INPUT(VectorFilterDouble,k1,"(default [0]) nothing (Type0), k1[0]=new size vectors (Type 1) , nothing (Type2), k1[0] = Addition const. (Type 3), k1[0] = Substraction const. (Type 4), k1[0] = Multiplication const. (Type 5) , k1[0] = Division const. (Type 6) , k1[spcX,spcY,spcZ] MulSpc In0_X,In1_Y,In2_Z (type 11), k1[spcX,spcY,spcZ] DivSpc In0_X,In1_Y,In2_Z (type 12) , k1[segment1, segment2,..] (type 14) ",std::vector<double>,"");
+ BBTK_INPUT(VectorFilterDouble,Type,"default (0) 0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition k1, 4=Substraction k1, 5=Multilication k1, 6=Division k1, 7=Connect mesh X1,Y1,Z1,idxs1,X2,X2,X2,idx2, 8=Order All vectors with the logic of In0 , 9=Invert Vectors, 10=Nearest Point in the vector. In3PointXYZ In0LstX In1LstY In2LstZ (Out0-index Out1-PointXYZ), 11=Mul Spacing (K1[spcX,spcY,spcZ]=Spacing), 12=Div Spacing (K1[spcX,spcY,spcZ]=Spacing), 13=Distance pointIn0 and pontIn1, 14=Select specific segments [k1] in In0=lstPx In1=lstPy In2=lstPz In3=lstIndex (if k1 empty all segments are selected) , 15 swhitch element in a point k1=0 yz, k1=1 nothing k1=2 xz , 16 switch In0 and In1 (k1=1 nothing k0 swhich)",int,"");
+ BBTK_INPUT(VectorFilterDouble,k1,"(default [0]) nothing (Type0), k1[0]=new size vectors (Type 1) , nothing (Type2), k1[0] = Addition const. (Type 3), k1[0] = Substraction const. (Type 4), k1[0] = Multiplication const. (Type 5) , k1[0] = Division const. (Type 6), k1[0] In0..9 element base to be order (Type 8) , k1[spcX,spcY,spcZ] MulSpc In0_X,In1_Y,In2_Z (type 11), k1[spcX,spcY,spcZ] DivSpc In0_X,In1_Y,In2_Z (type 12) , k1[segment1, segment2,..] (type 14) , direction (type 15), direction (type 16) ",std::vector<double>,"");
BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector<double>,"");
BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector<double>,"");
BBTK_INPUT(VectorFilterDouble,In2,"Input vector",std::vector<double>,"");
int i,size = values.size();
for ( i=0 ; i<size-1 ; i++ )
{
+ printf("EED WriteColumnsString::Process %d %d \n", values[i].size() , values[i+1].size() );
if ( values[i].size() != values[i+1].size() )
{
ok=false;
} // for
} // for
} else { // if write_fi.is_open()
- std::cout<<"EED WriteColumnsString::Process Imposible to open file."<<std::endl;
+ std::cout<<"EED WriteColumnsString::Process Impossible to open file."<<std::endl;
}//if open
} else {
APP_START
CATEGORY:<VOID>
-DESCRIPTION:(C++,Python) Description ??
+DESCRIPTION:(C++,Python,JavaScript) Description ??
AUTHOR:Author ??
EXPORTFORMAT:0
COMPLEXBOX:TRUE
define ImageVtkPropertiesWidget toolsbbtk
author "Author ??"
-description "(C++,Python) Description ??"
+description "(C++,Python,JavaScript) Description ??"
category "<VOID>"
# SET(${BBTK_PACKAGE_NAME}_USE_GDCM2 ON)
# SET(${BBTK_PACKAGE_NAME}_USE_GSMIS ON)
# SET(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS ON)
+SET(${BBTK_PACKAGE_NAME}_USE_OPENMP ON)
#===========================================================================
#===========================================================================
if (bbGetInputIn1() == NULL)
{
- printf( "EED Warning!!! (%s) BinaryOperations::Process Set In1 at least", bbGetFullName().c_str() );
+ printf( "EED Warning!!! (%s) BinaryOperations::Process Set In1 at least \n", bbGetFullName().c_str() );
bbSetOutputOut(NULL);
return;
}
-
- if (ope!=NULL)
- {
- ope->Delete();
- ope = NULL;
- } // if
- ope = vtkImageMathematics::New();
-
- //EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5)
- ope->SetInput1((vtkDataObject*)bbGetInputIn1());
-#endif
-#if (VTK_MAJOR_VERSION >= 6)
- ope->SetInput1Data((vtkDataObject*)bbGetInputIn1());
-#endif
-
- if (bbGetInputIn2() != NULL)
- {
- //EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5)
- ope->SetInput2((vtkDataObject*)bbGetInputIn2());
-#endif
-#if (VTK_MAJOR_VERSION >= 6)
- ope->SetInput2Data((vtkDataObject*)bbGetInputIn2());
-#endif
- } else {
- printf( "EED Warning!!! (%s) BinaryOperations::Process Set In2 at least", bbGetFullName().c_str() );
- bbSetOutputOut(NULL);
- return;
- }
-
+
if ( (bbGetInputOperation()>=0) && (bbGetInputOperation()<=5) )
{
+ if (ope!=NULL)
+ {
+ ope->Delete();
+ ope = NULL;
+ } // if
+ ope = vtkImageMathematics::New();
+
+ //EED 2017-01-01 Migration VTK7
+ #if (VTK_MAJOR_VERSION <= 5)
+ ope->SetInput1((vtkDataObject*)bbGetInputIn1());
+ #endif
+ #if (VTK_MAJOR_VERSION >= 6)
+ ope->SetInput1Data((vtkDataObject*)bbGetInputIn1());
+ #endif
+
+ if (bbGetInputIn2() != NULL)
+ {
+ //EED 2017-01-01 Migration VTK7
+ #if (VTK_MAJOR_VERSION <= 5)
+ ope->SetInput2((vtkDataObject*)bbGetInputIn2());
+ #endif
+ #if (VTK_MAJOR_VERSION >= 6)
+ ope->SetInput2Data((vtkDataObject*)bbGetInputIn2());
+ #endif
+ } else {
+ printf( "EED Warning!!! (%s) BinaryOperations::Process Set In2 at least \n", bbGetFullName().c_str() );
+ bbSetOutputOut(NULL);
+ return;
+ }
+
+ int ext1[6];
+ int ext2[6];
+ bbGetInputIn1()->GetExtent(ext1);
+ bbGetInputIn2()->GetExtent(ext2);
+ if ( (ext1[0]!=ext2[0]) || (ext1[1]!=ext2[1]) || (ext1[2]!=ext2[2]) || (ext1[3]!=ext2[3]) || (ext1[4]!=ext2[4]) || (ext1[5]!=ext2[5]) )
+ {
+ printf( "EED Warning!!! (%s) BinaryOperations::Process Sizes of images are not the same.\n", bbGetFullName().c_str() );
+ bbSetOutputOut(NULL);
+ return;
+ }
+
switch ( bbGetInputOperation() )
{
case 0:
{
bbSetOutputOut( bbGetInputIn2() );
}
+ if ( bbGetInputOperation()==8 )
+ {
+ if (bbGetInputIn1()!=NULL)
+ {
+ if (bbGetInputIn2()==NULL)
+ {
+ int ext[6];
+ bbGetInputIn1()->GetExtent(ext);
+ int dimX = ext[1]-ext[0] + 1;
+ int dimY = ext[3]-ext[2] + 1;
+ int dimZ = ext[5]-ext[4] + 1;
+ int scalarSize = bbGetInputIn1()->GetScalarSize();
+ long int size = dimX * dimY * dimZ *scalarSize;
+ memset ( bbGetInputIn1()->GetScalarPointer(), 0 , size );
+ } else {
+ /*
+ int ext[6];
+ bbGetInputIn1()->GetExtent(ext);
+ int dimX1 = ext[1]-ext[0] + 1;
+ int dimY1 = ext[3]-ext[2] + 1;
+ int dimZ1 = ext[5]-ext[4] + 1;
+ int scalarSize1 = bbGetInputIn1()->GetScalarSize();
+ bbGetInputIn2()->GetExtent(ext);
+ int dimX2 = ext[1]-ext[0] + 1;
+ int dimY2 = ext[3]-ext[2] + 1;
+ int dimZ2 = ext[5]-ext[4] + 1;
+ int scalarSize2 = bbGetInputIn1()->GetScalarSize();
+ long int size = dimX1 * dimY1 * dimZ1 * scalarSize1;
+ if ((dimX1==dimX2) && (dimY1==dimY2) && (dimZ1==dimZ2) && (scalarSize1==scalarSize2))
+ {
+ memcpy( bbGetInputIn1()->GetScalarPointer(), bbGetInputIn2()->GetScalarPointer() , size );
+ } // if dim size
+ */
+ bbGetInputIn1()->DeepCopy( bbGetInputIn2() );
+ } // if In2
+ } // if In1
+ bbSetOutputOut( bbGetInputIn1() );
+ } // Operation 8
// bbSignalOutputModification();
}
BBTK_CATEGORY("filter");
BBTK_INPUT(BinaryOperations,In1,"first image to be operated",vtkImageData*,"NULL default");
BBTK_INPUT(BinaryOperations,In2,"second image to be operated",vtkImageData*,"NULL default");
- BBTK_INPUT(BinaryOperations,Operation,"0:Add (default) , 1:subtract, 2:multiply, 3:divide, 4=Max, 5=Min, 6=Replace with In1, 7=Replace with In2",int,"");
+ BBTK_INPUT(BinaryOperations,Operation,"0:Add (default) , 1:subtract, 2:multiply, 3:divide, 4=Max, 5=Min, 6=Replace with In1, 7=Replace with In2, 8=DeepCopy de In2 to In1 (output In1)",int,"");
BBTK_OUTPUT(BinaryOperations,Out,"",vtkImageData*,"");
BBTK_END_DESCRIBE_BLACK_BOX(BinaryOperations);
}
BBTK_NAME("CreateImage");
BBTK_AUTHOR("Info-Dev");
- BBTK_DESCRIPTION("(C++,Python)Create a new vtkImageData");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) Create a new vtkImageData");
BBTK_CATEGORY("Filter");
BBTK_INPUT(CreateImage,Dimensions,"[SizeX SizeY SizeZ] of the image ([250 250 250] default)",std::vector<int>,"");
// BBTK_NAME("GetVectorVtkImageDataElement");
BBTK_AUTHOR("info-dev@creatis.insa-lyon.fr");
// BBTK_DEFAULT_ADAPTOR();
- BBTK_DESCRIPTION("Gets the i-th element from the input vector ("+bbtk::TypeName<std::vector<T> >());
+ BBTK_DESCRIPTION("(C++,JavaScript) Gets the i-th element from the input vector ("+bbtk::TypeName<std::vector<T> >());
typedef std::vector<T> Tvector;
BBTK_TEMPLATE_INPUT(GetVectorElement, In,"(default NULL) Input",Tvector);
BBTK_TEMPLATE_INPUT(GetVectorElement, I, "iElement (default 0)",int);
double lowervalue = bbGetInputLowerValue();
double uppervalue = bbGetInputUpperValue();
DEF_POINTER_IMAGE_VTK_CREA(vI,ssI,pI,stI,bbGetInputIn())
- long int index=0;
-
- //int i,j;
- int k;
-
-int k1omp=(double)(maxZ-1)*0.0;
-int k2omp=(double)(maxZ-1)*0.2;
-int k3omp=(double)(maxZ-1)*0.4;
-int k4omp=(double)(maxZ-1)*0.6;
-int k5omp=(double)(maxZ-1)*0.8;
-int k6omp=(double)(maxZ-1)*1.0;
-
-//printf("EED ImageBoundaries::Process (with openmp)\n");
+
+ int *vecXMin = (int*)malloc( maxZ*sizeof(int) );
+ int *vecYMin = (int*)malloc( maxZ*sizeof(int) );
+ int *vecZMin = (int*)malloc( maxZ*sizeof(int) );
+ int *vecXMax = (int*)malloc( maxZ*sizeof(int) );
+ int *vecYMax = (int*)malloc( maxZ*sizeof(int) );
+ int *vecZMax = (int*)malloc( maxZ*sizeof(int) );
+
+ //int i,j;
+ int k;
+
+ for ( k=0 ; k<maxZ ; k++)
+ {
+ vecXMax[k] = 0;
+ vecYMax[k] = 0;
+ vecZMax[k] = 0;
+ vecXMin[k] = maxX-1;
+ vecYMin[k] = maxY-1;
+ vecZMin[k] = maxZ-1;
+ } // for
+
+ int k1omp = (double)(maxZ-1)*0.0;
+ int k2omp = (double)(maxZ-1)*0.2;
+ int k3omp = (double)(maxZ-1)*0.4;
+ int k4omp = (double)(maxZ-1)*0.6;
+ int k5omp = (double)(maxZ-1)*0.8;
+ int k6omp = (double)(maxZ-1)*1.0;
+
+printf("EED ImageBoundaries::Process (with openmp)\n");
// http://jakascorner.com/blog/2016/05/omp-for.html
-//#pragma omp parallel shared(maxZ,bXMin,bYMin,bZMin,bXMax,bYMax,bZMax)
-//{
- #pragma omp for
+ #pragma omp parallel for
for ( k=0 ; k<maxZ ; k++)
{
-//if ( (k1omp==k) || (k2omp==k) || (k3omp==k) ||
-// (k4omp==k) || (k5omp==k) || (k6omp==k) ) { printf(" %d%\n", (int)(((double)k/(double)(maxZ-1))*100 )); }
+if ( (k1omp==k) || (k2omp==k) || (k3omp==k) ||
+ (k4omp==k) || (k5omp==k) || (k6omp==k) ) { printf(" %d%\n", (int)(((double)k/(double)(maxZ-1))*100 )); }
int i,j;
double vItmpOMP;
+ long int index = maxX * maxY * k;
for (j=0 ; j<maxY ; j++)
{
for (i=0 ; i<maxX ; i++)
index++;
if ( (vItmpOMP>=lowervalue) && (vItmpOMP<=uppervalue) )
{
+ /*
if (i<bXMin) bXMin = i;
if (j<bYMin) bYMin = j;
if (k<bZMin) bZMin = k;
if (i>bXMax) bXMax = i;
if (j>bYMax) bYMax = j;
if (k>bZMax) bZMax = k;
+ */
+ if (i<vecXMin[k]) vecXMin[k] = i;
+ if (j<vecYMin[k]) vecYMin[k] = j;
+ if (k<vecZMin[k]) vecZMin[k] = k;
+ if (i>vecXMax[k]) vecXMax[k] = i;
+ if (j>vecYMax[k]) vecYMax[k] = j;
+ if (k>vecZMax[k]) vecZMax[k] = k;
}
} // for k
} // for j
} // i
-// } // #pragma
- std::vector<int> tmpIndex;
+
+ for ( k=0 ; k<maxZ ; k++)
+ {
+ if (vecXMin[k]<bXMin) bXMin = vecXMin[k];
+ if (vecYMin[k]<bYMin) bYMin = vecYMin[k];
+ if (vecZMin[k]<bZMin) bZMin = vecZMin[k];
+ if (vecXMax[k]>bXMax) bXMax = vecXMax[k];
+ if (vecYMax[k]>bYMax) bYMax = vecYMax[k];
+ if (vecZMax[k]>bZMax) bZMax = vecZMax[k];
+ }
+
+ delete vecXMin;
+ delete vecYMin;
+ delete vecZMin;
+ delete vecXMax;
+ delete vecYMax;
+ delete vecZMax;
+
+ std::vector<int> tmpIndex;
std::vector<int> tmpSize;
if (bXMin>bXMax){
tmpIndex.push_back(0);
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageVtkProperties,bbtk::AtomicBlackBox);
BBTK_NAME("ImageVtkProperties");
BBTK_AUTHOR("Info-Dev Creatis");
- BBTK_DESCRIPTION("(C++,Python) Image information Dim, Spc, Type, MinMax");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) Image information Dim, Spc, Type, MinMax");
BBTK_CATEGORY("filter");
BBTK_INPUT(ImageVtkProperties,In,"Input image (vtk)",vtkImageData*,"");
BBTK_OUTPUT(ImageVtkProperties,Origin,"Origin", std::vector<double> ,"");
BBTK_BEGIN_DESCRIBE_BLACK_BOX(Magnitud,bbtk::AtomicBlackBox);
BBTK_NAME("Magnitud");
BBTK_AUTHOR("seba-tor@uniandes.edu.co");
-BBTK_DESCRIPTION("Receive an ImgaData and generates an Actor. 'EED this box habe to be splited in 5 box'");
+BBTK_DESCRIPTION("Receive an ImgaData and generates an Actor. 'EED this box have to be splited in 5 box'");
BBTK_CATEGORY("");
// -------------- [
BBTK_INPUT(Magnitud,In,"Receive the image source",vtkImageData*, "");
namespace bbvtk
{
-
BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,MarchingCubes)
BBTK_BLACK_BOX_IMPLEMENTATION(MarchingCubes,bbtk::AtomicBlackBox);
-
void MarchingCubes::Process()
{
if (bbGetInputActive()==true)
bbGetVtkObject()->Update();
} // Active
}
-
//-----------------------------------------------------------------
void MarchingCubes::bbUserSetDefaultValues()
{
- BBTK_VTK_SET_DEFAULT_VALUES();
+ BBTK_VTK_SET_DEFAULT_VALUES();
bbSetInputActive(true);
bbSetInputValue(400);
bbSetInputComputeNormalsOn(true);
bbSetInputComputeScalarsOn(true);
}
-
- //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
void MarchingCubes::bbUserInitializeProcessing()
{
BBTK_VTK_INITIALIZE_PROCESSING();
}
-
//-----------------------------------------------------------------
void MarchingCubes::bbUserFinalizeProcessing()
{
BBTK_VTK_FINALIZE_PROCESSING();
}
-
} // EO namespace bbvtk
#endif //_USE_VTK_
bbSetOutputClippedPolyData(outPolydata);
// std::cout << "RaC PlaneClipPolyData::Process END "<<polydataCopy<< 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 PlaneClipPolyData::bbUserSetDefaultValues()
{
-
-
}
-//=====
+
+//=====
// 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 PlaneClipPolyData::bbUserInitializeProcessing()
{
-
-
}
-//=====
+
+//=====
// 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 PlaneClipPolyData::bbUserFinalizeProcessing()
{
-
}
-}
-// EO namespace bbvtk
+
+}// EO namespace bbvtk
// (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 ( (bbGetInputSource()==NULL) || (bbGetInputInput()==NULL) )
{
- bbSetOutputOut( NULL );
+ bbSetOutputOut( NULL );
} else {
//EED 2017-01-01 Migration VTK7
bbSetOutputOut( _probefilter->GetOutput() );
} // if source input
}
-//=====
+
+//=====
// 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 ProbeFilter::bbUserSetDefaultValues()
// bbSetInputSource(NULL);
// bbSetOutputOut(NULL);
}
-//=====
+
+//=====
// 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 ProbeFilter::bbUserInitializeProcessing()
{
-
// THE INITIALIZATION METHOD BODY :
// Here does nothing
// but this is where you should allocate the internal/output pointers
-// if any
-
+// if any
_probefilter = vtkProbeFilter::New();
-
-
}
-//=====
+
+//=====
// 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 ProbeFilter::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
_probefilter->Delete();
-
-}
}
-// EO namespace bbvtk
+
+}// EO namespace bbvtk
double A=bbGetInputA();
double B=bbGetInputB();
- if (bbGetInputIn()!=0)
+ if (bbGetInputIn()!=NULL)
{
+
+ if (filter1!=NULL){
+ mchange->Delete();
+ filter1->Delete();
+ filter2->Delete();
+ filter1 = vtkImageShiftScale::New();
+ filter2 = vtkImageShiftScale::New();
+ mchange = vtkImageChangeInformation::New();
+ }
+
+
int outputformat = bbtkStaticLecture::GetTypeFormat( bbGetInputOutputFormat() , bbGetInputIn() );
bbGetInputIn()->GetScalarRange(range);
bbGetInputIn()->GetSpacing(spc);
//=====
void RescaleSlopeIntercept::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
bbSetInputIn(NULL);
filter2 = NULL;
mchange = NULL;
}
-//=====
+
+//=====
// Don't edit this file. This file is generated from xml description..
//=====
void RescaleSlopeIntercept::bbUserInitializeProcessing()
filter2 = vtkImageShiftScale::New();
mchange = vtkImageChangeInformation::New();
}
-//=====
+
+//=====
// Don't edit this file. This file is generated from xml description..
//=====
void RescaleSlopeIntercept::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
filter2->Delete();
}
-}
-// EO namespace bbvtk
+}// EO namespace bbvtk
BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,StructuredPointsReader)
BBTK_BLACK_BOX_IMPLEMENTATION(StructuredPointsReader,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 StructuredPointsReader::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')
-
+
+ // 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')
+
//warning: comparison with string literal results in unspecified behaviour
- //if ( bbGetInputIn().c_str()!="")
+ //if ( bbGetInputIn().c_str()!="")
std::string empty(""); // JPR
if ( bbGetInputIn().c_str()!=empty)
- {
- spr -> SetFileName( bbGetInputIn().c_str() );
-//EED 2017-01-01 Migration VTK7
+ {
+ spr -> SetFileName( bbGetInputIn().c_str() );
+ //EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- sp = spr->GetOutput();
- sp -> Update();
- bbSetOutputOut( sp );
+ sp = spr->GetOutput();
+ sp -> Update();
+ bbSetOutputOut( sp );
#else
- spr -> Update();
- bbSetOutputOut( spr->GetOutput() );
+ spr -> Update();
+ bbSetOutputOut( spr->GetOutput() );
#endif
- } else {
- bbSetOutputOut( NULL );
- }
-
+ } else {
+ bbSetOutputOut( NULL );
+ }
}
-//=====
+
+//=====
// 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 StructuredPointsReader::bbUserSetDefaultValues()
{
-
-// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
-// Here we initialize the input 'In' to 0
- bbSetInputIn("");
- bbSetOutputOut( NULL );
-
+
+ // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+ // Here we initialize the input 'In' to 0
+ bbSetInputIn("");
+ bbSetOutputOut( NULL );
}
-//=====
+
+//=====
// 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 StructuredPointsReader::bbUserInitializeProcessing()
{
-
-// THE INITIALIZATION METHOD BODY :
-// Here does nothing
-// but this is where you should allocate the internal/output pointers
-// if any
-
- sp = vtkImageData::New();
- spr = vtkStructuredPointsReader::New();
-
-
-
+ // THE INITIALIZATION METHOD BODY :
+ // Here does nothing
+ // but this is where you should allocate the internal/output pointers
+ // if any
+ sp = vtkImageData::New();
+ spr = vtkStructuredPointsReader::New();
}
-//=====
+
+//=====
// 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 StructuredPointsReader::bbUserFinalizeProcessing()
{
-
-// THE FINALIZATION METHOD BODY :
-// Here does nothing
-// but this is where you should desallocate the internal/output pointers
-// if any
-
-}
+ // THE FINALIZATION METHOD BODY :
+ // Here does nothing
+ // but this is where you should desallocate the internal/output pointers
+ // if any
}
-// EO namespace bbvtk
+
+}// EO namespace bbvtk
#include "bbvtkTransform.h"
#include "bbvtkPackage.h"
+
#include "vtkMath.h"
+#include "vtkMatrix4x4.h"
+
namespace bbvtk
{
BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,Transform);
result->RotateWXYZ( ang , v3[0], v3[1], v3[2] );
} // if rotation size >=4
+ if (bbGetInputManualMatrixIn().size()==16)
+ {
+ std::vector<double> manaulMatrixIn = bbGetInputManualMatrixIn();
+ vtkMatrix4x4* m = result->GetMatrix();
+ int i,j,ii=0;
+ for (j=0;j<4;j++)
+ {
+ for (i=0;i<4;i++)
+ {
+ m->SetElement(j,i,manaulMatrixIn[ii]);
+ ii++;
+ }// for i
+ } // for j
+ m->Modified();
+ result->Update();
+ } // ManualMatrix
+
+ vtkTransform * finalTransform;
if (bbGetInputInverse()==false)
{
- bbSetOutputOut(result);
+ finalTransform = result;
} else {
vtkMatrix4x4 *matrix;
matrix=vtkMatrix4x4::New();
result->GetInverse(matrix);
resultInverse->SetMatrix( matrix );
- bbSetOutputOut(resultInverse);
+ finalTransform = resultInverse;
} // if Inverse
+
+ bbSetOutputOut(finalTransform);
+
+ std::vector<double> manualMatrixOut;
+ vtkMatrix4x4* m = finalTransform->GetMatrix();
+ int i,j,ii=0;
+ for (j=0;j<4;j++)
+ {
+ for (i=0;i<4;i++)
+ {
+ manualMatrixOut.push_back( m->GetElement(i,j) );
+ }// for i
+ } // for j
+ bbSetOutputManualMatrixOut( manualMatrixOut );
}
}// EO namespace bbvtk
BBTK_DECLARE_INPUT(Translate,std::vector<double>);
BBTK_DECLARE_INPUT(Spacing,std::vector<double>);
BBTK_DECLARE_INPUT(RotateToNormal,std::vector<double>);
+ BBTK_DECLARE_INPUT(ManualMatrixIn,std::vector<double>);
BBTK_DECLARE_OUTPUT(Out,vtkLinearTransform *);
+ BBTK_DECLARE_OUTPUT(ManualMatrixOut,std::vector<double>);
BBTK_PROCESS(Process);
void Process();
BBTK_INPUT(Transform,Spacing,"vector with spacingX spacingY spacingZ",std::vector<double>,"");
BBTK_INPUT(Transform,RotateWXYZ,"vector with Angle Vx Vy Vz",std::vector<double>,"");
BBTK_INPUT(Transform,RotateToNormal,"(default is EMPTY) Normal vector [nx,ny,nz]",std::vector<double>,"");
+ BBTK_INPUT(Transform,ManualMatrixIn,"(default EMPTY) The 16 elements of a 4x4 matrix",std::vector<double>,"");
BBTK_OUTPUT(Transform,Out,"vtkTransform result",vtkLinearTransform *,"");
+ BBTK_OUTPUT(Transform,ManualMatrixOut,"The 16 elements of the 4x4 matrix",std::vector<double>,"");
BBTK_END_DESCRIBE_BLACK_BOX(Transform);
}
{
if (bbGetInputRenderer()!=NULL)
{
- bbGetInputRenderer()->GetRenderWindow()->Render();
+//EED 2025-01-20 Create sync mechanism windows
+// bbGetInputRenderer()->GetRenderWindow()->Render();
+ bbGetInputRenderer()->GetRenderWindow()->GetInteractor()->Render();
} // Renderer
} // if Active
}
}
-
-
-
-
BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ButtonSelectFilesDirectory)
BBTK_BLACK_BOX_IMPLEMENTATION(ButtonSelectFilesDirectory,bbtk::WxBlackBox);
//=====
//=====
void ButtonSelectFilesDirectory::Process()
{
-
ButtonSelectFilesDirectoryWidget* w = (ButtonSelectFilesDirectoryWidget*)bbGetOutputWidget();
if (w)
{
UpdateLabel();
}
-
+
+ if (bbGetInputType()==1)
+ {
+ bbSetOutputOut( bbGetInputDefaultDir() );
+ } else {
+ bbSetOutputOut( bbGetInputDefaultFile() );
+ }
+
}
-//=====
+
+//=====
// 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 ButtonSelectFilesDirectory::CreateWidget(wxWindow* parent)
{
-
bbSetOutputWidget
( new ButtonSelectFilesDirectoryWidget ( this, //bbGetWxParent(),
parent,
bbtk::std2wx(bbGetInputLabel()) ) );
-
-
}
-//=====
+
+//=====
// 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 ButtonSelectFilesDirectory::bbUserSetDefaultValues()
//=====
void ButtonSelectFilesDirectory::bbUserInitializeProcessing()
{
-
}
-//=====
+
+//=====
// 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 ButtonSelectFilesDirectory::bbUserFinalizeProcessing()
{
-
}
void ButtonSelectFilesDirectory::UpdateLabel()
wxwidget->SetLabel( bbtk::std2wx( bbGetInputLabel() ) );
}
-
-
}// EO namespace bbwx
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ButtonSelectFilesDirectory,bbtk::WxBlackBox);
BBTK_NAME("ButtonSelectFilesDirectory");
BBTK_AUTHOR("InfoDev");
- BBTK_DESCRIPTION("No Description.");
+ BBTK_DESCRIPTION("(C++,Python) No Description.");
BBTK_CATEGORY("__CategoryBlackBox__");
BBTK_INPUT(ButtonSelectFilesDirectory,Type,"(default 0) 0:Files 1:Directory",int,"");
BBTK_INPUT(ButtonSelectFilesDirectory,Label,"Label",std::string,"");
BBTK_NAME("CheckBox");
BBTK_AUTHOR("jpr@creatis.insa-lyon.fr");
// Already inserted for any WxBlackBox BBTK_CATEGORY("widget");
- BBTK_DESCRIPTION("(C++,Python) CheckBox widget");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) CheckBox widget");
BBTK_INPUT(CheckBox, In, "Initial value of the CheckBox (default false)",bool, "");
BBTK_INPUT(CheckBox, Title,"Title shown above the CheckBox (default '') ", std::string,"");
BBTK_OUTPUT(CheckBox,Out, "Current value of the CheckBox", bool, "");
- BBTK_INPUT(CheckBox,ReactiveOnKeystroke,"0: no event generated when the checkbox is clicked on, 1: event generated when the checkbox is clicked on (default 1) ", int,"");
+ BBTK_INPUT(CheckBox,ReactiveOnKeystroke,"(default 1) 0: no event generated when the checkbox is clicked on, 1: event generated when the checkbox is clicked on ", int,"");
BBTK_END_DESCRIBE_BLACK_BOX(CheckBox);
//=================================================================
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ComboBox,bbtk::WxBlackBox);
BBTK_NAME("ComboBox");
BBTK_AUTHOR("Info-Dev");
- BBTK_DESCRIPTION("(C++,Python) wxComboBox");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) wxComboBox");
BBTK_CATEGORY("__CategoryBlackBox__");
BBTK_INPUT(ComboBox,Title,"Title prepended to the text",std::string,"");
BBTK_BEGIN_DESCRIBE_BLACK_BOX(CommandButton,bbtk::WxBlackBox);
BBTK_NAME("CommandButton");
BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
- BBTK_DESCRIPTION("Button which executes bbi commands");
+ BBTK_DESCRIPTION("(C++,JavaScript) Button which executes bbi commands");
typedef std::vector<double> vectorcolour;
//=====
#include "bbwxFreeMemoryAlert.h"
#include "bbwxPackage.h"
+
#include <wx/msgdlg.h>
namespace bbwx
double memfreeGB = (double) (wxGetFreeMemory().ToLong()/1000000000.0);
if ( memfreeGB < bbGetInputFreeMemoryLimit() )
{
- wxMessageBox(wxString::Format( "This application needs minimum %4.1f Gb to be executed correctly. \nTry to close somes applications you don't need. \n\n Actual free memory = %4.1f Gb\n",bbGetInputFreeMemoryLimit(),
+ /*
+ wxMessageBox( wxString::Format( "This application needs minimum %4.1f Gb to be executed correctly. \nTry to close somes applications you don't need. \n\n Actual free memory = %4.1f Gb\n" ,bbGetInputFreeMemoryLimit(),
memfreeGB ),
_T("Warning!"),
- wxOK | wxICON_INFORMATION,
- NULL);
- } // if memfree
-
+ wxOK | wxICON_INFORMATION | wxSTAY_ON_TOP | wxCENTRE ,
+ NULL);
+ */
-
+
+ wxMessageDialog *dial = new wxMessageDialog( NULL , wxT("Please select a Contour"), wxT("Warning"), wxOK | wxSTAY_ON_TOP| wxICON_EXCLAMATION ) ;
+ dial->ShowModal();
+ } // if memfree
}
-//=====
+
+//=====
// 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 FreeMemoryAlert::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
bbSetInputFreeMemoryLimit(1);
-
}
-//=====
+
+//=====
// 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 FreeMemoryAlert::bbUserInitializeProcessing()
{
-
// THE INITIALIZATION METHOD BODY :
// Here does nothing
// but this is where you should allocate the internal/output pointers
-// if any
-
-
+// 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 FreeMemoryAlert::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
}
-}
-// EO namespace bbwx
+
+}// EO namespace bbwx
Version: $Revision: 1.10 $
=========================================================================*/
-
/**
* \file
* \brief
*/
-
#ifdef _USE_WXWIDGETS_
#include "bbwxLayoutLine.h"
#include "bbwxPackage.h"
#include "bbtkUtilities.h"
-
namespace bbwx
{
BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx, LayoutLine);
bbSetInputWidget9(NULL);
}
- //-----------------------------------------------------------------
- void LayoutLine::bbUserInitializeProcessing()
- {
- }
-
- //-----------------------------------------------------------------
- void LayoutLine::bbUserFinalizeProcessing()
- {
- }
+//-----------------------------------------------------------------
+void LayoutLine::bbUserInitializeProcessing()
+{
+}
+//-----------------------------------------------------------------
+void LayoutLine::bbUserFinalizeProcessing()
+{
+}
+//-----------------------------------------------------------------
void LayoutLine::Process()
{
- PutWinTitle();
+ PutWinTitle();
}
-
-
+
/*
void LayoutLine::TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer)
{
void LayoutLine::CreateWidget(wxWindow* parent)
{
wxBoxSizer *sizer;
- wxPanel *w=new wxPanel(parent, -1, wxDefaultPosition, wxSize(40,40) );
+ wxPanel *w = new wxPanel(parent, -1, wxDefaultPosition, wxSize(40,40) );
w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
int style=0;
{
style=wxVERTICAL;
} // if
-
sizer = new wxBoxSizer(style);
-
wxWindow* cw;
//
TryInsertWindow(w,bbGetInputWidget8(),sizer);
TryInsertWindow(w,bbGetInputWidget9(),sizer);
*/
+ w -> SetSizer(sizer);
w -> SetAutoLayout(true);
- w -> SetSizer(sizer);
+ w -> Layout();
bbSetOutputWidget( w );
+
}
// This callback is necessary to get actual processing of the view
// when window is shown
void LayoutLine::OnShowWidget()
{
+ if (bbGetOutputWidget()!=NULL)
+ {
+ bbGetOutputWidget()->Layout();
+ } // if bbGetOutputWidget
}
}//namespace bbwx
* \class bbtk::NodePatern
* \brief Pattern for the definition of a new type of Node
*/
-
-
#ifdef USE_WXWIDGETS
-
#ifndef __bbWxLayoutLine_h__
#define __bbWxLayoutLine_h__
#include "bbtkWxBlackBox.h"
#include "bbwx_EXPORT.h"
-
namespace bbwx
{
-
-
-
//===========================================================
class bbwx_EXPORT LayoutLine : public bbtk::WxBlackBox
{
-
BBTK_BLACK_BOX_INTERFACE(LayoutLine,bbtk::WxBlackBox);
BBTK_DECLARE_INPUT(Widget1,wxWindow*);
BBTK_DECLARE_INPUT(Widget2,wxWindow*);
BBTK_PROCESS(Process);
BBTK_CREATE_WIDGET(CreateWidget);
BBTK_ON_SHOW_WIDGET(OnShowWidget);
-
void Process();
void CreateWidget(wxWindow*);
void OnShowWidget();
-
protected:
void TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer);
-
};
//===========================================================
-
-
+
//=================================================================
// BlackBox description
BBTK_BEGIN_DESCRIBE_BLACK_BOX(LayoutLine,bbtk::WxBlackBox);
BBTK_NAME("LayoutLine");
BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
- BBTK_DESCRIPTION("(C++,Python) LayoutLine widget (wxBoxSizer)");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) LayoutLine widget (wxBoxSizer)");
// Already inserted for any WxBlackBox BBTK_CATEGORY("widget");
BBTK_INPUT(LayoutLine,Widget1,"widget 1",wxWindow*,"");
BBTK_INPUT(LayoutLine,Widget2,"widget 2",wxWindow*,"");
BBTK_INPUT(LayoutLine,Orientation,"Orientation (default V), 0=H=HORIZONTAL , 1=V=VERTICAL",std::string,"");
BBTK_END_DESCRIBE_BLACK_BOX(LayoutLine);
//=================================================================
-
-
-
}
-
-
-
//namespace bbtk
#endif //__bbtkWxLayoutLine_h__
bbSetInputProportion(50);
bbSetInputWidget1(NULL);
bbSetInputWidget2(NULL);
- w=NULL;
+ w = NULL;
}
//-----------------------------------------------------------------
void LayoutSplit::CreateWidget(wxWindow* parent)
{
- wxPanel *splitterWindowPanel = new wxPanel(parent, -1, wxDefaultPosition, wxSize(40,40) );
+ wxPanel *splitterWindowPanel = new wxPanel(parent, -1, wxDefaultPosition, wxSize(40,40) );
// wxSplitterWindow *w
w = new wxSplitterWindow( splitterWindowPanel, //bbGetWxParent(),
// wxSize(400,200),
wxSP_3DSASH |
wxSP_LIVE_UPDATE );
- w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
+ w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
w->SetMinimumPaneSize(15);
//RaC Nov2012 Correctly resize internal panels with the window resize event
w->SetSashGravity(0.5);
if (w2==NULL) { w2=new wxPanel(bbGetWxParent()); }
w1->Reparent(w);
w2->Reparent(w);
- */
-
+ */
wxWindow* w1 = bbCreateWidgetOfInput("Widget1",w);
wxWindow* w2 = bbCreateWidgetOfInput("Widget2",w);
if (w1==NULL) { w1=new wxPanel(splitterWindowPanel); }
if (w2==NULL) { w2=new wxPanel(splitterWindowPanel); }
-
int orientation=0;
- if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|h|horizontal|Horizontal|HORIZONTAL")==true) { orientation=0; }
- if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|v|vertical|Vertical|VERTICAL")==true) { orientation=1; }
-
-
- if (orientation==1) { w->SplitHorizontally( w1, w2, 100); }
- else { w->SplitVertically( w1, w2, 100); }
+ if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|h|horizontal|Horizontal|HORIZONTAL")==true)
+ {
+ orientation=0;
+ }
+ if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|v|vertical|Vertical|VERTICAL")==true)
+ {
+ orientation=1;
+ } // ig
+ if (orientation==1)
+ {
+ w->SplitHorizontally( w1, w2, 100);
+ } else {
+ w->SplitVertically( w1, w2, 100);
+ }
//EED 2024-03-30
wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
splitterWindowPanel->Layout();
bbSetOutputWidget( splitterWindowPanel );
// bbSetOutputWidget( w );
-
}
-
// This callback is necessary to get actual processing of the view
// when window is shown
void LayoutSplit::OnShowWidget()
// bbtkError("LayoutSplit::OnShowWidget() : win == 0 !");
}
w->GetParent()->GetParent()->GetClientSize(&width,&height);
- int pos = 100;
- double ww = width;
- double hh = height;
- double proportion = bbGetInputProportion();
+ int pos = 100;
+ double ww = width;
+ double hh = height;
+ double proportion = bbGetInputProportion();
if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
"0|H|h|horizontal|Horizontal|HORIZONTAL")==true)
- {
- pos = (int)(ww * proportion * 0.01);
- } else {
- pos = (int)(hh * proportion * 0.01);
- }
-
- printf("EED LayoutSplit::OnShowWidget width=%d height=%d proportion=%d pos=%d box=%s\n", width,height,bbGetInputProportion(),pos, bbGetFullName().c_str() );
+ {
+ pos = (int)(ww * proportion * 0.01);
+ } else {
+ pos = (int)(hh * proportion * 0.01);
+ }
w->SetSashPosition(pos,true);
//RaC Nov2012 Correctly resize internal panels with the window resize event
w->SetSashGravity(0.5);
-
}
-
-
}//namespace bbwx
#endif // _USE_WXWIDGETS_
BBTK_BEGIN_DESCRIBE_BLACK_BOX(LayoutSplit,bbtk::WxBlackBox);
BBTK_NAME("LayoutSplit");
BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
- BBTK_DESCRIPTION("(C++,Python) Widget which splits a window in two fixed size parts (wxSplitterWindow)");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) Widget which splits a window in two fixed size parts (wxSplitterWindow)");
// Already inserted for any WxBlackBox BBTK_CATEGORY("widget");
BBTK_INPUT(LayoutSplit,Widget1,"Upper or left widget",wxWindow*,"");
BBTK_INPUT(LayoutSplit,Widget2,"Lower or right widget",wxWindow*,"");
Date: $Date: 2012/11/16 08:52:14 $
Version: $Revision: 1.12 $
=========================================================================*/
-
/**
* \file
* \brief
*/
-
-
#ifdef _USE_WXWIDGETS_
-
#include "bbwxLayoutTab.h"
#include "bbwxPackage.h"
#include "bbtkUtilities.h"
#include "bbtkBlackBoxInputConnector.h"
-
-
namespace bbwx
{
-
-
//--------------------------------------------------------------------------
class TabWidget : public wxPanel
{
wxNotebook *mwxNotebook;
};
-
TabWidget::TabWidget(LayoutTab* box, wxWindow *parent,long style )
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
mBox(box)
void LayoutTab::Process()
{
- PutWinTitle();
- SetTitleTabs();
+ PutWinTitle();
+ SetTitleTabs();
}
void LayoutTab::CreateWidget(wxWindow* parent)
TryInsertWindow(w,"Widget7");
TryInsertWindow(w,"Widget8");
TryInsertWindow(w,"Widget9");
+ w->SetAutoLayout(true);
w->Layout();
+ tabwidget->Layout();
//EED2020-04-06
// bbSetOutputWidget( w );
bbSetOutputWidget( tabwidget );
- }
-
-
- // This callback is necessary to get actual processing of the view
+}
+
+// This callback is necessary to get actual processing of the view
// when window is shown
void LayoutTab::OnShowWidget()
{
//EED2020-04-06
// wxNotebook* w = (wxNotebook*)bbGetOutputWidget();
wxNotebook* w = ((TabWidget*)bbGetOutputWidget())->GetmwxNotebook();
- if (w)
+ if (w!=NULL)
{
if (w->GetPageCount()>0)
{
w->AdvanceSelection();
} // for
} // if PageCount
- } // if w
+ } // if w
+ if (bbGetOutputWidget()!=NULL)
+ {
+ bbGetOutputWidget()->Layout();
+ } // if bbGetOutputWidget
}
-
}//namespace bbwx
#endif
BBTK_BEGIN_DESCRIBE_BLACK_BOX(LayoutTab,bbtk::WxBlackBox);
BBTK_NAME("LayoutTab");
BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
- BBTK_DESCRIPTION("(C++, Python) LayoutTab widget (wxNotebook) The label of each 'note book' will be the name of the object it contains");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) LayoutTab widget (wxNotebook) The label of each 'note book' will be the name of the object it contains");
// Already inserted for any WxBlackBox BBTK_CATEGORY("widget");
BBTK_INPUT(LayoutTab,Widget1,"widget 1",wxWindow*,"");
BBTK_INPUT(LayoutTab,Widget2,"widget 2",wxWindow*,"");
<blackbox name="OutputText" widget>
<author>laurent.guigues at creatis.insa-lyon.fr</author>
- <description>(C++,Python) Text zone to be inserted into a window (wxStaticText)</description>
+ <description>(C++,Python,JavaScript) Text zone to be inserted into a window (wxStaticText)</description>
<category></category>
<input name="Title" type="std::string" description="Title prepended to the text"/>
BBTK_NAME("Slider");
BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
// Already inserted for any WxBlackBox BBTK_CATEGORY("widget");
- BBTK_DESCRIPTION("(C++,Python) Slider widget (wxSlider)");
+ BBTK_DESCRIPTION("(C++,Python,JavaScript) Slider widget (wxSlider)");
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, "");