From: Eduardo DAVILA Date: Fri, 10 Sep 2021 09:28:09 +0000 (+0200) Subject: #3472 merge vtk8itk5wx3-mingw64 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9e8c95c96acaea8851733d20090bf6de7eed1269;hp=4d64ae7e0e9239c96dd610edfddc6bbc5de74fe3;p=bbtk.git #3472 merge vtk8itk5wx3-mingw64 --- diff --git a/README.txt b/README.txt index 668c2b5..3e64ec1 100644 --- a/README.txt +++ b/README.txt @@ -49,3 +49,12 @@ Note Xcode MacOS: -> Build 3.Copiler Version -> C/C++ CompilerVersion GCC 4.2 + + + + +------------- + +rename file +bbitkDICOMSeriesFileNames.xml-OLD-gdcm1.3 + diff --git a/kernel/appli/bbi/bbi.cxx b/kernel/appli/bbi/bbi.cxx index 7918d19..c4729fc 100644 --- a/kernel/appli/bbi/bbi.cxx +++ b/kernel/appli/bbi/bbi.cxx @@ -24,9 +24,11 @@ # knowledge of the CeCILL-B license and that you accept its terms. # ------------------------------------------------------------------------ */ +//__asm__(".symver fcntl64,fcntl64@GLIBC_2.27"); #ifdef _USE_WXWIDGETS_ + #include //========================================================================== @@ -202,14 +204,12 @@ bool wxBBIApp::OnCmdLineParsed(wxCmdLineParser& parser) - - - //========================================================================== // 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); diff --git a/kernel/cmake/BBTKConfigurePackage.cmake b/kernel/cmake/BBTKConfigurePackage.cmake index 27fea04..cf1949e 100644 --- a/kernel/cmake/BBTKConfigurePackage.cmake +++ b/kernel/cmake/BBTKConfigurePackage.cmake @@ -75,9 +75,23 @@ IF(NOT BBTK_CORE_PACKAGE) @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}) diff --git a/kernel/cmake/BBTKConfigurePackage2.cmake b/kernel/cmake/BBTKConfigurePackage2.cmake index 4e68397..3e0d478 100644 --- a/kernel/cmake/BBTKConfigurePackage2.cmake +++ b/kernel/cmake/BBTKConfigurePackage2.cmake @@ -82,8 +82,13 @@ IF(NOT BBTK_CORE_PACKAGE) @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) diff --git a/kernel/cmake/BBTKConfigurePackage_src.cmake b/kernel/cmake/BBTKConfigurePackage_src.cmake index b151364..8c6a06c 100644 --- a/kernel/cmake/BBTKConfigurePackage_src.cmake +++ b/kernel/cmake/BBTKConfigurePackage_src.cmake @@ -118,10 +118,10 @@ FOREACH(xmlfile ${${BBTK_PACKAGE_NAME}_XML_SOURCES}) 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} @@ -323,7 +323,7 @@ IF (WIN32) 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 ) diff --git a/kernel/cmake/BBTKMacros.cmake b/kernel/cmake/BBTKMacros.cmake index 8b1c2ae..cde367b 100644 --- a/kernel/cmake/BBTKMacros.cmake +++ b/kernel/cmake/BBTKMacros.cmake @@ -85,7 +85,7 @@ MACRO(MAKE_DLL_PATH) 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) #======================================================================== diff --git a/kernel/cmake/PlugPackage.bat.in b/kernel/cmake/PlugPackage.bat.in new file mode 100644 index 0000000..599df56 --- /dev/null +++ b/kernel/cmake/PlugPackage.bat.in @@ -0,0 +1,2 @@ +bbPlugPackage %~dp0 +pause \ No newline at end of file diff --git a/kernel/cmake/PlugPackage.sh.in b/kernel/cmake/PlugPackage.sh.in new file mode 100644 index 0000000..395d365 --- /dev/null +++ b/kernel/cmake/PlugPackage.sh.in @@ -0,0 +1,4 @@ +ACTUALDIR=$(pwd) +bbPlugPackage $ACTUALDIR + + diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index 6fb1fb8..4b000f0 100644 --- a/kernel/src/bbtkBlackBox.cxx +++ b/kernel/src/bbtkBlackBox.cxx @@ -55,8 +55,8 @@ namespace bbtk { - static bool bbmgSomeBoxExecuting = false; - static bool bbmgFreezeExecution = false; + static bool bbmgSomeBoxExecuting = false; + static bool bbmgFreezeExecution = false; static std::set bbmgExecutionList; //========================================================================= @@ -93,14 +93,10 @@ namespace bbtk if (!pack.expired()) { Package::ReleaseBlackBoxDescriptor(pack,desc); - } - else - { + } else { bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""< BlackBox::Deleter(\""<bbGetNameWithParent() + ":" + bbmName; - } - else - { - return bbmName; - } + { + return bbmParent.lock()->bbGetNameWithParent() + ":" + bbmName; + } else { + return bbmName; + } } //========================================================================= @@ -707,19 +701,18 @@ namespace bbtk //========================================================================= void BlackBox::bbRecursiveExecute( Connection::Pointer caller ) { - bbtkBlackBoxDebugMessage("process",3, "=> BlackBox::bbRecursiveExecute(" <<(caller?caller->GetFullName():"0")<<")" < already executing : abort"<bbProcess(); +//printf("EED BlackBox::bbRecursiveExecute bbProcess end %s \n", bbGetFullName().c_str() ); } // Manual analysis //EED ups if ((bbBoxProcessModeIsManual()==true) && (bbLetRecursiveExecuteManualMode==false)) @@ -766,9 +761,7 @@ namespace bbtk // Update the I/O statuses bbComputePostProcessStatus(); - } - else - { + } else { // Test output status... OutputConnectorMapType::iterator o; for ( o = bbGetOutputConnectorMap().begin(); @@ -780,11 +773,11 @@ namespace bbtk <<"all inputs are Up-to-date but output '" <first<<"' is Out-of-date ???"); } - } + } // for bbtkBlackBoxDebugMessage("process",3," -> Up-to-date : nothing to do" <bbShowWindow(); @@ -797,7 +790,6 @@ namespace bbtk bbSetExecuting(false); bbGlobalSetSomeBoxExecuting(wasExecuting); - return; } //========================================================================= diff --git a/kernel/src/bbtkConfigurationFile.cxx b/kernel/src/bbtkConfigurationFile.cxx index e5b8529..e91dcfd 100644 --- a/kernel/src/bbtkConfigurationFile.cxx +++ b/kernel/src/bbtkConfigurationFile.cxx @@ -436,18 +436,16 @@ namespace bbtk 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; // ------------------------------------------------------------------ @@ -563,42 +561,76 @@ namespace bbtk } 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 diff --git a/kernel/src/bbtkWidgetBlackBox.txx b/kernel/src/bbtkWidgetBlackBox.txx index 6f2e8a6..0c2a7a1 100644 --- a/kernel/src/bbtkWidgetBlackBox.txx +++ b/kernel/src/bbtkWidgetBlackBox.txx @@ -295,6 +295,9 @@ namespace bbtk { bbtkBlackBoxDebugMessage("widget",1,"=> WidgetBlackBox::bbCloseWindow() [" <::bbDestroy\n"); + if (bbGetWindow()!=0) bbGetWindow()->bbDestroy(); diff --git a/kernel/src/bbtkWidgetBlackBoxWindow.txx b/kernel/src/bbtkWidgetBlackBoxWindow.txx index 13d1273..14413ed 100644 --- a/kernel/src/bbtkWidgetBlackBoxWindow.txx +++ b/kernel/src/bbtkWidgetBlackBoxWindow.txx @@ -71,6 +71,8 @@ namespace bbtk template WidgetBlackBoxWindow::~WidgetBlackBoxWindow() { + printf("EED WidgetBlackBoxWindow::~WidgetBlackBoxWindow\n"); + bbtkDebugMessage("widget",9, "WidgetBlackBoxWindow::~WidgetBlackBoxWindow() " <::bbDestroy() { +printf("EED WidgetBlackBoxWindow::bbDestroy \n"); + if (mBox.expired()) return; bbtkDebugMessage("widget",9,"WidgetBlackBoxWindow::bbDestroy() [" <bbGetName()<<"]"< #include @@ -153,6 +153,7 @@ namespace bbtk //EED 2020-04-21 // typedef boost::signals::trackable SignalObserver; // typedef boost::signal Signal_type; + typedef boost::signals2::trackable SignalObserver; typedef boost::signals2::signal Signal_type; diff --git a/kernel/src/bbtkWtBlackBox.h b/kernel/src/bbtkWtBlackBox.h index 4725a0d..e73bde9 100644 --- a/kernel/src/bbtkWtBlackBox.h +++ b/kernel/src/bbtkWtBlackBox.h @@ -157,6 +157,6 @@ namespace bbtk } //namespace bbtk -#endif //__bbtkWxBlackBox_h__ +#endif //__bbtkWtBlackBox_h__ -#endif //USE_WXWIDGETS +#endif //USE_WT diff --git a/kernel/src/bbtkWx.cxx b/kernel/src/bbtkWx.cxx index 78848c1..31b473f 100644 --- a/kernel/src/bbtkWx.cxx +++ b/kernel/src/bbtkWx.cxx @@ -106,6 +106,10 @@ namespace bbtk { if (mgWxApp!= 0) { + +printf("EED Wx::DestroyWxAppIfNeeded \n"); + + // bbtkDebugMessage("wx",1," --> Destructing bbtk WxApp"<bbGetName() + { + bbtkDebugMessage("widget",9,"["<bbGetName() <<"] $$$$$$$$$$$$$$$$$$$ ~WxFrame()" <bbSetWindow(0); + } else { + bbtkDebugMessage("widget",9,"[DEAD] $$$$$$$$$$$$$$$$$$$$$ ~WxFrame()"<bbSetWindow(0); + } // if mBox.lock() Wx::DecNbWindowsAlive(); } //================================================================== diff --git a/packages/gdcmvtk/bbs/boxes/DicomSerieInfoDir.bbg b/packages/gdcmvtk/bbs/boxes/DicomSerieInfoDir.bbg new file mode 100644 index 0000000..234bb1e --- /dev/null +++ b/packages/gdcmvtk/bbs/boxes/DicomSerieInfoDir.bbg @@ -0,0 +1,196 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/C8/creatools_source/bbtk/packages/gdcmvtk/bbs/boxes/DicomSerieInfoDir.bbg +# ---------------------------------- + +APP_START +CATEGORY: +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 diff --git a/packages/gdcmvtk/bbs/boxes/DicomSerieInfoDir.bbs b/packages/gdcmvtk/bbs/boxes/DicomSerieInfoDir.bbs new file mode 100644 index 0000000..9967d14 --- /dev/null +++ b/packages/gdcmvtk/bbs/boxes/DicomSerieInfoDir.bbs @@ -0,0 +1,85 @@ +# ---------------------------------- +# - 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 "" + +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 diff --git a/packages/gdcmvtk/bbs/boxes/LstDicomSerieInfoDir.bbg b/packages/gdcmvtk/bbs/boxes/LstDicomSerieInfoDir.bbg new file mode 100644 index 0000000..b9684bb --- /dev/null +++ b/packages/gdcmvtk/bbs/boxes/LstDicomSerieInfoDir.bbg @@ -0,0 +1,465 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/C8/creatools_source/bbtk/packages/gdcmvtk/bbs/boxes/LstDicomSerieInfoDir.bbg +# ---------------------------------- + +APP_START +CATEGORY: +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 diff --git a/packages/gdcmvtk/bbs/boxes/LstDicomSerieInfoDir.bbs b/packages/gdcmvtk/bbs/boxes/LstDicomSerieInfoDir.bbs new file mode 100644 index 0000000..a9d7e81 --- /dev/null +++ b/packages/gdcmvtk/bbs/boxes/LstDicomSerieInfoDir.bbs @@ -0,0 +1,186 @@ +# ---------------------------------- +# - 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 "" + +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 diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx index 39ff153..c8a1e47 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx +++ b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx @@ -87,7 +87,6 @@ vtkImageData* GetXCoherentInfoGdcmReader::CreateDefaultImage() #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(); @@ -97,7 +96,7 @@ void GetXCoherentInfoGdcmReader::Process() } else { f->SetFileName( "" ); } // if - + bool res = f->Load(); if ( !res ) { @@ -106,6 +105,7 @@ void GetXCoherentInfoGdcmReader::Process() bbSetOutputOut( CreateDefaultImage() ); return; } // if res + // Get info from the first image file int i; std::vector v_iop; @@ -131,7 +131,7 @@ void GetXCoherentInfoGdcmReader::Process() // Add *all the files* to the SerieHelper sh = GDCM_NAME_SPACE::SerieHelper::New(); std::vector gii = bbGetInputIn(); - + for(std::vector::iterator it = gii.begin(); it != gii.end(); ++it) @@ -139,13 +139,17 @@ void GetXCoherentInfoGdcmReader::Process() 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(); @@ -166,10 +170,10 @@ void GetXCoherentInfoGdcmReader::Process() 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; iTagDelete(); - 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 @@ -207,10 +213,10 @@ void GetXCoherentInfoGdcmReader::Process() #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 ) { @@ -219,8 +225,6 @@ void GetXCoherentInfoGdcmReader::Process() return; } - - // Get info from the first image file const gdcm::File &f = read->GetFile(); int i; @@ -231,17 +235,17 @@ void GetXCoherentInfoGdcmReader::Process() gdcm::Element iop; iop.Read( ss ); for(i=0; i< 6; i++) - { + { v_iop.push_back((float)(iop[i])); - } + } bbSetOutputIOP(v_iop ); - std::vector v_ipp; + std::vector v_ipp; const gdcm::DataElement &deIpp = f.GetDataSet().GetDataElement(gdcm::Tag((0x0020,0x0032))); deIpp.GetValue().Print(ss); gdcm::Element 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 @@ -289,15 +293,16 @@ void GetXCoherentInfoGdcmReader::Process() void GetXCoherentInfoGdcmReader::bbUserSetDefaultValues() { + reader=NULL; std::vector init; init.push_back(""); bbSetInputIn(init); + bbSetInputReadRaw(true); //reader=NULL; /// \TODO fixme JPR } void GetXCoherentInfoGdcmReader::bbUserInitializeProcessing() { - } #if defined USE_GDCM diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h index f0b3c21..41c2ea7 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h +++ b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h @@ -60,6 +60,7 @@ class bbgdcmvtk_EXPORT GetXCoherentInfoGdcmReader BBTK_DECLARE_INPUT(In , std::vector); BBTK_DECLARE_INPUT(IPPSort , bool); BBTK_DECLARE_INPUT(DicomTags , std::vector); + BBTK_DECLARE_INPUT(ReadRaw , bool); BBTK_DECLARE_OUTPUT(Out , vtkImageData *); BBTK_DECLARE_OUTPUT(IPP , std::vector); @@ -96,6 +97,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox); BBTK_INPUT(GetXCoherentInfoGdcmReader,In ,"List of Dicom image file names", std::vector,""); 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,""); + 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,""); diff --git a/packages/itk/bbs/boxes/bbDICOMDirReader.bbs-OLD-gdcm1.3 b/packages/itk/bbs/boxes/bbDICOMDirReader.bbs similarity index 100% rename from packages/itk/bbs/boxes/bbDICOMDirReader.bbs-OLD-gdcm1.3 rename to packages/itk/bbs/boxes/bbDICOMDirReader.bbs diff --git a/packages/itk/src/bbitkDICOMSeriesFileNames.xml-OLD-gdcm1.3 b/packages/itk/src/bbitkDICOMSeriesFileNames.xml similarity index 100% rename from packages/itk/src/bbitkDICOMSeriesFileNames.xml-OLD-gdcm1.3 rename to packages/itk/src/bbitkDICOMSeriesFileNames.xml diff --git a/packages/std/src/bbstdExecSystemCommand.cxx b/packages/std/src/bbstdExecSystemCommand.cxx index 63beb0c..43c9dc5 100755 --- a/packages/std/src/bbstdExecSystemCommand.cxx +++ b/packages/std/src/bbstdExecSystemCommand.cxx @@ -46,10 +46,13 @@ namespace bbstd void ExecSystemCommand::bbUserSetDefaultValues() { bbSetInputIn("help"); + bbSetInputVerbose(true); } + void ExecSystemCommand::bbUserInitializeProcessing() { } + void ExecSystemCommand::bbUserFinalizeProcessing() { } @@ -80,8 +83,11 @@ namespace bbstd // #if defined(_WIN32) // ccommand="start /b "+ccommand; // #endif // defined(_WIN32) - std::cout << "*** Executing system command : '"<=0){ + + std::string dirName = NormalizePath(dirpath); + int tmpNumberOfFiles; std::string fileName; #ifdef _MSC_VER WIN32_FIND_DATA fileData; @@ -130,7 +141,7 @@ int FilesFromDirectory::Explore(std::string const &dirpath, bool recursive) 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; @@ -249,7 +260,7 @@ int FilesFromDirectory::Explore(std::string const &dirpath, bool recursive) numberOfFiles++; } // Type All_directories - tmpNumberOfFiles = Explore( fileName, recursive); + tmpNumberOfFiles = Explore( fileName, recursive, recursiveLevel-1); if ((bbGetInputType()==2)&&tmpNumberOfFiles==0) { Filenames.push_back(fileName); @@ -277,6 +288,7 @@ int FilesFromDirectory::Explore(std::string const &dirpath, bool recursive) }// closedir #endif +} // if recursiveLevel return numberOfFiles; } @@ -286,24 +298,27 @@ int FilesFromDirectory::Explore(std::string const &dirpath, bool recursive) 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=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) @@ -312,14 +327,11 @@ void FilesFromDirectory::CleanFilenames( std::string basePath ) } } // for i } // if FileEnd !=0 - sizeFilenames = Filenames.size(); - // Cleanning paths with spaces for (i=0; i); BBTK_DECLARE_OUTPUT(Out,std::vector); @@ -50,7 +52,7 @@ namespace bbstd 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 @@ -68,9 +70,11 @@ namespace bbstd 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,""); BBTK_OUTPUT(FilesFromDirectory,Out,"FullPathNames of the files",std::vector,""); diff --git a/packages/std/src/bbstdFindOptimalParam.cxx b/packages/std/src/bbstdFindOptimalParam.cxx new file mode 100644 index 0000000..28bcdeb --- /dev/null +++ b/packages/std/src/bbstdFindOptimalParam.cxx @@ -0,0 +1,138 @@ +//===== +// 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 = " < >()); typedef std::vector 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); @@ -89,7 +89,7 @@ namespace bbstd template void GetVectorElement::bbUserSetDefaultValues() { - + bbSetInputI(0); } //================================================================= //================================================================= diff --git a/packages/std/src/bbstdMapToLst.cxx b/packages/std/src/bbstdMapToLst.cxx new file mode 100644 index 0000000..69c6c61 --- /dev/null +++ b/packages/std/src/bbstdMapToLst.cxx @@ -0,0 +1,83 @@ +//===== +// 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 lstTitles; + std::vector 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 + + diff --git a/packages/std/src/bbstdMapToLst.h b/packages/std/src/bbstdMapToLst.h new file mode 100644 index 0000000..9aa8413 --- /dev/null +++ b/packages/std/src/bbstdMapToLst.h @@ -0,0 +1,51 @@ +//===== +// 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 +#include +typedef std::map 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); + BBTK_DECLARE_OUTPUT(LstValues,std::vector); + 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,""); + BBTK_OUTPUT(MapToLst,LstValues,"List of map.second",std::vector,""); +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__ + diff --git a/packages/std/src/bbstdMathOperation.cxx b/packages/std/src/bbstdMathOperation.cxx index fdedc10..3ab9e6f 100644 --- a/packages/std/src/bbstdMathOperation.cxx +++ b/packages/std/src/bbstdMathOperation.cxx @@ -85,6 +85,14 @@ void MathOperation::Process() 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) diff --git a/packages/std/src/bbstdMathOperation.h b/packages/std/src/bbstdMathOperation.h index 097545e..a6dc725 100644 --- a/packages/std/src/bbstdMathOperation.h +++ b/packages/std/src/bbstdMathOperation.h @@ -42,7 +42,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(MathOperation,bbtk::AtomicBlackBox); 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 In1In2, 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); diff --git a/packages/std/src/bbstdMathOperationVector.cxx b/packages/std/src/bbstdMathOperationVector.cxx index 454311f..cbd934f 100644 --- a/packages/std/src/bbstdMathOperationVector.cxx +++ b/packages/std/src/bbstdMathOperationVector.cxx @@ -116,8 +116,8 @@ void MathOperationVector::Process() std::vector *v8 = &_v8; std::vector *v9 = &_v9; - double minTmp; - double maxTmp; + double minTmp; + double maxTmp; if (firsttime==true) { @@ -415,7 +415,104 @@ void MathOperationVector::Process() resultVec.push_back( (int)bbGetInputIn0()[i] % (int)bbGetInputIn1()[i] ); } // for i bbSetOutputOut( resultVec ); - } // Type 18 + } // Type 19 + + if (bbGetInputType()==20) + { + for (i=0;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,""); BBTK_INPUT(MathOperationVector,In8,"Input vector 8",std::vector,""); BBTK_INPUT(MathOperationVector,In9,"Input vector 9",std::vector,""); - 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], 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,""); diff --git a/packages/std/src/bbstdReplaceCleanString.cxx b/packages/std/src/bbstdReplaceCleanString.cxx new file mode 100644 index 0000000..e778035 --- /dev/null +++ b/packages/std/src/bbstdReplaceCleanString.cxx @@ -0,0 +1,86 @@ +//===== +// 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 = " < >()); typedef std::vector* 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); BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(SetElementVector); @@ -89,7 +89,7 @@ namespace bbstd template void SetElementVector::bbUserSetDefaultValues() { - + bbSetInputI(0); } //================================================================= //================================================================= diff --git a/packages/std/src/bbstdSpin.cxx b/packages/std/src/bbstdSpin.cxx new file mode 100644 index 0000000..7c915d3 --- /dev/null +++ b/packages/std/src/bbstdSpin.cxx @@ -0,0 +1,97 @@ +//===== +// 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 = " <bbGetInputEnd()) + { + count = bbGetInputStart(); + } // if count + }else{ + if (count>bbGetInputEnd()) + { + count = bbGetInputEnd(); + } // if count + } // if Loop + + if (count void ToString ::DoIt() { - std::ostringstream s; - s << bbGetInputIn(); - bbSetOutputOut( s.str() ); +// std::ostringstream s; +// s << bbGetInputIn(); +// bbSetOutputOut( s.str() ); + bbSetOutputOut( std::to_string( bbGetInputIn() ) ); } //==================================================================== diff --git a/packages/std/src/bbstdVectorFilterDouble.cxx b/packages/std/src/bbstdVectorFilterDouble.cxx index 9a948a8..88370e2 100644 --- a/packages/std/src/bbstdVectorFilterDouble.cxx +++ b/packages/std/src/bbstdVectorFilterDouble.cxx @@ -3,6 +3,8 @@ //===== #include "bbstdVectorFilterDouble.h" #include "bbstdPackage.h" +#include "math.h" + namespace bbstd { @@ -75,36 +77,39 @@ void VectorFilterDouble::Process() if (bbGetInputType()==0) // Erase duplicate lines { - bool okSizeVec=true; - int ipLstvec; - for (ipLstvec=1;ipLstvec0) && (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,""); BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector,""); diff --git a/packages/std/src/bbstdVectorFilterString.cxx b/packages/std/src/bbstdVectorFilterString.cxx new file mode 100644 index 0000000..1973e7b --- /dev/null +++ b/packages/std/src/bbstdVectorFilterString.cxx @@ -0,0 +1,180 @@ +//===== +// 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 vIn,std::vector *vOut ) +{ + int i,size=vIn.size(); + int itmp=0, acum=0; + std::string stmp; + for( i=0;ipush_back(std::to_string(acum)); + acum=1; + } + } // for + vOut->push_back(std::to_string(acum)); +} + +void VectorFilterString::FilterByFindinIn0() +{ + std::vector vOut0; + std::vector vOut1; + std::vector vOut2; + std::vector vOut3; + std::vector vOut4; + std::vector vOut5; + std::vector vOut6; + std::vector vOut7; + std::vector vOut8; + std::vector vOut9; + + int i,size = bbGetInputIn0().size(); + int pos; + for (i=0; i= 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 = " < vOut0; + std::vector vOut1; + std::vector vOut2; + std::vector vOut3; + std::vector vOut4; + std::vector vOut5; + std::vector vOut6; + std::vector vOut7; + std::vector vOut8; + std::vector 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 + + diff --git a/packages/std/src/bbstdVectorFilterString.h b/packages/std/src/bbstdVectorFilterString.h new file mode 100644 index 0000000..4bfe5af --- /dev/null +++ b/packages/std/src/bbstdVectorFilterString.h @@ -0,0 +1,97 @@ +//===== +// 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); + BBTK_DECLARE_INPUT(In1,std::vector); + BBTK_DECLARE_INPUT(In2,std::vector); + BBTK_DECLARE_INPUT(In3,std::vector); + BBTK_DECLARE_INPUT(In4,std::vector); + BBTK_DECLARE_INPUT(In5,std::vector); + BBTK_DECLARE_INPUT(In6,std::vector); + BBTK_DECLARE_INPUT(In7,std::vector); + BBTK_DECLARE_INPUT(In8,std::vector); + BBTK_DECLARE_INPUT(In9,std::vector); + BBTK_DECLARE_INPUT(Type,int); + BBTK_DECLARE_INPUT(sk1,std::string); + BBTK_DECLARE_INPUT(sk2,std::string); + + BBTK_DECLARE_OUTPUT(Out0,std::vector); + BBTK_DECLARE_OUTPUT(Out1,std::vector); + BBTK_DECLARE_OUTPUT(Out2,std::vector); + BBTK_DECLARE_OUTPUT(Out3,std::vector); + BBTK_DECLARE_OUTPUT(Out4,std::vector); + BBTK_DECLARE_OUTPUT(Out5,std::vector); + BBTK_DECLARE_OUTPUT(Out6,std::vector); + BBTK_DECLARE_OUTPUT(Out7,std::vector); + BBTK_DECLARE_OUTPUT(Out8,std::vector); + BBTK_DECLARE_OUTPUT(Out9,std::vector); + BBTK_PROCESS(Process); + void Process(); + +void ConnectionRepetitions( std::vector vIn,std::vector *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,""); + BBTK_INPUT(VectorFilterString,In1,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In2,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In3,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In4,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In5,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In6,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In7,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In8,"Input vector",std::vector,""); + BBTK_INPUT(VectorFilterString,In9,"Input vector",std::vector,""); + 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,""); + BBTK_OUTPUT(VectorFilterString,Out1,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out2,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out3,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out4,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out5,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out6,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out7,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out8,"First output",std::vector,""); + BBTK_OUTPUT(VectorFilterString,Out9,"First output",std::vector,""); + +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__ + diff --git a/packages/std/src/bbstdWriteColumnsString.cxx b/packages/std/src/bbstdWriteColumnsString.cxx index 229601c..3c5d8d5 100644 --- a/packages/std/src/bbstdWriteColumnsString.cxx +++ b/packages/std/src/bbstdWriteColumnsString.cxx @@ -18,16 +18,19 @@ void WriteColumnsString::Process() std::vector headers = bbGetInputHeaders(); //Headers Input bool onHeaders = bbGetInputOnHeaders(); std::vector > 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 >::iterator it; + + + for(it = values.begin() ; it != values.end() ; ) { if((*it).empty()) @@ -36,44 +39,63 @@ void WriteColumnsString::Process() }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 ; iModified(); ope->Update(); vtkImageData* salida = ope->GetOutput(); - bbSetOutputOut(salida); - bbSignalOutputModification(); - +// bbSignalOutputModification(); } diff --git a/packages/vtk/src/bbvtkCreateImage.cxx b/packages/vtk/src/bbvtkCreateImage.cxx index 007c347..2cdb383 100644 --- a/packages/vtk/src/bbvtkCreateImage.cxx +++ b/packages/vtk/src/bbvtkCreateImage.cxx @@ -53,101 +53,124 @@ void CreateImage::Process() // * 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; iSetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() ); - } // for i - - sizeBlock= dim[0] * imageoutput->GetScalarSize(); - for (j=1; jGetScalarPointer(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; iSetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() ); + } // for i + sizeBlock= dim[0] * imageoutput->GetScalarSize(); + for (j=1; jGetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock ); + } // for j + sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize(); + for (k=0; kGetScalarPointer(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; kGetScalarPointer(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); + } //===== diff --git a/packages/vtk/src/bbvtkExtractVtkImageFilter.cxx b/packages/vtk/src/bbvtkExtractVtkImageFilter.cxx index 2193423..30ca25a 100644 --- a/packages/vtk/src/bbvtkExtractVtkImageFilter.cxx +++ b/packages/vtk/src/bbvtkExtractVtkImageFilter.cxx @@ -88,7 +88,7 @@ void ExtractVtkImageFilter::bbUserSetDefaultValues() bbSetInputIndex(tmpIndex); bbSetInputSize(tmpSize); - bbSetOutputOut(0); + bbSetOutputOut(NULL); } //===== diff --git a/packages/vtk/src/bbvtkGetVectorElement.h b/packages/vtk/src/bbvtkGetVectorElement.h index 94903be..fd49627 100644 --- a/packages/vtk/src/bbvtkGetVectorElement.h +++ b/packages/vtk/src/bbvtkGetVectorElement.h @@ -88,7 +88,7 @@ namespace bbvtk BBTK_DESCRIPTION("Gets the i-th element from the input vector ("+bbtk::TypeName >()); typedef std::vector 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); @@ -112,7 +112,7 @@ namespace bbvtk template void GetVectorElement::bbUserSetDefaultValues() { - + bbSetInputI(0); } //================================================================= //================================================================= diff --git a/packages/vtk/src/bbvtkImageBoundaries.cxx b/packages/vtk/src/bbvtkImageBoundaries.cxx index 3275137..1a2128c 100644 --- a/packages/vtk/src/bbvtkImageBoundaries.cxx +++ b/packages/vtk/src/bbvtkImageBoundaries.cxx @@ -52,7 +52,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ImageBoundaries,bbtk::AtomicBlackBox); void ImageBoundaries::Process() { if (bbGetInputIn()!=NULL){ - int i,j,k; int ext[6]; double value; @@ -74,54 +73,55 @@ void ImageBoundaries::Process() int bYMin = maxY-1; int bZMin = maxZ-1; -/* - #pragma omp parallel for - for (int i=0 ; iGetScalarComponentAsDouble(i, j, k,0); - if ( (value>=bbGetInputLowerValue()) && (value<=bbGetInputUpperValue()) ) - { - if (ibXMax) 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 ; kGetScalarComponentAsDouble(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 (ibXMax) bXMax=i; - if (j>bYMax) bYMax=j; - if (k>bZMax) bZMax=k; + if (ibXMax) bXMax = i; + if (j>bYMax) bYMax = j; + if (k>bZMax) bZMax = k; } } // for k } // for j } // i +} // #pragma + std::vector tmpIndex; std::vector tmpSize; if (bXMin>bXMax){ diff --git a/packages/vtk/src/bbvtkInversCrop.cxx b/packages/vtk/src/bbvtkInversCrop.cxx index 9e8c578..9064a09 100644 --- a/packages/vtk/src/bbvtkInversCrop.cxx +++ b/packages/vtk/src/bbvtkInversCrop.cxx @@ -45,8 +45,11 @@ void InversCrop::Process() #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(); @@ -61,7 +64,7 @@ void InversCrop::Process() #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); @@ -71,8 +74,6 @@ void InversCrop::Process() _imageoutput=bbGetInputImageFix(); } - - // Copy the Move Image int j,k; int px,py,pz; @@ -86,51 +87,72 @@ void InversCrop::Process() #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; kGetDataDimension()==3) + { + pz = k+org[2]; + } else { + pz = k; + }// Dimension 3 if ( (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 - } //===== diff --git a/packages/vtk/src/bbvtkMaskPoint.cxx b/packages/vtk/src/bbvtkMaskPoint.cxx index 58a2c73..eb1457c 100644 --- a/packages/vtk/src/bbvtkMaskPoint.cxx +++ b/packages/vtk/src/bbvtkMaskPoint.cxx @@ -26,19 +26,31 @@ void MaskPoint::Process() // * 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) @@ -48,8 +60,11 @@ void MaskPoint::bbUserSetDefaultValues() // 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); } //===== diff --git a/packages/vtk/src/bbvtkMaskPoint.h b/packages/vtk/src/bbvtkMaskPoint.h index 28c9a2c..41ceac6 100644 --- a/packages/vtk/src/bbvtkMaskPoint.h +++ b/packages/vtk/src/bbvtkMaskPoint.h @@ -23,8 +23,10 @@ class bbvtk_EXPORT 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_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(); @@ -38,13 +40,18 @@ class bbvtk_EXPORT MaskPoint }; 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) diff --git a/packages/vtk/src/bbvtkMetaImageReader.cxx b/packages/vtk/src/bbvtkMetaImageReader.cxx index f092643..e035419 100644 --- a/packages/vtk/src/bbvtkMetaImageReader.cxx +++ b/packages/vtk/src/bbvtkMetaImageReader.cxx @@ -11,6 +11,14 @@ namespace bbvtk 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) //===== @@ -32,18 +40,24 @@ void MetaImageReader::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <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) //===== diff --git a/packages/vtk/src/bbvtkMetaImageReader.h b/packages/vtk/src/bbvtkMetaImageReader.h index 25d749d..66bc9cf 100644 --- a/packages/vtk/src/bbvtkMetaImageReader.h +++ b/packages/vtk/src/bbvtkMetaImageReader.h @@ -24,6 +24,7 @@ class bbvtk_EXPORT MetaImageReader 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) //===== diff --git a/packages/vtk/src/bbvtkMetaImageWriter.cxx b/packages/vtk/src/bbvtkMetaImageWriter.cxx new file mode 100644 index 0000000..f17001e --- /dev/null +++ b/packages/vtk/src/bbvtkMetaImageWriter.cxx @@ -0,0 +1,200 @@ +//===== +// 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 +#include + +#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=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 + + diff --git a/packages/vtk/src/bbvtkMetaImageWriter.h b/packages/vtk/src/bbvtkMetaImageWriter.h new file mode 100644 index 0000000..7ddd20d --- /dev/null +++ b/packages/vtk/src/bbvtkMetaImageWriter.h @@ -0,0 +1,61 @@ +//===== +// 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 + + +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__ + diff --git a/packages/vtk/src/bbvtkMetaImageWriter.xml b/packages/vtk/src/bbvtkMetaImageWriter.xml deleted file mode 100644 index 21f22d7..0000000 --- a/packages/vtk/src/bbvtkMetaImageWriter.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - -laurent.guigues at creatis.insa-lyon.fr -
Writes .mhd / .mhd image formats (bbfication of vtkMetaImageWriter)
-image;read/write - -vtkMetaImageWriter.h -vtkImageData.h -vtkMetaImageWriter - - - - - -
-   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();
- 
- - -
-    bbSetInputCompression(false);
-  
-
- - -
- - diff --git a/packages/vtk/src/bbvtkPolyDataToActor.cxx b/packages/vtk/src/bbvtkPolyDataToActor.cxx index c0fa208..1ec9ff2 100644 --- a/packages/vtk/src/bbvtkPolyDataToActor.cxx +++ b/packages/vtk/src/bbvtkPolyDataToActor.cxx @@ -43,10 +43,13 @@ #include "vtkProperty.h" #include "vtkLinearTransform.h" +#include "vtkCleanPolyData.h" +#include "vtkFieldData.h" #include "bbvtkPolyDataToActor.h" #include "bbvtkPackage.h" +#include "vtkRenderWindow.h" namespace bbvtk { @@ -71,6 +74,9 @@ namespace bbvtk bbSetInputScalarVisibility(false); polydatamapper = NULL; vtkactor = NULL; + + bbSetInputScalarVisibilityOn_LookupTable(NULL); + bbSetInputScalarVisibilityOn_NameColorArray(""); } @@ -81,6 +87,7 @@ namespace bbvtk vtkactor = vtkActor::New(); // polydatamapper->SetInput(marchingcubes->GetOutput()); vtkactor->SetMapper(polydatamapper); + //EED 2020-04-21 vtk8 deprecated // polydatamapper->ImmediateModeRenderingOn(); } @@ -101,29 +108,90 @@ namespace bbvtk } + + +/* + +----------------------------------------------- + +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 scalars = vtkSmartPointer::New(); + scalars set value .... +poly->GetPointData()->SetScalars(scalars); or poly->GetPointData()->SetActiveScalars(""); + +vtkSmartPointer hueLut = vtkSmartPoint | ^~ +er::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(""); + + 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() ); @@ -151,7 +219,28 @@ printf("EED WARNNING! PolyDataToActor::DoProcess which is the default values o 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 @@ -163,7 +252,7 @@ printf("EED WARNNING! PolyDataToActor::DoProcess which is the default values o bbGetInputRenderer()->RemoveActor( vtkactor ); } // actorAdded } // Active - } +} diff --git a/packages/vtk/src/bbvtkPolyDataToActor.h b/packages/vtk/src/bbvtkPolyDataToActor.h index 9dd2790..583f0f7 100644 --- a/packages/vtk/src/bbvtkPolyDataToActor.h +++ b/packages/vtk/src/bbvtkPolyDataToActor.h @@ -61,6 +61,7 @@ #include "vtkPolyDataMapper.h" #include "vtkProp3D.h" #include "vtkActor.h" +#include "vtkScalarsToColors.h" #include #include "bbtkAtomicBlackBox.h" @@ -88,6 +89,10 @@ namespace bbvtk 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); + BBTK_DECLARE_OUTPUT(Out,vtkProp3D *); BBTK_PROCESS(DoProcess); @@ -111,7 +116,12 @@ namespace bbvtk 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() use PolyData->SetScalars( scalar() ). 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 ,""); + BBTK_OUTPUT(PolyDataToActor,Out,"Extracted iso-surface",vtkProp3D *,""); BBTK_END_DESCRIBE_BLACK_BOX(PolyDataToActor); diff --git a/packages/vtk/src/bbvtkProbeFilter.cxx b/packages/vtk/src/bbvtkProbeFilter.cxx index 6dc66a9..d75378b 100644 --- a/packages/vtk/src/bbvtkProbeFilter.cxx +++ b/packages/vtk/src/bbvtkProbeFilter.cxx @@ -13,7 +13,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ProbeFilter,bbtk::AtomicBlackBox); //===== 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 @@ -25,20 +24,22 @@ void ProbeFilter::Process() // (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) diff --git a/packages/vtk/src/bbvtkSegmentationConnectivity.cxx b/packages/vtk/src/bbvtkSegmentationConnectivity.cxx index a04f6bd..1f2758e 100644 --- a/packages/vtk/src/bbvtkSegmentationConnectivity.cxx +++ b/packages/vtk/src/bbvtkSegmentationConnectivity.cxx @@ -59,7 +59,6 @@ namespace bbvtk // cast2 = NULL; connect2 = NULL; cast4 = NULL; - bbSetInputIn(NULL); std::vector position; position.push_back(0); @@ -71,30 +70,24 @@ namespace bbvtk 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); @@ -105,31 +98,9 @@ namespace bbvtk #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) @@ -154,14 +125,9 @@ namespace bbvtk } } - - - // -------------------------------------------------------------- - void SegmentationConnectivity::DoProcess() { - int x,y,z; int i,numPoints = bbGetInputPositionXYZ().size()/3; int verif = (bbGetInputPositionXYZ().size()-1) % 3; @@ -176,29 +142,22 @@ namespace bbvtk 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;iAddSeed( 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 ); @@ -222,9 +180,7 @@ namespace bbvtk printf("EED WARNNIG! In box: SegmentationConnectivity List of points are not coherent. \n"); bbSetOutputOut( NULL ); }// if numPoints verif - } - }// EO namespace bbvtk diff --git a/packages/vtk/src/bbvtkSegmentationConnectivity.h b/packages/vtk/src/bbvtkSegmentationConnectivity.h index bd4b479..f5faa13 100644 --- a/packages/vtk/src/bbvtkSegmentationConnectivity.h +++ b/packages/vtk/src/bbvtkSegmentationConnectivity.h @@ -90,10 +90,10 @@ 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,""); + BBTK_INPUT(SegmentationConnectivity,PositionXYZ,"Lsit of POINTS. Vector with the Position [x y z]" , std::vector,""); BBTK_INPUT(SegmentationConnectivity,ThresholdMinMax,"vector with the Threshold [min max]" , std::vector,""); 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,""); diff --git a/packages/vtk/src/bbvtkSphereList.cxx b/packages/vtk/src/bbvtkSphereList.cxx index cde4561..b8519fb 100644 --- a/packages/vtk/src/bbvtkSphereList.cxx +++ b/packages/vtk/src/bbvtkSphereList.cxx @@ -98,20 +98,19 @@ void SphereList::GetColor(int i, double &cr,double &cg,double &cb) 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;iRemoveActor( sphereActor[0] ); @@ -124,8 +123,7 @@ printf("EED SphereList::Process Start\n"); if (sizeLstActorsRemoveActor( sphereActor[i] ); + vtkspheresourceLst[i]->Delete(); + vtkpolydatamaperLst[i]->Delete(); + sphereActor[i]->Delete(); + } // for + vtkspheresourceLst.clear(); + vtkpolydatamaperLst.clear(); + sphereActor.clear(); + + + for (i=0;i 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 } diff --git a/packages/vtk/src/bbvtkSphereList.h b/packages/vtk/src/bbvtkSphereList.h index 070da95..89b471f 100644 --- a/packages/vtk/src/bbvtkSphereList.h +++ b/packages/vtk/src/bbvtkSphereList.h @@ -62,6 +62,7 @@ class bbvtk_EXPORT SphereList void Process(); std::vector sphereActor; + std::vectorvtkpolydatamaperLst; std::vector vtkspheresourceLst; private: diff --git a/packages/vtk/src/bbvtkSphereSource.xml b/packages/vtk/src/bbvtkSphereSource.xml index c526c82..50d2bc1 100644 --- a/packages/vtk/src/bbvtkSphereSource.xml +++ b/packages/vtk/src/bbvtkSphereSource.xml @@ -39,6 +39,9 @@ if (bbGetInputActive()==true)
   bbSetInputActive(true);
   bbSetInputRadius(10);
