-> Build
3.Copiler Version -> C/C++ CompilerVersion
GCC 4.2
+
+
+
+
+-------------
+
+rename file
+bbitkDICOMSeriesFileNames.xml-OLD-gdcm1.3
+
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
+//__asm__(".symver fcntl64,fcntl64@GLIBC_2.27");
#ifdef _USE_WXWIDGETS_
+
#include <exception>
//==========================================================================
-
-
-
//==========================================================================
// The `main program' equivalent, creating the windows and returning the
// main frame
bool wxBBIApp::OnInit( )
{
+
//Borrame
//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED wxBBIApp::OnInit\n"); fclose(ff);
@ONLY
)
IF (WIN32)
- INSTALL ( FILES ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/bbtkPackage
- DESTINATION "." )
+ CONFIGURE_FILE(
+ ${BBTK_CMAKE_DIR}/PlugPackage.bat.in
+ ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/PlugPackage.bat
+ COPYONLY
+ )
+ INSTALL ( FILES ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/bbtkPackage DESTINATION "." )
+ INSTALL ( FILES ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/PlugPackage.bat DESTINATION "." )
+ ELSE(WIN32)
+ CONFIGURE_FILE(
+ ${BBTK_CMAKE_DIR}/PlugPackage.sh.in
+ ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/PlugPackage.sh
+ COPYONLY
+ )
+ INSTALL ( FILES ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/bbtkPackage DESTINATION "share/bbtk" )
+ INSTALL ( FILES ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/PlugPackage.sh DESTINATION "share/bbtk" )
ENDIF (WIN32)
+
#---------------------------------------------------------------------------
ELSE(NOT BBTK_CORE_PACKAGE)
SET(${BBTK_PACKAGE_NAME}_BINARY_DIR ${PROJECT_BINARY_DIR})
@ONLY
)
IF (WIN32)
- INSTALL ( FILES ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/bbtkPackage
- DESTINATION "." )
+ CONFIGURE_FILE(
+ ${BBTK_CMAKE_DIR}/PlugPackage.bat.in
+ ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/PlugPackage.bat
+ COPYONLY
+ )
+ INSTALL ( FILES ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/bbtkPackage DESTINATION "." )
+ INSTALL ( FILES ${${BBTK_PACKAGE_NAME}_BINARY_DIR}/PlugPackage.bat DESTINATION "." )
ENDIF (WIN32)
#---------------------------------------------------------------------------
ELSE(NOT BBTK_CORE_PACKAGE)
ADD_CUSTOM_COMMAND(
OUTPUT ${BBFY_CXX_OUT}
COMMAND echo ${BBFY_CXX_OUT}
- COMMAND echo set "Path=${crea_DIR}/bin/\;"${DLL_PATH}
+ COMMAND echo set "Path=${crea_DIR}/bin/\;"${DLL_PATH}\;
COMMAND echo ${BBTK_BBFY} ${xmlfile} ${BBTK_PACKAGE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/ -q
## COMMAND echo ${BBFY_CXX_OUT}
- COMMAND set "Path=${crea_DIR}/bin/\;"${DLL_PATH} && ${BBTK_BBFY} ${xmlfile} ${BBTK_PACKAGE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/ -q
+ COMMAND set "Path=${crea_DIR}/bin/\;"${DLL_PATH}\; && ${BBTK_BBFY} ${xmlfile} ${BBTK_PACKAGE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/ -q
## COMMAND set Path=${DLL_PATH} && ${BBTK_BBFY} ${xmlfile} ${BBTK_PACKAGE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/ -q
DEPENDS ${xmlfile}
${BBTK_BBFY_DEPENDENCY}
ADD_CUSTOM_COMMAND(
## OUTPUT ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}.bbp
TARGET bb${BBTK_PACKAGE_NAME} POST_BUILD
- COMMAND set "Path=${crea_DIR}/bin/\;"${DLL_PATH} && ${BBTK_BBPCONFIGURATOR} ${CMAKE_CURRENT_SOURCE_DIR}/../bbs/boxes/ ${BBTK_PACKAGE_NAME} ${BBTK_BBS_BUILD_PATH}/
+ COMMAND set "Path=${crea_DIR}/bin/\;"${DLL_PATH}\; && ${BBTK_BBPCONFIGURATOR} ${CMAKE_CURRENT_SOURCE_DIR}/../bbs/boxes/ ${BBTK_PACKAGE_NAME} ${BBTK_BBS_BUILD_PATH}/
## DEPENDS ${BBTK_BBPCONFIGURATOR_DEPENDENCY}
)
add_dependencies( bb${BBTK_PACKAGE_NAME} bbpConfigurator )
FOREACH(APATH $ENV{PATH})
SET(DLL_PATHA ${DLL_PATHA}__RR__${APATH})
ENDFOREACH(APATH)
- STRING(REPLACE "__RR__" "\;" DLL_PATH ${DLL_PATHA} )
+ STRING(REPLACE "__RR__" "\;" DLL_PATH ${DLL_PATHA} )
ENDIF(WIN32)
ENDMACRO(MAKE_DLL_PATH)
#========================================================================
--- /dev/null
+bbPlugPackage %~dp0
+pause
\ No newline at end of file
--- /dev/null
+ACTUALDIR=$(pwd)
+bbPlugPackage $ACTUALDIR
+
+
namespace bbtk
{
- static bool bbmgSomeBoxExecuting = false;
- static bool bbmgFreezeExecution = false;
+ static bool bbmgSomeBoxExecuting = false;
+ static bool bbmgFreezeExecution = false;
static std::set<BlackBox::WeakPointer> bbmgExecutionList;
//=========================================================================
if (!pack.expired())
{
Package::ReleaseBlackBoxDescriptor(pack,desc);
- }
- else
- {
+ } else {
bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : descriptor package expired (was not held by a package and the box was the last instance)"<<std::endl);
}
- }
- else
- {
+ } else {
bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : descriptor expired : nothing to do (was not held by a package or the box is a complex black box prototype)"<<std::endl);
}
bbtkDebugMessage("object",2,"<## BlackBox::Deleter(\""<<name<<"\")"<<std::endl);
std::string BlackBox::bbGetNameWithParent() const
{
if (bbmParent.lock())
- {
- return bbmParent.lock()->bbGetNameWithParent() + ":" + bbmName;
- }
- else
- {
- return bbmName;
- }
+ {
+ return bbmParent.lock()->bbGetNameWithParent() + ":" + bbmName;
+ } else {
+ return bbmName;
+ }
}
//=========================================================================
//=========================================================================
void BlackBox::bbRecursiveExecute( Connection::Pointer caller )
{
-
bbtkBlackBoxDebugMessage("process",3,
"=> BlackBox::bbRecursiveExecute("
<<(caller?caller->GetFullName():"0")<<")"
<<std::endl);
// If already executing : return
- if (bbGetExecuting())
- {
- bbtkBlackBoxDebugMessage("process",3,
+ if (bbGetExecuting())
+ {
+ bbtkBlackBoxDebugMessage("process",3,
" -> already executing : abort"<<std::endl);
- return;
- }
+ return;
+ }
// If not initialized do it
bbInitializeProcessing();
( (bbBoxProcessModeIsManual()==true)&&(bbLetRecursiveExecuteManualMode==true) )
)
{
+//printf("EED BlackBox::bbRecursiveExecute bbProcess start %s \n", bbGetFullName().c_str() );
this->bbProcess();
+//printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() );
} // Manual analysis
//EED ups if ((bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==false))
// Update the I/O statuses
bbComputePostProcessStatus();
- }
- else
- {
+ } else {
// Test output status...
OutputConnectorMapType::iterator o;
for ( o = bbGetOutputConnectorMap().begin();
<<"all inputs are Up-to-date but output '"
<<o->first<<"' is Out-of-date ???");
}
- }
+ } // for
bbtkBlackBoxDebugMessage("process",3," -> Up-to-date : nothing to do"
<<std::endl);
- }
+ } // if
// Shows the window if the black box has one
this->bbShowWindow();
bbSetExecuting(false);
bbGlobalSetSomeBoxExecuting(wasExecuting);
-
return;
}
//=========================================================================
char copyFile[250];
if (!Utilities::FileExists(configXmlTmp)) // bbtk_config.xml.tmp not found (not installed)
- {
- // if "bbtk_path/bbtk_config.xml.tmp" doesn't exist, hard-create a minimum version in .bbtk
- CreateConfigXML( rootDirectory );// create .bbtk
- }
- else
- {
- sprintf(copyFile,"cp %s %s/bbtk_config.xml ",configXmlTmp,rootDirectory );
- if (!Utilities::FileExists(configPath))
- {
- system(copyFile);
- }
- }
+ {
+ // if "bbtk_path/bbtk_config.xml.tmp" doesn't exist, hard-create a minimum version in .bbtk
+ CreateConfigXML( rootDirectory );// create .bbtk
+ } else {
+ sprintf(copyFile,"cp %s %s/bbtk_config.xml ",configXmlTmp,rootDirectory );
+ if (!Utilities::FileExists(configPath))
+ {
+ system(copyFile);
+ } // FileExists configPath
+ } // FileExists configXmlTmp
return;
// ------------------------------------------------------------------
}
delete res;
+ std::string bbs_path;
#ifdef _WIN32
- std::string bbs_path = path + "/bbs";
+ bbs_path = path + "/bbs";
+ XMLNode BBSPATH = BB.addChild((XMLCSTR)"bbs_path");
+ BBSPATH.addText((XMLCSTR)bbs_path.c_str());
+ Utilities::replace(bbs_path, INVALID_FILE_SEPARATOR, VALID_FILE_SEPARATOR);
+ mBbs_paths.push_back(bbs_path);
#else
- std::string bbs_path = path + "/share/bbtk/bbs" ;
-#endif
+ bbs_path = path + "/share/bbtk/bbs" ;
XMLNode BBSPATH = BB.addChild((XMLCSTR)"bbs_path");
BBSPATH.addText((XMLCSTR)bbs_path.c_str());
Utilities::replace(bbs_path, INVALID_FILE_SEPARATOR, VALID_FILE_SEPARATOR);
mBbs_paths.push_back(bbs_path);
-#ifdef _WIN32
- std::string pack_path = path + "/bin";
-#else
- std::string pack_path = path ;
+ bbs_path = path + "/../../share/bbtk/bbs" ;
+ BBSPATH = BB.addChild((XMLCSTR)"bbs_path");
+ BBSPATH.addText((XMLCSTR)bbs_path.c_str());
+ Utilities::replace(bbs_path, INVALID_FILE_SEPARATOR, VALID_FILE_SEPARATOR);
+ mBbs_paths.push_back(bbs_path);
+
#endif
+
+ std::string pack_path;
+#ifdef _WIN32
+ pack_path = path;
XMLNode PACKPATH = BB.addChild((XMLCSTR)"package_path");
PACKPATH.addText((XMLCSTR)pack_path.c_str());
Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
mPackage_paths.push_back(pack_path);
-#ifdef _WIN32
- pack_path = path + "/RelWithDebInfo";
+ pack_path = path + "/bin";
PACKPATH = BB.addChild((XMLCSTR)"package_path");
PACKPATH.addText((XMLCSTR)pack_path.c_str());
Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
mPackage_paths.push_back(pack_path);
- pack_path = path + "/Debug";
- PACKPATH = BB.addChild((XMLCSTR)"package_path");
+
+// pack_path = path + "/RelWithDebInfo";
+// PACKPATH = BB.addChild((XMLCSTR)"package_path");
+// PACKPATH.addText((XMLCSTR)pack_path.c_str());
+// Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
+// mPackage_paths.push_back(pack_path);
+
+// pack_path = path + "/Debug";
+// PACKPATH = BB.addChild((XMLCSTR)"package_path");
+// PACKPATH.addText((XMLCSTR)pack_path.c_str());
+// Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
+// mPackage_paths.push_back(pack_path);
+
+// pack_path = path + "/Release";
+// PACKPATH = BB.addChild((XMLCSTR)"package_path");
+// PACKPATH.addText((XMLCSTR)pack_path.c_str());
+// Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
+// mPackage_paths.push_back(pack_path);
+#else
+ pack_path = path ;
+ XMLNode PACKPATH = BB.addChild((XMLCSTR)"package_path");
PACKPATH.addText((XMLCSTR)pack_path.c_str());
Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
mPackage_paths.push_back(pack_path);
- pack_path = path + "/Release";
+
+ pack_path = path+"/../../lib64/creatools" ;
PACKPATH = BB.addChild((XMLCSTR)"package_path");
PACKPATH.addText((XMLCSTR)pack_path.c_str());
Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
mPackage_paths.push_back(pack_path);
+
+#endif
+
+
+#ifdef _WIN32
#endif
{
bbtkBlackBoxDebugMessage("widget",1,"=> WidgetBlackBox::bbCloseWindow() ["
<<bbGetFullName()<<"]"<<std::endl);
+
+printf("EED WidgetBlackBoxWindow<W>::bbDestroy\n");
+
if (bbGetWindow()!=0) bbGetWindow()->bbDestroy();
template <class W>
WidgetBlackBoxWindow<W>::~WidgetBlackBoxWindow()
{
+ printf("EED WidgetBlackBoxWindow<W>::~WidgetBlackBoxWindow\n");
+
bbtkDebugMessage("widget",9,
"WidgetBlackBoxWindow::~WidgetBlackBoxWindow() "
<<this<<std::endl);
void WidgetBlackBoxWindow<W>::bbDestroy()
{
+printf("EED WidgetBlackBoxWindow<W>::bbDestroy \n");
+
if (mBox.expired()) return;
bbtkDebugMessage("widget",9,"WidgetBlackBoxWindow::bbDestroy() ["
<<mBox.lock()->bbGetName()<<"]"<<std::endl);
// FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION
// BBTKWXSIG
-//EED 2020-04-21
+//EED 2020-03-17
//#include <boost/signal.hpp>
#include <boost/signals2/signal.hpp>
//EED 2020-04-21
// typedef boost::signals::trackable SignalObserver;
// typedef boost::signal<void ()> Signal_type;
+
typedef boost::signals2::trackable SignalObserver;
typedef boost::signals2::signal<void ()> Signal_type;
} //namespace bbtk
-#endif //__bbtkWxBlackBox_h__
+#endif //__bbtkWtBlackBox_h__
-#endif //USE_WXWIDGETS
+#endif //USE_WT
{
if (mgWxApp!= 0)
{
+
+printf("EED Wx::DestroyWxAppIfNeeded \n");
+
+
// bbtkDebugMessage("wx",1," --> Destructing bbtk WxApp"<<std::endl);
//delete mgWxApp;
// mgWxApp = 0;
//==================================================================
WxFrame::~WxFrame()
{
+
+printf("EED WxFrame::~WxFrame\n");
+
if (mBox.lock())
- bbtkDebugMessage("widget",9,"["<<mBox.lock()->bbGetName()
+ {
+ bbtkDebugMessage("widget",9,"["<<mBox.lock()->bbGetName()
<<"] $$$$$$$$$$$$$$$$$$$ ~WxFrame()"
<<std::endl);
- else
- bbtkDebugMessage("widget",9,"[DEAD] $$$$$$$$$$$$$$$$$$$$$ ~WxFrame()"<<std::endl);
- //bbtkDebugMessage("widget",9,"WxFrame::~WxFrame()"<<std::endl);
- if (mBox.lock()) mBox.lock()->bbSetWindow(0);
+ } else {
+ bbtkDebugMessage("widget",9,"[DEAD] $$$$$$$$$$$$$$$$$$$$$ ~WxFrame()"<<std::endl);
+ //bbtkDebugMessage("widget",9,"WxFrame::~WxFrame()"<<std::endl);
+ } // if mBox.lock()
+ if (mBox.lock())
+ {
+ mBox.lock()->bbSetWindow(0);
+ } // if mBox.lock()
Wx::DecNbWindowsAlive();
}
//==================================================================
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C8/creatools_source/bbtk/packages/gdcmvtk/bbs/boxes/DicomSerieInfoDir.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:TRUE
+COMPLEXBOXNAME:DicomSerieInfoDir
+PACKAGENAME:gdcmvtk
+COMPLEXOUTPUTS:1
+COMPLEX_PORT
+OutString
+23.123899:-155.606672:-900.000000
+FIN_COMPLEX_PORT
+COMPLEXINPUTS:3
+COMPLEX_PORT
+LstPaths
+-39.489376:120.816144:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+LstSimpleDirName
+87.730451:116.973935:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+idDir
+15.155382:119.108496:-900.000000
+FIN_COMPLEX_PORT
+BOXES:13
+BOX
+std:FilesFromDirectory:Box03
+ISEXEC:FALSE
+10.731660:9.163982:-900.000000
+54.606660:-0.836018:-900.000000
+PORT
+Type:"0"
+FIN_BOX
+BOX
+std:GetVectorStringElement:Box04
+ISEXEC:FALSE
+8.013459:29.757210:-900.000000
+57.413459:19.757210:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+std:GetVectorStringElement:Box05
+ISEXEC:FALSE
+-13.647988:-9.810019:-900.000000
+35.752012:-19.810019:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+gdcmvtk:GetXCoherentInfoGdcmReader:Box06
+ISEXEC:FALSE
+84.539379:-29.755153:-900.000000
+141.514379:-39.755153:-900.000000
+PORT
+DicomTags:"D0028_0030"
+FIN_BOX
+BOX
+creaImageIO:GetDicomAttributesFromMaps:Box07
+ISEXEC:FALSE
+92.540130:-48.258085:-900.000000
+147.865130:-58.258085:-900.000000
+PORT
+KeyDicom:"D0028_0030"
+FIN_BOX
+BOX
+std:ConcatStrings:Box08
+ISEXEC:FALSE
+116.064960:12.082463:-900.000000
+155.789960:2.082463:-900.000000
+PORT
+In1:"D0008_103e"
+FIN_BOX
+BOX
+std:ConcatStrings:Box09
+ISEXEC:FALSE
+66.680200:-83.660762:-900.000000
+106.405200:-93.660762:-900.000000
+PORT
+In2:" "
+PORT
+In4:" ("
+PORT
+In6:"imgs)"
+FIN_BOX
+BOX
+std:GetVectorStringElement:Box10
+ISEXEC:FALSE
+71.763136:28.235191:-900.000000
+121.163136:18.235191:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+std:GetDoubleVectorSize:Box11
+ISEXEC:FALSE
+99.766716:-68.094255:-900.000000
+146.791716:-78.094255:-900.000000
+FIN_BOX
+BOX
+std:ReplaceCleanString:Box13
+ISEXEC:FALSE
+58.467387:-101.909474:-900.000000
+104.017387:-111.909474:-900.000000
+PORT
+Replace:"_"
+PORT
+Search:" "
+FIN_BOX
+BOX
+std:MagicBox:Box15
+ISEXEC:FALSE
+18.570679:86.236258:-900.000000
+54.645679:76.236258:-900.000000
+FIN_BOX
+BOX
+std:ReplaceCleanString:Box16
+ISEXEC:FALSE
+44.220452:-136.277407:-900.000000
+89.770452:-146.277407:-900.000000
+PORT
+Search:"____(0imgs)"
+FIN_BOX
+BOX
+std:ReplaceCleanString:Box17
+ISEXEC:FALSE
+67.219157:-118.466223:-900.000000
+112.769157:-128.466223:-900.000000
+PORT
+Search:","
+FIN_BOX
+CONNECTIONS:19
+CONNECTION
+Box04:Out:Box03:In
+NumberOfControlPoints:0
+CONNECTION
+Box03:Out:Box05:In
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box06:In
+NumberOfControlPoints:0
+CONNECTION
+Box06:DicomInfo:Box07:In
+NumberOfControlPoints:0
+CONNECTION
+Box08:Out:Box06:DicomTags
+NumberOfControlPoints:0
+CONNECTION
+Box08:Out:Box07:KeyDicom
+NumberOfControlPoints:0
+CONNECTION
+Box07:Out:Box09:In3
+NumberOfControlPoints:0
+CONNECTION
+Box03:OutSimple:Box11:In
+NumberOfControlPoints:0
+CONNECTION
+Box11:VectorSize:Box09:In5
+NumberOfControlPoints:0
+CONNECTION
+Box09:Out:Box13:In
+NumberOfControlPoints:0
+CONNECTION
+Box10:Out:Box09:In1
+NumberOfControlPoints:0
+CONNECTION
+LstPaths:LstPaths:Box04:In
+NumberOfControlPoints:0
+CONNECTION
+LstSimpleDirName:LstSimpleDirName:Box10:In
+NumberOfControlPoints:0
+CONNECTION
+idDir:idDir:Box15:In
+NumberOfControlPoints:0
+CONNECTION
+Box15:Out:Box10:I
+NumberOfControlPoints:0
+CONNECTION
+Box15:Out:Box04:I
+NumberOfControlPoints:0
+CONNECTION
+Box16:Out:OutString:OutString
+NumberOfControlPoints:0
+CONNECTION
+Box13:Out:Box17:In
+NumberOfControlPoints:0
+CONNECTION
+Box17:Out:Box16:In
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+# - /home/davila/Creatis/C8/creatools_source/bbtk/packages/gdcmvtk/bbs/boxes/DicomSerieInfoDir.bbs
+# ----------------------------------
+
+include std
+include itkvtk
+include std
+include gdcmvtk
+include creaImageIO
+
+define DicomSerieInfoDir gdcmvtk
+
+author "Author ??"
+description "Description ??"
+
+category "<VOID>"
+
+new std:FilesFromDirectory Box03
+ set Box03.Type "0"
+
+new std:GetVectorStringElement Box04
+ set Box04.I "0"
+
+new std:GetVectorStringElement Box05
+ set Box05.I "0"
+
+new gdcmvtk:GetXCoherentInfoGdcmReader Box06
+ set Box06.DicomTags "D0028_0030"
+
+new creaImageIO:GetDicomAttributesFromMaps Box07
+ set Box07.KeyDicom "D0028_0030"
+
+new std:ConcatStrings Box08
+ set Box08.In1 "D0008_103e"
+
+new std:ConcatStrings Box09
+ set Box09.In2 " "
+ set Box09.In4 " ("
+ set Box09.In6 "imgs)"
+
+new std:GetVectorStringElement Box10
+ set Box10.I "0"
+
+new std:GetDoubleVectorSize Box11
+
+new std:ReplaceCleanString Box13
+ set Box13.Replace "_"
+ set Box13.Search " "
+
+new std:MagicBox Box15
+
+new std:ReplaceCleanString Box16
+ set Box16.Search "____(0imgs)"
+
+new std:ReplaceCleanString Box17
+ set Box17.Search ","
+
+
+connect Box04.Out Box03.In
+connect Box03.Out Box05.In
+connect Box05.Out Box06.In
+connect Box06.DicomInfo Box07.In
+connect Box08.Out Box06.DicomTags
+connect Box08.Out Box07.KeyDicom
+connect Box07.Out Box09.In3
+connect Box03.OutSimple Box11.In
+connect Box11.VectorSize Box09.In5
+connect Box09.Out Box13.In
+connect Box10.Out Box09.In1
+connect Box15.Out Box10.I
+connect Box15.Out Box04.I
+connect Box13.Out Box17.In
+connect Box17.Out Box16.In
+
+# Complex input ports
+input LstPaths Box04.In " "
+input LstSimpleDirName Box10.In " "
+input idDir Box15.In " "
+
+# Complex output ports
+output OutString Box16.Out " "
+
+
+endefine
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C8/creatools_source/bbtk/packages/gdcmvtk/bbs/boxes/LstDicomSerieInfoDir.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:TRUE
+COMPLEXBOXNAME:LstDicomSerieInfoDir
+PACKAGENAME:gdcmvtk
+COMPLEXOUTPUTS:2
+COMPLEX_PORT
+lst
+-176.080762:-249.552015:-900.000000
+FIN_COMPLEX_PORT
+COMPLEX_PORT
+lstPath
+-443.760527:-238.330689:-900.000000
+FIN_COMPLEX_PORT
+COMPLEXINPUTS:1
+COMPLEX_PORT
+DirName
+-426.791489:149.063269:-900.000000
+FIN_COMPLEX_PORT
+BOXES:25
+BOX
+gdcmvtk:DicomSerieInfoDir:Box00
+ISEXEC:FALSE
+-951.940026:-10.508085:-900.000000
+-908.490026:-20.508085:-900.000000
+PORT
+idDir:"0"
+FIN_BOX
+BOX
+std:FilesFromDirectory:Box01
+ISEXEC:FALSE
+-437.823023:79.064069:-900.000000
+-393.948023:69.064069:-900.000000
+PORT
+In:"/home/davila/CreatisWorks/tmpMonica/SegCal/Benoit-Test-Dicom"
+PORT
+Recursive:"true"
+PORT
+Type:"2"
+FIN_BOX
+BOX
+std:ConcatStrings:Box03
+ISEXEC:FALSE
+-779.393451:-57.817697:-900.000000
+-739.668451:-67.817697:-900.000000
+PORT
+In10:" "
+PORT
+In2:" "
+PORT
+In4:" "
+PORT
+In6:" "
+PORT
+In8:" "
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box04
+ISEXEC:FALSE
+-904.389074:-11.844139:-900.000000
+-860.939074:-21.844139:-900.000000
+PORT
+idDir:"1"
+FIN_BOX
+BOX
+std:ConcatStrings:Box06
+ISEXEC:FALSE
+-578.642500:-95.299663:-900.000000
+-538.917500:-105.299663:-900.000000
+PORT
+In10:" "
+PORT
+In2:" "
+PORT
+In4:" "
+PORT
+In6:" "
+PORT
+In8:" "
+FIN_BOX
+BOX
+std:ConcatStrings:Box07
+ISEXEC:FALSE
+-379.672231:-130.515916:-900.000000
+-339.947231:-140.515916:-900.000000
+PORT
+In10:" "
+PORT
+In3:" "
+PORT
+In5:" "
+PORT
+In7:" "
+PORT
+In9:" "
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box09
+ISEXEC:FALSE
+-857.352025:-11.053807:-900.000000
+-813.902025:-21.053807:-900.000000
+PORT
+idDir:"2"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box11
+ISEXEC:FALSE
+-809.641036:-10.188896:-900.000000
+-766.191036:-20.188896:-900.000000
+PORT
+idDir:"3"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box12
+ISEXEC:FALSE
+-751.374640:-10.240842:-900.000000
+-707.924640:-20.240842:-900.000000
+PORT
+idDir:"4"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box13
+ISEXEC:FALSE
+-696.533498:-8.521817:-900.000000
+-653.083498:-18.521817:-900.000000
+PORT
+idDir:"5"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box14
+ISEXEC:FALSE
+-645.364774:-7.348775:-900.000000
+-601.914774:-17.348775:-900.000000
+PORT
+idDir:"6"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box15
+ISEXEC:FALSE
+-589.672506:-5.439898:-900.000000
+-546.222506:-15.439898:-900.000000
+PORT
+idDir:"7"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box16
+ISEXEC:FALSE
+-537.084637:-3.207460:-900.000000
+-493.634637:-13.207460:-900.000000
+PORT
+idDir:"8"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box17
+ISEXEC:FALSE
+-476.106578:-7.697690:-900.000000
+-432.656578:-17.697690:-900.000000
+PORT
+idDir:"9"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box18
+ISEXEC:FALSE
+-428.555625:-9.033745:-900.000000
+-385.105625:-19.033745:-900.000000
+PORT
+idDir:"10"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box19
+ISEXEC:FALSE
+-381.518577:-8.243412:-900.000000
+-338.068577:-18.243412:-900.000000
+PORT
+idDir:"11"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box20
+ISEXEC:FALSE
+-333.807587:-7.378501:-900.000000
+-290.357587:-17.378501:-900.000000
+PORT
+idDir:"12"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box21
+ISEXEC:FALSE
+-221.615538:-4.216335:-900.000000
+-178.165538:-14.216335:-900.000000
+PORT
+idDir:"14"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box22
+ISEXEC:FALSE
+-271.706735:-3.925805:-900.000000
+-228.256735:-13.925805:-900.000000
+PORT
+idDir:"13"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box23
+ISEXEC:FALSE
+-169.531325:-4.538380:-900.000000
+-126.081325:-14.538380:-900.000000
+PORT
+idDir:"15"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box24
+ISEXEC:FALSE
+-112.650730:3.122007:-900.000000
+-69.200730:-6.877993:-900.000000
+PORT
+idDir:"16"
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box25
+ISEXEC:FALSE
+-62.448267:4.245541:-900.000000
+-18.998267:-5.754459:-900.000000
+PORT
+idDir:"17"
+FIN_BOX
+BOX
+std:ConcatStrings:Box26
+ISEXEC:FALSE
+-252.521011:-157.121798:-900.000000
+-212.796011:-167.121798:-900.000000
+PORT
+In10:" "
+PORT
+In3:" "
+PORT
+In5:" "
+PORT
+In7:" "
+PORT
+In9:" "
+FIN_BOX
+BOX
+gdcmvtk:DicomSerieInfoDir:Box27
+ISEXEC:FALSE
+-10.137281:3.328842:-900.000000
+33.312719:-6.671158:-900.000000
+PORT
+idDir:"17"
+FIN_BOX
+BOX
+std:ConcatStrings:Box28
+ISEXEC:FALSE
+-179.215105:-180.086181:-900.000000
+-139.490105:-190.086181:-900.000000
+PORT
+In10:" "
+PORT
+In3:" "
+PORT
+In5:" "
+PORT
+In7:" "
+PORT
+In9:" "
+FIN_BOX
+CONNECTIONS:64
+CONNECTION
+Box01:OutSimple:Box00:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box00:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box04:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box04:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box04:OutString:Box03:In3
+NumberOfControlPoints:0
+CONNECTION
+Box00:OutString:Box03:In1
+NumberOfControlPoints:0
+CONNECTION
+Box03:Out:Box06:In1
+NumberOfControlPoints:0
+CONNECTION
+Box06:Out:Box07:In1
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box09:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box09:OutString:Box03:In5
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box09:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box11:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box11:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box12:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box12:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box13:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box13:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box11:OutString:Box03:In7
+NumberOfControlPoints:0
+CONNECTION
+Box12:OutString:Box03:In9
+NumberOfControlPoints:0
+CONNECTION
+Box13:OutString:Box06:In3
+NumberOfControlPoints:0
+CONNECTION
+Box14:OutString:Box06:In5
+NumberOfControlPoints:0
+CONNECTION
+Box15:OutString:Box06:In7
+NumberOfControlPoints:0
+CONNECTION
+Box16:OutString:Box06:In9
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box14:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box14:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box15:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box15:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box16:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box16:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box17:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box17:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box18:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box18:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box19:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box19:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box20:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box20:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box22:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box22:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box21:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box21:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box23:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box23:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box24:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box24:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box25:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box25:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box17:OutString:Box07:In2
+NumberOfControlPoints:0
+CONNECTION
+Box18:OutString:Box07:In4
+NumberOfControlPoints:0
+CONNECTION
+Box19:OutString:Box07:In6
+NumberOfControlPoints:0
+CONNECTION
+Box20:OutString:Box07:In8
+NumberOfControlPoints:0
+CONNECTION
+Box22:OutString:Box07:In10
+NumberOfControlPoints:0
+CONNECTION
+Box07:Out:Box26:In1
+NumberOfControlPoints:0
+CONNECTION
+Box21:OutString:Box26:In2
+NumberOfControlPoints:0
+CONNECTION
+Box23:OutString:Box26:In4
+NumberOfControlPoints:0
+CONNECTION
+Box24:OutString:Box26:In6
+NumberOfControlPoints:0
+CONNECTION
+Box25:OutString:Box26:In8
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box27:LstPaths
+NumberOfControlPoints:0
+CONNECTION
+Box01:OutSimple:Box27:LstSimpleDirName
+NumberOfControlPoints:0
+CONNECTION
+Box26:Out:Box28:In1
+NumberOfControlPoints:0
+CONNECTION
+Box27:OutString:Box28:In2
+NumberOfControlPoints:0
+CONNECTION
+DirName:DirName:Box01:In
+NumberOfControlPoints:0
+CONNECTION
+Box28:Out:lst:lst
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:lstPath:lstPath
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+# - /home/davila/Creatis/C8/creatools_source/bbtk/packages/gdcmvtk/bbs/boxes/LstDicomSerieInfoDir.bbs
+# ----------------------------------
+
+include std
+include itkvtk
+include gdcmvtk
+include std
+
+define LstDicomSerieInfoDir gdcmvtk
+
+author "Author ??"
+description "Description ??"
+
+category "<VOID>"
+
+new gdcmvtk:DicomSerieInfoDir Box00
+ set Box00.idDir "0"
+
+new std:FilesFromDirectory Box01
+ set Box01.In "/home/davila/CreatisWorks/tmpMonica/SegCal/Benoit-Test-Dicom"
+ set Box01.Recursive "true"
+ set Box01.Type "2"
+
+new std:ConcatStrings Box03
+ set Box03.In10 " "
+ set Box03.In2 " "
+ set Box03.In4 " "
+ set Box03.In6 " "
+ set Box03.In8 " "
+
+new gdcmvtk:DicomSerieInfoDir Box04
+ set Box04.idDir "1"
+
+new std:ConcatStrings Box06
+ set Box06.In10 " "
+ set Box06.In2 " "
+ set Box06.In4 " "
+ set Box06.In6 " "
+ set Box06.In8 " "
+
+new std:ConcatStrings Box07
+ set Box07.In10 " "
+ set Box07.In3 " "
+ set Box07.In5 " "
+ set Box07.In7 " "
+ set Box07.In9 " "
+
+new gdcmvtk:DicomSerieInfoDir Box09
+ set Box09.idDir "2"
+
+new gdcmvtk:DicomSerieInfoDir Box11
+ set Box11.idDir "3"
+
+new gdcmvtk:DicomSerieInfoDir Box12
+ set Box12.idDir "4"
+
+new gdcmvtk:DicomSerieInfoDir Box13
+ set Box13.idDir "5"
+
+new gdcmvtk:DicomSerieInfoDir Box14
+ set Box14.idDir "6"
+
+new gdcmvtk:DicomSerieInfoDir Box15
+ set Box15.idDir "7"
+
+new gdcmvtk:DicomSerieInfoDir Box16
+ set Box16.idDir "8"
+
+new gdcmvtk:DicomSerieInfoDir Box17
+ set Box17.idDir "9"
+
+new gdcmvtk:DicomSerieInfoDir Box18
+ set Box18.idDir "10"
+
+new gdcmvtk:DicomSerieInfoDir Box19
+ set Box19.idDir "11"
+
+new gdcmvtk:DicomSerieInfoDir Box20
+ set Box20.idDir "12"
+
+new gdcmvtk:DicomSerieInfoDir Box21
+ set Box21.idDir "14"
+
+new gdcmvtk:DicomSerieInfoDir Box22
+ set Box22.idDir "13"
+
+new gdcmvtk:DicomSerieInfoDir Box23
+ set Box23.idDir "15"
+
+new gdcmvtk:DicomSerieInfoDir Box24
+ set Box24.idDir "16"
+
+new gdcmvtk:DicomSerieInfoDir Box25
+ set Box25.idDir "17"
+
+new std:ConcatStrings Box26
+ set Box26.In10 " "
+ set Box26.In3 " "
+ set Box26.In5 " "
+ set Box26.In7 " "
+ set Box26.In9 " "
+
+new gdcmvtk:DicomSerieInfoDir Box27
+ set Box27.idDir "17"
+
+new std:ConcatStrings Box28
+ set Box28.In10 " "
+ set Box28.In3 " "
+ set Box28.In5 " "
+ set Box28.In7 " "
+ set Box28.In9 " "
+
+
+connect Box01.OutSimple Box00.LstSimpleDirName
+connect Box01.Out Box00.LstPaths
+connect Box01.OutSimple Box04.LstSimpleDirName
+connect Box01.Out Box04.LstPaths
+connect Box04.OutString Box03.In3
+connect Box00.OutString Box03.In1
+connect Box03.Out Box06.In1
+connect Box06.Out Box07.In1
+connect Box01.OutSimple Box09.LstSimpleDirName
+connect Box09.OutString Box03.In5
+connect Box01.Out Box09.LstPaths
+connect Box01.Out Box11.LstPaths
+connect Box01.OutSimple Box11.LstSimpleDirName
+connect Box01.Out Box12.LstPaths
+connect Box01.OutSimple Box12.LstSimpleDirName
+connect Box01.Out Box13.LstPaths
+connect Box01.OutSimple Box13.LstSimpleDirName
+connect Box11.OutString Box03.In7
+connect Box12.OutString Box03.In9
+connect Box13.OutString Box06.In3
+connect Box14.OutString Box06.In5
+connect Box15.OutString Box06.In7
+connect Box16.OutString Box06.In9
+connect Box01.Out Box14.LstPaths
+connect Box01.OutSimple Box14.LstSimpleDirName
+connect Box01.Out Box15.LstPaths
+connect Box01.OutSimple Box15.LstSimpleDirName
+connect Box01.Out Box16.LstPaths
+connect Box01.OutSimple Box16.LstSimpleDirName
+connect Box01.Out Box17.LstPaths
+connect Box01.OutSimple Box17.LstSimpleDirName
+connect Box01.Out Box18.LstPaths
+connect Box01.OutSimple Box18.LstSimpleDirName
+connect Box01.Out Box19.LstPaths
+connect Box01.OutSimple Box19.LstSimpleDirName
+connect Box01.Out Box20.LstPaths
+connect Box01.OutSimple Box20.LstSimpleDirName
+connect Box01.Out Box22.LstPaths
+connect Box01.OutSimple Box22.LstSimpleDirName
+connect Box01.Out Box21.LstPaths
+connect Box01.OutSimple Box21.LstSimpleDirName
+connect Box01.Out Box23.LstPaths
+connect Box01.OutSimple Box23.LstSimpleDirName
+connect Box01.Out Box24.LstPaths
+connect Box01.OutSimple Box24.LstSimpleDirName
+connect Box01.Out Box25.LstPaths
+connect Box01.OutSimple Box25.LstSimpleDirName
+connect Box17.OutString Box07.In2
+connect Box18.OutString Box07.In4
+connect Box19.OutString Box07.In6
+connect Box20.OutString Box07.In8
+connect Box22.OutString Box07.In10
+connect Box07.Out Box26.In1
+connect Box21.OutString Box26.In2
+connect Box23.OutString Box26.In4
+connect Box24.OutString Box26.In6
+connect Box25.OutString Box26.In8
+connect Box01.Out Box27.LstPaths
+connect Box01.OutSimple Box27.LstSimpleDirName
+connect Box26.Out Box28.In1
+connect Box27.OutString Box28.In2
+
+# Complex input ports
+input DirName Box01.In " "
+
+# Complex output ports
+output lst Box28.Out " "
+output lstPath Box01.Out " "
+
+
+endefine
#if defined USE_GDCM
void GetXCoherentInfoGdcmReader::Process()
{
-
// Read the *first* image file (a SET of file names is given as input)
f = GDCM_NAME_SPACE::File::New();
} else {
f->SetFileName( "" );
} // if
-
+
bool res = f->Load();
if ( !res )
{
bbSetOutputOut( CreateDefaultImage() );
return;
} // if res
+
// Get info from the first image file
int i;
std::vector<double> v_iop;
// Add *all the files* to the SerieHelper
sh = GDCM_NAME_SPACE::SerieHelper::New();
std::vector<std::string> gii = bbGetInputIn();
-
+
for(std::vector<std::string>::iterator it = gii.begin();
it != gii.end();
++it)
sh->AddFileName(*it);
} //for vector
-
GDCM_NAME_SPACE::FileList::const_iterator it;
GDCM_NAME_SPACE::FileList *l;
// Should only contain one!
l = sh->GetFirstSingleSerieUIDFileSet();
+ if (l==NULL)
+ {
+ return;
+ }
+
double zspacing = 0.;
sh->OrderFileList(l); // this one should compute the *actual* Z Spacing!
zspacing = sh->GetZSpacing();
int iTag,sizeDicomTagsVector=bbGetInputDicomTags().size();
GDCM_NAME_SPACE::FileList::const_iterator iitt = l->begin();
//iitt ++;
+
for ( ; iitt != l->end(); ++iitt)
{
MapInfoDicom mapinfodicom;
-
for (iTag=0; iTag<sizeDicomTagsVector; iTag++)
{
key = bbGetInputDicomTags()[iTag];
} // for iitt
bbSetOutputDicomInfo( vectormapinfodicom );
- if (reader!=NULL)
- {
- reader->Delete();
- reader = NULL;
- }
- reader = vtkGdcmReader::New();
- //EED 21 mars 2012 FLIP probleme ..PLOP..
- reader->SetFlipY(false);
- //reader->SetFileName( bbGetInputIn().c_str() );
- reader->SetCoherentFileList(l);
- reader->Update();
- reader->GetOutput();
-
- bbSetOutputOut( reader->GetOutput() );
+ if (bbGetInputReadRaw()==true)
+ {
+ if (reader!=NULL)
+ {
+ reader->Delete();
+ reader = NULL;
+ }
+ reader = vtkGdcmReader::New();
+ //EED 21 mars 2012 FLIP probleme ..PLOP..
+ reader->SetFlipY(false);
+ //reader->SetFileName( bbGetInputIn().c_str() );
+ reader->SetCoherentFileList(l);
+ reader->Update();
+ reader->GetOutput();
+ bbSetOutputOut( reader->GetOutput() );
+ } // if bGetInputReadRaw
}
#endif
// endif USE_GDCM
#if defined USE_GDCM2
void GetXCoherentInfoGdcmReader::Process()
{
+ printf("GetXCoherentInfoGdcmReader %d files.\n", bbGetInputIn().size() );
// Read the *first* image file (a SET of file names is given as input)
gdcm::Reader *read = new gdcm::Reader();
reader->SetFileName( bbGetInputIn()[0].c_str() );
-
bool res = read->Read();
if ( !res )
{
return;
}
-
-
// Get info from the first image file
const gdcm::File &f = read->GetFile();
int i;
gdcm::Element<gdcm::VR::DS,gdcm::VM::VM6> iop;
iop.Read( ss );
for(i=0; i< 6; i++)
- {
+ {
v_iop.push_back((float)(iop[i]));
- }
+ }
bbSetOutputIOP(v_iop );
- std::vector<double> v_ipp;
+ std::vector<double> v_ipp;
const gdcm::DataElement &deIpp = f.GetDataSet().GetDataElement(gdcm::Tag((0x0020,0x0032)));
deIpp.GetValue().Print(ss);
gdcm::Element<gdcm::VR::DS,gdcm::VM::VM3> ipp;
ipp.Read( ss );
- for(i=0; i< 3; i++)
+ for(i=0; i< 3; i++)
{
v_ipp.push_back((float)(ipp[i]));
} // for 3
void GetXCoherentInfoGdcmReader::bbUserSetDefaultValues()
{
+ reader=NULL;
std::vector<std::string> init;
init.push_back("");
bbSetInputIn(init);
+ bbSetInputReadRaw(true);
//reader=NULL; /// \TODO fixme JPR
}
void GetXCoherentInfoGdcmReader::bbUserInitializeProcessing()
{
-
}
#if defined USE_GDCM
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_OUTPUT(Out , vtkImageData *);
BBTK_DECLARE_OUTPUT(IPP , std::vector<double>);
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_OUTPUT(GetXCoherentInfoGdcmReader,Out ,"Output image" , vtkImageData *,"");
BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP ,"Image Position (Patient)" , std::vector<double>,"");
void ExecSystemCommand::bbUserSetDefaultValues()
{
bbSetInputIn("help");
+ bbSetInputVerbose(true);
}
+
void ExecSystemCommand::bbUserInitializeProcessing()
{
}
+
void ExecSystemCommand::bbUserFinalizeProcessing()
{
}
// #if defined(_WIN32)
// ccommand="start /b "+ccommand;
// #endif // defined(_WIN32)
- std::cout << "*** Executing system command : '"<<ccommand<<"'"<<std::endl;
-
+
+ if (bbGetInputVerbose()==true)
+ {
+ std::cout << "*** Executing system command : '"<<ccommand<<"'"<<std::endl;
+ }
result = system ( ccommand.c_str() );
//std::cout << "DFGO - ExecSystemCommand::DoProcess result=" << result << std::endl;
public:
BBTK_BLACK_BOX_INTERFACE(ExecSystemCommand,bbtk::AtomicBlackBox);
BBTK_DECLARE_INPUT(In,std::string)
+ BBTK_DECLARE_INPUT(Verbose,bool)
BBTK_DECLARE_OUTPUT(Return,int);
BBTK_PROCESS(DoProcess);
void DoProcess();
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ExecSystemCommand,bbtk::AtomicBlackBox);
- BBTK_NAME("ExecSystemCommand");
- BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
- BBTK_DESCRIPTION("Executes system (O.S.) commands");
- BBTK_INPUT(ExecSystemCommand,In,"system (O.S.) commands separated by ';' , use '' to indicate strings ex. help 'graph' ",std::string,"");
- BBTK_OUTPUT(ExecSystemCommand,Return,"result (0 if no error or error number of the first error",int,"");
+ BBTK_NAME("ExecSystemCommand");
+ BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
+ BBTK_DESCRIPTION("Executes system (O.S.) commands");
+ BBTK_INPUT(ExecSystemCommand,In,"system (O.S.) commands separated by ';' , use '' to indicate strings ex. help 'graph' ",std::string,"");
+ BBTK_INPUT(ExecSystemCommand,Verbose,"(true default) true with console message / false NO console message",bool,"");
+ BBTK_OUTPUT(ExecSystemCommand,Return,"result (0 if no error or error number of the first error",int,"");
BBTK_END_DESCRIBE_BLACK_BOX(ExecSystemCommand);
} // EO namespace bbstd
//=====
#include "bbstdExit.h"
#include "bbstdPackage.h"
+
namespace bbstd
{
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+#if defined(_WIN32)
+ int pid=getpid();
+ char tmp[256];
+ sprintf(tmp,"taskkill /pid %d /F", pid);
+ system(tmp);
+#elif defined(__GNUC__)
+ exit( bbGetInputIn() );
+#else
exit( bbGetInputIn() );
+#endif
+
}
//=====
// 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)
{
Filenames.clear();
SimpleFilenames.clear();
- DirName = bbGetInputIn();
- bool rec = bbGetInputRecursive();
- /*int nbFiles = */ Explore(DirName, rec);
- CleanFilenames( DirName );
+
+ if (bbGetInputActive()==true)
+ {
+ if (bbGetInputIn()!="")
+ {
+ DirName = bbGetInputIn();
+ /*int nbFiles = */ Explore(DirName, bbGetInputRecursive(), bbGetInputRecursiveLevel() );
+ CleanFilenames( DirName );
+ } // if In
+ } // Active
bbSetOutputOut(Filenames);
bbSetOutputOutSimple(SimpleFilenames);
}
void FilesFromDirectory::bbUserSetDefaultValues()
{
+ bbSetInputActive(true);
bbSetInputIn(".");
bbSetInputRecursive(false);
bbSetInputType(0);
+ bbSetInputRecursiveLevel(999);
}
void FilesFromDirectory::bbUserInitializeProcessing()
-int FilesFromDirectory::Explore(std::string const &dirpath, bool recursive)
+int FilesFromDirectory::Explore(std::string const &dirpath, bool recursive, int recursiveLevel)
{
- int numberOfFiles = 0;
- std::string dirName = NormalizePath(dirpath);
- int tmpNumberOfFiles;
+ int numberOfFiles = 0;
+
+if (recursiveLevel>=0){
+
+ std::string dirName = NormalizePath(dirpath);
+ int tmpNumberOfFiles;
std::string fileName;
#ifdef _MSC_VER
WIN32_FIND_DATA fileData;
numberOfFiles++;
} // Type ALL_directories
- tmpNumberOfFiles = Explore(dirName+fileName, recursive);
+ tmpNumberOfFiles = Explore(dirName+fileName, recursive,recursiveLevel-1);
if ((bbGetInputType()==2)&&tmpNumberOfFiles==0)
{
std::string temp = dirName+fileName;
numberOfFiles++;
} // Type All_directories
- tmpNumberOfFiles = Explore( fileName, recursive);
+ tmpNumberOfFiles = Explore( fileName, recursive, recursiveLevel-1);
if ((bbGetInputType()==2)&&tmpNumberOfFiles==0)
{
Filenames.push_back(fileName);
}// closedir
#endif
+} // if recursiveLevel
return numberOfFiles;
}
void FilesFromDirectory::CleanFilenames( std::string basePath )
{
std::string tmpString;
- int i,ii,sizeFilenames = Filenames.size();
- int j,sizeFileEnd = bbGetInputFileEnd().size();
-
+ int i,ii,sizeFilenames = Filenames.size();
+ int j,sizeFileEnd = bbGetInputFileEnd().size();
int okEraseElement;
-
+ int posStr;
//Selecting just the files in the FileEnd List
if (bbGetInputFileEnd().size()!=0)
{
for (i=sizeFilenames-1; i>=0; i--)
{
- okEraseElement=0;
+ okEraseElement = 0;
for (j=0; j<sizeFileEnd; j++)
{
- std::string tmp=Filenames[i].substr( (Filenames[i].length()) - (bbGetInputFileEnd()[j]).length() ) ;
- if (bbGetInputFileEnd()[j].compare( tmp )==0 )
+ posStr=(Filenames[i].length()) - (bbGetInputFileEnd()[j]).length();
+ if (posStr>=0)
{
- okEraseElement++;
- } // if FileEnd
+ std::string tmp=Filenames[i].substr( posStr ) ;
+ if (bbGetInputFileEnd()[j].compare( tmp )==0 )
+ {
+ okEraseElement++;
+ } // if FileEnd
+ }// if posStr
} // for j
if (okEraseElement==0)
}
} // for i
} // if FileEnd !=0
-
sizeFilenames = Filenames.size();
-
// Cleanning paths with spaces
for (i=0; i<sizeFilenames; i++)
{
tmpString=Filenames[i];
-
std::string::size_type spacePosition = tmpString.find_first_of(' ');
if (spacePosition != std::string::npos)
{
} // if spacePosition
}
-
// Alphabetical order
for (i=0; i<sizeFilenames; i++)
{
} // if
} // for ii
} // for i
-
// Creating SimpleFilenames
unsigned int lenghtBasePath = basePath.length();
for (i=0; i<sizeFilenames; i++)
{
SimpleFilenames.push_back( Filenames[i].substr( lenghtBasePath ) );
} // for i
-
}
public bbtk::AtomicBlackBox
{
BBTK_BLACK_BOX_INTERFACE(FilesFromDirectory,bbtk::AtomicBlackBox);
+ BBTK_DECLARE_INPUT(Active,bool);
BBTK_DECLARE_INPUT(In,std::string);
BBTK_DECLARE_INPUT(Recursive,bool);
+ BBTK_DECLARE_INPUT(RecursiveLevel,int);
BBTK_DECLARE_INPUT(Type,int);
BBTK_DECLARE_INPUT(FileEnd,std::vector<std::string>);
BBTK_DECLARE_OUTPUT(Out,std::vector<std::string>);
private :
std::string NormalizePath(std::string const &pathname);
- int Explore(std::string const &dirpath, bool recursive);
+ int Explore(std::string const &dirpath, bool recursive, int recursiveLevel);
void CleanFilenames( std::string basePath );
/// List of file names
BBTK_DESCRIPTION("returns the fullPathNames of the files in a Directory");
BBTK_CATEGORY("");
+ BBTK_INPUT(FilesFromDirectory,Active,"(default true) Active true/false ",bool,"");
BBTK_INPUT(FilesFromDirectory,In,"Directory Name",std::string,"");
- BBTK_INPUT(FilesFromDirectory,Recursive,"Recursive directory exploration",bool,"");
- BBTK_INPUT(FilesFromDirectory,Type,"0=files 1=All_directories 2=last_directories (0 default)",int,"");
+ BBTK_INPUT(FilesFromDirectory,Recursive,"(default false) Recursive directory exploration",bool,"");
+ BBTK_INPUT(FilesFromDirectory,Type,"(0 default) 0=files 1=All_directories 2=last_directories ",int,"");
+ BBTK_INPUT(FilesFromDirectory,RecursiveLevel,"(999 default) Recursive level",int,"");
BBTK_INPUT(FilesFromDirectory,FileEnd,"Select just the files with this end file name",std::vector<std::string>,"");
BBTK_OUTPUT(FilesFromDirectory,Out,"FullPathNames of the files",std::vector<std::string>,"");
--- /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 "bbstdFindOptimalParam.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,FindOptimalParam)
+BBTK_BLACK_BOX_IMPLEMENTATION(FindOptimalParam,bbtk::AtomicBlackBox);
+
+
+std::string FindOptimalParam::Replace(std::string strCommand, double value)
+{
+ std::string toReplace = std::to_string( value );
+ int pos = strCommand.find("XXvalueXX");
+ if (pos>=0)
+ {
+ strCommand.replace(pos,9,toReplace);
+ } // if pos
+ return strCommand;
+}
+
+int FindOptimalParam::Evaluate( double value )
+{
+ int result=-9999;
+ std::string strCommand = Replace( bbGetInputString(), value );
+ strCommand=strCommand+" NameFileTransfer="+bbGetInputTransferFile();
+ printf("EED FindOptimalParam::Evaluate command=%s\n", strCommand.c_str());
+ system( strCommand.c_str() );
+ FILE *ff = fopen( bbGetInputTransferFile().c_str() , "r");
+ if (ff!=NULL)
+ {
+ fscanf(ff,"%d",&result);
+ } else {
+ printf("EED Warnning!! FindOptimalParam::Evaluate TransferFile not set.\n");
+ }// ff
+ fclose(ff);
+ return result;
+}
+
+
+//=====
+// 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 FindOptimalParam::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() );
+ // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ double start = bbGetInputInitStart();
+ double end = bbGetInputInitEnd();
+ double actual;
+ int iter = 0;
+ int evalStart = 1;
+ int evalEnd = 0;
+ int evalActual;
+ do
+ {
+ iter++;
+ actual = (start+end)/2;
+ evalActual = Evaluate(actual);
+ if (evalActual==1)
+ {
+ start= actual;
+ } else if (evalActual==0) {
+ end = actual;
+ } else if (evalActual==-9999) {
+ printf("EED Warnning! FindOptimalParam::Process Transfer file Evaluation not coherent ..... \n");
+ break;
+ } else {
+ printf("EED Warnning! FindOptimalParam::Process Evaluation not coherent ..... \n");
+ break;
+ }
+ if (iter==10000)
+ {
+ printf("EED Warnning! FindOptimalParam::Process Out limit iteration ..... \n");
+ break;
+ }
+ printf("EED FindOptimalParam::Process %f \n",actual);
+ } while ( bbGetInputMinDifference() < (end-start) );
+ bbSetOutputResult(start);
+}
+//=====
+// 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 FindOptimalParam::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputInitStart(0);
+ bbSetInputInitEnd(100);
+ bbSetInputString("");
+ bbSetInputMinDifference(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 FindOptimalParam::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 FindOptimalParam::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 __bbstdFindOptimalParam_h_INCLUDED__
+#define __bbstdFindOptimalParam_h_INCLUDED__
+
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT FindOptimalParam
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(FindOptimalParam,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(InitStart,double);
+ BBTK_DECLARE_INPUT(InitEnd,double);
+ BBTK_DECLARE_INPUT(MinDifference,double);
+ BBTK_DECLARE_INPUT(String,std::string);
+ BBTK_DECLARE_INPUT(TransferFile,std::string);
+ BBTK_DECLARE_OUTPUT(Result,double);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ std::string Replace(std::string command, double value);
+ int Evaluate( double value );
+
+
+//=====
+// 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(FindOptimalParam,bbtk::AtomicBlackBox);
+ BBTK_NAME("FindOptimalParam");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(FindOptimalParam,InitStart,"Initial Start",double,"");
+ BBTK_INPUT(FindOptimalParam,InitEnd,"(defalut 100) Initial End ",double,"");
+ BBTK_INPUT(FindOptimalParam,MinDifference,"(default 1) Minimum (End-Start) to stop iteration ",double,"");
+ BBTK_INPUT(FindOptimalParam,String,"String script evaluation (use 'XXvalueXX' to be optimice)",std::string,"");
+ BBTK_INPUT(FindOptimalParam,TransferFile,"File to check the difference",std::string,"");
+
+ BBTK_OUTPUT(FindOptimalParam,Result,"Find optimal parameter",double,"");
+
+
+BBTK_END_DESCRIBE_BLACK_BOX(FindOptimalParam);
+//=====
+// 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 // __bbstdFindOptimalParam_h_INCLUDED__
+
BBTK_DESCRIPTION("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, "Input",int);
+ BBTK_TEMPLATE_INPUT(GetVectorElement, I, "iElement (default 0)",int);
BBTK_TEMPLATE_INPUT(GetVectorElement, ErrorValue, "ErrorValue",T);
BBTK_TEMPLATE_OUTPUT(GetVectorElement,Out,"Output",T);
BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorElement);
template <class T>
void GetVectorElement<T>::bbUserSetDefaultValues()
{
-
+ bbSetInputI(0);
}
//=================================================================
//=================================================================
--- /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 "bbstdMapToLst.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,MapToLst)
+BBTK_BLACK_BOX_IMPLEMENTATION(MapToLst,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 MapToLst::Process()
+{
+ printf("EED MapToLst::Process Start\n");
+// 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')
+
+ std::vector<std::string> lstTitles;
+ std::vector<std::string> lstValues;
+
+ for ( auto& element : bbGetInputInMap() )
+ {
+ lstTitles.push_back(element.first);
+ lstValues.push_back(element.second);
+ } // for
+
+ bbSetOutputLstTitles( lstTitles );
+ bbSetOutputLstValues( lstValues );
+
+ printf("EED MapToLst::Process End\n");
+
+}
+//=====
+// 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 MapToLst::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+// bbSetInputIn(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 MapToLst::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 MapToLst::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 __bbstdMapToLst_h_INCLUDED__
+#define __bbstdMapToLst_h_INCLUDED__
+
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+#include <vector>
+#include <map>
+typedef std::map <std::string, std::string> mapString;
+
+namespace bbstd
+{
+
+class bbstd_EXPORT MapToLst
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(MapToLst,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(InMap,mapString);
+ BBTK_DECLARE_OUTPUT(LstTitles,std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(LstValues,std::vector<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(MapToLst,bbtk::AtomicBlackBox);
+ BBTK_NAME("MapToLst");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(MapToLst,InMap,"Input map",mapString,"");
+ BBTK_OUTPUT(MapToLst,LstTitles,"List of map.first",std::vector<std::string>,"");
+ BBTK_OUTPUT(MapToLst,LstValues,"List of map.second",std::vector<std::string>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(MapToLst);
+//=====
+// 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 // __bbstdMapToLst_h_INCLUDED__
+
if (bbGetInputType()==17) bbSetOutputOut( std::max( bbGetInputIn1(),bbGetInputIn2() ) );
if (bbGetInputType()==18) bbSetOutputOut( fabs( bbGetInputIn1() ) );
if (bbGetInputType()==19) bbSetOutputOut( (int)bbGetInputIn1() % (int)bbGetInputIn2() );
+ if (bbGetInputType()==20) if (bbGetInputIn1()<(int)bbGetInputIn2()) { bbSetOutputOut(1); } else { bbSetOutputOut(0); } ;
+ if (bbGetInputType()==21) if (bbGetInputIn1()>(int)bbGetInputIn2()) { bbSetOutputOut(1); } else { bbSetOutputOut(0); } ;
+ if (bbGetInputType()==22) bbSetOutputOut( round( bbGetInputIn1() ) );
+ if (bbGetInputType()==23) bbSetOutputOut( rint( bbGetInputIn1() ) );
+ if (bbGetInputType()==24) bbSetOutputOut( floor( bbGetInputIn1() ) );
+ if (bbGetInputType()==25) bbSetOutputOut( ceil( bbGetInputIn1() ) );
+ if (bbGetInputType()==26) bbSetOutputOut( trunc( bbGetInputIn1() ) );
+ if (bbGetInputType()==30) if (bbGetInputIn1()==(int)bbGetInputIn2()) { bbSetOutputOut(1); } else { bbSetOutputOut(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)
BBTK_CATEGORY("empty");
BBTK_INPUT(MathOperation,In1,"First input",double,"");
BBTK_INPUT(MathOperation,In2,"Second input",double,"");
- BBTK_INPUT(MathOperation,Type,"Type (defalult 0): 0 adition (default), 1 sustraction In1-In2, 2 multiplication In1*In2, 3 divisiuon In1/In2, 4 sqrt In1, 5 log In1, 6 exp In1, 7 incremental int [In1..In2], 8 random int [In1..In2], 9 sin In1-rad, 10 cos In1-rad, 11 tan In1-rad, 12 asin In 1, 13 acos In1, 14 atan In1, 15 atan2 In1 In2 , 16 min, 17 max, 18 abs In1, 19 module In1%In2 ",int,"");
+ BBTK_INPUT(MathOperation,Type,"Type (defalult 0): 0 adition (default), 1 sustraction In1-In2, 2 multiplication In1*In2, 3 divisiuon In1/In2, 4 sqrt In1, 5 log In1, 6 exp In1, 7 incremental int [In1..In2], 8 random int [In1..In2], 9 sin In1-rad, 10 cos In1-rad, 11 tan In1-rad, 12 asin In 1, 13 acos In1, 14 atan In1, 15 atan2 In1 In2 , 16 min, 17 max, 18 abs In1, 19 module In1%In2 , 20 lessThan In1<In2, 21 greaterThan In1>In2, 22 round In1, 23 rint In1, 24 floor In1, 25 ceil In1, 26 trunc In1, 30 equal In1=In2",int,"");
BBTK_OUTPUT(MathOperation,Out,"Output",double,"");
BBTK_END_DESCRIBE_BLACK_BOX(MathOperation);
std::vector<double> *v8 = &_v8;
std::vector<double> *v9 = &_v9;
- double minTmp;
- double maxTmp;
+ double minTmp;
+ double maxTmp;
if (firsttime==true)
{
resultVec.push_back( (int)bbGetInputIn0()[i] % (int)bbGetInputIn1()[i] );
} // for i
bbSetOutputOut( resultVec );
- } // Type 18
+ } // Type 19
+
+ if (bbGetInputType()==20)
+ {
+ for (i=0;i<sizeVec;i++)
+ {
+ if (bbGetInputIn0()[i] < bbGetInputIn1()[i])
+ {
+ resultVec.push_back( 1 );
+ } else {
+ resultVec.push_back( 0 );
+ }
+ } // for i
+ bbSetOutputOut( resultVec );
+ } // Type 20
+
+ if (bbGetInputType()==21)
+ {
+ for (i=0;i<sizeVec;i++)
+ {
+ if (bbGetInputIn0()[i] > bbGetInputIn1()[i])
+ {
+ resultVec.push_back( 1 );
+ } else {
+ resultVec.push_back( 0 );
+ }
+ } // for i
+ bbSetOutputOut( resultVec );
+ } // Type 21
+
+
+ if (bbGetInputType()==22)
+ {
+ double resultX=0;
+ double resultY=0;
+ double resultZ=0;
+ double resultMassTotal=0;
+ for (i=0;i<sizeVec;i++)
+ {
+ resultX = resultX + g(v0,i,0)*g(v3,i,1);
+ resultY = resultY + g(v1,i,0)*g(v3,i,1);
+ resultZ = resultZ + g(v2,i,0)*g(v3,i,1);
+ resultMassTotal = resultMassTotal + g(v3,i,1);
+ } // for i
+ if (resultMassTotal!=0)
+ {
+ resultVec.push_back( resultX / resultMassTotal );
+ resultVec.push_back( resultY / resultMassTotal );
+ resultVec.push_back( resultZ / resultMassTotal );
+ } // if resultMassTotal
+ bbSetOutputOut( resultVec );
+ } // if Type 22
+
+
+ if (bbGetInputType()==23)
+ {
+ for (i=0;i<sizeVec;i++)
+ {
+ resultVec.push_back( round( bbGetInputIn0()[i] ) );
+ } // for i
+ bbSetOutputOut( resultVec );
+ } // Type 23
+
+ if (bbGetInputType()==24)
+ {
+ for (i=0;i<sizeVec;i++)
+ {
+ resultVec.push_back( rint( bbGetInputIn0()[i] ) );
+ } // for i
+ bbSetOutputOut( resultVec );
+ } // Type 24
+
+ if (bbGetInputType()==25)
+ {
+ for (i=0;i<sizeVec;i++)
+ {
+ resultVec.push_back( floor( bbGetInputIn0()[i] ) );
+ } // for i
+ bbSetOutputOut( resultVec );
+ } // Type 25
+
+ if (bbGetInputType()==26)
+ {
+ for (i=0;i<sizeVec;i++)
+ {
+ resultVec.push_back( ceil( bbGetInputIn0()[i] ) );
+ } // for i
+ bbSetOutputOut( resultVec );
+ } // Type 26
+
+ if (bbGetInputType()==27)
+ {
+ for (i=0;i<sizeVec;i++)
+ {
+ resultVec.push_back( trunc( bbGetInputIn0()[i] ) );
+ } // for i
+ bbSetOutputOut( resultVec );
+ } // Type 27
}
BBTK_INPUT(MathOperationVector,In7,"Input vector 7",std::vector<double>,"");
BBTK_INPUT(MathOperationVector,In8,"Input vector 8",std::vector<double>,"");
BBTK_INPUT(MathOperationVector,In9,"Input vector 9",std::vector<double>,"");
- BBTK_INPUT(MathOperationVector,Type,"Type (defalult 0): 0 adition (default) In0[i]+In1[i]+..+In9[i], -99 adition In0[i] In1[i] ... In[9], 1 sustraction In0[i]-In1[i]-..-In9[i], 2 multiplication In0[i]*In2[i]*...*In9[i], 3 division In0/In1/.../In9, 4 sqrt In1, 5 log10 In1, 6 exp In1, 7 incremental int [In0..In1], 8 random int [In0..In1], 9 (rad) sin In0, 10 (rad) cos In0, 11 tan (rad) In0, 12 asin In0, 13 acos In0, 14 atan In0, 15 atan2 In0 In1 , 16 min (In0[i],In1[i]..In9[i]), -16 min(In0) min(In1) ... min(In9) , 17 max (In0[i],In1[i]..In9[i]), -17 max(In0) max(In1) ... max(In9) , 18 abs In0 , 19 module In0[i]%In1[i] " ,int,"");
+ BBTK_INPUT(MathOperationVector,Type,"Type (defalult 0): 0 adition (default) In0[i]+In1[i]+..+In9[i], -99 adition In0[i] In1[i] ... In[9], 1 sustraction In0[i]-In1[i]-..-In9[i], 2 multiplication In0[i]*In2[i]*...*In9[i], 3 division In0/In1/.../In9, 4 sqrt In1, 5 log10 In1, 6 exp In1, 7 incremental int [In0..In1], 8 random int [In0..In1], 9 (rad) sin In0, 10 (rad) cos In0, 11 tan (rad) In0, 12 asin In0, 13 acos In0, 14 atan In0, 15 atan2 In0 In1 , 16 min (In0[i],In1[i]..In9[i]), -16 min(In0) min(In1) ... min(In9) , 17 max (In0[i],In1[i]..In9[i]), -17 max(In0) max(In1) ... max(In9) , 18 abs In0 , 19 module In0[i]%In1[i] , 20 lessThan In0[i]<In1[i], 21 greaterThan In0[i]>In1[i], 22 Centre of Mass In0=lstX In1=lstY In2=lstZ In3=lstValues, 23 round In0[i], 24 rint In0[i], 25 floor In0[i], 26 ceil In0[i], 27 trunc In0[i]" ,int,"");
BBTK_OUTPUT(MathOperationVector,Out,"Output vector",std::vector<double>,"");
--- /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 "bbstdReplaceCleanString.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ReplaceCleanString)
+BBTK_BLACK_BOX_IMPLEMENTATION(ReplaceCleanString,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 ReplaceCleanString::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() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ std::string subjectIn = bbGetInputIn();
+ if (bbGetInputSearch().length()!=0)
+ {
+ size_t pos = 0;
+ while((pos = subjectIn.find(bbGetInputSearch(), pos)) != std::string::npos)
+ {
+ subjectIn.replace(pos, bbGetInputSearch().length(), bbGetInputReplace());
+ pos += bbGetInputReplace().length();
+ } // while
+ }
+ bbSetOutputOut( subjectIn );
+}
+//=====
+// 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 ReplaceCleanString::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputReplace("");
+ bbSetInputSearch("");
+
+
+
+}
+//=====
+// 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 ReplaceCleanString::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 ReplaceCleanString::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 __bbstdReplaceCleanString_h_INCLUDED__
+#define __bbstdReplaceCleanString_h_INCLUDED__
+
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT ReplaceCleanString
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ReplaceCleanString,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(Replace,std::string);
+ BBTK_DECLARE_INPUT(Search,std::string);
+ 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(ReplaceCleanString,bbtk::AtomicBlackBox);
+ BBTK_NAME("ReplaceCleanString");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("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_INPUT(ReplaceCleanString,Search,"String to be replaced",std::string,"");
+ BBTK_OUTPUT(ReplaceCleanString,Out,"Output string",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ReplaceCleanString);
+//=====
+// 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 // __bbstdReplaceCleanString_h_INCLUDED__
+
for ( i=0 ; i<size ; i++ )
{
subjectInVec = bbGetInputIn()[i];
- size_t pos = 0;
- while((pos = subjectInVec.find(bbGetInputSearch(), pos)) != std::string::npos)
+ if (bbGetInputSearch().length()!=0)
{
- subjectInVec.replace(pos, bbGetInputSearch().length(), bbGetInputReplace());
- pos += bbGetInputReplace().length();
- } // while
+ size_t pos = 0;
+ while((pos = subjectInVec.find(bbGetInputSearch(), pos)) != std::string::npos)
+ {
+ subjectInVec.replace(pos, bbGetInputSearch().length(), bbGetInputReplace());
+ pos += bbGetInputReplace().length();
+ } // while
+ } // if
tmpLst.push_back( subjectInVec );
} // for
BBTK_DESCRIPTION("Sets the value of the i-element ("+bbtk::TypeName<std::vector<T> >());
typedef std::vector<T>* pTvector;
BBTK_TEMPLATE_INPUT(SetElementVector, PVec,"Pointer to Vector",pTvector);
- BBTK_TEMPLATE_INPUT(SetElementVector, I, "id-element",int);
+ BBTK_TEMPLATE_INPUT(SetElementVector, I, "id-element (default 0)",int);
BBTK_TEMPLATE_INPUT(SetElementVector, Value, "Input Value",T);
BBTK_TEMPLATE_OUTPUT(SetElementVector,Vec,"Output Vector",std::vector<T>);
BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(SetElementVector);
template <class T>
void SetElementVector<T>::bbUserSetDefaultValues()
{
-
+ bbSetInputI(0);
}
//=================================================================
//=================================================================
--- /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 "bbstdSpin.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,Spin)
+BBTK_BLACK_BOX_IMPLEMENTATION(Spin,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 Spin::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() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+
+ count = count+bbGetInputStep();
+ if (bbGetInputLoop()==true)
+ {
+ if (count>bbGetInputEnd())
+ {
+ count = bbGetInputStart();
+ } // if count
+ }else{
+ if (count>bbGetInputEnd())
+ {
+ count = bbGetInputEnd();
+ } // if count
+ } // if Loop
+
+ if (count<bbGetInputStart())
+ {
+ count = bbGetInputStart();
+ }
+ bbSetOutputOut(count);
+
+}
+//=====
+// 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 Spin::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ count = 0;
+ bbSetInputLoop(true);
+ bbSetInputStep(1);
+ bbSetInputStart(0);
+ bbSetInputEnd(100);
+ bbSetInputEnd(100);
+
+}
+//=====
+// 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 Spin::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 Spin::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 __bbstdSpin_h_INCLUDED__
+#define __bbstdSpin_h_INCLUDED__
+
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT Spin
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(Spin,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,double);
+ BBTK_DECLARE_INPUT(Loop,bool);
+ BBTK_DECLARE_INPUT(Step,double);
+ BBTK_DECLARE_INPUT(Start,double);
+ BBTK_DECLARE_INPUT(End,double);
+ BBTK_DECLARE_OUTPUT(Out,double);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ double count;
+//=====
+// 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(Spin,bbtk::AtomicBlackBox);
+ BBTK_NAME("Spin");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("Automatic counter");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(Spin,Loop,"(default true) true/false",bool,"");
+ BBTK_INPUT(Spin,Step,"(default 1) step in each BoxExecute",double,"");
+ BBTK_INPUT(Spin,Start,"(default 0) Start range",double,"");
+ BBTK_INPUT(Spin,End,"(default 100) End range",double,"");
+
+ BBTK_OUTPUT(Spin,Out,"Internar count",double,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(Spin);
+//=====
+// 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 // __bbstdSpin_h_INCLUDED__
+
//====================================================================
template <class T> void ToString<T> ::DoIt()
{
- std::ostringstream s;
- s << bbGetInputIn();
- bbSetOutputOut( s.str() );
+// std::ostringstream s;
+// s << bbGetInputIn();
+// bbSetOutputOut( s.str() );
+ bbSetOutputOut( std::to_string( bbGetInputIn() ) );
}
//====================================================================
//=====
#include "bbstdVectorFilterDouble.h"
#include "bbstdPackage.h"
+#include "math.h"
+
namespace bbstd
{
if (bbGetInputType()==0) // Erase duplicate lines
{
- bool okSizeVec=true;
- int ipLstvec;
- for (ipLstvec=1;ipLstvec<pLstVec.size();ipLstvec++)
- {
- if ( (*pLstVec[ipLstvec]).size()!=(*pLstVec[0]).size() ) { okSizeVec=false; }
- }
- if ( okSizeVec==false)
+ if (bbGetInputIn0().size()!=0) // At least one element
{
- printf("EED VectorFilterDouble::Process WARNING! vectors are not of the same size.\n");
- } else {
- int iLine;
- int ipLstvec2;
- bool okLine;
- for (iLine=0 ; iLine < (*pLstVec[0]).size() ; iLine++ )
+ bool okSizeVec=true;
+ int ipLstvec;
+ for (ipLstvec=1;ipLstvec<pLstVec.size();ipLstvec++)
{
- okLine=false;
- for ( ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
- {
- if ( (*pLstVec[ipLstvec2])[iLine]!=(*pLstVec[ipLstvec2])[iLine-1] ) { okLine=true; }
- } // for ipLstVec2
-
- if ( (okLine==true) || (iLine==0) )
+ if ( (*pLstVec[ipLstvec]).size()!=(*pLstVec[0]).size() ) { okSizeVec=false; }
+ }
+ if ( okSizeVec==false)
+ {
+ printf("EED VectorFilterDouble::Process WARNING! vectors are not of the same size.\n");
+ } else {
+ int iLine;
+ int ipLstvec2;
+ bool okLine;
+ for (iLine=0 ; iLine < (*pLstVec[0]).size() ; iLine++ )
{
- for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+ okLine=false;
+ for ( ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+ {
+ if ( (*pLstVec[ipLstvec2])[iLine]!=(*pLstVec[ipLstvec2])[iLine-1] ) { okLine=true; }
+ } // for ipLstVec2
+
+ if ( (okLine==true) || (iLine==0) )
{
- (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[iLine] );
- } // for
- } // if okLine
- } // for iLine
- } // if okSizeVec
+ for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+ {
+ (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[iLine] );
+ } // for
+ } // if okLine
+ } // for iLine
+ } // if okSizeVec
+ } // bbGetInputIn0() size
} // Type==0
int ipLstvec2;
double iLine;
int sizeLines = (*pLstVec[0]).size();
- double step = (double)sizeLines/(double)bbGetInputk1();
+ double step = (double)sizeLines/((double)bbGetInputk1()-1);
for (iLine=0 ; iLine<sizeLines ; iLine=iLine+step)
{
for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
(*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[(int)iLine] );
} // for
} // for ipLstVec
+
+ // adding the lastone
+ for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+ {
+ (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[(int)(sizeLines-1)] );
+ } // for
+
} // Type==1
if (bbGetInputType()==2) // Insert intermediate points
} // for pLstVec
} // Type==5
- if (bbGetInputType()==6) // Division k1
+ if (bbGetInputType()==6) // Division k1ng gadget (node check, owner GtkCheckButton)
+
+
{
int ipLstvec;
int i;
} // for pLstVec
} // Type==6
+
+
+ if (bbGetInputType()==7)
+ {
+ int i,j;
+ for (j=0;j<In4.size(); j++)
+ {
+ Out0.push_back( In4[j] );
+ Out1.push_back( In5[j] );
+ Out2.push_back( In6[j] );
+ } //
+
+
+ int iGeneral=0,sizeI,sizeLst1Indexes=In3.size();
+ for (i=0; i<sizeLst1Indexes-1;i++) { iGeneral=iGeneral+In3[i]; }
+ sizeI=iGeneral+In3[ sizeLst1Indexes-1 ];
+
+ int jGeneral = 0;
+ int sizeJ = In7[ 0 ];
+
+ double dist2,dist2Min,dx,dy,dz;
+ int iBack;
+
+ for (j=jGeneral;j<sizeJ;j++)
+ {
+ dist2Min=1000000;
+ for (i=iGeneral;i<sizeI;i++)
+ {
+ dx = In0[i]-In4[j];
+ dy = In1[i]-In5[j];
+ dz = In2[i]-In6[j];
+ dist2 = dx*dx + dy*dy + dz*dz;
+ if (dist2<dist2Min)
+ {
+ dist2Min=dist2;
+ iBack=i;
+ } // if
+ } // for j
+ Out0[j]=In0[iBack];
+ Out1[j]=In1[iBack];
+ Out2[j]=In2[iBack];
+ } // for i
+
+
+ } // Type 7
+
+
+
+ if (bbGetInputType()==8) // order all vectors using as base the vector In0
+ {
+ double tmp;
+ int i,j,ii,sizeII;
+ sizeII=pLstVec.size();
+
+
+ int size=In0.size();
+ for (i=0;i<size; i++)
+ {
+ for (ii=0;ii<sizeII;ii++)
+ {
+ (*pLstVecOut[ii]).push_back( (*pLstVec[ii])[i] );
+ } // for ii
+ } // i
+ for (i=0;i<size;i++)
+ {
+ for (j=i;j<size;j++)
+ {
+ if ((*pLstVecOut[0])[j] <= (*pLstVecOut[0])[i] )
+ {
+
+ for (ii=0;ii<sizeII;ii++)
+ {
+ tmp = (*pLstVecOut[ii])[i];
+ (*pLstVecOut[ii])[i] = (*pLstVecOut[ii])[j];
+ (*pLstVecOut[ii])[j] = tmp;
+ } // for ii
+ } // if <
+ } // for j
+ } // for i
+ } // Type 8
+
+
+ if (bbGetInputType()==9) // Invert vectors
+ {
+ double tmp;
+ int i,j,ii,sizeII;
+ sizeII=pLstVec.size();
+
+ int size=In0.size();
+ int size2=size/2;
+ for (i=0;i<size; i++)
+ {
+ for (ii=0;ii<sizeII;ii++)
+ {
+ (*pLstVecOut[ii]).push_back( (*pLstVec[ii])[i] );
+ } // for ii
+ } // i
+
+ for (i=0;i<size2;i++)
+ {
+ for (ii=0;ii<sizeII;ii++)
+ {
+ j=size-1-i;
+ tmp = (*pLstVecOut[ii])[i];
+ (*pLstVecOut[ii])[i] = (*pLstVecOut[ii])[ j ];
+ (*pLstVecOut[ii])[j] = tmp;
+ } // for ii
+ } // for i
+ } // Type 9
+
+
+ if (bbGetInputType()==10) // Nearest point in vector
+ {
+ int sizeLstX = In0.size(); // lstX
+ int sizeLstY = In1.size(); // lstY
+ int sizeLstZ = In2.size(); // lstZ
+ if ( (sizeLstX==sizeLstY) && (sizeLstY==sizeLstZ) && (sizeLstX>0) && (In3.size()==3) )
+ {
+ int i;
+ double x1 = In3[0]; // pointX of pointXYZ
+ double y1 = In3[1]; // pointY of pointXYZ
+ double z1 = In3[2]; // pointZ of pointXYZ
+ double distMin = 100000;
+ double dist;
+ double x2;
+ double y2;
+ double z2;
+ Out0.push_back( -1 );
+ Out1.push_back( -999 );
+ Out1.push_back( -999 );
+ Out1.push_back( -999 );
+ for (i=0;i<sizeLstX; i++)
+ {
+ x2 = In0[i]; // lstX
+ y2 = In1[i]; // lstY
+ z2 = In2[i]; // lstZ
+ dist = sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2) );
+ if (dist<distMin)
+ {
+ distMin = dist;
+ Out0[0] = i;
+ Out1[0] = x2;
+ Out1[1] = y2;
+ Out1[2] = z2;
+ }
+ } // for i
+ } else {
+ printf("EED Warnning VectorFilterDouble::Process() For Type 10 the size of the vectors are not coherent.\n");
+ }// if size
+ } // Type 10
+
+
+
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, 4=Substraction, 5=Multilication, 6=Division ",int,"");
+ BBTK_INPUT(VectorFilterDouble,Type,"default (0) 0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition, 4=Substraction, 5=Multilication, 6=Division, 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)",int,"");
BBTK_INPUT(VectorFilterDouble,k1,"default (0) nothing (Type0), k1=new size vectors (Type 1) , nothing (Type2), k1 = Addition const. (Type 3), k1 = Substraction const. (Type 4), k1 = Multiplication const. (Type 5) , k1 = Division const. (Type 6) , ",double,"");
BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector<double>,"");
BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector<double>,"");
--- /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 "bbstdVectorFilterString.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,VectorFilterString)
+BBTK_BLACK_BOX_IMPLEMENTATION(VectorFilterString,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 VectorFilterString::ConnectionRepetitions( std::vector<std::string> vIn,std::vector<std::string> *vOut )
+{
+ int i,size=vIn.size();
+ int itmp=0, acum=0;
+ std::string stmp;
+ for( i=0;i<size;i++)
+ {
+ if (vIn[i].compare( vIn[itmp])==0)
+ {
+ acum++;
+ } else {
+ itmp=i;
+ vOut->push_back(std::to_string(acum));
+ acum=1;
+ }
+ } // for
+ vOut->push_back(std::to_string(acum));
+}
+
+void VectorFilterString::FilterByFindinIn0()
+{
+ std::vector<std::string> vOut0;
+ std::vector<std::string> vOut1;
+ std::vector<std::string> vOut2;
+ std::vector<std::string> vOut3;
+ std::vector<std::string> vOut4;
+ std::vector<std::string> vOut5;
+ std::vector<std::string> vOut6;
+ std::vector<std::string> vOut7;
+ std::vector<std::string> vOut8;
+ std::vector<std::string> vOut9;
+
+ int i,size = bbGetInputIn0().size();
+ int pos;
+ for (i=0; i<size; i++)
+ {
+ pos=bbGetInputIn0()[i].find( bbGetInputsk1());
+ if ( pos >= 0)
+ {
+ vOut0.push_back( bbGetInputIn0()[i] );
+ if ( i < bbGetInputIn1().size() ) { vOut1.push_back( bbGetInputIn1()[i] ); }
+ if ( i < bbGetInputIn2().size() ) { vOut2.push_back( bbGetInputIn2()[i] ); }
+ if ( i < bbGetInputIn3().size() ) { vOut3.push_back( bbGetInputIn3()[i] ); }
+ if ( i < bbGetInputIn4().size() ) { vOut4.push_back( bbGetInputIn4()[i] ); }
+ if ( i < bbGetInputIn5().size() ) { vOut5.push_back( bbGetInputIn5()[i] ); }
+ if ( i < bbGetInputIn6().size() ) { vOut6.push_back( bbGetInputIn6()[i] ); }
+ if ( i < bbGetInputIn7().size() ) { vOut7.push_back( bbGetInputIn7()[i] ); }
+ if ( i < bbGetInputIn8().size() ) { vOut8.push_back( bbGetInputIn8()[i] ); }
+ if ( i < bbGetInputIn9().size() ) { vOut9.push_back( bbGetInputIn9()[i] ); }
+ } // if pos
+ } // for i
+
+ bbSetOutputOut0( vOut0 );
+ bbSetOutputOut1( vOut1 );
+ bbSetOutputOut2( vOut2 );
+ bbSetOutputOut3( vOut3 );
+ bbSetOutputOut4( vOut4 );
+ bbSetOutputOut5( vOut5 );
+ bbSetOutputOut6( vOut6 );
+ bbSetOutputOut7( vOut7 );
+ bbSetOutputOut8( vOut8 );
+ bbSetOutputOut9( vOut9 );
+
+}
+
+
+void VectorFilterString::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() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ if (bbGetInputType()==0)
+ {
+ std::vector<std::string> vOut0;
+ std::vector<std::string> vOut1;
+ std::vector<std::string> vOut2;
+ std::vector<std::string> vOut3;
+ std::vector<std::string> vOut4;
+ std::vector<std::string> vOut5;
+ std::vector<std::string> vOut6;
+ std::vector<std::string> vOut7;
+ std::vector<std::string> vOut8;
+ std::vector<std::string> vOut9;
+ ConnectionRepetitions( bbGetInputIn0() , &vOut0 );
+ ConnectionRepetitions( bbGetInputIn1() , &vOut1 );
+ ConnectionRepetitions( bbGetInputIn2() , &vOut2 );
+ ConnectionRepetitions( bbGetInputIn3() , &vOut3 );
+ ConnectionRepetitions( bbGetInputIn4() , &vOut4 );
+ ConnectionRepetitions( bbGetInputIn5() , &vOut5 );
+ ConnectionRepetitions( bbGetInputIn6() , &vOut6 );
+ ConnectionRepetitions( bbGetInputIn7() , &vOut7 );
+ ConnectionRepetitions( bbGetInputIn8() , &vOut8 );
+ ConnectionRepetitions( bbGetInputIn9() , &vOut9 );
+ bbSetOutputOut0( vOut0 );
+ bbSetOutputOut1( vOut1 );
+ bbSetOutputOut2( vOut2 );
+ bbSetOutputOut3( vOut3 );
+ bbSetOutputOut4( vOut4 );
+ bbSetOutputOut5( vOut5 );
+ bbSetOutputOut6( vOut6 );
+ bbSetOutputOut7( vOut7 );
+ bbSetOutputOut8( vOut8 );
+ bbSetOutputOut9( vOut9 );
+ }
+
+
+ if (bbGetInputType()==2)
+ {
+ FilterByFindinIn0();
+ }
+
+}
+//=====
+// 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 VectorFilterString::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputType(0);
+ bbSetInputsk1("");
+ bbSetInputsk2("");
+}
+//=====
+// 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 VectorFilterString::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 VectorFilterString::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 __bbstdVectorFilterString_h_INCLUDED__
+#define __bbstdVectorFilterString_h_INCLUDED__
+
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT VectorFilterString
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(VectorFilterString,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(In0,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(In1,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(In2,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(In3,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(In4,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(In5,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(In6,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(In7,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(In8,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(In9,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Type,int);
+ BBTK_DECLARE_INPUT(sk1,std::string);
+ BBTK_DECLARE_INPUT(sk2,std::string);
+
+ BBTK_DECLARE_OUTPUT(Out0,std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(Out1,std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(Out2,std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(Out3,std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(Out4,std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(Out5,std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(Out6,std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(Out7,std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(Out8,std::vector<std::string>);
+ BBTK_DECLARE_OUTPUT(Out9,std::vector<std::string>);
+ BBTK_PROCESS(Process);
+ void Process();
+
+void ConnectionRepetitions( std::vector<std::string> vIn,std::vector<std::string> *vOut );
+void FilterByFindinIn0();
+
+
+//=====
+// 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(VectorFilterString,bbtk::AtomicBlackBox);
+ BBTK_NAME("VectorFilterString");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(VectorFilterString,In0,"Input vector",std::vector<std::string>,"");
+ BBTK_INPUT(VectorFilterString,In1,"Input vector",std::vector<std::string>,"");
+ BBTK_INPUT(VectorFilterString,In2,"Input vector",std::vector<std::string>,"");
+ BBTK_INPUT(VectorFilterString,In3,"Input vector",std::vector<std::string>,"");
+ BBTK_INPUT(VectorFilterString,In4,"Input vector",std::vector<std::string>,"");
+ BBTK_INPUT(VectorFilterString,In5,"Input vector",std::vector<std::string>,"");
+ BBTK_INPUT(VectorFilterString,In6,"Input vector",std::vector<std::string>,"");
+ BBTK_INPUT(VectorFilterString,In7,"Input vector",std::vector<std::string>,"");
+ BBTK_INPUT(VectorFilterString,In8,"Input vector",std::vector<std::string>,"");
+ BBTK_INPUT(VectorFilterString,In9,"Input vector",std::vector<std::string>,"");
+ BBTK_INPUT(VectorFilterString,Type,"(Default 0) 0:count connected repetitions, 1:CleaningPointsConnectTwoMesh sk1 criterium, 2: Select lines contain sk1 in In0 (the other intputs In1..In9 are afected)",int,"");
+ BBTK_INPUT(VectorFilterString,sk1,"constant 1",std::string,"");
+ BBTK_INPUT(VectorFilterString,sk2,"constant 2",std::string,"");
+
+ BBTK_OUTPUT(VectorFilterString,Out0,"First output",std::vector<std::string>,"");
+ BBTK_OUTPUT(VectorFilterString,Out1,"First output",std::vector<std::string>,"");
+ BBTK_OUTPUT(VectorFilterString,Out2,"First output",std::vector<std::string>,"");
+ BBTK_OUTPUT(VectorFilterString,Out3,"First output",std::vector<std::string>,"");
+ BBTK_OUTPUT(VectorFilterString,Out4,"First output",std::vector<std::string>,"");
+ BBTK_OUTPUT(VectorFilterString,Out5,"First output",std::vector<std::string>,"");
+ BBTK_OUTPUT(VectorFilterString,Out6,"First output",std::vector<std::string>,"");
+ BBTK_OUTPUT(VectorFilterString,Out7,"First output",std::vector<std::string>,"");
+ BBTK_OUTPUT(VectorFilterString,Out8,"First output",std::vector<std::string>,"");
+ BBTK_OUTPUT(VectorFilterString,Out9,"First output",std::vector<std::string>,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(VectorFilterString);
+//=====
+// 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 // __bbstdVectorFilterString_h_INCLUDED__
+
std::vector<std::string> headers = bbGetInputHeaders(); //Headers Input
bool onHeaders = bbGetInputOnHeaders();
std::vector<std::vector<std::string> > values;
- values.push_back(bbGetInputlstData1());
- values.push_back(bbGetInputlstData2());
- values.push_back(bbGetInputlstData3());
- values.push_back(bbGetInputlstData4());
- values.push_back(bbGetInputlstData5());
- values.push_back(bbGetInputlstData6());
- values.push_back(bbGetInputlstData7());
- values.push_back(bbGetInputlstData8());
- values.push_back(bbGetInputlstData9());
+ values.push_back( bbGetInputlstData1() );
+ values.push_back( bbGetInputlstData2() );
+ values.push_back( bbGetInputlstData3() );
+ values.push_back( bbGetInputlstData4() );
+ values.push_back( bbGetInputlstData5() );
+ values.push_back( bbGetInputlstData6() );
+ values.push_back( bbGetInputlstData7() );
+ values.push_back( bbGetInputlstData8() );
+ values.push_back( bbGetInputlstData9() );
std::vector<std::vector<std::string> >::iterator it;
+
+
+
for(it = values.begin() ; it != values.end() ; )
{
if((*it).empty())
}else
{
it++;
- }
- }
- if(write_fi.is_open())
- {
- if(onHeaders == true) // If onHeaders is true, the file is write with Headers.
+ } // if
+ } // for it
+
+
+ bool ok = true;
+ int i,size = values.size();
+ for ( i=0 ; i<size-1 ; i++ )
+ {
+ if ( values[i].size() != values[i+1].size() )
{
- //Add each header input write to file
- for(unsigned int i=0 ;i< headers.size(); i++ )
+ ok=false;
+ } // if
+ } // for
+
+
+ if (ok==true)
+ {
+ if(write_fi.is_open())
+ {
+ if(onHeaders == true) // If onHeaders is true, the file is write with Headers.
{
- if(i==(headers.size()-1))
+ //Add each header input write to file
+ for(unsigned int i=0 ;i< headers.size(); i++ )
{
- write_fi << headers[i] << "\n";
- }else{
- write_fi << headers[i] << "\t";
- }
-
- }//for headersSize
- }
- unsigned int colSize = values[0].size();
- for(unsigned int j=0;j<colSize;j++)
- {
- for(unsigned int i=0;i<values.size();i++)
+ if(i==(headers.size()-1))
+ {
+ write_fi << headers[i] << "\n";
+ }else{
+ write_fi << headers[i] << "\t";
+ } // if
+ }//for headersSize
+ }
+ unsigned int colSize = values[0].size();
+ for(unsigned int j=0 ; j<colSize ; j++)
{
- if(i==(values.size()-1))
+ for(unsigned int i=0;i<values.size();i++)
{
- write_fi << values[i][j] << "\n";
- }else{
- write_fi << values[i][j] << "\t";
- }
- }
- }
- }// if write_fi.is_open()
- else
- {
- std::cout<<"No es posible abrir"<<std::endl;
- }//else
+ if(i==(values.size()-1))
+ {
+ write_fi << values[i][j] << "\n";
+ }else{
+ write_fi << values[i][j] << "\t";
+ } // if
+ } // for
+ } // for
+ } else { // if write_fi.is_open()
+ std::cout<<"EED WriteColumnsString::Process Imposible to open file."<<std::endl;
+ }//if open
+
+ } else {
+ printf("EED WriteColumnsString::Process Warning! The size of the vectors are not equal. \n");
+ }// if ok
+
write_fi.close();
bbSetOutputOutFileName(bbGetInputFileName().c_str());
+
+
}
//=====
// 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)
// Here we initialize the input 'In' to 0
bbSetInputFileName("");
bbSetInputFileName("true");
-
}
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
// 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)
BBTK_BLACK_BOX_IMPLEMENTATION(BinaryOperations,bbtk::AtomicBlackBox);
void BinaryOperations::Process()
{
-
// THE MAIN PROCESSING METHOD BODY
// Here we simply set the input 'In' value to the output 'Out'
// And print out the output value
if (bbGetInputIn1() == NULL)
{
- std::cout << "Set In1 at least" << std::endl;
+ std::cout << "EED BinaryOperations::Process Set In1 at least" << std::endl;
return;
}
#endif
} else {
- std::cout << "Set In2" << std::endl;
+ std::cout << "EED BinaryOperations::Process Set In2" << std::endl;
return;
}
-
-
-
switch (bbGetInputOperation())
{
case 0:
return;
break;
}
-
ope->Modified();
ope->Update();
vtkImageData* salida = ope->GetOutput();
-
bbSetOutputOut(salida);
- bbSignalOutputModification();
-
+// bbSignalOutputModification();
}
// * TYPE is the C++ type of the input/output
// (the one provided in the attribute 'type' of the tag 'input')
- double spc[3];
+
int dim[3];
- int outputformat = VTK_UNSIGNED_SHORT;
-
- if (bbGetInputOutputFormat()=="VTK_BIT") outputformat = VTK_BIT; // 1
- else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR; // 2
- else if (bbGetInputOutputFormat()=="MET_CHAR") outputformat = VTK_CHAR; // 2
- else if (bbGetInputOutputFormat()=="VTK_SIGNED_CHAR") outputformat = VTK_SIGNED_CHAR; // 15
- else if (bbGetInputOutputFormat()=="MET_UCHAR") outputformat = VTK_UNSIGNED_CHAR; // 3
- else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_CHAR") outputformat = VTK_UNSIGNED_CHAR; // 3
- else if (bbGetInputOutputFormat()=="VTK_SHORT") outputformat = VTK_SHORT; // 4
- else if (bbGetInputOutputFormat()=="MET_SHORT") outputformat = VTK_SHORT; // 4
- else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_SHORT") outputformat = VTK_UNSIGNED_SHORT; // 5
- else if (bbGetInputOutputFormat()=="MET_USHORT") outputformat = VTK_UNSIGNED_SHORT; // 5
- else if (bbGetInputOutputFormat()=="VTK_INT") outputformat = VTK_INT; // 6
- else if (bbGetInputOutputFormat()=="MET_INT") outputformat = VTK_INT; // 6
- else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_INT") outputformat = VTK_UNSIGNED_INT; // 7
- else if (bbGetInputOutputFormat()=="MEY_UINT") outputformat = VTK_UNSIGNED_INT; // 7
- else if (bbGetInputOutputFormat()=="VTK_LONG") outputformat = VTK_LONG; // 8
- else if (bbGetInputOutputFormat()=="MET_LONG") outputformat = VTK_LONG; // 8
- else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_LONG") outputformat = VTK_UNSIGNED_LONG; // 9
- else if (bbGetInputOutputFormat()=="MET_ULONG") outputformat = VTK_UNSIGNED_LONG; // 9
- else if (bbGetInputOutputFormat()=="VTK_FLOAT") outputformat = VTK_FLOAT; // 10
- else if (bbGetInputOutputFormat()=="MET_FLOAT") outputformat = VTK_FLOAT; // 10
- else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; // 11
- else if (bbGetInputOutputFormat()=="MET_DOUBLE") outputformat = VTK_DOUBLE; // 11
-
- spc[0] = bbGetInputSpacing()[0];
- spc[1] = bbGetInputSpacing()[1];
- spc[2] = bbGetInputSpacing()[2];
- dim[0] = bbGetInputDimensions()[0];
- dim[1] = bbGetInputDimensions()[1];
- dim[2] = bbGetInputDimensions()[2];
- if ((dim[0]<=0)||(dim[1]<=0)||(dim[2]<=0))
- {
- dim[0]=1;
- dim[1]=1;
- dim[2]=1;
- }
- if ((spc[0]<=0)||(spc[1]<=0)||(spc[2]<=0))
- {
- spc[0]=1;
- spc[1]=1;
- spc[2]=1;
- }
-//EED 2017-12-7
+ dim[0] = bbGetInputDimensions()[0];
+ dim[1] = bbGetInputDimensions()[1];
+ dim[2] = bbGetInputDimensions()[2];
+
+
+
if (imageoutput!=NULL)
{
imageoutput->Delete();
- }
- imageoutput = vtkImageData::New();
- imageoutput->Initialize();
- imageoutput->SetSpacing( spc );
- imageoutput->SetDimensions( dim[0], dim[1], dim[2] );
-
-//EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5)
- imageoutput->SetScalarType( outputformat );
- imageoutput->AllocateScalars();
-#endif
-#if (VTK_MAJOR_VERSION >= 6)
- imageoutput->AllocateScalars( outputformat,1 );
-#endif
-
- int i,j,k;
- long sizeBlock;
+ imageoutput = NULL;
+ } // if imageoutput
- for (i=0; i<dim[0]; i++)
+ if ( !((dim[0]<=0)||(dim[1]<=0)||(dim[2]<=0)) )
{
- imageoutput->SetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() );
- } // for i
-
- sizeBlock= dim[0] * imageoutput->GetScalarSize();
- for (j=1; j<dim[1]; j++)
- {
- memcpy( imageoutput->GetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock );
- } // for j
+ double spc[3];
+ int outputformat = VTK_UNSIGNED_SHORT;
+
+ spc[0] = 1;
+ spc[1] = 1;
+ spc[2] = 1;
+ if ( bbGetInputSpacing().size()==3 )
+ {
+ spc[0] = bbGetInputSpacing()[0];
+ spc[1] = bbGetInputSpacing()[1];
+ spc[2] = bbGetInputSpacing()[2];
+ if ((spc[0]<=0)||(spc[1]<=0)||(spc[2]<=0))
+ {
+ spc[0] = 1;
+ spc[1] = 1;
+ spc[2] = 1;
+ }
+ } // size spc 3
+ if ( bbGetInputSpacing().size()==2 )
+ {
+ spc[0] = bbGetInputSpacing()[0];
+ spc[1] = bbGetInputSpacing()[1];
+ if ((spc[0]<=0)||(spc[1]<=0))
+ {
+ spc[0] = 1;
+ spc[1] = 1;
+ }
+ } // if size spc 2
+
+
+ if (bbGetInputOutputFormat()=="VTK_BIT") outputformat = VTK_BIT; // 1
+ else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR; // 2
+ else if (bbGetInputOutputFormat()=="MET_CHAR") outputformat = VTK_CHAR; // 2
+ else if (bbGetInputOutputFormat()=="VTK_SIGNED_CHAR") outputformat = VTK_SIGNED_CHAR; // 15
+ else if (bbGetInputOutputFormat()=="MET_UCHAR") outputformat = VTK_UNSIGNED_CHAR; // 3
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_CHAR") outputformat = VTK_UNSIGNED_CHAR; // 3
+ else if (bbGetInputOutputFormat()=="VTK_SHORT") outputformat = VTK_SHORT; // 4
+ else if (bbGetInputOutputFormat()=="MET_SHORT") outputformat = VTK_SHORT; // 4
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_SHORT") outputformat = VTK_UNSIGNED_SHORT; // 5
+ else if (bbGetInputOutputFormat()=="MET_USHORT") outputformat = VTK_UNSIGNED_SHORT; // 5
+ else if (bbGetInputOutputFormat()=="VTK_INT") outputformat = VTK_INT; // 6
+ else if (bbGetInputOutputFormat()=="MET_INT") outputformat = VTK_INT; // 6
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_INT") outputformat = VTK_UNSIGNED_INT; // 7
+ else if (bbGetInputOutputFormat()=="MEY_UINT") outputformat = VTK_UNSIGNED_INT; // 7
+ else if (bbGetInputOutputFormat()=="VTK_LONG") outputformat = VTK_LONG; // 8
+ else if (bbGetInputOutputFormat()=="MET_LONG") outputformat = VTK_LONG; // 8
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_LONG") outputformat = VTK_UNSIGNED_LONG; // 9
+ else if (bbGetInputOutputFormat()=="MET_ULONG") outputformat = VTK_UNSIGNED_LONG; // 9
+ else if (bbGetInputOutputFormat()=="VTK_FLOAT") outputformat = VTK_FLOAT; // 10
+ else if (bbGetInputOutputFormat()=="MET_FLOAT") outputformat = VTK_FLOAT; // 10
+ else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; // 11
+ else if (bbGetInputOutputFormat()=="MET_DOUBLE") outputformat = VTK_DOUBLE; // 11
+
+ if ((dim[0]<=0)||(dim[1]<=0)||(dim[2]<=0))
+ {
+ dim[0] = 1;
+ dim[1] = 1;
+ dim[2] = 1;
+ }
+
+ imageoutput = vtkImageData::New();
+ imageoutput->Initialize();
+ imageoutput->SetSpacing( spc );
+ imageoutput->SetDimensions( dim[0], dim[1], dim[2] );
+
+ //EED 2017-01-01 Migration VTK7
+ #if (VTK_MAJOR_VERSION <= 5)
+ imageoutput->SetScalarType( outputformat );
+ imageoutput->AllocateScalars();
+ #endif
+ #if (VTK_MAJOR_VERSION >= 6)
+ imageoutput->AllocateScalars( outputformat,1 );
+ #endif
+
+ int i,j,k;
+ long sizeBlock;
+ for (i=0; i<dim[0]; i++)
+ {
+ imageoutput->SetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() );
+ } // for i
+ sizeBlock= dim[0] * imageoutput->GetScalarSize();
+ for (j=1; j<dim[1]; j++)
+ {
+ memcpy( imageoutput->GetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock );
+ } // for j
+ sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize();
+ for (k=0; k<dim[2]; k++)
+ {
+ memcpy( imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock );
+ } // for k
+ //EED 2017-01-01 Migration VTK7
+ #if (VTK_MAJOR_VERSION <= 5)
+ imageoutput->Update();
+ #endif
+ #if (VTK_MAJOR_VERSION >= 6)
+ // ..
+ #endif
+ imageoutput->Modified();
+ } // if dim = 0
- sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize();
- for (k=0; k<dim[2]; k++)
- {
- memcpy( imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock );
- } // for k
-
-
-//EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5)
- imageoutput->Update();
-#endif
-#if (VTK_MAJOR_VERSION >= 6)
- // ..
-#endif
-
- imageoutput->Modified();
bbSetOutputOut(imageoutput);
+
}
//=====
bbSetInputIndex(tmpIndex);
bbSetInputSize(tmpSize);
- bbSetOutputOut(0);
+ bbSetOutputOut(NULL);
}
//=====
BBTK_DESCRIPTION("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, "Input",int);
+ BBTK_TEMPLATE_INPUT(GetVectorElement, I, "iElement (default 0)",int);
BBTK_TEMPLATE_INPUT(GetVectorElement, ErrorValue, "ErrorValue",T);
BBTK_TEMPLATE_OUTPUT(GetVectorElement,Out,"Output",T);
BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorElement);
template <class T>
void GetVectorElement<T>::bbUserSetDefaultValues()
{
-
+ bbSetInputI(0);
}
//=================================================================
//=================================================================
void ImageBoundaries::Process()
{
if (bbGetInputIn()!=NULL){
- int i,j,k;
int ext[6];
double value;
int bYMin = maxY-1;
int bZMin = maxZ-1;
-/*
- #pragma omp parallel for
- for (int i=0 ; i<maxX ; i++)
- {
- int j;
- int k;
- for (j=0 ; j<maxY ; j++)
- {
- for (k=0 ; k<maxZ ; k++)
- {
- double value = bbGetInputIn()->GetScalarComponentAsDouble(i, j, k,0);
- if ( (value>=bbGetInputLowerValue()) && (value<=bbGetInputUpperValue()) )
- {
- 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;
- }
- } // for k
- } // for j
- } // i
-*/
-
+
+ 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");
+
+// http://jakascorner.com/blog/2016/05/omp-for.html
+#pragma omp parallel shared(maxZ,bXMin,bYMin,bZMin,bXMax,bYMax,bZMax)
+{
+ #pragma omp 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 )); }
+ int i,j;
+ double vItmpOMP;
for (j=0 ; j<maxY ; j++)
{
for (i=0 ; i<maxX ; i++)
{
// double value = bbGetInputIn()->GetScalarComponentAsDouble(i, j, k,0);
- GETVALUE2_VTK_CREA(vI,pI,stI,index)
+ GETVALUE2_VTK_CREA(vItmpOMP,pI,stI,index)
index++;
- if ( (vI>=bbGetInputLowerValue()) && (vI<=bbGetInputUpperValue()) )
+ 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<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;
}
} // for k
} // for j
} // i
+} // #pragma
+
std::vector<int> tmpIndex;
std::vector<int> tmpSize;
if (bXMin>bXMax){
#endif
dim[0]= ext[1]-ext[0]+1;
dim[1]= ext[3]-ext[2]+1;
- dim[2]= ext[5]-ext[4]+1;
-
+ dim[2] = 1;
+ if (bbGetInputImageFix()->GetDataDimension()==3)
+ {
+ dim[2] = ext[5]-ext[4]+1;
+ }
if (bbGetInputType()==0)
{
_imageoutput = vtkImageData::New();
#if (VTK_MAJOR_VERSION >= 6)
_imageoutput->AllocateScalars(bbGetInputImageFix()->GetScalarType() , 1);
#endif
-
+
// Duplicating Fix Image
long sizeimage = dim[0]*dim[1]*dim[2]*bbGetInputImageFix()->GetScalarSize();
memcpy( _imageoutput->GetScalarPointer() , bbGetInputImageFix()->GetScalarPointer() , sizeimage);
_imageoutput=bbGetInputImageFix();
}
-
-
// Copy the Move Image
int j,k;
int px,py,pz;
#endif
int dimMoveX = ext[1]-ext[0]+1;
int dimMoveY = ext[3]-ext[2]+1;
- int dimMoveZ = ext[5]-ext[4]+1;
-
+ int dimMoveZ = 1;
+ if (bbGetInputImageMove()->GetDataDimension()==3)
+ {
+ dimMoveZ = ext[5]-ext[4]+1;
+ }
+ double org[3];
+ org[0]=0;
+ org[1]=0;
+ org[2]=0;
+ if (bbGetInputOrigin().size()==3)
+ {
+ org[0]=bbGetInputOrigin()[0];
+ org[1]=bbGetInputOrigin()[1];
+ org[2]=bbGetInputOrigin()[2];
+ }
+ if (bbGetInputOrigin().size()==2)
+ {
+ org[0]=bbGetInputOrigin()[0];
+ org[1]=bbGetInputOrigin()[1];
+ }
+ if (bbGetInputOrigin().size()==1)
+ {
+ org[0]=bbGetInputOrigin()[0];
+ }
int spxM = 0; // start px MoveImage
int sizeXM = 0; // sizeX MoveImage
-
- px = bbGetInputOrigin()[0];
+ px = org[0];
spxM = 0;
if (px<0)
{
- spxM=px*(-1);
- px=0;
+ spxM = px*(-1);
+ px = 0;
}
- sizeXM = dimMoveX-spxM;
- if (px+sizeXM>=dim[0]) sizeXM=dim[0]-px;
- sizeXM=sizeXM*bbGetInputImageFix()->GetScalarSize();
+ sizeXM = dimMoveX-spxM;
+ if (px+sizeXM>=dim[0]) { sizeXM=dim[0]-px; }
+ sizeXM = sizeXM * bbGetInputImageFix()->GetScalarSize();
for (k=0; k<dimMoveZ; k++)
{
for (j=0; j<dimMoveY; j++)
{
- py=j+bbGetInputOrigin()[1];
- pz=k+bbGetInputOrigin()[2];
+ py = j+org[1];
+ if (bbGetInputImageMove()->GetDataDimension()==3)
+ {
+ pz = k+org[2];
+ } else {
+ pz = k;
+ }// Dimension 3
if ( (py<dim[1]) && (pz<dim[2]) &&
(py>=0) && (pz>=0) &&
(sizeXM>0) )
{
memcpy( _imageoutput->GetScalarPointer(px,py,pz) , bbGetInputImageMove()->GetScalarPointer(spxM,j,k) , sizeXM );
}
-
} // for j
} // for k
_imageoutput->Modified();
- } // If Image Fixe Move the same GetScalarType
- else {
+ } else { // If Image Fixe Move the same GetScalarType
printf ("ERROR: InversCrop both ImageFixe and ImageMove need the same format.\n");
printf (" type ImageFix:%d type ImageMove:%d\n", bbGetInputImageFix()->GetScalarType(), bbGetInputImageMove()->GetScalarType() );
}
- } // If Image Fixe Move != NULL
- else {
- printf ("ERROR: InversCrop need ImageFixe and ImageMove to run.\n");
- }
- bbSetOutputOut(_imageoutput);
-
+ } else { // If Image Fixe Move != NULL
+ printf ("ERROR: InversCrop need ImageFixe and ImageMove to run.\n");
+ }
+ bbSetOutputOut(_imageoutput);
} // if Active
-
}
//=====
// * TYPE is the C++ type of the input/output
// (the one provided in the attribute 'type' of the tag 'input')
-//EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5)
- maskpoints->SetInput( bbGetInputIn() );
-#endif
-#if (VTK_MAJOR_VERSION >= 6)
- maskpoints->SetInputData( bbGetInputIn() );
-#endif
- maskpoints->SetOnRatio( bbGetInputRatio() );
- maskpoints->RandomModeOn();
- maskpoints->SetMaximumNumberOfPoints(5000);
- maskpoints->Update();
- bbSetOutputOut( maskpoints->GetOutput() );
+ if (bbGetInputActive()==true)
+ {
+ //EED 2017-01-01 Migration VTK7
+ #if (VTK_MAJOR_VERSION <= 5)
+ maskpoints->SetInput( bbGetInputIn() );
+ #endif
+ #if (VTK_MAJOR_VERSION >= 6)
+ maskpoints->SetInputData( bbGetInputIn() );
+ #endif
+
+ maskpoints->SetOnRatio( bbGetInputRatio() );
+
+ if (bbGetInputRandomType()==-1)
+ {
+ maskpoints->RandomModeOff();
+ } else if(bbGetInputRandomType()==0) {
+ maskpoints->RandomModeOn();
+ maskpoints->SetRandomModeType(0);
+ }
+
+ // maskpoints->SetMaximumNumberOfPoints(5000);
+ maskpoints->Update();
+ bbSetOutputOut( maskpoints->GetOutput() );
+ } // if Active
}
//=====
// 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)
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
+ bbSetInputActive( true );
bbSetInputIn(NULL);
bbSetOutputOut(NULL);
+ bbSetInputRandomType(-1);
+ bbSetInputRatio(30);
}
//=====
//=====
// 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(Active,bool);
BBTK_DECLARE_INPUT(In,vtkImageData*);
BBTK_DECLARE_INPUT(Ratio,int);
+ BBTK_DECLARE_INPUT(RandomType,int);
BBTK_DECLARE_OUTPUT(Out,vtkPolyData*);
BBTK_PROCESS(Process);
void Process();
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(MaskPoint,bbtk::AtomicBlackBox);
-BBTK_NAME("MaskPoint");
-BBTK_AUTHOR("ED at InfoDev Creatis");
-BBTK_DESCRIPTION("vtkMaskPoint. See Vectors/Tensors Examples");
-BBTK_CATEGORY("empty");
+ BBTK_NAME("MaskPoint");
+ BBTK_AUTHOR("ED at InfoDev Creatis");
+ BBTK_DESCRIPTION("vtkMaskPoint. See Vectors/Tensors Examples");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(MaskPoint,Active,"(default true) true/false",bool,"");
BBTK_INPUT(MaskPoint,In,"vtkImageData",vtkImageData*,"");
- BBTK_INPUT(MaskPoint,Ratio,"Ratio",int,"");
+ BBTK_INPUT(MaskPoint,Ratio,"(default 30) Ratio",int,"");
+ BBTK_INPUT(MaskPoint,RandomType,"(default -1) -1:RandomOff 0:Random(0) 1:Random(1 not set)",int,"");
+
BBTK_OUTPUT(MaskPoint,Out,"vtkPolyData",vtkPolyData*,"");
+
BBTK_END_DESCRIBE_BLACK_BOX(MaskPoint);
//=====
// 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_ADD_BLACK_BOX_TO_PACKAGE(vtk,MetaImageReader)
BBTK_BLACK_BOX_IMPLEMENTATION(MetaImageReader,bbtk::AtomicBlackBox);
+
+
+void MetaImageReader::Read_mhdb( std::string filename )
+{
+ printf("EED MetaImageReader::Read_mhdb \n");
+}
+
+
//=====
// 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)
//=====
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
- FILE *ff=fopen(bbGetInputIn().c_str(),"r");
- if (ff)
- {
- fclose(ff);
- vtkMetaImageReader *reader = vtkMetaImageReader::New();
- reader->SetFileName(bbGetInputIn().c_str());
- reader->Update();
- bbSetOutputOut(reader->GetOutput());
+ if (bbGetInputIn().substr(bbGetInputIn().size()-5) == ".mhdb")
+ {
+ Read_mhdb( bbGetInputIn() );
} else {
+ FILE *ff = fopen( bbGetInputIn().c_str() , "r" );
+ if (ff)
+ {
+ fclose(ff);
+ vtkMetaImageReader *reader = vtkMetaImageReader::New();
+ reader->SetFileName( bbGetInputIn().c_str() );
+ reader->Update();
+ bbSetOutputOut( reader->GetOutput() );
+ } else {
bbSetOutputOut(NULL);
- }
+ } // ff
+ }// .mhdb
}
+
//=====
// 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_OUTPUT(Out,vtkImageData*);
BBTK_PROCESS(Process);
void Process();
+ void Read_mhdb( std::string filename );
//=====
// 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)
//=====
--- /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 "bbvtkMetaImageWriter.h"
+#include "bbvtkPackage.h"
+
+#include <vtkExtractVOI.h>
+#include <vtkMetaImageWriter.h>
+
+#include "vtkJSONImageWriter.h"
+#include "vtkXMLImageDataWriter.h"
+#include "vtkXMLDataSetWriter.h"
+#include "vtkDataSetWriter.h"
+#include "vtkPDataSetWriter.h"
+#include "vtkXMLWriter.h"
+
+namespace bbvtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,MetaImageWriter)
+BBTK_BLACK_BOX_IMPLEMENTATION(MetaImageWriter,bbtk::AtomicBlackBox);
+
+
+
+void MetaImageWriter::Save_mhdb( std::string filename , vtkImageData* img ,int sizeB)
+{
+ int i,j,k;
+ int ext[6];
+ int dim[3];
+ int elementType=img->GetScalarType();
+
+ img->GetExtent(ext);
+ dim[0]=ext[1]-ext[0]+1;
+ dim[1]=ext[3]-ext[2]+1;
+ dim[2]=ext[5]-ext[4]+1;
+ int bsx=ceil((double)dim[0]/(double)sizeB);
+ int bsy=ceil((double)dim[1]/(double)sizeB);
+ int bsz=ceil((double)dim[2]/(double)sizeB);
+ int voi[6];
+ std::string filenameBlock;
+ std::string filenameBlockVti;
+ if (filename.substr(filename.size()-5) == ".mhdb")
+ {
+ std::string cmd;
+// cmd="rm -rf "+filename;
+ system( cmd.c_str() );
+ cmd="mkdir "+filename;
+ system( cmd.c_str() );
+ }
+
+ std::string fileinfoname=filename+"/info.dat";
+ FILE *ff=fopen(fileinfoname.c_str(),"w");
+ fprintf(ff,"SizeBlock = %d\n",sizeB);
+ fprintf(ff,"DimSize = %d %d %d\n" , dim[0],dim[1],dim[2] );
+ fprintf(ff,"ElementType = %d\n", elementType );
+ fclose(ff);
+
+ for (i=0;i<bsx;i++)
+ {
+ for (j=0;j<bsy;j++)
+ {
+ for (k=0;k<bsz;k++)
+ {
+ voi[0]=i*sizeB;
+ voi[1]=voi[0]+(sizeB-1);
+ voi[2]=j*sizeB;
+ voi[3]=voi[2]+(sizeB-1);
+ voi[4]=k*sizeB;
+ voi[5]=voi[4]+(sizeB-1);
+ if (voi[1]>=dim[0]) { voi[1]=dim[0]-1; }
+ if (voi[3]>=dim[1]) { voi[3]=dim[1]-1; }
+ if (voi[5]>=dim[2]) { voi[5]=dim[2]-1; }
+ vtkExtractVOI *extract = vtkExtractVOI::New();
+ extract->SetInputData( img );
+ extract->SetVOI(voi);
+ extract->UpdateWholeExtent();
+ extract->Modified();
+ extract->Update();
+ filenameBlock =filename+"/mhdb-"+ std::to_string(i)+"-"+ std::to_string(j)+"-"+ std::to_string(k)+".mha";
+ vtkMetaImageWriter* w = vtkMetaImageWriter::New();
+ w->SetInputData( extract->GetOutput() );
+ w->SetCompression(true);
+ w->SetFileDimensionality(bbGetInputIn()->GetDataDimension()); // NTU
+ w->SetFileName( filenameBlock.c_str() );
+ w->Write();
+ w->Delete();
+
+/* Borrame
+ filenameBlockVti=filenameBlock+"-ZLib.vti";
+ vtkXMLImageDataWriter *writer = vtkXMLImageDataWriter::New();
+ writer->SetDataModeToBinary();
+// writer->SetCompressionLevel(5);
+ writer->SetCompressorTypeToZLib();
+ writer->SetFileName( filenameBlockVti.c_str() );
+ writer->SetInputData( bbGetInputIn() );
+ writer->Write();
+*/
+
+ extract->Delete();
+ } // for k
+ } // for j
+ } // for i
+}
+
+
+
+//=====
+// 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 MetaImageWriter::Process()
+{
+
+printf("EED vtkMetaImageWriter::Process START\n");
+
+// 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')
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ bbGetInputIn()->Update();
+#else
+ // ...
+#endif
+ std::string userGivenName = bbGetInputFilename();
+ if (bbGetInputIn()!=NULL)
+ {
+ if (userGivenName.substr(userGivenName.size()-5) == ".mhdb")
+ {
+ Save_mhdb( userGivenName , bbGetInputIn() , bbGetInputSizeBlock() );
+ } else {
+ if (!((userGivenName.substr(userGivenName.size()-4) == ".mhd") || (userGivenName.substr(userGivenName.size()-4) == ".mha"))) //JPR
+ {
+ userGivenName += ".mhd";
+ }
+ vtkMetaImageWriter* w = vtkMetaImageWriter::New();
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ w->SetInput(bbGetInputIn());
+ #else
+ w->SetInputData(bbGetInputIn());
+ #endif
+ w->SetCompression(bbGetInputCompression());
+ w->SetFileDimensionality(bbGetInputIn()->GetDataDimension()); // NTU
+ w->SetFileName(userGivenName.c_str());
+ //w->SetFileName(bbGetInputFilename().c_str()); // JPR
+ w->Write();
+ w->Delete();
+ } // .mhdb
+ } // bbGetInputIn()!=NULL
+printf("EED vtkMetaImageWriter::Process END\n");
+}
+//=====
+// 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 MetaImageWriter::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputCompression(false);
+ bbSetInputSizeBlock(20);
+}
+//=====
+// 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 MetaImageWriter::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 MetaImageWriter::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbvtk
+
+
--- /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 __bbvtkMetaImageWriter_h_INCLUDED__
+#define __bbvtkMetaImageWriter_h_INCLUDED__
+
+#include "bbvtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <vtkImageData.h>
+
+
+namespace bbvtk
+{
+
+class bbvtk_EXPORT MetaImageWriter
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(MetaImageWriter,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,vtkImageData*);
+ BBTK_DECLARE_INPUT(Filename,std::string);
+ BBTK_DECLARE_INPUT(Compression,bool);
+ BBTK_DECLARE_INPUT(SizeBlock,int);
+// BBTK_DECLARE_OUTPUT(Out,double);
+ BBTK_PROCESS(Process);
+ void Process();
+
+void Save_mhdb( std::string filename , vtkImageData* img , int sizeB);
+
+//=====
+// 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(MetaImageWriter,bbtk::AtomicBlackBox);
+ BBTK_NAME("MetaImageWriter");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(MetaImageWriter,In,"Input image",vtkImageData*,"");
+ BBTK_INPUT(MetaImageWriter,Filename,"Name of the file to write",std::string,"file name");
+ BBTK_INPUT(MetaImageWriter,Compression,"default(false) true/false",bool,"");
+ BBTK_INPUT(MetaImageWriter,SizeBlock,"(default 50) Size block (for .mhdb format)",int,"");
+
+ //BBTK_OUTPUT(MetaImageWriter,Out,"First output",double,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(MetaImageWriter);
+//=====
+// 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 bbvtk
+
+#endif // __bbvtkMetaImageWriter_h_INCLUDED__
+
+++ /dev/null
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-<blackbox name="MetaImageWriter" type="VTK_ImageAlgorithm">
-
-<author>laurent.guigues at creatis.insa-lyon.fr</author>
-<description><PRE>Writes .mhd / .mhd image formats (bbfication of vtkMetaImageWriter)</PRE></description>
-<category>image;read/write</category>
-
-<include>vtkMetaImageWriter.h</include>
-<include>vtkImageData.h</include>
-<vtkobject>vtkMetaImageWriter</vtkobject>
-
-<input name="Filename" type="std::string" nature="file name" description="Name of the file to write"/>
-<input name="In" type="vtkImageData*" description="Input image" />
-<input name="Compression" type="bool" description="default(false) true/false" />
-
- <process><PRE>
- vtkMetaImageWriter* w = vtkMetaImageWriter::New();
-
-
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- bbGetInputIn()->Update();
-#else
- // ...
-#endif
-
-/*
- if (bbGetInputIn() == 0)
- std::cout << "======================= Katastrophe : bbGetInputIn() == 0 " << std::endl;
- else
- std::cout << "======================= OK : bbGetInputIn() not NULL " << std::endl;
-
- bbGetInputIn()->PrintSelf(std::cout, vtkIndent(1));
- bbGetInputIn()->GetSpacing(spacing);
- std::cout << "=======" << spacing[0] << " " << spacing[1] << " " << spacing[2] << std::endl;
-*/
-
-
- if (bbGetInputIn()!=NULL)
- {
-
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- w->SetInput(bbGetInputIn());
-#else
- w->SetInputData(bbGetInputIn());
-#endif
- w->SetCompression(bbGetInputCompression());
- w->SetFileDimensionality(bbGetInputIn()->GetDataDimension()); // NTU
- std::string userGivenName = bbGetInputFilename();
- if (userGivenName.substr(userGivenName.size()-4) != ".mhd") //JPR
- {
- userGivenName += ".mhd";
- }
- w->SetFileName(userGivenName.c_str());
- //w->SetFileName(bbGetInputFilename().c_str()); // JPR
-//EEDJuly22-2014 w->Update(); // Fred
- w->Write();
- } // bbGetInputIn()!=NULL
-
- w->Delete();
- </PRE></process>
-
- <defaultValues>
- <PRE>
- bbSetInputCompression(false);
- </PRE>
- </defaultValues>
-
-
-</blackbox>
-
-
#include "vtkProperty.h"
#include "vtkLinearTransform.h"
+#include "vtkCleanPolyData.h"
+#include "vtkFieldData.h"
#include "bbvtkPolyDataToActor.h"
#include "bbvtkPackage.h"
+#include "vtkRenderWindow.h"
namespace bbvtk
{
bbSetInputScalarVisibility(false);
polydatamapper = NULL;
vtkactor = NULL;
+
+ bbSetInputScalarVisibilityOn_LookupTable(NULL);
+ bbSetInputScalarVisibilityOn_NameColorArray("");
}
vtkactor = vtkActor::New();
// polydatamapper->SetInput(marchingcubes->GetOutput());
vtkactor->SetMapper(polydatamapper);
+
//EED 2020-04-21 vtk8 deprecated
// polydatamapper->ImmediateModeRenderingOn();
}
}
+
+
+/*
+
+-----------------------------------------------
+
+https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ScalarBarActor
+https://vtk.org/Wiki/VTK/Examples/Cxx/VisualizationAlgorithms/TubesFromSplines
+https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ElevationBandsWithGlyphs
+
+vtkSmartPointer<vtkFloatArray> scalars = vtkSmartPointer<vtkFloatArray>::New();
+ scalars set value ....
+poly->GetPointData()->SetScalars(scalars); or poly->GetPointData()->SetActiveScalars("<NameArray>");
+
+vtkSmartPointer<vtkLookupTable> hueLut = vtkSmartPoint | ^~
+er<vtkLookupTable>::New();
+ hueLut Build ....
+
+ mapper->SetInputData(poly);
+ mapper->ScalarVisibilityOn();
+ mapper->SetScalarModeToUsePointData(); Point of Cell ...
+
+ default: mapper->SetColorModeToDirectScalars() Busca scalars 3 componentes [R,G,B] float 0..1 or integer 0..255
+ else:
+ mapper->SetColorModeToMapScalars() El vector scalar solo tiene un componente
+ mapper->SetLookupTable( hueLut );
+
+ To change Array
+ mapper->SelectColorArray("<NameVector>");
+
+ mapper->SetUseLookupTableScalarRange( true/false ) true:Para compartir lookuptable con otros mappers
+ si false then
+ mapper->SetScalarRange( min, max); Range especifico este mapper
+ mapper->SetScalarRange( tubePolyData->GetScalarRange() );
+
+------------------------------------------
+
+ mapper->ScalarVisibilityOff(); -> SetScalarModeToDefault()
+ Utiliza el color del actor
+
+----------------------------------------
+
+*/
+
+
//---------------------------------------------------------------------
- void PolyDataToActor::DoProcess()
- {
+void PolyDataToActor::DoProcess()
+{
+ if (bbGetInputRenderer()==NULL)
+ {
+ printf("EED Warnning! PolyDataToActor::DoProcess missing Renderer.\n");
+ }
+
if (bbGetInputActive()==true)
{
+
+
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
polydatamapper->SetInput( bbGetInputIn() );
#else
- polydatamapper->SetInputData( bbGetInputIn() );
+ polydatamapper->SetInputData( bbGetInputIn() );
#endif
vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
- if (bbGetInputRepresentation()==1)
+ if (bbGetInputRepresentation()==0)
{
vtkactor->GetProperty()->SetAmbient(1);
vtkactor->GetProperty()->SetDiffuse(1);
vtkactor->GetProperty()->SetSpecular(0);
- } else {
-printf("EED WARNNING! PolyDataToActor::DoProcess which is the default values of Ambient, Diffuse, Specular ? \n");
+printf("EED WARNNING! PolyDataToActor::DoProcess which is the default values of Ambient, Diffuse, Specular for points option? \n");
+ } else if (bbGetInputRepresentation()==1)
+ {
+ vtkactor->GetProperty()->SetAmbient(1);
+ vtkactor->GetProperty()->SetDiffuse(1);
+ vtkactor->GetProperty()->SetSpecular(0);
+ } else if (bbGetInputRepresentation()==2)
+ {
+ vtkactor->GetProperty()->SetAmbient(0);
+ vtkactor->GetProperty()->SetDiffuse(1);
+ vtkactor->GetProperty()->SetSpecular(0);
}
vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
if (bbGetInputScalarVisibility()==true )
{
- polydatamapper->ScalarVisibilityOn();
+ polydatamapper->ScalarVisibilityOn();
+ if (bbGetInputScalarVisibilityOn_LookupTable()!=NULL)
+ {
+// polydatamapper->SetScalarModeToDefault();
+// polydatamapper->SetScalarModeToUseCellData();
+// polydatamapper->SetScalarModeToUseCellFieldData();
+// polydatamapper->SetScalarModeToUseFieldData(); // 1/2 hausdorff->SetTargetDistanceMethodToPointToCell();
+// polydatamapper->SetScalarModeToUsePointData(); // *
+ polydatamapper->SetScalarModeToUsePointFieldData();
+
+ polydatamapper->SetColorModeToMapScalars();
+ polydatamapper->SetLookupTable( bbGetInputScalarVisibilityOn_LookupTable() );
+ if (bbGetInputScalarVisibilityOn_NameColorArray()!="")
+ {
+ polydatamapper->SelectColorArray( bbGetInputScalarVisibilityOn_NameColorArray().c_str() );
+ }
+ if (bbGetInputScalarVisibilityOn_ScalarRange().size()==2)
+ {
+ polydatamapper->SetScalarRange( bbGetInputScalarVisibilityOn_ScalarRange()[0] , bbGetInputScalarVisibilityOn_ScalarRange()[1] );
+ }
+
+ } // if ScalarVisibilityOn_LookupTable
} else {
polydatamapper->ScalarVisibilityOff();
} // ScalarVisibility
bbGetInputRenderer()->RemoveActor( vtkactor );
} // actorAdded
} // Active
- }
+}
#include "vtkPolyDataMapper.h"
#include "vtkProp3D.h"
#include "vtkActor.h"
+#include "vtkScalarsToColors.h"
#include <vector>
#include "bbtkAtomicBlackBox.h"
BBTK_DECLARE_INPUT(Representation, int);
BBTK_DECLARE_INPUT(LineWidth, double);
BBTK_DECLARE_INPUT(ScalarVisibility, bool);
+ BBTK_DECLARE_INPUT(ScalarVisibilityOn_LookupTable, vtkScalarsToColors*);
+ BBTK_DECLARE_INPUT(ScalarVisibilityOn_NameColorArray, std::string);
+ BBTK_DECLARE_INPUT(ScalarVisibilityOn_ScalarRange, std::vector<double>);
+
BBTK_DECLARE_OUTPUT(Out,vtkProp3D *);
BBTK_PROCESS(DoProcess);
BBTK_INPUT(PolyDataToActor,Transform,"Linear Transform (4x4 homogeneous)",vtkLinearTransform*,"");
BBTK_INPUT(PolyDataToActor,Representation,"0 points,1 wireframe, 2(default) surface",int,"");
BBTK_INPUT(PolyDataToActor,LineWidth,"Width of the wireframe (1 default)",double,"");
- BBTK_INPUT(PolyDataToActor,ScalarVisibility,"Scalar Visibility (false default)",bool,"");
+ BBTK_INPUT(PolyDataToActor,ScalarVisibility,"(false default) a) ScalarVisibility:false use color actor. b) ScalarVisibility:true use PolyData->SetScalars [3-components-RGB] (float 0..1 or int 0..255). c) ScalarVisibility:true and SetLookupTable use PolyData->SetScalars [1-component] d) ScalarVisibility:true and SetLookupTable SelectColorArray(<NameArray>) use PolyData->SetScalars( scalar(<NameArray>) ). e) For c/d SetScalarRange just for the mapper. d) [-1,-1] take PolyData->GetScalarRange()",bool,"");
+
+ BBTK_INPUT(PolyDataToActor,ScalarVisibilityOn_LookupTable,"LookupTable (need ScalarVisibility true)",vtkScalarsToColors*,"");
+ BBTK_INPUT(PolyDataToActor,ScalarVisibilityOn_NameColorArray,"Name of the array in PolyData (need ScalarVisibility true)",std::string,"");
+ BBTK_INPUT(PolyDataToActor,ScalarVisibilityOn_ScalarRange,"[min,max] Make ScalarRange independent from LookupTable (need ScalarVisibility true)", std::vector<double> ,"");
+
BBTK_OUTPUT(PolyDataToActor,Out,"Extracted iso-surface",vtkProp3D *,"");
BBTK_END_DESCRIBE_BLACK_BOX(PolyDataToActor);
//=====
void ProbeFilter::Process()
{
-
// THE MAIN PROCESSING METHOD BODY
// Here we simply set the input 'In' value to the output 'Out'
// And print out the output value
// (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 );
+ } else {
+ //EED 2017-01-01 Migration VTK7
-
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- _probefilter->SetSource( bbGetInputSource() );
- _probefilter->SetInput( bbGetInputInput() );
-#else
- _probefilter->SetSourceData( bbGetInputSource() );
- _probefilter->SetInputData( bbGetInputInput() );
-#endif
-
- _probefilter->Update();
- bbSetOutputOut( _probefilter->GetOutput() );
-
+ #if VTK_MAJOR_VERSION <= 5
+ _probefilter->SetSource( bbGetInputSource() );
+ _probefilter->SetInput( bbGetInputInput() );
+ #else
+ _probefilter->SetSourceData( bbGetInputSource() );
+ _probefilter->SetInputData( bbGetInputInput() );
+ #endif
+ _probefilter->Update();
+ 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)
// cast2 = NULL;
connect2 = NULL;
cast4 = NULL;
-
bbSetInputIn(NULL);
std::vector<int> position;
position.push_back(0);
threshold.push_back(0);
bbSetInputThresholdMinMax(threshold);
bbSetOutputOut(NULL);
-
bbSetInputOutputFormat("SAME");
bbSetInputValue(255);
-
-
}
-// --------------------------------------------------------------
-
+// --------------------------------------------------------------
void SegmentationConnectivity::bbUserInitializeProcessing()
{
-
thresh2 = vtkImageThreshold::New();
thresh2->SetInValue(255);
+ thresh2->SetOutValue(0);
thresh2->SetOutputScalarTypeToUnsignedChar();
connect2 = vtkImageSeedConnectivity::New();
-
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
connect2->SetInput(thresh2->GetOutput());
#else
connect2->SetInputData(thresh2->GetOutput());
#endif
-
connect2->SetInputConnectValue(255);
connect2->SetOutputConnectedValue( 255 );
connect2->SetOutputUnconnectedValue(0);
#else
cast4->SetInputData(connect2->GetOutput());
#endif
-
-// EED 2016 06 15
-
-/*
- thresh2 = vtkImageThreshold::New();
- thresh2->SetInValue(255);
- thresh2->SetOutputScalarTypeToUnsignedShort();
- thresh2->SetOutValue(0);
- cast2 = vtkImageCast::New();
- cast2->SetInput(thresh2->GetOutput());
- cast2->SetOutputScalarTypeToUnsignedChar();
- connect2 = vtkImageSeedConnectivity::New();
- connect2->SetInput(cast2->GetOutput());
- connect2->SetInputConnectValue(255);
- connect2->SetOutputConnectedValue(255);
- connect2->SetOutputUnconnectedValue(0);
- cast4 = vtkImageCast::New();
- cast4->SetInput(connect2->GetOutput());
- cast4->SetOutputScalarTypeToUnsignedShort();
-*/
-
}
-// --------------------------------------------------------------
-
+// --------------------------------------------------------------
void SegmentationConnectivity::bbUserFinalizeProcessing()
{
if (thresh2!=NULL)
}
}
-
-
-
// --------------------------------------------------------------
-
void SegmentationConnectivity::DoProcess()
{
-
int x,y,z;
int i,numPoints = bbGetInputPositionXYZ().size()/3;
int verif = (bbGetInputPositionXYZ().size()-1) % 3;
imagedata->Update();
thresh2->SetInput(imagedata);
#else
- imagedata->SetExtent(imagedata->GetExtent());
+// imagedata->SetExtent(imagedata->GetExtent());
thresh2->SetInputData(imagedata);
#endif
-
- thresh2->ThresholdBetween(3000, 3001);
thresh2->ThresholdBetween(bbGetInputThresholdMinMax()[0], bbGetInputThresholdMinMax()[1]);
- thresh2->Modified();
thresh2->Update();
connect2->RemoveAllSeeds ();
-
int ext[6];
-
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
imagedata->GetWholeExtent(ext);
#else
imagedata->GetExtent(ext);
#endif
-
int maxX = ext[1]-ext[0]+1;
int maxY = ext[3]-ext[2]+1;
int maxZ = ext[5]-ext[4]+1;
-
for (i=0;i<numPoints;i++)
{
x=bbGetInputPositionXYZ()[i*3+0];
{
connect2->AddSeed( x,y,z );
} else {
- printf("EED WARNNIG! In box: SegmentationConnectivity point out of range \n");
+ printf("EED WARNNIG! In box: SegmentationConnectivity points list out of range \n");
} // if point inside image
-
} // for i
connect2->SetOutputConnectedValue( bbGetInputValue() );
cast4->SetOutputScalarType( outputformat );
printf("EED WARNNIG! In box: SegmentationConnectivity List of points are not coherent. \n");
bbSetOutputOut( NULL );
}// if numPoints verif
-
}
-
}// EO namespace bbvtk
BBTK_BEGIN_DESCRIBE_BLACK_BOX(SegmentationConnectivity,bbtk::AtomicBlackBox);
BBTK_NAME("SegmentationConnectivity");
BBTK_AUTHOR("eduardo.davila [at] creatis.insa-lyon.fr");
- BBTK_DESCRIPTION("Segmentation with min max threshold and connectivity");
+ BBTK_DESCRIPTION("(Adapted to use vtkImageSeedConnectivity) - Segmentation with min max threshold and connectivity");
BBTK_INPUT(SegmentationConnectivity,In,"Input image",vtkImageData *,"");
- BBTK_INPUT(SegmentationConnectivity,PositionXYZ,"vector with the Position [x y z]" , std::vector<int>,"");
+ BBTK_INPUT(SegmentationConnectivity,PositionXYZ,"Lsit of POINTS. Vector with the Position [x y z]" , std::vector<int>,"");
BBTK_INPUT(SegmentationConnectivity,ThresholdMinMax,"vector with the Threshold [min max]" , std::vector<int>,"");
BBTK_INPUT(SegmentationConnectivity,Value,"(255 default) [0..255] Gey level of output image" , unsigned char,"");
BBTK_INPUT(SegmentationConnectivity,OutputFormat,"Image output format: SAME (default), VTK_BIT, VTK_CHAR, VTK_SIGNED_CHAR, VTK_UNSIGNED_CHAR, VTK_SHORT, VTK_UNSIGNED_SHORT, VTK_INT, VTK_UNSIGNED_INT, VTK_LONG, VTK_UNSIGNED_LONG, VTK_FLOAT, VTK_DOUBLE",std::string,"");
void SphereList::Process()
{
-printf("EED SphereList::Process Start\n");
-
+/*
if (bbGetInputRenderer()!=NULL)
{
- int sizeLstX=bbGetInputlstPointX().size();
- int sizeLstY=bbGetInputlstPointY().size();
- int sizeLstZ=bbGetInputlstPointZ().size();
- int sizeLstActors=sphereActor.size();
+ int sizeLstX = bbGetInputlstPointX().size();
+ int sizeLstY = bbGetInputlstPointY().size();
+ int sizeLstZ = bbGetInputlstPointZ().size();
+ int sizeLstActors = sphereActor.size();
if ((sizeLstX==sizeLstY) &&(sizeLstX==sizeLstZ))
{
+ int i,diff;
if (sizeLstActors>sizeLstX)
{
- int i;
- int diff=sizeLstActors-sizeLstX;
+ diff=sizeLstActors-sizeLstX;
for (i=0;i<diff;i++)
{
bbGetInputRenderer()->RemoveActor( sphereActor[0] );
if (sizeLstActors<sizeLstX)
{
- int i;
- int diff=sizeLstX-sizeLstActors;
+ diff=sizeLstX-sizeLstActors;
for (i=0;i<diff;i++)
{
// Sphere
} // if size
// Refresh data
- for (int i = 0; i < sphereActor.size() ; i++)
+ for (i = 0; i < sphereActor.size() ; i++)
{
double px = 0.0;
double py = 0.0;
}// if Renderer
//====================================================================
+*/
+
+ if (bbGetInputRenderer()!=NULL)
+ {
+ int sizeLstX = bbGetInputlstPointX().size();
+ int sizeLstY = bbGetInputlstPointY().size();
+ int sizeLstZ = bbGetInputlstPointZ().size();
+ int sizeLstActors = sphereActor.size();
+ if ((sizeLstX==sizeLstY) &&(sizeLstX==sizeLstZ))
+ {
+ int i;
+ double px,py,pz;
+ double cr,cg,cb;
+ for ( i=0 ; i<sizeLstActors ; i++ )
+ {
+ bbGetInputRenderer()->RemoveActor( sphereActor[i] );
+ vtkspheresourceLst[i]->Delete();
+ vtkpolydatamaperLst[i]->Delete();
+ sphereActor[i]->Delete();
+ } // for
+ vtkspheresourceLst.clear();
+ vtkpolydatamaperLst.clear();
+ sphereActor.clear();
+
+
+ for (i=0;i<sizeLstX;i++)
+ {
+ // Sphere
+ vtkSphereSource * newSphere = vtkSphereSource::New();
+ vtkspheresourceLst.push_back(newSphere);
+ newSphere -> SetThetaResolution(20);
+ newSphere -> SetPhiResolution(20);
+ newSphere -> SetRadius( 1 );
+ vtkPolyDataMapper * newMapper = vtkPolyDataMapper::New();
+ vtkpolydatamaperLst.push_back(newMapper);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ newMapper -> SetInput( newSphere -> GetOutput() );
+#else
+ newSphere -> Update();
+ newMapper -> SetInputData( newSphere -> GetOutput() );
+#endif
+
+ vtkActor * newActor = vtkActor::New();
+ sphereActor.push_back(newActor);
+ newActor -> SetMapper(newMapper);
+ newActor -> SetOrigin(0, 0, 0);
+ if ( bbGetInputTransform()!=NULL )
+ {
+ newActor->SetUserTransform( bbGetInputTransform() );
+ }
+ bbGetInputRenderer()->AddActor( newActor );
+ } // for
+
+
+ // Refresh data
+ for (i = 0; i < sphereActor.size() ; i++)
+ {
+ GetPoint(i, px,py,pz);
+ GetColor(i, cr,cg,cb);
+ sphereActor[i] ->SetPosition( px,py,pz );
+ sphereActor[i] -> GetProperty() -> SetOpacity( bbGetInputOpacity() );
+ sphereActor[i] -> GetProperty() -> SetColor( cr,cg,cb );
+ vtkspheresourceLst[i] -> SetRadius( GetRadio(i) );
+ vtkspheresourceLst[i] -> Update();
+ } // for i
+
+ if (sphereActor.size() != 0)
+ {
+ // Sets the output.
+ bbSetOutputActorList(sphereActor);
+ }
+ } // sizeLstX sizeLstY sizeLstZ
+ } // if Renderer
}
void Process();
std::vector<vtkActor *> sphereActor;
+ std::vector<vtkPolyDataMapper *>vtkpolydatamaperLst;
std::vector<vtkSphereSource *> vtkspheresourceLst;
private:
<defaultValues><PRE>
bbSetInputActive(true);
bbSetInputRadius(10);
+ bbSetInputCenterX(0);
+ bbSetInputCenterY(0);
+ bbSetInputCenterZ(0);
bbSetInputPhiResolution(10);
bbSetInputThetaResolution(10);
</PRE></defaultValues>
//=====
void SurfaceTexture::Process()
{
-
// THE MAIN PROCESSING METHOD BODY
// Here we simply set the input 'In' value to the output 'Out'
// And print out the output value
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-
- int i;
- double spc[3];
- double range[2];
- int ext[6];
- bbGetInputImage()->GetSpacing(spc);
- bbGetInputImage()->GetScalarRange(range);
-
-
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- bbGetInputImage()->GetWholeExtent(ext);
-#else
- bbGetInputImage()->GetExtent(ext);
-#endif
-
- int maxX = ext[1]-ext[0]+1;
- int maxY = ext[3]-ext[2]+1;
- int maxZ = ext[5]-ext[4]+1;
-
- if (firsttime==true)
+ int i;
+ double spc[3];
+ double range[2];
+ int ext[6];
+ if ((bbGetInputImage()!=NULL) && (bbGetInputMesh()!=NULL))
{
- firsttime=false;
- // Generate the colors for each point based on the color map
- colors = vtkUnsignedCharArray::New();
- colors->SetNumberOfComponents(3);
- colors->SetName("Colors");
+ bbGetInputImage()->GetSpacing(spc);
+ bbGetInputImage()->GetScalarRange(range);
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ bbGetInputImage()->GetWholeExtent(ext);
+ #else
+ bbGetInputImage()->GetExtent(ext);
+ #endif
+ int maxX = ext[1]-ext[0]+1;
+ int maxY = ext[3]-ext[2]+1;
+ int maxZ = ext[5]-ext[4]+1;
- // Create the color map
- if (bbGetInputColorType()==1)
+ if (backColorType!=bbGetInputColorType() )
{
- colorLookupTableWL = vtkWindowLevelLookupTable::New();
- colorLookupTableWL->InverseVideoOn();
- colorLookupTable = colorLookupTableWL;
- } else {
- colorLookupTable = vtkLookupTable::New();
- }
- colorLookupTable->SetTableRange(range[0],range[1]);
- colorLookupTable->Build();
- double rgba1[4];
- double rgba2[4];
- for (int iLookTable = 0; iLookTable<128; iLookTable++)
- {
- colorLookupTable->GetTableValue( iLookTable, rgba1);
- colorLookupTable->GetTableValue(256-1-iLookTable, rgba2);
-
- colorLookupTable->SetTableValue(256-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
- colorLookupTable->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
- } // for iLookTable
-
-//EED 2018-06-8 ***********************ARDS Projet***********************************************
- if (bbGetInputColorType()==2)
- {
- int tableSize=256;
- colorLookupTable = vtkLookupTable::New();
-// colorLookupTable->SetNumberOfTableValues(tableSize);
- colorLookupTable->SetTableRange(range[0],range[1]);
-// colorLookupTable->SetTableRange(0,11);
+ backColorType = bbGetInputColorType();
+ if (colors!=NULL) { colors->Delete(); }
+// if (colorLookupTable!=NULL) { colorLookupTable->Delete(); }
+// if (colorLookupTableWL!=NULL) { colorLookupTableWL->Delete(); }
+
+
+// firsttime=false;
+ // Generate the colors for each point based on the color map
+ colors = vtkUnsignedCharArray::New();
+ colors->SetNumberOfComponents(3);
+// colors->SetName("ColorsEED");
+ // Create the color map
+ if (bbGetInputColorType()==1)
+ {
+ colorLookupTableWL = vtkWindowLevelLookupTable::New();
+ colorLookupTableWL->InverseVideoOn();
+ colorLookupTable = colorLookupTableWL;
+ } else {
+ colorLookupTable = vtkLookupTable::New();
+ }
+ colorLookupTable->SetTableRange(range[0],range[1]);
colorLookupTable->Build();
-
-/*
- for (unsigned int i = 0; i < tableSize; ++i)
- {
- colorLookupTable->SetTableValue(i,
- vtkMath::Random(.25, 1.0),
- vtkMath::Random(.25, 1.0),
- vtkMath::Random(.25, 1.0),
- 1.0);
- }
-*/
-
double rgba1[4];
double rgba2[4];
- int i,j;
- for (int iLookTable = 0; iLookTable<tableSize*3; iLookTable++)
+ for (int iLookTable = 0; iLookTable<128; iLookTable++)
{
- i=rand() % tableSize;
- j=rand() % tableSize;
- colorLookupTable->GetTableValue(i, rgba1);
- colorLookupTable->GetTableValue(j, rgba2);
-
- colorLookupTable->SetTableValue(j, rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
- colorLookupTable->SetTableValue(i, rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
+ colorLookupTable->GetTableValue( iLookTable, rgba1);
+ colorLookupTable->GetTableValue(256-1-iLookTable, rgba2);
+ colorLookupTable->SetTableValue(256-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
+ colorLookupTable->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
} // for iLookTable
- } // type 2
-
-
- if (bbGetInputColorType()==3)
+ //EED 2018-06-8 ***********************ARDS Projet***********************************************
+ if (bbGetInputColorType()==2)
+ {
+ int tableSize=256;
+ colorLookupTable = vtkLookupTable::New();
+ // colorLookupTable->SetNumberOfTableValues(tableSize);
+ colorLookupTable->SetTableRange(range[0],range[1]);
+ // colorLookupTable->SetTableRange(0,11);
+ colorLookupTable->Build();
+
+ /*
+ for (unsigned int i = 0; i < tableSize; ++i)
{
- int tableSize=13;
- colorLookupTable = vtkLookupTable::New();
- colorLookupTable->SetNumberOfTableValues(tableSize);
- colorLookupTable->SetTableRange(6,range[1]);
- colorLookupTable->Build();
-
- colorLookupTable->SetTableValue(0, 1 ,1 ,1 ,1);
- colorLookupTable->SetTableValue(1, 1 ,0 ,0 ,1);
- colorLookupTable->SetTableValue(2, 0 ,1 ,0 ,1);
- colorLookupTable->SetTableValue(3, 0 ,0 ,1 ,1);
- colorLookupTable->SetTableValue(4, 0 ,1 ,1 ,1);
- colorLookupTable->SetTableValue(5, 1 ,1 ,0 ,1);
- colorLookupTable->SetTableValue(6, 1 ,0 ,1 ,1);
-
- colorLookupTable->SetTableValue(7, 0.5,1 ,1 ,1);
- colorLookupTable->SetTableValue(8, 1 ,0.5,1 ,1);
- colorLookupTable->SetTableValue(9, 1 ,1 ,0.5,1);
-
- colorLookupTable->SetTableValue(10,1 ,0.5,0.5,1);
- colorLookupTable->SetTableValue(11,0.5,0.5,1 ,1);
-
- } // type 2
-
-
-
-
- }
-
- bbGetInputMesh()->GetPointData()->SetScalars(colors);
-
- if (bbGetInputColorType()==1)
- {
- colorLookupTableWL->SetLevel( bbGetInputColorLevel() );
- colorLookupTableWL->SetWindow( bbGetInputColorWindow() );
- }
+ colorLookupTable->SetTableValue(i,
+ vtkMath::Random(.25, 1.0),
+ vtkMath::Random(.25, 1.0),
+ vtkMath::Random(.25, 1.0),
+ 1.0);
+ }
+ */
+ double rgba1[4];
+ double rgba2[4];
+ int i,j;
+ for (int iLookTable = 0; iLookTable<tableSize*3; iLookTable++)
+ {
+ i=rand() % tableSize;
+ j=rand() % tableSize;
+ colorLookupTable->GetTableValue(i, rgba1);
+ colorLookupTable->GetTableValue(j, rgba2);
+
+ colorLookupTable->SetTableValue(j, rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
+ colorLookupTable->SetTableValue(i, rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
+ } // for iLookTable
+ } // type 2
+ if (bbGetInputColorType()==3)
+ {
+ int tableSize=13;
+ colorLookupTable = vtkLookupTable::New();
+ colorLookupTable->SetNumberOfTableValues(tableSize);
+ colorLookupTable->SetTableRange(6,range[1]);
+ colorLookupTable->Build();
+ colorLookupTable->SetTableValue(0, 1 ,1 ,1 ,1);
+ colorLookupTable->SetTableValue(1, 1 ,0 ,0 ,1);
+ colorLookupTable->SetTableValue(2, 0 ,1 ,0 ,1);
+ colorLookupTable->SetTableValue(3, 0 ,0 ,1 ,1);
+ colorLookupTable->SetTableValue(4, 0 ,1 ,1 ,1);
+ colorLookupTable->SetTableValue(5, 1 ,1 ,0 ,1);
+ colorLookupTable->SetTableValue(6, 1 ,0 ,1 ,1);
+ colorLookupTable->SetTableValue(7, 0.5,1 ,1 ,1);
+ colorLookupTable->SetTableValue(8, 1 ,0.5,1 ,1);
+ colorLookupTable->SetTableValue(9, 1 ,1 ,0.5,1);
+ colorLookupTable->SetTableValue(10,1 ,0.5,0.5,1);
+ colorLookupTable->SetTableValue(11,0.5,0.5,1 ,1);
+ } // type 3
+ } // firsttime
- int missingpoints = bbGetInputMesh()->GetNumberOfPoints() - colors->GetDataSize()/colors->GetNumberOfComponents();
- for(i = 0; i < missingpoints; i++)
- {
- colors->InsertNextTuple3(0,0,0);
- }
-
- if (bbGetInputTransform()!=NULL)
- {
- bbGetInputTransform()->Update();
- }
-
- double gl;
- double p1[3];
- double p2[3];
- double dcolor[3];
- for(i = 0; i < bbGetInputMesh()->GetNumberOfPoints(); i++)
- {
- if (bbGetInputTransform()!=NULL)
+
+
+ bbGetInputMesh()->GetPointData()->SetScalars(colors);
+ if (bbGetInputColorType()==1)
+ {
+ colorLookupTableWL->SetLevel( bbGetInputColorLevel() );
+ colorLookupTableWL->SetWindow( bbGetInputColorWindow() );
+ }
+ if (bbGetInputExternalLookupTable()!=NULL)
{
- bbGetInputMesh()->GetPoint(i,p1);
- bbGetInputTransform()->TransformPoint(p1,p2);
+ generalLookupTable = bbGetInputExternalLookupTable();
} else {
- bbGetInputMesh()->GetPoint(i,p2);
+ generalLookupTable = colorLookupTable;
}
- p2[0] = p2[0]/spc[0];
- p2[1] = p2[1]/spc[1];
- p2[2] = p2[2]/spc[2];
-
- if ( (p2[0]>=0) && (p2[0]<maxX) && (p2[1]>=0) && (p2[1]<maxY) &&(p2[2]>=0) && (p2[2]<maxZ) )
+ int missingpoints = bbGetInputMesh()->GetNumberOfPoints() - colors->GetDataSize()/colors->GetNumberOfComponents();
+ for(i = 0; i < missingpoints; i++)
{
- gl = bbGetInputImage()->GetScalarComponentAsDouble(p2[0], p2[1], p2[2],0);
- } else {
- gl=0;
+ colors->InsertNextTuple3(0,0,0);
+ }
+ if (bbGetInputTransform()!=NULL)
+ {
+ bbGetInputTransform()->Update();
}
- colorLookupTable->GetColor(gl, dcolor);
- colors->SetTuple3(i,255*dcolor[0],255*dcolor[1],255*dcolor[2]);
- } // for i
- bbGetInputMesh()->Modified();
-
+ double gl;
+ double p1[3];
+ double p2[3];
+ double dcolor[3];
+ for(i = 0; i < bbGetInputMesh()->GetNumberOfPoints(); i++)
+ {
+ if (bbGetInputTransform()!=NULL)
+ {
+ bbGetInputMesh()->GetPoint(i,p1);
+ bbGetInputTransform()->TransformPoint(p1,p2);
+ } else {
+ bbGetInputMesh()->GetPoint(i,p2);
+ }
+ p2[0] = p2[0]/spc[0];
+ p2[1] = p2[1]/spc[1];
+ p2[2] = p2[2]/spc[2];
+ if ( (p2[0]>=0) && (p2[0]<maxX) && (p2[1]>=0) && (p2[1]<maxY) &&(p2[2]>=0) && (p2[2]<maxZ) )
+ {
+ gl = bbGetInputImage()->GetScalarComponentAsDouble(round(p2[0]), round(p2[1]), round(p2[2]),0);
+ } else {
+ gl=0;
+ }
+ generalLookupTable->GetColor(gl, dcolor);
+ colors->SetTuple3(i,255*dcolor[0],255*dcolor[1],255*dcolor[2]);
+ } // for i
+ bbGetInputMesh()->Modified();
+ } // if Image && Mesh
}
+
//=====
// 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)
//=====
bbSetInputColorLevel(500);
bbSetInputColorWindow(500);
bbSetInputTransform(NULL);
+ bbSetInputExternalLookupTable(NULL);
- firsttime = true;
+ backColorType = -999;
colors = NULL;
colorLookupTable = NULL;
- colorLookupTableWL = NULL;
+ colorLookupTableWL = 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)
BBTK_DECLARE_INPUT(ColorType,int);
BBTK_DECLARE_INPUT(ColorLevel,double);
BBTK_DECLARE_INPUT(ColorWindow,double);
+ BBTK_DECLARE_INPUT(ExternalLookupTable,vtkScalarsToColors*);
BBTK_DECLARE_INPUT(Transform,vtkLinearTransform*);
// BBTK_DECLARE_OUTPUT(Out,double);
BBTK_PROCESS(Process);
void Process();
- bool firsttime;
+ int backColorType;
vtkUnsignedCharArray *colors;
- vtkLookupTable *colorLookupTable;
+ vtkScalarsToColors *generalLookupTable;
+ vtkLookupTable *colorLookupTable;
vtkWindowLevelLookupTable *colorLookupTableWL;
//=====
BBTK_CATEGORY("");
BBTK_INPUT(SurfaceTexture,Mesh,"Mesh topology",vtkPolyData*,"");
BBTK_INPUT(SurfaceTexture,Image,"Image Reference",vtkImageData*,"");
- BBTK_INPUT(SurfaceTexture,ColorType,"Color Type (default 0) 0 Colors(JET), 1 ColorWindowLevel",int,"");
+ BBTK_INPUT(SurfaceTexture,ColorType,"Color Type (default 0) 0 Colors(JET-simple), 1 ColorWindowLevel, 2 Random Color, 3 Eleven colors",int,"");
BBTK_INPUT(SurfaceTexture,ColorLevel,"Color Level (default 500)",double,"");
BBTK_INPUT(SurfaceTexture,ColorWindow,"ColorWindow (default 500)",double,"");
+ BBTK_INPUT(SurfaceTexture,ExternalLookupTable,"External vtkScalarsToColors ",vtkScalarsToColors*,"");
BBTK_INPUT(SurfaceTexture,Transform,"vtk Linear Transform (default NULL)",vtkLinearTransform*,"");
// BBTK_OUTPUT(SurfaceTexture,Out,"First output",double,"");
//=====
#include "bbvtkTemporalPicker.h"
#include "bbvtkPackage.h"
+
+#include "creaVtk_MACROS.h"
+
namespace bbvtk
{
//=====
// 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 TemporalPicker::Process()
+
+
+void TemporalPicker::Process_TemporaryPicker3DT()
{
+ std::vector<double> result;
+ if (bbGetInputInLst().size()>0)
+ {
+ int ext[6];
+ int sizeX,sizeY,sizeZ,sizeT=bbGetInputInLst().size();
-// 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')
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ bbGetInputInLst()[0]->GetWholeExtent(ext);
+#else
+ bbGetInputInLst()[0]->GetExtent(ext);
+#endif
+
+ sizeX = ext[1]-ext[0]+1;
+ sizeY = ext[3]-ext[2]+1;
+ sizeZ = ext[5]-ext[4]+1;
+
+ if (bbGetInputPoint().size()>=3)
+ {
+ int px = bbGetInputPoint()[0];
+ int py = bbGetInputPoint()[1];
+ int pz = bbGetInputPoint()[2];
+ int minX = px-bbGetInputSizeRegion()-1;
+ int maxX = px+bbGetInputSizeRegion()-1;
+ int minY = py-bbGetInputSizeRegion()-1;
+ int maxY = py+bbGetInputSizeRegion()-1;
+ int minZ = pz-bbGetInputSizeRegion()-1;
+ int maxZ = pz+bbGetInputSizeRegion()-1;
+
+ if ( (minX>=0) &&
+ (maxX<sizeX) &&
+ (minY>=0) &&
+ (maxY<sizeY) &&
+ (minZ>=0) &&
+ (maxZ<sizeZ) )
+ {
+ int i,j,k,t;
+ int numElem;
+ double acum;
+ long int index = px + py*sizeX + pz*sizeX*sizeY;
+
+ DEF_POINTER_IMAGE_VTK_CREA(vIn,ssIn,pIn,stIn,bbGetInputInLst()[0] )
+
+ for (t=0;t<sizeT;t++)
+ {
+ pIn=(char*)( bbGetInputInLst()[t]->GetScalarPointer() );
+ acum = 0;
+ numElem = 0;
+
+ GETVALUE2_VTK_CREA(vIn,pIn,stIn,index)
+ numElem++;
+ acum = acum + vIn;
+/*
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region 3D calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region 3D calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region 3D calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region 3D calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region 3D calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region 3D calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region 3D calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region 3D calcule missing ...........\n");
+*/
+
+/*
+ for(i=minX;i<=maxX;i++)
+ {
+ for(j=minY;j<=maxY;j++)
+ {
+// if ((i>=0) && (i<sizeX) && (j>=0) && (j<sizeY) )
+// {
+ acum = acum + bbGetInputIn()->GetScalarComponentAsDouble(i, j, k, 0);
+ numElem++;
+// }// if i j
+ }// for j
+ } // for i
+
+*/
+ if (numElem>0)
+ {
+ result.push_back( acum/numElem ); /// ???????????? Aqui ????
+ } else {
+ result.push_back( 0 );
+ } // numElem
+
+ } // for k
+ } // px py
+ } else {// bbGetInputPoint
+ printf("ERROR: Input:Point is not good defined in TemporalPicker Box..\n ");
+ } // bbGetInputPoint
+ } else {// bbGetInputIn
+ printf("ERROR: Missing Input:In vtkImageData* in TemporalPicker Box..\n ");
+ } // bbGetInputIn
+ bbSetOutputOut(result);
+}
-
+
+//--------------------------------------------------------------------------------------------
+void TemporalPicker::Process_TemporaryPicker2DT()
+{
std::vector<double> result;
if (bbGetInputIn()!=NULL)
{
sizeY=ext[3]-ext[2]+1;
sizeZ=ext[5]-ext[4]+1;
+
if (bbGetInputPoint().size()>=2)
{
int px=bbGetInputPoint()[0];
int py=bbGetInputPoint()[1];
- int pz=bbGetInputPoint()[2];
+//EED Eraseme int pz=bbGetInputPoint()[2];
+
+ int minX,maxX,minY,maxY;
+ minX = px-bbGetInputSizeRegion()-1;
+ maxX = px+bbGetInputSizeRegion()-1;
+ minY = py-bbGetInputSizeRegion()-1;
+ maxY = py+bbGetInputSizeRegion()-1;
- if ((px>=0) && (px<sizeX) && (py>=0) && (py<sizeY) )
+ if ( (minX>=0) &&
+ (maxX<sizeX) &&
+ (minY>=0) &&
+ (maxY<sizeY) )
{
- int i,j,k;
- int minX,maxX,minY,maxY;
- int acum,numElem;
- minX=px-bbGetInputSizeRegion()-1;
- maxX=px+bbGetInputSizeRegion()-1;
- minY=py-bbGetInputSizeRegion()-1;
- maxY=py+bbGetInputSizeRegion()-1;
- for (k=0;k<sizeZ;k++)
+ int i,j,t;
+ int numElem;
+ double acum;
+
+ long int index = px+py*sizeX;
+ long int stepIndex = sizeX*sizeY;
+ DEF_POINTER_IMAGE_VTK_CREA(vIn,ssIn,pIn,stIn,bbGetInputIn() )
+
+ for (t=0;t<sizeZ;t++)
{
- acum=0;
- numElem=0;
+ acum = 0;
+ numElem = 0;
+
+ GETVALUE2_VTK_CREA(vIn,pIn,stIn,index)
+ numElem++;
+ acum = acum + vIn;
+ index = index + stepIndex;
+/*
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region ....2D...... calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region ....2D...... calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region ....2D...... calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region ....2D...... calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region ....2D...... calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region ....2D...... calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region ....2D...... calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region ....2D...... calcule missing ...........\n");
+printf("EED Warnning !!!!!! TemporalPicker::Process Clean this method region ....2D...... calcule missing ...........\n");
+*/
+/*
for(i=minX;i<=maxX;i++)
{
for(j=minY;j<=maxY;j++)
{
- if ((i>=0) && (i<sizeX) && (j>=0) && (j<sizeY) )
- {
+// if ((i>=0) && (i<sizeX) && (j>=0) && (j<sizeY) )
+// {
acum = acum + bbGetInputIn()->GetScalarComponentAsDouble(i, j, k, 0);
numElem++;
- }// i j
+// }// if i j
}// for j
} // for i
+*/
if (numElem>0)
{
- result.push_back( acum/numElem );
+ result.push_back( acum/numElem ); /// Aqui ?????
} else {
result.push_back( 0 );
} // numElem
} else {// bbGetInputIn
printf("ERROR: Missing Input:In vtkImageData* in TemporalPicker Box..\n ");
} // bbGetInputIn
-
bbSetOutputOut(result);
}
+
+void TemporalPicker::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+
+
+ if (bbGetInputInLst().size()>0)
+ {
+ Process_TemporaryPicker3DT();
+ } else {
+ Process_TemporaryPicker2DT();
+ }
+
+}
//=====
// 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)
//=====
# ------------------------------------------------------------------------ */
-//=====
-// 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 __bbvtkTemporalPicker_h_INCLUDED__
#define __bbvtkTemporalPicker_h_INCLUDED__
#include "bbvtk_EXPORT.h"
#include "vtkImageData.h"
-
namespace bbvtk
{
-class bbvtk_EXPORT TemporalPicker
- :
- public bbtk::AtomicBlackBox
+class bbvtk_EXPORT TemporalPicker : public bbtk::AtomicBlackBox
{
BBTK_BLACK_BOX_INTERFACE(TemporalPicker,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,vtkImageData*);
+ BBTK_DECLARE_INPUT(InLst,std::vector < vtkImageData*> );
BBTK_DECLARE_INPUT(SizeRegion,int);
BBTK_DECLARE_INPUT(Point,std::vector<int>);
BBTK_DECLARE_OUTPUT(Out,std::vector<double>);
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)
-//=====
+
+ void Process();
+ void Process_TemporaryPicker2DT();
+ void Process_TemporaryPicker3DT();
+
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(TemporalPicker,bbtk::AtomicBlackBox);
BBTK_AUTHOR("Info-Dev");
BBTK_DESCRIPTION("Pick vector in Z direction (2D+t => 3D)");
BBTK_CATEGORY("");
- BBTK_INPUT(TemporalPicker,In,"Input image",vtkImageData*,"");
+ BBTK_INPUT(TemporalPicker,In,"In image or InLst images",vtkImageData*,"");
+ BBTK_INPUT(TemporalPicker,InLst,"In image or InLst images",std::vector<vtkImageData*>,"");
BBTK_INPUT(TemporalPicker,SizeRegion,"Size region (default 1)",int,"");
BBTK_INPUT(TemporalPicker,Point,"Point [x,y]",std::vector<int>,"");
BBTK_OUTPUT(TemporalPicker,Out,"Output vector with Z information",std::vector<double>,"");
BBTK_END_DESCRIBE_BLACK_BOX(TemporalPicker);
-//=====
-// 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 bbvtk
bbUserFinalizeProcessing();
result = vtkTransform::New();
result->Update();
+ resultInverse = vtkTransform::New();
+ resultInverse->Update();
}
// --------------------------------------------------------------
if (bbGetInputIn()!=NULL)
{
result->Concatenate( bbGetInputIn()->GetMatrix() );
- }
-
+ } // if In
if ((bbGetInputTranslate().size()>=3) && (bbGetInputSpacing().size()>=3))
{
double tx = bbGetInputTranslate()[0] * bbGetInputSpacing()[0];
double ty = bbGetInputTranslate()[1] * bbGetInputSpacing()[1];
double tz = bbGetInputTranslate()[2] * bbGetInputSpacing()[2];
result->Translate(tx,ty,tz);
- }
-
+ } // if translate spacing size >=3
if (bbGetInputScale().size()>=3)
{
result->Scale(bbGetInputScale()[0], bbGetInputScale()[1], bbGetInputScale()[2]);
- }
-
+ } // if scale size >=3
if (bbGetInputRotateWXYZ().size()>=4)
{
result->RotateWXYZ(bbGetInputRotateWXYZ()[0],bbGetInputRotateWXYZ()[1], bbGetInputRotateWXYZ()[2], bbGetInputRotateWXYZ()[3]);
- }
+ } // if rotation size >=4
- bbSetOutputOut(result);
+ if (bbGetInputInverse()==false)
+ {
+ bbSetOutputOut(result);
+ } else {
+ vtkMatrix4x4 *matrix;
+ matrix=vtkMatrix4x4::New();
+ result->GetInverse(matrix);
+ resultInverse->SetMatrix( matrix );
+ bbSetOutputOut(resultInverse);
+ } // if Inverse
}
-}
-// EO namespace bbvtk
+
+}// EO namespace bbvtk
public bbtk::AtomicBlackBox
{
BBTK_BLACK_BOX_INTERFACE(Transform,bbtk::AtomicBlackBox);
+ BBTK_DECLARE_INPUT(Inverse,bool);
BBTK_DECLARE_INPUT(In,vtkLinearTransform *);
BBTK_DECLARE_INPUT(Scale,std::vector<double>);
BBTK_DECLARE_INPUT(RotateWXYZ,std::vector<double>);
std::vector<double> vecRotateWXYZ;
std::vector<double> vecTranslate;
std::vector<double> vecSpacing;
- vtkTransform *result;
+ vtkTransform *result;
+ vtkTransform *resultInverse;
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(Transform,bbtk::AtomicBlackBox);
BBTK_DESCRIPTION("vtkTransform");
BBTK_CATEGORY("math");
+ BBTK_INPUT(Transform,Inverse,"(default false) true/false",bool,"");
BBTK_INPUT(Transform,In,"vtkTransform to be concatenate",vtkLinearTransform *,"");
BBTK_INPUT(Transform,Scale,"vector with sx sy sz",std::vector<double>,"");
BBTK_INPUT(Transform,Translate,"vector with x y z",std::vector<double>,"");
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C11/creatools_source/bbtk/packages/wx/bbs/appli/example_SpinCtrl.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:3
+BOX
+wx:SpinCtrl:Box00
+ISEXEC:FALSE
+-63.378740:69.384705:-900.000000
+-24.298740:59.384705:-900.000000
+PORT
+Selected:"50"
+PORT
+Type:"1"
+FIN_BOX
+BOX
+wx:LayoutLine:Box01
+ISEXEC:TRUE
+-82.661050:20.704775:-900.000000
+-25.101050:10.704775:-900.000000
+FIN_BOX
+BOX
+wx:OutputText:Box02
+ISEXEC:FALSE
+-44.096430:49.470189:-900.000000
+-7.321430:39.470189:-900.000000
+FIN_BOX
+CONNECTIONS:4
+CONNECTION
+Box00:Widget:Box01:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box02:Widget:Box01:Widget5
+NumberOfControlPoints:0
+CONNECTION
+Box00:BoxChange:Box02:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box00:Out:Box02:In
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /home/davila/Creatis/C11/creatools_source/bbtk/packages/wx/bbs/appli/example_SpinCtrl.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include wx
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new wx:SpinCtrl Box00
+ set Box00.Selected "50"
+ set Box00.Type "1"
+
+new wx:LayoutLine Box01
+
+new wx:OutputText Box02
+
+
+connect Box00.Widget Box01.Widget1
+
+connect Box02.Widget Box01.Widget5
+
+connect Box00.BoxChange Box02.BoxExecute
+
+connect Box00.Out Box02.In
+
+
+
+# Complex input ports
+exec Box01
#include <wx/control.h>
#include <wx/listbox.h>
+#include <wx/spinbutt.h>
+
namespace bbwx
{
//--------------------------------------------------------------------------
void FillItems( int iSelection, std::vector< std::string > lstIn);
void VerifyDeselect(int iSelection);
+ void OnSpinCtrlClick(wxCommandEvent& event);
+
+
private:
int mTypeForm;
ComboBox *mBox;
- wxItemContainer* itemcontainer;
+ wxItemContainer *itemcontainer;
+ wxSpinButton *mwxspinbutton;
};
mBox(box),
mTypeForm(typeForm)
{
- wxPanel *panel = this;
+ mwxspinbutton = NULL;
itemcontainer = NULL;
- int i;
-
+ wxPanel *panel = this;
+ int i;
//---------------------------------------------------------------------
// 2) Insertion of the components in the window
// We use a FlexGridSizer
- wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+// wxFlexGridSizer *sizerV = new wxFlexGridSizer(1);
+// wxFlexGridSizer *sizerH1 = new wxFlexGridSizer(0);
+// wxFlexGridSizer *sizerH2 = new wxFlexGridSizer(2);
+ wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
+
if (title!="")
{
sizer->Add( new wxStaticText(panel,-1, bbtk::std2wx(title) ) );
+ sizer->Add( new wxStaticText(panel,-1, _T("") ) );
}
//---------------------------------------------------------------------
if (mTypeForm==1)
itemcontainer=wxlistbox;
sizer->Add( wxlistbox,1,wxEXPAND );
Connect( wxlistbox->GetId(),
- wxEVT_COMMAND_LISTBOX_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
+ wxEVT_COMMAND_LISTBOX_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
} else if (mTypeForm==0) {
- wxChoice *wxchoice = new wxChoice ( panel , -1);
+ wxChoice *wxchoice = new wxChoice ( panel , -1, wxDefaultPosition,wxSize(sizeX,sizeY));
itemcontainer=wxchoice;
sizer->Add( wxchoice,1,wxGROW );
-
Connect( wxchoice->GetId(),
wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
}
- sizer->AddGrowableCol(0);
- panel->SetSizer(sizer);
- for (i=0;i<lstIn.size(); i++)
+ if (mBox->bbGetInputWithSpinButton()==true)
{
- itemcontainer->Append( bbtk::std2wx( lstIn[i] ) );
- } // for i
-// itemcontainer->SetSelection(iSelection);
+ mwxspinbutton = new wxSpinButton( panel, -1 );
+ Connect( mwxspinbutton->GetId(),
+ wxEVT_SPIN,
+ (wxObjectEventFunction)
+ (void (wxPanel::*)(wxScrollEvent&))
+ &ComboBoxWidget::OnSpinCtrlClick);
+ sizer->Add( mwxspinbutton,1,wxEXPAND );
+ }
+ sizer->AddGrowableCol(0);
+
+ panel->SetSizer(sizer);
+ FillItems( iSelection,lstIn );
}
//-------------------------------------------------------------------------
{
mBox->bbSetInputSelection( iSelection );
mBox->bbSetOutputOut( iSelection );
- mBox->bbSetOutputOutString( bbtk::wx2std( itemcontainer->GetString(iSelection) ) );
- mBox->bbSignalOutputModification();
+// Patch to clean the spaces at the begining
+ std::string tmpStr = bbtk::wx2std( itemcontainer->GetString(iSelection) );
+ if (tmpStr.length()>0) { while(tmpStr[0]==' ') tmpStr.erase(0,1); }
+ mBox->bbSetOutputOutString( tmpStr );
+// mBox->bbSetOutputOutString( bbtk::wx2std( itemcontainer->GetString(iSelection) ) );
+
+ mBox->bbSignalOutputModification();
VerifyDeselect(iSelection);
+ if (mTypeForm==0)
+ {
+ wxChoice *wxchoise=(wxChoice *)itemcontainer;
+ wxchoise->SetToolTip( itemcontainer->GetString(iSelection) );
+ } // if mTypeForm
+
// mBox->bbSignalOutputModification("Out");
// mBox->bbSignalOutputModification("OutString");
} // if iSelection
}
- //--------------------------------------------------------------------------
- void ComboBoxWidget::OnComboBox(wxEvent& event)
- {
- OnComboBoxSelection( itemcontainer->GetSelection() );
- }
//--------------------------------------------------------------------------
- void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn )
+void ComboBoxWidget::OnComboBox(wxEvent& event)
+{
+ int iSelection = itemcontainer->GetSelection();
+ OnComboBoxSelection( iSelection );
+ if (mBox->bbGetInputWithSpinButton()==true)
{
- int i;
- itemcontainer->Clear();
- for (i=0;i<lstIn.size(); i++)
- {
- itemcontainer->Append( bbtk::std2wx( lstIn[i] ) );
- } // for i
- if (iSelection>=0) itemcontainer->SetSelection(iSelection);
- }
+ mwxspinbutton->SetValue( iSelection );
+ }
+
+}
+
+//--------------------------------------------------------------------------
+void ComboBoxWidget::OnSpinCtrlClick(wxCommandEvent& event)
+{
+ int iSelection = mwxspinbutton->GetValue();
+ itemcontainer->SetSelection(iSelection);
+ OnComboBoxSelection( iSelection );
+}
+
+
+//--------------------------------------------------------------------------
+void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn )
+{
+ int i,size = lstIn.size();
+
+
+#if defined(_WIN32)
+ // Patch to put spaces at the beginin
+#else
+ // Patch to put spaces at the beginin
+ int strLength=-1;
+ // Looking for the longest string
+ for (i=0 ;i<size; i++)
+ {
+ if ( strLength < (int) lstIn[i].length() ) { strLength=lstIn[i].length(); }
+ } // for
+ // Adding spaces at the bigining to the others strings in the list to have the same size
+ int ii,len2;
+ for (i=0 ;i<size; i++)
+ {
+ len2 = strLength - lstIn[i].length();
+ for (ii=0;ii<len2;ii++)
+ {
+ lstIn[i]=" "+lstIn[i]; // spaces characters
+ } // for ii
+ } // for i
+#endif // defined(_WIN32)
+
+ itemcontainer->Clear();
+ for (i=0;i<size; i++)
+ {
+ itemcontainer->Append( bbtk::std2wx( lstIn[i] ) );
+ } // for i
+ if (iSelection>=0)
+ {
+ itemcontainer->SetSelection(iSelection);
+ if (mBox->bbGetInputWithSpinButton()==true)
+ {
+ mwxspinbutton->SetRange( 0,size-1 );
+ mwxspinbutton->SetValue( iSelection );
+ }
+
+ } // iSelection
+
+ if (mTypeForm==0)
+ {
+ ((wxChoice*)itemcontainer)->SetAutoLayout( true );
+ ((wxChoice*)itemcontainer)->Layout( );
+ } // if mTypeForm
+}
BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ComboBox)
BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WxBlackBox);
+
//=====
// 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 ComboBox::Process()
{
int iSelection = bbGetInputSelection();
- if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=bbGetInputIn().size()-1; }
+// if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=bbGetInputIn().size()-1; }
+ if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=0; }
ComboBoxWidget *w = (ComboBoxWidget*)bbGetOutputWidget();
w->FillItems( iSelection, bbGetInputIn() );
bbSetInputSelection( iSelection );
bbSetOutputOut( iSelection );
int size = bbGetInputIn().size();
- if ( (iSelection>0) && ( (size-1)<=iSelection) )
+ if ( (iSelection>=0) && ( iSelection<size) )
{
bbSetOutputOutString( bbGetInputIn()[ iSelection ] );
} // if iSelection
-
w->VerifyDeselect(iSelection);
}
//=====
bbGetInputForm(),
bbGetInputWinWidth(), bbGetInputWinHeight() );
bbSetOutputOut( bbGetInputSelection() );
- bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
+ if (bbGetInputIn().size()> bbGetInputSelection() )
+ {
+ bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
+ } // if InputIn size
bbSetOutputWidget( w );
}
//=====
bbSetInputSelection(0);
bbSetInputTitle("");
bbSetInputForm(0);
- bbSetInputWinWidth(100);
- bbSetInputWinHeight(200);
+ bbSetInputWinWidth(10);
+ bbSetInputWinHeight(45);
bbSetInputDeselect(false);
+ bbSetInputWithSpinButton(false);
}
//=====
// 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::vector< std::string >);
BBTK_DECLARE_INPUT(Form, int );
BBTK_DECLARE_INPUT(Deselect, bool );
+ BBTK_DECLARE_INPUT(WithSpinButton, bool );
+
BBTK_DECLARE_OUTPUT(Out, int );
BBTK_DECLARE_OUTPUT(OutString, std::string );
+
BBTK_PROCESS(Process);
void Process();
BBTK_CREATE_WIDGET(CreateWidget);
BBTK_AUTHOR("Info-Dev");
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("__CategoryBlackBox__");
+
BBTK_INPUT(ComboBox,Title,"Title prepended to the text",std::string,"");
BBTK_INPUT(ComboBox,Selection,"i element to be selected (default 0)",int,"");
BBTK_INPUT(ComboBox,In,"Vector of strings",std::vector< std::string >,"");
BBTK_INPUT(ComboBox,Form,"0 Combobox, 1 List (default 0)",int,"");
BBTK_INPUT(ComboBox,Deselect,"(default false) Just for List form",bool,"");
+ BBTK_INPUT(ComboBox,WithSpinButton,"(default false) With spin button true/false",bool,"");
+
BBTK_OUTPUT(ComboBox,Out,"i Item selected",int,"");
BBTK_OUTPUT(ComboBox,OutString,"string Item selected",std::string,"");
+
BBTK_END_DESCRIBE_BLACK_BOX(ComboBox);
//=====
// 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)
{
// If no executer : create a totally independant interpreter
I = bbtk::Interpreter::New();
- }
- else
- {
+ } else {
// If executer : create an interpreter using E
I = bbtk::Interpreter::New(E);
}
{
ok=false;
ccommand=commandstr.substr(pos1,commandstr.length()-pos1 );
- }
- else
- {
+ } else {
ccommand=commandstr.substr(pos1,pos2-pos1);
}
for ( i=0 ; i < ccommand.length() ; i++)
{
if (ccommand[i]==39) // '
- {
- ccommand[i]=34; // "
- }
+ {
+ ccommand[i]=34; // "
+ }
}
I->InterpretLine( ccommand );
pos1=pos2+1;
--- /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 "bbwxFreeMemoryAlert.h"
+#include "bbwxPackage.h"
+#include <wx/msgdlg.h>
+
+namespace bbwx
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,FreeMemoryAlert)
+BBTK_BLACK_BOX_IMPLEMENTATION(FreeMemoryAlert,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 FreeMemoryAlert::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')
+
+ 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(),
+ memfreeGB ),
+ _T("Warning!"),
+ wxOK | wxICON_INFORMATION,
+ NULL);
+ } // 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
+
+
+}
+//=====
+// 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
+
+
--- /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 __bbwxFreeMemoryAlert_h_INCLUDED__
+#define __bbwxFreeMemoryAlert_h_INCLUDED__
+
+#include "bbwx_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbwx
+{
+
+class bbwx_EXPORT FreeMemoryAlert
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(FreeMemoryAlert,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(FreeMemoryLimit,double);
+// BBTK_DECLARE_OUTPUT(Out,double);
+ 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(FreeMemoryAlert,bbtk::AtomicBlackBox);
+ BBTK_NAME("FreeMemoryAlert");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(FreeMemoryAlert,FreeMemoryLimit,"(default 1) Limit free memory en GB",double,"");
+// BBTK_OUTPUT(FreeMemoryAlert,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(FreeMemoryAlert);
+//=====
+// 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 bbwx
+
+#endif // __bbwxFreeMemoryAlert_h_INCLUDED__
+
{
public:
InputTextWidget(InputText* box, wxWindow *parent,
- wxString In, wxString title);
+ wxString In, wxString title );
~InputTextWidget();
std::string GetValue();
InputTextWidget::InputTextWidget(InputText* box,
wxWindow *parent,
wxString In,
- wxString title)
+ wxString title )
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
mBox(box)
{
wxPanel *panel = this;
-
- mwxTextCtrl = new wxTextCtrl( panel, -1, In,wxDefaultPosition, wxSize(800,20),wxTE_PROCESS_ENTER);
+
+//wxTE_PROCESS_ENTER
+//wxTE_MULTILINE
+//wxTE_PASSWORD
+ mwxTextCtrl = new wxTextCtrl( panel, -1, In,wxDefaultPosition, wxSize(80,80) , wxTE_PROCESS_ENTER);
Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_ENTER,
(wxObjectEventFunction)
(wxEventFunction)
wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
mwxTitle = new wxStaticText(panel, -1, title );
sizer-> Add( mwxTitle );
- sizer-> Add( mwxTextCtrl, 1, wxGROW );
+ sizer-> Add( mwxTextCtrl, 1, wxEXPAND );
sizer-> AddGrowableCol(0);
panel-> SetSizer(sizer);
firsttime=true;
bbSetInputTitle("");
bbSetInputIn("");
- bbSetOutputWidget(0);
+ bbSetOutputWidget(NULL);
bbSetInputReactiveOnKeystroke(2);
}
void InputText::CreateWidget(wxWindow* parent)
{
bbSetOutputWidget
- ( (wxWindow*) new InputTextWidget(this, //bbGetWxParent(),
- parent,
- bbtk::std2wx ( bbGetInputIn() ) ,
- bbtk::std2wx ( bbGetInputTitle() ) ) );
+ ( (wxWindow*) new InputTextWidget( this, //bbGetWxParent(),
+ parent,
+ bbtk::std2wx ( bbGetInputIn() ) ,
+ bbtk::std2wx ( bbGetInputTitle() )
+ )
+ );
}
}//namespace bbtk
BBTK_AUTHOR("laurent guigues at creatis.insa-lyon.fr");
BBTK_DESCRIPTION("A zone in which the user can enter a text (wxTextCtrl)");
BBTK_INPUT(InputText,In,"Initial text (default '')",std::string,"");
-
BBTK_INPUT(InputText,Title,"Title of the input zone (default '') ", std::string,"");
BBTK_INPUT(InputText,ReactiveOnKeystroke,"0 not event generated, 1 Enter event genereated, 2 All keys, (default '2') ", int,"");
-
BBTK_OUTPUT(InputText,Out,"Current text",std::string,"");
BBTK_END_DESCRIBE_BLACK_BOX(InputText);
--- /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 "bbwxInputTextMultiLine.h"
+#include "bbwxPackage.h"
+namespace bbwx
+{
+
+
+ //--------------------------------------------------------------------------
+ class InputTextMultiLineWidget : wxPanel
+ {
+ public:
+ InputTextMultiLineWidget(InputTextMultiLine* box, wxWindow *parent,
+ wxString In, wxString title );
+ ~InputTextMultiLineWidget();
+
+ std::string GetValue();
+ void SetValue(std::string value);
+
+ void OnTextEnter(wxCommandEvent& event);
+ void OnTextUpdate(wxCommandEvent& event);
+
+ void SetTitle(wxString);
+
+ private:
+ InputTextMultiLine *mBox;
+ wxTextCtrl *mwxTextCtrl;
+ wxStaticText *mwxTitle;
+ };
+
+ //------------------------------------------------------------------------
+ //------------------------------------------------------------------------
+ //------------------------------------------------------------------------
+
+ InputTextMultiLineWidget::InputTextMultiLineWidget(InputTextMultiLine* box,
+ wxWindow *parent,
+ wxString In,
+ wxString title )
+ : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
+ mBox(box)
+ {
+ wxPanel *panel = this;
+
+//wxTE_PROCESS_ENTER
+//wxTE_MULTILINE
+//wxTE_PASSWORD
+ mwxTextCtrl = new wxTextCtrl( panel, -1, In,wxDefaultPosition, wxSize(40,40) , wxTE_MULTILINE);
+ Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_ENTER,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCommandEventFunction)
+ (void (wxPanel::*)(wxCommandEvent&))
+ &InputTextMultiLineWidget::OnTextEnter );
+
+ Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCommandEventFunction)
+ (void (wxPanel::*)(wxCommandEvent&))
+ &InputTextMultiLineWidget::OnTextUpdate );
+
+
+ wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+ mwxTitle = new wxStaticText(panel, -1, title );
+ sizer->Add( mwxTitle );
+ sizer->Add( mwxTextCtrl, 1, wxEXPAND );
+ sizer->AddGrowableCol(0);
+ sizer->AddGrowableRow(1);
+
+ panel-> SetSizer(sizer);
+ panel-> SetAutoLayout(true);
+ panel-> Layout();
+
+ }
+ //-------------------------------------------------------------------------
+
+ InputTextMultiLineWidget::~InputTextMultiLineWidget()
+ {
+ }
+
+ //-------------------------------------------------------------------------
+
+
+ void InputTextMultiLineWidget::SetTitle(wxString s)
+ {
+ mwxTitle->SetLabel(s);
+ }
+
+ //-------------------------------------------------------------------------
+ std::string InputTextMultiLineWidget::GetValue()
+ {
+ return bbtk::wx2std ( mwxTextCtrl->GetValue() );
+ }
+
+ void InputTextMultiLineWidget::SetValue(std::string value)
+ {
+ mwxTextCtrl->SetValue( bbtk::std2wx(value) ) ;
+ }
+
+ //--------------------------------------------------------------------------
+ void InputTextMultiLineWidget::OnTextUpdate(wxCommandEvent& event)
+ {
+ if (mBox->bbGetInputReactiveOnKeystroke()==2){
+ mBox->bbSetOutputOut( GetValue() );
+ mBox->bbSetInputIn( GetValue() );
+ mBox->bbSignalOutputModification("Out");
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ void InputTextMultiLineWidget::OnTextEnter(wxCommandEvent& event)
+ {
+ if (mBox->bbGetInputReactiveOnKeystroke()==1){
+ mBox->bbSetOutputOut( GetValue() );
+ mBox->bbSetInputIn( GetValue() );
+ mBox->bbSignalOutputModification("Out");
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //--------------------------------------------------------------------------
+ //--------------------------------------------------------------------------
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,InputTextMultiLine)
+BBTK_BLACK_BOX_IMPLEMENTATION(InputTextMultiLine,bbtk::WxBlackBox);
+//=====
+// 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 InputTextMultiLine::Process()
+{
+ InputTextMultiLineWidget *w=(InputTextMultiLineWidget *)bbGetOutputWidget();
+ if (w)
+ {
+ if (firsttime==true)
+ {
+ firsttime=false;
+ w->SetValue( bbGetInputIn().c_str() );
+ }
+ w->SetTitle( bbtk::std2wx ( bbGetInputTitle() ) );
+ bbSetOutputOut( w->GetValue() );
+ } else {
+ bbSetOutputOut( "<VOID>" );
+ }
+}
+//=====
+// 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 InputTextMultiLine::CreateWidget(wxWindow* parent)
+{
+ bbSetOutputWidget
+ ( (wxWindow*) new InputTextMultiLineWidget( this, //bbGetWxParent(),
+ parent,
+ bbtk::std2wx ( bbGetInputIn() ) ,
+ bbtk::std2wx ( bbGetInputTitle() )
+ )
+ );
+}
+//=====
+// 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 InputTextMultiLine::bbUserSetDefaultValues()
+{
+ firsttime=true;
+ bbSetInputTitle("");
+ bbSetInputIn("");
+ bbSetOutputWidget(NULL);
+ bbSetInputReactiveOnKeystroke(2);
+}
+//=====
+// 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 InputTextMultiLine::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 InputTextMultiLine::bbUserFinalizeProcessing()
+{
+
+}
+}
+// EO namespace bbwx
+
+
--- /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)
+//=====
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbwxInputTextMultiLine_h_INCLUDED__
+#define __bbwxInputTextMultiLine_h_INCLUDED__
+
+#include "bbwx_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+namespace bbwx
+{
+
+class bbwx_EXPORT InputTextMultiLine
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(InputTextMultiLine,bbtk::WxBlackBox);
+//=====
+// 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(Title,std::string);
+ BBTK_DECLARE_INPUT(ReactiveOnKeystroke,int);
+ BBTK_DECLARE_OUTPUT(Out,std::string);
+
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget(wxWindow*);
+
+ private:
+ bool firsttime;
+
+//=====
+// 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(InputTextMultiLine,bbtk::WxBlackBox);
+ BBTK_NAME("InputTextMultiLine");
+ BBTK_AUTHOR("Info-Dev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("__CategoryBlackBox__");
+
+ BBTK_INPUT(InputTextMultiLine,In,"Initial text (default '')",std::string,"");
+ BBTK_INPUT(InputTextMultiLine,Title,"Title of the input zone (default '') ", std::string,"");
+ BBTK_INPUT(InputTextMultiLine,ReactiveOnKeystroke,"0 not event generated, 1 Enter event genereated, 2 All keys, (default '2') ", int,"");
+ BBTK_OUTPUT(InputTextMultiLine,Out,"Current text",std::string,"");
+
+
+BBTK_END_DESCRIBE_BLACK_BOX(InputTextMultiLine);
+//=====
+// 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 bbwx
+
+#endif // __bbwxInputTextMultiLine_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
--- /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 "bbwxInputTextPassword.h"
+#include "bbwxPackage.h"
+namespace bbwx
+{
+
+
+ //--------------------------------------------------------------------------
+ class InputTextPasswordWidget : wxPanel
+ {
+ public:
+ InputTextPasswordWidget(InputTextPassword* box, wxWindow *parent,
+ wxString In, wxString title );
+ ~InputTextPasswordWidget();
+
+ std::string GetValue();
+ void SetValue(std::string value);
+
+ void OnTextEnter(wxCommandEvent& event);
+ void OnTextUpdate(wxCommandEvent& event);
+
+ void SetTitle(wxString);
+
+ private:
+ InputTextPassword *mBox;
+ wxTextCtrl *mwxTextCtrl;
+ wxStaticText *mwxTitle;
+ };
+
+ //------------------------------------------------------------------------
+ //------------------------------------------------------------------------
+ //------------------------------------------------------------------------
+
+ InputTextPasswordWidget::InputTextPasswordWidget(InputTextPassword* box,
+ wxWindow *parent,
+ wxString In,
+ wxString title )
+ : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
+ mBox(box)
+ {
+ wxPanel *panel = this;
+
+//wxTE_PROCESS_ENTER
+//wxTE_MULTILINE
+//wxTE_PASSWORD
+
+ mwxTextCtrl = new wxTextCtrl( panel, -1, In,wxDefaultPosition, wxSize(40,40) , wxTE_PASSWORD);
+ Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_ENTER,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCommandEventFunction)
+ (void (wxPanel::*)(wxCommandEvent&))
+ &InputTextPasswordWidget::OnTextEnter );
+
+ Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCommandEventFunction)
+ (void (wxPanel::*)(wxCommandEvent&))
+ &InputTextPasswordWidget::OnTextUpdate );
+
+ wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+ mwxTitle = new wxStaticText(panel, -1, title );
+ sizer-> Add( mwxTitle );
+ sizer-> Add( mwxTextCtrl, 1, wxEXPAND );
+ sizer-> AddGrowableCol(0);
+
+ panel-> SetSizer(sizer);
+ panel-> SetAutoLayout(true);
+ panel-> Layout();
+
+ }
+ //-------------------------------------------------------------------------
+
+ InputTextPasswordWidget::~InputTextPasswordWidget()
+ {
+ }
+
+ //-------------------------------------------------------------------------
+
+
+ void InputTextPasswordWidget::SetTitle(wxString s)
+ {
+ mwxTitle->SetLabel(s);
+ }
+
+ //-------------------------------------------------------------------------
+ std::string InputTextPasswordWidget::GetValue()
+ {
+ return bbtk::wx2std ( mwxTextCtrl->GetValue() );
+ }
+
+ void InputTextPasswordWidget::SetValue(std::string value)
+ {
+ mwxTextCtrl->SetValue( bbtk::std2wx(value) ) ;
+ }
+
+ //--------------------------------------------------------------------------
+ void InputTextPasswordWidget::OnTextUpdate(wxCommandEvent& event)
+ {
+ if (mBox->bbGetInputReactiveOnKeystroke()==2){
+ mBox->bbSetOutputOut( GetValue() );
+ mBox->bbSetInputIn( GetValue() );
+ mBox->bbSignalOutputModification("Out");
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ void InputTextPasswordWidget::OnTextEnter(wxCommandEvent& event)
+ {
+ if (mBox->bbGetInputReactiveOnKeystroke()==1){
+ mBox->bbSetOutputOut( GetValue() );
+ mBox->bbSetInputIn( GetValue() );
+ mBox->bbSignalOutputModification("Out");
+ }
+ }
+
+
+ //--------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //--------------------------------------------------------------------------
+ //--------------------------------------------------------------------------
+
+
+
+
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,InputTextPassword)
+BBTK_BLACK_BOX_IMPLEMENTATION(InputTextPassword,bbtk::WxBlackBox);
+//=====
+// 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 InputTextPassword::Process()
+{
+ InputTextPasswordWidget *w=(InputTextPasswordWidget *)bbGetOutputWidget();
+ if (w)
+ {
+ if (firsttime==true)
+ {
+ firsttime=false;
+ w->SetValue( bbGetInputIn().c_str() );
+ }
+ w->SetTitle( bbtk::std2wx ( bbGetInputTitle() ) );
+ bbSetOutputOut( w->GetValue() );
+ } else {
+ bbSetOutputOut( "<VOID>" );
+ }
+
+}
+//=====
+// 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 InputTextPassword::CreateWidget(wxWindow* parent)
+{
+ bbSetOutputWidget
+ ( (wxWindow*) new InputTextPasswordWidget( this, //bbGetWxParent(),
+ parent,
+ bbtk::std2wx ( bbGetInputIn() ) ,
+ bbtk::std2wx ( bbGetInputTitle() )
+ )
+ );
+}
+//=====
+// 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 InputTextPassword::bbUserSetDefaultValues()
+{
+ firsttime=true;
+ bbSetInputTitle("");
+ bbSetInputIn("");
+ bbSetOutputWidget(NULL);
+ bbSetInputReactiveOnKeystroke(2);
+}
+//=====
+// 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 InputTextPassword::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 InputTextPassword::bbUserFinalizeProcessing()
+{
+
+}
+}
+// EO namespace bbwx
+
+
--- /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)
+//=====
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbwxInputTextPassword_h_INCLUDED__
+#define __bbwxInputTextPassword_h_INCLUDED__
+
+#include "bbwx_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+namespace bbwx
+{
+
+class bbwx_EXPORT InputTextPassword
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(InputTextPassword,bbtk::WxBlackBox);
+//=====
+// 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(Title,std::string);
+ BBTK_DECLARE_INPUT(ReactiveOnKeystroke,int);
+ BBTK_DECLARE_OUTPUT(Out,std::string); BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget(wxWindow*);
+
+
+ private:
+ bool firsttime;
+
+
+
+//=====
+// 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(InputTextPassword,bbtk::WxBlackBox);
+ BBTK_NAME("InputTextPassword");
+ BBTK_AUTHOR("Info-Dev");
+ BBTK_DESCRIPTION("A zone in which the user can enter a text (wxTextCtrl)");
+ BBTK_CATEGORY("__CategoryBlackBox__");
+
+ BBTK_INPUT(InputTextPassword,In,"Initial text (default '')",std::string,"");
+ BBTK_INPUT(InputTextPassword,Title,"Title of the input zone (default '') ", std::string,"");
+ BBTK_INPUT(InputTextPassword,ReactiveOnKeystroke,"0 not event generated, 1 Enter event genereated, 2 All keys, (default '2') ", int,"");
+ BBTK_OUTPUT(InputTextPassword,Out,"Current text",std::string,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(InputTextPassword);
+//=====
+// 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 bbwx
+
+#endif // __bbwxInputTextPassword_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
}
- void LayoutLine::Process()
- {
- PutWinTitle();
- }
+void LayoutLine::Process()
+{
+ PutWinTitle();
+}
/*
void LayoutLine::CreateWidget(wxWindow* parent)
{
wxBoxSizer *sizer;
- wxPanel *w=new wxPanel(parent, //bbGetWxParent(),
- -1);
+ wxPanel *w=new wxPanel(parent, -1, wxDefaultPosition, wxSize(20,20) );
w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
int style=0;
- if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
- "0|H|HORIZONTAL")==true)
- { style=wxHORIZONTAL; }
- if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
- "1|V|VERTICAL")==true)
- { style=wxVERTICAL; }
+ if (bbtk::Utilities::loosematch(bbGetInputOrientation(), "0|H|HORIZONTAL")==true)
+ {
+ style=wxHORIZONTAL;
+ } // if
+ if (bbtk::Utilities::loosematch(bbGetInputOrientation(), "1|V|VERTICAL")==true)
+ {
+ style=wxVERTICAL;
+ } // if
sizer = new wxBoxSizer(style);
- wxWindow* cw;
+ wxWindow* cw;
if ((cw=bbCreateWidgetOfInput("Widget1",w)) != 0) sizer->Add(cw, 1, wxGROW, 0);
if ((cw=bbCreateWidgetOfInput("Widget2",w)) != 0) sizer->Add(cw, 1, wxGROW, 0);
if ((cw=bbCreateWidgetOfInput("Widget3",w)) != 0) sizer->Add(cw, 1, wxGROW, 0);
namespace bbwx
{
- BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx , LayoutTab);
+
+
+ //--------------------------------------------------------------------------
+ class TabWidget : public wxPanel
+ {
+ public:
+ TabWidget(LayoutTab* box, wxWindow *parent, long style);
+ ~TabWidget();
+ void OnTabChange( wxEvent& );
+ wxNotebook* GetmwxNotebook();
+ private:
+ LayoutTab *mBox;
+ wxNotebook *mwxNotebook;
+ };
+
+
+ TabWidget::TabWidget(LayoutTab* box,
+ wxWindow *parent,long style )
+ : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
+ mBox(box)
+ {
+ wxPanel *panel = this;
+ mwxNotebook = new wxNotebook(panel, //bbGetWxParent(),
+ -1,
+ wxDefaultPosition,
+ wxDefaultSize,
+ style );
+ Connect( mwxNotebook->GetId(), wxEVT_NOTEBOOK_PAGE_CHANGED ,
+ (wxObjectEventFunction)
+ (void (wxPanel::*)(wxEvent&))
+ &TabWidget::OnTabChange );
+ wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
+ sizer -> Add( mwxNotebook,1,wxGROW,0 );
+ panel -> SetSizer(sizer);
+ panel -> SetAutoLayout(true);
+ panel -> Layout();
+ }
+ TabWidget::~TabWidget()
+ {
+ }
+
+ void TabWidget::OnTabChange( wxEvent& )
+ {
+ mBox->bbSetOutputSelection( mwxNotebook->GetSelection() );
+ mBox->bbSignalOutputModification();
+ }
+wxNotebook* TabWidget::GetmwxNotebook()
+{
+ return mwxNotebook;
+}
+
+
+
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx , LayoutTab);
BBTK_BLACK_BOX_IMPLEMENTATION(LayoutTab,bbtk::WxBlackBox);
//-----------------------------------------------------------------
//-----------------------------------------------------------------
void LayoutTab::TryInsertWindow(wxNotebook *book, const std::string& input )
{
- wxWindow* w = bbCreateWidgetOfInput(input,book); //panel);
+ wxWindow* w = bbCreateWidgetOfInput(input,book);
if (w!=NULL)
{
book->AddPage(w,w->GetName());
- }
+ } // if w
}
- void LayoutTab::SetTitleTabs()
- {
-
+void LayoutTab::SetTitleTabs()
+{
std::vector<std::string> vecTitle;
std::vector<std::string> vecInputNameWidget;
vecInputNameWidget.push_back("Widget1");
} // if c
} // for iWidget
-
- wxNotebook* w = (wxNotebook*)bbGetOutputWidget();
- if (w!=NULL)
+//EED2020-04-06
+// wxNotebook* w = (wxNotebook*)bbGetOutputWidget();
+ TabWidget *tabwidget=(TabWidget*)bbGetOutputWidget();
+ if (tabwidget!=NULL)
{
- int i,size=vecTitle.size();
- for (i=0; i<size; i++)
+ wxNotebook *w = tabwidget->GetmwxNotebook();
+ if (w!=NULL)
{
- w->SetPageText(i, wxString( vecTitle[i].c_str(),wxConvUTF8 ) );
- } // for i
- } //w
+ int i,size=vecTitle.size();
+ for (i=0; i<size; i++)
+ {
+ w->SetPageText(i, wxString( vecTitle[i].c_str(),wxConvUTF8 ) );
+ } // for i
+ } //w
+ } // if tabwidget
}
-
void LayoutTab::Process()
{
PutWinTitle();
SetTitleTabs();
}
-
-
+
void LayoutTab::CreateWidget(wxWindow* parent)
{
long style = wxNB_TOP;
{ style=wxNB_BOTTOM; }
if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"3|L|LEFT")==true)
{ style=wxNB_LEFT; }
- wxNotebook *w = new wxNotebook(parent, //bbGetWxParent(),
- -1,
- wxDefaultPosition,
- wxDefaultSize,
- style );
- w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
-
+
+//EED2020-04-06
+// wxNotebook *w = new wxNotebook(parent, //bbGetWxParent(),
+// -1,
+// wxDefaultPosition,
+// wxDefaultSize,
+// style );
+//
+ TabWidget *tabwidget = new TabWidget (this, parent, style );
+ tabwidget->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
+ wxNotebook *w = tabwidget->GetmwxNotebook();
+
+//EED2020-04-06
+// w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
TryInsertWindow(w,"Widget1");
TryInsertWindow(w,"Widget2");
TryInsertWindow(w,"Widget3");
TryInsertWindow(w,"Widget7");
TryInsertWindow(w,"Widget8");
TryInsertWindow(w,"Widget9");
-
- bbSetOutputWidget( w );
+
+//EED2020-04-06
+// bbSetOutputWidget( w );
+ bbSetOutputWidget( tabwidget );
}
- // This callback is necessary to get actual processing of the view
- // when window is shown
- void LayoutTab::OnShowWidget()
- {
- wxNotebook* w = (wxNotebook*)bbGetOutputWidget();
- if (w)
- {
- if (w->GetPageCount()>0)
- {
- w->SetSelection(0);
- for (unsigned int i=0; i<w->GetPageCount(); ++i) w->AdvanceSelection();
- }
- }
-
-
- }
+ // 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->GetPageCount()>0)
+ {
+ w->SetSelection(0);
+ for (unsigned int i=0; i<w->GetPageCount(); ++i)
+ {
+ w->AdvanceSelection();
+ } // for
+ } // if PageCount
+ } // if w
+}
}//namespace bbwx
BBTK_DECLARE_INPUT(Widget8,wxWindow*);
BBTK_DECLARE_INPUT(Widget9,wxWindow*);
BBTK_DECLARE_INPUT(Orientation,std::string);
+
+ BBTK_DECLARE_OUTPUT(Selection,int);
+
BBTK_PROCESS(Process);
BBTK_CREATE_WIDGET(CreateWidget);
BBTK_ON_SHOW_WIDGET(OnShowWidget);
BBTK_INPUT(LayoutTab,Orientation,
"Orientation (default T), 0=T=TOP , 1=R=RIGHT , 2=B=BOTTON , 3=L=LEFT "
,std::string,"");
+ BBTK_OUTPUT(LayoutTab,Selection,"Tab selection",int,"");
+
BBTK_END_DESCRIBE_BLACK_BOX(LayoutTab);
//=================================================================
--- /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 "bbwxListCtrl.h"
+#include "bbwxPackage.h"
+
+#include <wx/listctrl.h>
+
+namespace bbwx
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ListCtrl)
+BBTK_BLACK_BOX_IMPLEMENTATION(ListCtrl,bbtk::WxBlackBox);
+//=====
+// 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 ListCtrl::Process()
+{
+ wxListCtrl *lstctrl= ((wxListCtrl*)bbGetOutputWidget());
+ lstctrl->DeleteAllColumns();
+
+ unsigned int i,iSize=bbGetInputTitles().size();
+ for (i=0;i<iSize;i++)
+ {
+ lstctrl->AppendColumn( bbtk::std2wx( bbGetInputTitles()[i] ) );
+ } // for i
+
+ unsigned int j,jSize=bbGetInputColumn00().size();
+ for (j=0;j<jSize;j++)
+ {
+ lstctrl->InsertItem(j, bbtk::std2wx("0") );
+ lstctrl->SetItem(j,0, bbtk::std2wx( bbGetInputColumn00()[j] ) );
+
+ if ((bbGetInputColumn01().size()==jSize ) && (1<iSize) ) { lstctrl->SetItem(j,1, bbtk::std2wx( bbGetInputColumn01()[j] ) ); }
+ if ((bbGetInputColumn02().size()==jSize ) && (2<iSize) ) { lstctrl->SetItem(j,2, bbtk::std2wx( bbGetInputColumn02()[j] ) ); }
+ if ((bbGetInputColumn03().size()==jSize ) && (3<iSize) ) { lstctrl->SetItem(j,3, bbtk::std2wx( bbGetInputColumn03()[j] ) ); }
+ if ((bbGetInputColumn04().size()==jSize ) && (4<iSize) ) { lstctrl->SetItem(j,4, bbtk::std2wx( bbGetInputColumn04()[j] ) ); }
+ if ((bbGetInputColumn05().size()==jSize ) && (5<iSize) ) { lstctrl->SetItem(j,5, bbtk::std2wx( bbGetInputColumn05()[j] ) ); }
+ if ((bbGetInputColumn06().size()==jSize ) && (6<iSize) ) { lstctrl->SetItem(j,6, bbtk::std2wx( bbGetInputColumn06()[j] ) ); }
+ if ((bbGetInputColumn07().size()==jSize ) && (7<iSize) ) { lstctrl->SetItem(j,7, bbtk::std2wx( bbGetInputColumn07()[j] ) ); }
+ if ((bbGetInputColumn08().size()==jSize ) && (8<iSize) ) { lstctrl->SetItem(j,8, bbtk::std2wx( bbGetInputColumn08()[j] ) ); }
+ if ((bbGetInputColumn09().size()==jSize ) && (9<iSize) ) { lstctrl->SetItem(j,9, bbtk::std2wx( bbGetInputColumn09()[j] ) ); }
+ if ((bbGetInputColumn10().size()==jSize ) && (10<iSize)) { lstctrl->SetItem(j,10,bbtk::std2wx( bbGetInputColumn10()[j] ) ); }
+
+ } // for j
+
+
+
+}
+//=====
+// 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 ListCtrl::CreateWidget(wxWindow* parent)
+{
+// |wxLC_NO_HEADER
+ bbSetOutputWidget( new wxListCtrl ( parent , -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT ) );
+
+}
+//=====
+// 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 ListCtrl::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 ListCtrl::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 ListCtrl::bbUserFinalizeProcessing()
+{
+
+}
+}
+// EO namespace bbwx
+
+
--- /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)
+//=====
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbwxListCtrl_h_INCLUDED__
+#define __bbwxListCtrl_h_INCLUDED__
+
+#include "bbwx_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+namespace bbwx
+{
+
+class bbwx_EXPORT ListCtrl
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ListCtrl,bbtk::WxBlackBox);
+//=====
+// 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(Titles,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column00,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column01,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column02,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column03,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column04,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column05,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column06,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column07,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column08,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column09,std::vector<std::string>);
+ BBTK_DECLARE_INPUT(Column10,std::vector<std::string>);
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget(wxWindow*);
+//=====
+// 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(ListCtrl,bbtk::WxBlackBox);
+ BBTK_NAME("ListCtrl");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("__CategoryBlackBox__");
+
+ BBTK_INPUT(ListCtrl,Titles,"Titres",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column00,"Column 0",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column01,"Column 1",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column02,"Column 2",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column03,"Column 3",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column04,"Column 4",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column05,"Column 5",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column06,"Column 6",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column07,"Column 7",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column08,"Column 8",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column09,"Column 9",std::vector<std::string>,"");
+ BBTK_INPUT(ListCtrl,Column10,"Column 10",std::vector<std::string>,"");
+
+
+BBTK_END_DESCRIBE_BLACK_BOX(ListCtrl);
+//=====
+// 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 bbwx
+
+#endif // __bbwxListCtrl_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
mBox(box)
{
-/*
- MAX_RADIOBUTTON = lstIn.size();
- wxPanel *panel = this;
- int i;
- long style=wxRB_GROUP;
- for (i=0;i<MAX_RADIOBUTTON; i++)
- {
- if ( lstIn[i]!=_T(""))
- {
- //---------------------------------------------------------------------
- // 1) Creation of the components of the widget
- // Any top level sub-widget must have the panel returned by panel
- // for parent
- mwxRadioButton[i] = new wxRadioButton( panel, -1, lstIn[i],wxDefaultPosition, wxDefaultSize, style);
- style=0;
- if (In==i)
- {
- mwxRadioButton[i]->SetValue(true);
- } else {
- mwxRadioButton[i]->SetValue(false);
- }
- Connect( mwxRadioButton[i]->GetId(),
- wxEVT_COMMAND_RADIOBUTTON_SELECTED,
- (wxObjectEventFunction)
- (void (wxPanel::*)(wxEvent&))
- &RadioButtonWidget::OnRadioButton );
- } else {
- mwxRadioButton[i]=NULL;
- } // if
- } // for
-
- //---------------------------------------------------------------------
- // 2) Insertion of the components in the window
-
- // We use a FlexGridSizer
-
-//EED 2018-04-18
-// wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
- sizer = new wxFlexGridSizer(1);
-
- if (title!=_T(""))
- {
- sizer->Add( new wxStaticText(panel,-1, title ) );
- }
- for (i=0;i<MAX_RADIOBUTTON; i++)
- {
- if (mwxRadioButton[i]!=NULL)
- {
- sizer->Add( mwxRadioButton[i],1,wxGROW );
- }
- }
- sizer->AddGrowableCol(0);
- panel->SetSizer(sizer);
-
-// panel->SetAutoLayout(true);
-// panel->Layout();
-*/
-
}
//-------------------------------------------------------------------------
sizer->AddGrowableCol(0);
panel->SetSizer(sizer);
-// panel->SetAutoLayout(true);
-// panel->Layout();
-
-
+ panel->SetAutoLayout(true);
+ panel->Layout();
}
RadioButtonWidget *w = new RadioButtonWidget(
this,
-// bbGetWxParent(),
parent,
bbGetInputIn() ,
bbtk::std2wx(bbGetInputTitle()),
//--------------------------------------------------------------------------
void Slider::CreateWidget(wxWindow* parent)
{
-
int orientation=0;
if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true) { orientation=0; }
if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true) { orientation=1; }
-
-
// std::cout << "bbGetWxParent = "<<bbGetWxParent()<<std::endl;
SliderWidget *w = new SliderWidget(this,
parent, //bbGetWxParent(),
bbGetInputReactiveOnTrack()
);
// std::cout << "w = "<<w<<std::endl;
- // w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
-
+ // w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
bbSetOutputWidget( w );
}
--- /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 "bbwxSpinCtrl.h"
+#include "bbwxPackage.h"
+
+#include <wx/spinbutt.h>
+#include <wx/spinctrl.h>
+
+namespace bbwx
+{
+
+
+
+ //--------------------------------------------------------------------------
+ // The widget created by the box
+ class SpinCtrlWidget : public wxPanel
+ {
+ public:
+ /// Ctor with the two first params the parent window and the creator box
+ /// which must be passed to the WxBlackBoxWidget constructor.
+ /// The other params initialize the widget
+ SpinCtrlWidget(SpinCtrl* box, wxWindow *parent,
+ wxString title, int reactiveOnKeyStroke );
+ /// Dtor
+ ~SpinCtrlWidget();
+ /// Events callbacks
+ /// Called when the box is clicked
+ void OnSpinCtrlClick(wxCommandEvent& event);
+
+ // Accessors
+ bool GetValue() { return mwxSpinCtrl->GetValue(); }
+ void SetValue(int min, int max, int selected);
+ // Update the texts which display the min/max/current values of the slider
+
+ private:
+ SpinCtrl* mBox;
+ wxSpinCtrl *mwxSpinCtrl;
+ wxSpinButton *mwxSpinButton;
+ int _reactiveOnKeyStroke;
+ int selected;
+ };
+ //------------------------------------------------------------------------
+ //------------------------------------------------------------------------
+ //------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ SpinCtrlWidget::SpinCtrlWidget(SpinCtrl* box, wxWindow *parent,
+ wxString title,
+ int reactiveOnKeyStroke)
+ :
+ wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
+ mBox(box),
+ _reactiveOnKeyStroke(reactiveOnKeyStroke)
+ {
+ wxPanel * panel = this;
+ //---------------------------------------------------------------------
+ // 1) Creation of the components of the widget
+ // Any top level sub-widget must have the panel returned by panel
+ // for parent
+
+
+ wxFlexGridSizer *sizer;
+ sizer = new wxFlexGridSizer(1);
+
+
+ mwxSpinCtrl = NULL;
+ mwxSpinButton = NULL;
+
+ if (mBox->bbGetInputTitle()!="")
+ {
+ sizer->Add( new wxStaticText(parent , -1, bbtk::std2wx(mBox->bbGetInputTitle()) ) );
+ }
+
+ if (mBox->bbGetInputType()==0)
+ {
+ mwxSpinCtrl = new wxSpinCtrl( panel, -1 );
+ // Connecting events to callbacks
+ Connect( mwxSpinCtrl->GetId(),
+ wxEVT_COMMAND_SPINCTRL_UPDATED,
+ (wxObjectEventFunction)
+ (void (wxPanel::*)(wxScrollEvent&))
+ &SpinCtrlWidget::OnSpinCtrlClick);
+ sizer->Add( mwxSpinCtrl );
+ } else {
+ mwxSpinButton = new wxSpinButton( panel, -1 );
+ // Connecting events to callbacks
+ Connect( mwxSpinButton->GetId(),
+ wxEVT_SPIN,
+ (wxObjectEventFunction)
+ (void (wxPanel::*)(wxScrollEvent&))
+ &SpinCtrlWidget::OnSpinCtrlClick);
+ sizer->Add( mwxSpinButton );
+ }// if Type
+
+ //---------------------------------------------------------------------
+
+ //---------------------------------------------------------------------
+ // 2) Insertion of the components in the window
+
+ // We use a FlexGridSizer
+ panel->SetSizer(sizer);
+ }
+ //-------------------------------------------------------------------------
+
+
+ //-------------------------------------------------------------------------
+ SpinCtrlWidget::~SpinCtrlWidget()
+ {
+ }
+ //-------------------------------------------------------------------------
+
+
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ void SpinCtrlWidget::OnSpinCtrlClick(wxCommandEvent& event)
+ {
+ // When user clicks the box
+ // we update the output of the box
+
+ if (mBox->bbGetInputType()==0)
+ {
+ mBox->bbSetOutputOut( mwxSpinCtrl->GetValue() );
+ } else {
+ mBox->bbSetOutputOut( mwxSpinButton->GetValue() );
+ }// if Type
+
+ // and signal that the output has changed
+ //if(_reactiveOnKeyStroke==1){
+ mBox->bbSignalOutputModification(std::string("Out"));
+ //}
+ }
+ //-------------------------------------------------------------------------
+
+ //-------------------------------------------------------------------------
+
+
+ //-------------------------------------------------------------------------
+ void SpinCtrlWidget::SetValue(int min, int max, int selected)
+ {
+ if (mBox->bbGetInputType()==0)
+ {
+ mwxSpinCtrl->SetRange( min,max );
+ mwxSpinCtrl->SetValue( selected );
+ } else {
+ mwxSpinButton->SetRange( min,max );
+ mwxSpinButton->SetValue( selected );
+ }// if Type
+ }
+ //-------------------------------------------------------------------------
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,SpinCtrl)
+BBTK_BLACK_BOX_IMPLEMENTATION(SpinCtrl,bbtk::WxBlackBox);
+//=====
+// 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 SpinCtrl::Process()
+{
+ // if with label
+ ((SpinCtrlWidget*)bbGetOutputWidget())->SetValue( bbGetInputMin() , bbGetInputMax(), bbGetInputSelected() );
+ bbSetOutputOut( bbGetInputSelected() );
+}
+//=====
+// 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 SpinCtrl::CreateWidget(wxWindow* parent)
+{
+
+ SpinCtrlWidget *spinctrlwidget=new SpinCtrlWidget( this , parent, bbGetInputTitle() ,1);
+ bbSetOutputWidget( spinctrlwidget );
+ spinctrlwidget->SetValue( bbGetInputMin() , bbGetInputMax(), bbGetInputSelected() );
+
+}
+//=====
+// 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 SpinCtrl::bbUserSetDefaultValues()
+{
+ bbSetInputMin(0);
+ bbSetInputMax(100);
+ bbSetInputSelected(0);
+ bbSetInputType(0);
+ bbSetInputTitle("");
+
+}
+//=====
+// 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 SpinCtrl::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 SpinCtrl::bbUserFinalizeProcessing()
+{
+}
+
+} // EO namespace bbwx
+
+
--- /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)
+//=====
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbwxSpinCtrl_h_INCLUDED__
+#define __bbwxSpinCtrl_h_INCLUDED__
+
+#include "bbwx_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+namespace bbwx
+{
+
+class bbwx_EXPORT SpinCtrl
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(SpinCtrl,bbtk::WxBlackBox);
+//=====
+// 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(Title,std::string);
+ BBTK_DECLARE_INPUT(Min,int);
+ BBTK_DECLARE_INPUT(Max,int);
+ BBTK_DECLARE_INPUT(Selected,int);
+ BBTK_DECLARE_INPUT(Type,int);
+ BBTK_DECLARE_OUTPUT(Out,int);
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget(wxWindow*);
+//=====
+// 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(SpinCtrl,bbtk::WxBlackBox);
+ BBTK_NAME("SpinCtrl");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("__CategoryBlackBox__");
+
+ BBTK_INPUT(SpinCtrl,Title,"Title",std::string,"");
+ BBTK_INPUT(SpinCtrl,Min,"(default 0) Min",int,"");
+ BBTK_INPUT(SpinCtrl,Max,"default 100) Max",int,"");
+ BBTK_INPUT(SpinCtrl,Selected,"default 0) Selected",int,"");
+ BBTK_INPUT(SpinCtrl,Type,"(default 0) 0:with Label 1:not Label",int,"");
+
+ BBTK_OUTPUT(SpinCtrl,Out,"Output value",int,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(SpinCtrl);
+//=====
+// 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 bbwx
+
+#endif // __bbwxSpinCtrl_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+