+  bbSetInputCenterX(0);
+  bbSetInputCenterY(0);
+  bbSetInputCenterZ(0);
   bbSetInputPhiResolution(10);
   bbSetInputThetaResolution(10);
 
diff --git a/packages/vtk/src/bbvtkSurfaceTexture.cxx b/packages/vtk/src/bbvtkSurfaceTexture.cxx index 76b0b6d..ef9d87e 100644 --- a/packages/vtk/src/bbvtkSurfaceTexture.cxx +++ b/packages/vtk/src/bbvtkSurfaceTexture.cxx @@ -17,7 +17,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(SurfaceTexture,bbtk::AtomicBlackBox); //===== 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 @@ -33,172 +32,166 @@ void SurfaceTexture::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <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; iLookTableGetTableValue(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; iLookTableGetTableValue(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]=0) && (p2[1]=0) && (p2[2]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]=0) && (p2[1]=0) && (p2[2]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) //===== @@ -213,11 +206,12 @@ void SurfaceTexture::bbUserSetDefaultValues() 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) diff --git a/packages/vtk/src/bbvtkSurfaceTexture.h b/packages/vtk/src/bbvtkSurfaceTexture.h index 2ad3062..20032a5 100644 --- a/packages/vtk/src/bbvtkSurfaceTexture.h +++ b/packages/vtk/src/bbvtkSurfaceTexture.h @@ -29,15 +29,17 @@ class bbvtk_EXPORT SurfaceTexture 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; //===== @@ -52,9 +54,10 @@ BBTK_DESCRIPTION("Surface texture"); 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,""); diff --git a/packages/vtk/src/bbvtkTemporalPicker.cxx b/packages/vtk/src/bbvtkTemporalPicker.cxx index de51251..f1375ac 100644 --- a/packages/vtk/src/bbvtkTemporalPicker.cxx +++ b/packages/vtk/src/bbvtkTemporalPicker.cxx @@ -30,6 +30,9 @@ //===== #include "bbvtkTemporalPicker.h" #include "bbvtkPackage.h" + +#include "creaVtk_MACROS.h" + namespace bbvtk { @@ -38,22 +41,109 @@ BBTK_BLACK_BOX_IMPLEMENTATION(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) //===== -void TemporalPicker::Process() + + +void TemporalPicker::Process_TemporaryPicker3DT() { + std::vector 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=0) && + (maxY=0) && + (maxZGetScalarPointer() ); + 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=0) && (jGetScalarComponentAsDouble(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 result; if (bbGetInputIn()!=NULL) { @@ -71,40 +161,69 @@ void TemporalPicker::Process() 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=0) && (py=0) && + (maxX=0) && + (maxY=0) && (i=0) && (j=0) && (i=0) && (jGetScalarComponentAsDouble(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 @@ -117,9 +236,33 @@ void TemporalPicker::Process() } 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) //===== diff --git a/packages/vtk/src/bbvtkTemporalPicker.h b/packages/vtk/src/bbvtkTemporalPicker.h index f41e642..84f18f0 100644 --- a/packages/vtk/src/bbvtkTemporalPicker.h +++ b/packages/vtk/src/bbvtkTemporalPicker.h @@ -25,9 +25,6 @@ # ------------------------------------------------------------------------ */ -//===== -// 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" @@ -36,27 +33,23 @@ #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); BBTK_DECLARE_OUTPUT(Out,std::vector); 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); @@ -64,14 +57,12 @@ 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,""); BBTK_INPUT(TemporalPicker,SizeRegion,"Size region (default 1)",int,""); BBTK_INPUT(TemporalPicker,Point,"Point [x,y]",std::vector,""); BBTK_OUTPUT(TemporalPicker,Out,"Output vector with Z information",std::vector,""); 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 diff --git a/packages/vtk/src/bbvtkTransform.cxx b/packages/vtk/src/bbvtkTransform.cxx index fd0d369..1c6b335 100644 --- a/packages/vtk/src/bbvtkTransform.cxx +++ b/packages/vtk/src/bbvtkTransform.cxx @@ -68,6 +68,8 @@ namespace bbvtk bbUserFinalizeProcessing(); result = vtkTransform::New(); result->Update(); + resultInverse = vtkTransform::New(); + resultInverse->Update(); } // -------------------------------------------------------------- @@ -88,27 +90,33 @@ namespace bbvtk 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 diff --git a/packages/vtk/src/bbvtkTransform.h b/packages/vtk/src/bbvtkTransform.h index 7bd2dd5..618b0d3 100644 --- a/packages/vtk/src/bbvtkTransform.h +++ b/packages/vtk/src/bbvtkTransform.h @@ -41,6 +41,7 @@ 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); BBTK_DECLARE_INPUT(RotateWXYZ,std::vector); @@ -54,7 +55,8 @@ namespace bbvtk std::vector vecRotateWXYZ; std::vector vecTranslate; std::vector vecSpacing; - vtkTransform *result; + vtkTransform *result; + vtkTransform *resultInverse; }; BBTK_BEGIN_DESCRIBE_BLACK_BOX(Transform,bbtk::AtomicBlackBox); @@ -63,6 +65,7 @@ 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,""); BBTK_INPUT(Transform,Translate,"vector with x y z",std::vector,""); diff --git a/packages/wx/bbs/appli/example_SpinCtrl.bbg b/packages/wx/bbs/appli/example_SpinCtrl.bbg new file mode 100644 index 0000000..b7bc80a --- /dev/null +++ b/packages/wx/bbs/appli/example_SpinCtrl.bbg @@ -0,0 +1,48 @@ +# ---------------------------------- +# - 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: +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 diff --git a/packages/wx/bbs/appli/example_SpinCtrl.bbs b/packages/wx/bbs/appli/example_SpinCtrl.bbs new file mode 100644 index 0000000..b3a26a0 --- /dev/null +++ b/packages/wx/bbs/appli/example_SpinCtrl.bbs @@ -0,0 +1,37 @@ +# ---------------------------------- +# - 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 "" + +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 diff --git a/packages/wx/src/bbwxComboBox.cxx b/packages/wx/src/bbwxComboBox.cxx index d0872dd..37f5338 100644 --- a/packages/wx/src/bbwxComboBox.cxx +++ b/packages/wx/src/bbwxComboBox.cxx @@ -12,6 +12,8 @@ #include #include +#include + namespace bbwx { //-------------------------------------------------------------------------- @@ -31,10 +33,14 @@ 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; }; @@ -58,18 +64,23 @@ namespace bbwx 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) @@ -78,23 +89,29 @@ namespace bbwx 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;ibbGetInputWithSpinButton()==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 ); } //------------------------------------------------------------------------- @@ -121,52 +138,119 @@ namespace bbwx { 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;iAppend( 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 ;iClear(); + for (i=0;iAppend( 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) && ( iSelectionVerifyDeselect(iSelection); } //===== @@ -183,7 +267,10 @@ void ComboBox::CreateWidget(wxWindow* parent) bbGetInputForm(), bbGetInputWinWidth(), bbGetInputWinHeight() ); bbSetOutputOut( bbGetInputSelection() ); - bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] ); + if (bbGetInputIn().size()> bbGetInputSelection() ) + { + bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] ); + } // if InputIn size bbSetOutputWidget( w ); } //===== @@ -194,9 +281,10 @@ void ComboBox::bbUserSetDefaultValues() 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) diff --git a/packages/wx/src/bbwxComboBox.h b/packages/wx/src/bbwxComboBox.h index 6b1e702..3a02e05 100644 --- a/packages/wx/src/bbwxComboBox.h +++ b/packages/wx/src/bbwxComboBox.h @@ -23,8 +23,11 @@ class bbwx_EXPORT ComboBox 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); @@ -39,13 +42,17 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ComboBox,bbtk::WxBlackBox); 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) diff --git a/packages/wx/src/bbwxCommandButton.cxx b/packages/wx/src/bbwxCommandButton.cxx index 206d90c..24fccf7 100644 --- a/packages/wx/src/bbwxCommandButton.cxx +++ b/packages/wx/src/bbwxCommandButton.cxx @@ -118,9 +118,7 @@ namespace bbwx { // 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); } @@ -140,17 +138,15 @@ namespace bbwx { 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; diff --git a/packages/wx/src/bbwxFreeMemoryAlert.cxx b/packages/wx/src/bbwxFreeMemoryAlert.cxx new file mode 100644 index 0000000..ab4116b --- /dev/null +++ b/packages/wx/src/bbwxFreeMemoryAlert.cxx @@ -0,0 +1,83 @@ +//===== +// 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 + +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 + + diff --git a/packages/wx/src/bbwxFreeMemoryAlert.h b/packages/wx/src/bbwxFreeMemoryAlert.h new file mode 100644 index 0000000..2628ad4 --- /dev/null +++ b/packages/wx/src/bbwxFreeMemoryAlert.h @@ -0,0 +1,46 @@ +//===== +// 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__ + diff --git a/packages/wx/src/bbwxInputText.cxx b/packages/wx/src/bbwxInputText.cxx index 3056f05..da4870e 100644 --- a/packages/wx/src/bbwxInputText.cxx +++ b/packages/wx/src/bbwxInputText.cxx @@ -53,7 +53,7 @@ namespace bbwx { public: InputTextWidget(InputText* box, wxWindow *parent, - wxString In, wxString title); + wxString In, wxString title ); ~InputTextWidget(); std::string GetValue(); @@ -77,13 +77,16 @@ namespace bbwx 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) @@ -102,7 +105,7 @@ namespace bbwx 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); @@ -171,7 +174,7 @@ namespace bbwx firsttime=true; bbSetInputTitle(""); bbSetInputIn(""); - bbSetOutputWidget(0); + bbSetOutputWidget(NULL); bbSetInputReactiveOnKeystroke(2); } @@ -209,10 +212,12 @@ namespace bbwx 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 diff --git a/packages/wx/src/bbwxInputText.h b/packages/wx/src/bbwxInputText.h index 6eb1480..dbaa017 100644 --- a/packages/wx/src/bbwxInputText.h +++ b/packages/wx/src/bbwxInputText.h @@ -89,10 +89,8 @@ namespace bbwx 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); diff --git a/packages/wx/src/bbwxInputTextMultiLine.cxx b/packages/wx/src/bbwxInputTextMultiLine.cxx new file mode 100644 index 0000000..c47bc95 --- /dev/null +++ b/packages/wx/src/bbwxInputTextMultiLine.cxx @@ -0,0 +1,188 @@ +//===== +// 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( "" ); + } +} +//===== +// 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 + + diff --git a/packages/wx/src/bbwxInputTextMultiLine.h b/packages/wx/src/bbwxInputTextMultiLine.h new file mode 100644 index 0000000..3bf0897 --- /dev/null +++ b/packages/wx/src/bbwxInputTextMultiLine.h @@ -0,0 +1,61 @@ +//===== +// 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_ + diff --git a/packages/wx/src/bbwxInputTextPassword.cxx b/packages/wx/src/bbwxInputTextPassword.cxx new file mode 100644 index 0000000..d099cb3 --- /dev/null +++ b/packages/wx/src/bbwxInputTextPassword.cxx @@ -0,0 +1,194 @@ +//===== +// 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( "" ); + } + +} +//===== +// 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 + + diff --git a/packages/wx/src/bbwxInputTextPassword.h b/packages/wx/src/bbwxInputTextPassword.h new file mode 100644 index 0000000..ab8bbcd --- /dev/null +++ b/packages/wx/src/bbwxInputTextPassword.h @@ -0,0 +1,61 @@ +//===== +// 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_ + diff --git a/packages/wx/src/bbwxLayoutLine.cxx b/packages/wx/src/bbwxLayoutLine.cxx index 38c753e..cdd1322 100644 --- a/packages/wx/src/bbwxLayoutLine.cxx +++ b/packages/wx/src/bbwxLayoutLine.cxx @@ -78,10 +78,10 @@ namespace bbwx } - void LayoutLine::Process() - { - PutWinTitle(); - } +void LayoutLine::Process() +{ + PutWinTitle(); +} /* @@ -98,21 +98,22 @@ namespace bbwx 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); diff --git a/packages/wx/src/bbwxLayoutTab.cxx b/packages/wx/src/bbwxLayoutTab.cxx index 639281a..3655a77 100644 --- a/packages/wx/src/bbwxLayoutTab.cxx +++ b/packages/wx/src/bbwxLayoutTab.cxx @@ -51,9 +51,62 @@ 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); //----------------------------------------------------------------- @@ -84,17 +137,16 @@ namespace bbwx //----------------------------------------------------------------- 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 vecTitle; std::vector vecInputNameWidget; vecInputNameWidget.push_back("Widget1"); @@ -119,26 +171,29 @@ namespace bbwx } // 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; iGetmwxNotebook(); + if (w!=NULL) { - w->SetPageText(i, wxString( vecTitle[i].c_str(),wxConvUTF8 ) ); - } // for i - } //w + int i,size=vecTitle.size(); + for (i=0; iSetPageText(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; @@ -150,13 +205,20 @@ namespace bbwx { 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"); @@ -166,27 +228,32 @@ namespace bbwx 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; iGetPageCount(); ++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; iGetPageCount(); ++i) + { + w->AdvanceSelection(); + } // for + } // if PageCount + } // if w +} }//namespace bbwx diff --git a/packages/wx/src/bbwxLayoutTab.h b/packages/wx/src/bbwxLayoutTab.h index 6ed22cc..71dae24 100644 --- a/packages/wx/src/bbwxLayoutTab.h +++ b/packages/wx/src/bbwxLayoutTab.h @@ -81,6 +81,9 @@ 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); @@ -115,6 +118,8 @@ namespace bbwx 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); //================================================================= diff --git a/packages/wx/src/bbwxListCtrl.cxx b/packages/wx/src/bbwxListCtrl.cxx new file mode 100644 index 0000000..0576e54 --- /dev/null +++ b/packages/wx/src/bbwxListCtrl.cxx @@ -0,0 +1,83 @@ +//===== +// 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 + +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;iAppendColumn( bbtk::std2wx( bbGetInputTitles()[i] ) ); + } // for i + + unsigned int j,jSize=bbGetInputColumn00().size(); + for (j=0;jInsertItem(j, bbtk::std2wx("0") ); + lstctrl->SetItem(j,0, bbtk::std2wx( bbGetInputColumn00()[j] ) ); + + if ((bbGetInputColumn01().size()==jSize ) && (1SetItem(j,1, bbtk::std2wx( bbGetInputColumn01()[j] ) ); } + if ((bbGetInputColumn02().size()==jSize ) && (2SetItem(j,2, bbtk::std2wx( bbGetInputColumn02()[j] ) ); } + if ((bbGetInputColumn03().size()==jSize ) && (3SetItem(j,3, bbtk::std2wx( bbGetInputColumn03()[j] ) ); } + if ((bbGetInputColumn04().size()==jSize ) && (4SetItem(j,4, bbtk::std2wx( bbGetInputColumn04()[j] ) ); } + if ((bbGetInputColumn05().size()==jSize ) && (5SetItem(j,5, bbtk::std2wx( bbGetInputColumn05()[j] ) ); } + if ((bbGetInputColumn06().size()==jSize ) && (6SetItem(j,6, bbtk::std2wx( bbGetInputColumn06()[j] ) ); } + if ((bbGetInputColumn07().size()==jSize ) && (7SetItem(j,7, bbtk::std2wx( bbGetInputColumn07()[j] ) ); } + if ((bbGetInputColumn08().size()==jSize ) && (8SetItem(j,8, bbtk::std2wx( bbGetInputColumn08()[j] ) ); } + if ((bbGetInputColumn09().size()==jSize ) && (9SetItem(j,9, bbtk::std2wx( bbGetInputColumn09()[j] ) ); } + if ((bbGetInputColumn10().size()==jSize ) && (10SetItem(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 + + diff --git a/packages/wx/src/bbwxListCtrl.h b/packages/wx/src/bbwxListCtrl.h new file mode 100644 index 0000000..c606c65 --- /dev/null +++ b/packages/wx/src/bbwxListCtrl.h @@ -0,0 +1,72 @@ +//===== +// 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); + BBTK_DECLARE_INPUT(Column00,std::vector); + BBTK_DECLARE_INPUT(Column01,std::vector); + BBTK_DECLARE_INPUT(Column02,std::vector); + BBTK_DECLARE_INPUT(Column03,std::vector); + BBTK_DECLARE_INPUT(Column04,std::vector); + BBTK_DECLARE_INPUT(Column05,std::vector); + BBTK_DECLARE_INPUT(Column06,std::vector); + BBTK_DECLARE_INPUT(Column07,std::vector); + BBTK_DECLARE_INPUT(Column08,std::vector); + BBTK_DECLARE_INPUT(Column09,std::vector); + BBTK_DECLARE_INPUT(Column10,std::vector); + 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,""); + BBTK_INPUT(ListCtrl,Column00,"Column 0",std::vector,""); + BBTK_INPUT(ListCtrl,Column01,"Column 1",std::vector,""); + BBTK_INPUT(ListCtrl,Column02,"Column 2",std::vector,""); + BBTK_INPUT(ListCtrl,Column03,"Column 3",std::vector,""); + BBTK_INPUT(ListCtrl,Column04,"Column 4",std::vector,""); + BBTK_INPUT(ListCtrl,Column05,"Column 5",std::vector,""); + BBTK_INPUT(ListCtrl,Column06,"Column 6",std::vector,""); + BBTK_INPUT(ListCtrl,Column07,"Column 7",std::vector,""); + BBTK_INPUT(ListCtrl,Column08,"Column 8",std::vector,""); + BBTK_INPUT(ListCtrl,Column09,"Column 9",std::vector,""); + BBTK_INPUT(ListCtrl,Column10,"Column 10",std::vector,""); + + +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_ + diff --git a/packages/wx/src/bbwxRadioButton.cxx b/packages/wx/src/bbwxRadioButton.cxx index 8ff7751..375092b 100644 --- a/packages/wx/src/bbwxRadioButton.cxx +++ b/packages/wx/src/bbwxRadioButton.cxx @@ -90,64 +90,6 @@ namespace bbwx mBox(box) { -/* - MAX_RADIOBUTTON = lstIn.size(); - wxPanel *panel = this; - int i; - long style=wxRB_GROUP; - for (i=0;iSetValue(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;iAdd( mwxRadioButton[i],1,wxGROW ); - } - } - sizer->AddGrowableCol(0); - panel->SetSizer(sizer); - -// panel->SetAutoLayout(true); -// panel->Layout(); -*/ - } //------------------------------------------------------------------------- @@ -241,10 +183,8 @@ namespace bbwx sizer->AddGrowableCol(0); panel->SetSizer(sizer); -// panel->SetAutoLayout(true); -// panel->Layout(); - - + panel->SetAutoLayout(true); + panel->Layout(); } @@ -331,7 +271,6 @@ namespace bbwx RadioButtonWidget *w = new RadioButtonWidget( this, -// bbGetWxParent(), parent, bbGetInputIn() , bbtk::std2wx(bbGetInputTitle()), diff --git a/packages/wx/src/bbwxSlider.cxx b/packages/wx/src/bbwxSlider.cxx index e467c5f..0db2b07 100644 --- a/packages/wx/src/bbwxSlider.cxx +++ b/packages/wx/src/bbwxSlider.cxx @@ -464,12 +464,9 @@ namespace bbwx //-------------------------------------------------------------------------- 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 = "< +#include + +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 + + diff --git a/packages/wx/src/bbwxSpinCtrl.h b/packages/wx/src/bbwxSpinCtrl.h new file mode 100644 index 0000000..f325cc2 --- /dev/null +++ b/packages/wx/src/bbwxSpinCtrl.h @@ -0,0 +1,60 @@ +//===== +// 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_ +