From: Eduardo DAVILA Date: Mon, 16 May 2022 13:48:27 +0000 (+0200) Subject: #3483 PlaneWidget_Base Box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=6196c24cbb7b38c5862fb1aa30b69b4d33112825;p=creaVtk.git #3483 PlaneWidget_Base Box --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5308ece..2b5c5f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,61 @@ IF (crea_FOUND) ENDIF(crea_FOUND) #================================== + +#FIND_PACKAGE(OpenMP) +#IF(OPENMP_FOUND) +# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") +# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") +# message(EED oooopppppeeeeennnnmmmmmppppp ${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} ) +#ENDIF() +#message(EED oooopppppeeeeennnnmmmmmppppp ${OpenMP_FOUND} ) + + +### Find OpenMP +if(APPLE ) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + set(OpenMP_C "${CMAKE_C_COMPILER}") + set(OpenMP_C_FLAGS "-Xclang -fopenmp=libomp -Wno-unused-command-line-argument") + set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5") + set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES}) + set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES}) + set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES}) + endif() + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(OpenMP_CXX "${CMAKE_CXX_COMPILER}") +# set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument") + set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -Wno-unused-command-line-argument") + set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5") + set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES}) + +#EED 2022/05/15 + set(OpenMP_libomp_LIBRARY_crea libomp.dylib ) + + set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES}) + set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES}) + endif() +endif() + find_package(OpenMP REQUIRED) +if (OPENMP_FOUND) +# include_directories("${OPENMP_INCLUDES}") + link_directories("${OPENMP_LIBRARIES}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + # set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") +endif(OPENMP_FOUND) + +message(EED oooopppppeeeeennnnmmmmmppppp2222A ${OPENMP_FOUND} ) +message(EED oooopppppeeeeennnnmmmmmppppp2222B ${OPENMP_INCLUDES} ) +message(EED oooopppppeeeeennnnmmmmmppppp2222C ${OpenMP_libomp_LIBRARY} ) +message(EED oooopppppeeeeennnnmmmmmppppp2222D ${OpenMP_CXX_FLAGS} ) +message(EED oooopppppeeeeennnnmmmmmppppp2222E ${OpenMP_CXX_LIBRARIES} ) + + + + + + + # USER! : Add here as many 'FIND_PACKAGE' blocks as *your* aplication requires # ----- diff --git a/bbtk_creaVtk_PKG/CMakeLists.txt b/bbtk_creaVtk_PKG/CMakeLists.txt index 94a5bb8..6ee181f 100644 --- a/bbtk_creaVtk_PKG/CMakeLists.txt +++ b/bbtk_creaVtk_PKG/CMakeLists.txt @@ -146,6 +146,8 @@ SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS #=========================================================================== SET(${BBTK_PACKAGE_NAME}_LIBS creaVtk + ${OpenMP_libomp_LIBRARY_crea} + # LIST HERE THE ADDITIONAL LIBS TO LINK AGAINST # EXCEPT : the same libs than for INCLUDE_DIRS ) @@ -156,7 +158,7 @@ creaVtk # IF NEEDED : UNCOMMENT NEXT LINE # AND LIST ADDITIONNAL DIRECTORIES # IN WHICH TO LOOK FOR LIBRARIES TO LINK AGAINST -# LINK_DIRECTORIES() + LINK_DIRECTORIES( /opt/local/lib/libomp ) #=========================================================================== #=========================================================================== diff --git a/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget_Base.bbg b/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget_Base.bbg new file mode 100644 index 0000000..4d67ac6 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget_Base.bbg @@ -0,0 +1,151 @@ +# ---------------------------------- +# - BBTKGEditor v 1.5 BBG BlackBox Diagram file +# - /Users/davila/Creatis/C11/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget_Base.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:11 +BOX +vtk:LoadHola:Box00 +ISEXEC:FALSE +-13.443844:31.942867:-900.000000 +8.106156:29.442867:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box01 +ISEXEC:FALSE +-4.883301:13.155606:-900.000000 +33.716698:10.655606:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box02 +ISEXEC:TRUE +21.958038:-55.878532:-900.000000 +44.718038:-58.378532:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:LayoutLine:Box03 +ISEXEC:FALSE +-55.775627:-43.972731:-900.000000 +-22.455627:-46.472731:-900.000000 +FIN_BOX +BOX +wx:OutputText:Box04 +ISEXEC:FALSE +-51.933032:-30.825319:-900.000000 +-30.263032:-33.325319:-900.000000 +PORT +Title:"Center" +FIN_BOX +BOX +wx:OutputText:Box05 +ISEXEC:FALSE +-29.209676:-31.880361:-900.000000 +-7.539676:-34.380361:-900.000000 +PORT +Title:"normal" +FIN_BOX +BOX +creaVtk:PlaneWidget:Box06 +ISEXEC:FALSE +-41.033080:7.242318:-900.000000 +-19.188080:4.742318:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +creaVtk:PlaneWidget_Base:Box07 +ISEXEC:FALSE +-96.079023:-49.483009:-900.000000 +-73.669023:-51.983009:-900.000000 +PORT +Param:"3" +PORT +Type:"1" +FIN_BOX +BOX +wx:CommandButton:Box08 +ISEXEC:FALSE +-73.531349:-3.250078:-900.000000 +-51.256349:-5.750078:-900.000000 +FIN_BOX +BOX +std:MultipleInputs:Box09 +ISEXEC:FALSE +-40.833264:-19.737257:-900.000000 +-18.863264:-22.237257:-900.000000 +FIN_BOX +BOX +vtk:UpdateRender:Box10 +ISEXEC:FALSE +-2.560466:-32.150057:-900.000000 +19.464534:-34.650057:-900.000000 +PORT +Active:"true" +FIN_BOX +CONNECTIONS:19 +CONNECTION +Box00:Out:Box01:In +NumberOfControlPoints:0 +CONNECTION +Box01:Widget:Box02:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box03:Widget:Box02:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box05:Widget:Box03:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box04:Widget:Box03:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box01:Renderer1:Box06:Renderer +NumberOfControlPoints:0 +CONNECTION +Box00:Out:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box06:Center:Box04:In +NumberOfControlPoints:0 +CONNECTION +Box06:Normal:Box05:In +NumberOfControlPoints:0 +CONNECTION +Box08:Widget:Box03:Widget4 +NumberOfControlPoints:0 +CONNECTION +Box08:BoxChange:Box07:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box06:BoxChange:Box09:In1 +NumberOfControlPoints:0 +CONNECTION +Box09:BoxChange:Box04:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box09:BoxChange:Box05:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box01:Renderer1:Box10:Renderer +NumberOfControlPoints:0 +CONNECTION +Box09:BoxChange:Box10:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box06:Base:Box07:In +NumberOfControlPoints:0 +CONNECTION +Box08:BoxChange:Box03:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box08:BoxChange:Box09:In2 +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget_Base.bbs b/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget_Base.bbs new file mode 100644 index 0000000..8f3814f --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget_Base.bbs @@ -0,0 +1,92 @@ +# ---------------------------------- +# - BBTKGEditor v 1.5 BBS BlackBox Script +# - /Users/davila/Creatis/C11/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget_Base.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include vtk +include creaMaracasVisu +include wx +include creaVtk +include std + +author "Author ??" +description "Description ??" +category "" + +new vtk:LoadHola Box00 + +new creaMaracasVisu:ViewerNV Box01 + +new wx:LayoutSplit Box02 + set Box02.Orientation "H" + +new wx:LayoutLine Box03 + +new wx:OutputText Box04 + set Box04.Title "Center" + +new wx:OutputText Box05 + set Box05.Title "normal" + +new creaVtk:PlaneWidget Box06 + set Box06.Active "true" + +new creaVtk:PlaneWidget_Base Box07 + set Box07.Param "3" + set Box07.Type "1" + +new wx:CommandButton Box08 + +new std:MultipleInputs Box09 + +new vtk:UpdateRender Box10 + set Box10.Active "true" + + +connect Box00.Out Box01.In + +connect Box01.Widget Box02.Widget2 + +connect Box03.Widget Box02.Widget1 + +connect Box05.Widget Box03.Widget2 + +connect Box04.Widget Box03.Widget1 + +connect Box01.Renderer1 Box06.Renderer + +connect Box00.Out Box06.In + +connect Box06.Center Box04.In + +connect Box06.Normal Box05.In + +connect Box08.Widget Box03.Widget4 + +connect Box08.BoxChange Box07.BoxExecute + +connect Box06.BoxChange Box09.In1 + +connect Box09.BoxChange Box04.BoxExecute + +connect Box09.BoxChange Box05.BoxExecute + +connect Box01.Renderer1 Box10.Renderer + +connect Box09.BoxChange Box10.BoxExecute + +connect Box06.Base Box07.In + +connect Box08.BoxChange Box03.BoxExecute + +connect Box08.BoxChange Box09.In2 + + + +# Complex input ports +exec Box02 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx index 9223d52..cddffce 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx @@ -125,7 +125,7 @@ void MeshDeformation::Process() points->Modified(); bbGetInputIn()->Modified(); } // if distance_x y z != 0 - } // In != NULL + } // In != NULL ok 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) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx index 3204378..f45306d 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx @@ -95,24 +95,22 @@ void PlaneWidget::Process() bbSetOutputOut( _boxcreavtkplanewidget.GetPlaneSource()->GetOutput() ); bbSetOutputCenter( _boxcreavtkplanewidget.GetCenter() ); bbSetOutputNormal( _boxcreavtkplanewidget.GetNormal() ); - int sizeN=bbGetInputOrigin().size(); - int sizeC=_boxcreavtkplanewidget.GetCenter().size(); - printf("EED PlaneWidget::Process OriginIn.size=%d CenterOut.size=%d \n", sizeN, sizeC); - if (sizeN==3) + bbSetOutputBase( &_boxcreavtkplanewidget ); + int sizeN = bbGetInputOrigin().size(); + int sizeC = _boxcreavtkplanewidget.GetCenter().size(); + if (sizeN==3) { double nx = bbGetInputOrigin()[0]; double ny = bbGetInputOrigin()[1]; double nz = bbGetInputOrigin()[2]; - printf("EED PlaneWidget::Process OriginIn=%f %f %f \n", nx,ny,nz); - } + } // if sizeN if (sizeC==3) { double cx =_boxcreavtkplanewidget.GetCenter()[0]; double cy =_boxcreavtkplanewidget.GetCenter()[1]; double cz =_boxcreavtkplanewidget.GetCenter()[2]; - printf("EED PlaneWidget::Process CenterOut=%f %f %f \n", cx,cy,cz); - } - } + } // if sizeC + } // If In Renderer } //===== @@ -135,6 +133,7 @@ void PlaneWidget::bbUserSetDefaultValues() bbSetInputRenderer(NULL); bbSetInputReactiveType( _boxcreavtkplanewidget._ReactiveType ); bbSetOutputOut(NULL); + bbSetOutputBase(NULL); } //===== diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h index b54d4e8..aed64f8 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h @@ -55,6 +55,7 @@ class bbcreaVtk_EXPORT PlaneWidget BBTK_DECLARE_OUTPUT(Out,vtkDataSet*); BBTK_DECLARE_OUTPUT(Center,std::vector); BBTK_DECLARE_OUTPUT(Normal,std::vector); + BBTK_DECLARE_OUTPUT(Base, creaVtkPlaneWidget* ); BBTK_PROCESS(Process); void Process(); @@ -85,6 +86,7 @@ BBTK_CATEGORY("empty"); BBTK_OUTPUT(PlaneWidget,Out,"Dynamic plane result from vtkPlaneSource",vtkDataSet*,""); BBTK_OUTPUT(PlaneWidget,Center,"Center of the plane",std::vector,""); BBTK_OUTPUT(PlaneWidget,Normal,"Normal of the plane",std::vector,""); + BBTK_OUTPUT(PlaneWidget,Base,"Base creaVtkPlaneWidget", creaVtkPlaneWidget* ,""); BBTK_END_DESCRIBE_BLACK_BOX(PlaneWidget); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget_Base.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget_Base.cxx new file mode 100644 index 0000000..25b743a --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget_Base.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 "bbcreaVtkPlaneWidget_Base.h" +#include "bbcreaVtkPackage.h" +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,PlaneWidget_Base) +BBTK_BLACK_BOX_IMPLEMENTATION(PlaneWidget_Base,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 PlaneWidget_Base::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 = " < origin = bbGetInputIn()->GetCenter(); + std::vector normal = bbGetInputIn()->GetNormal(); + + printf("EED PlaneWidget_Base::Process normal %f %f %f \n", normal[0],normal[1],normal[2] ); + printf("EED PlaneWidget_Base::Process origin %f %f %f \n", origin[0],origin[1],origin[2] ); + + origin[0] = origin[0] + normal[0]*bbGetInputParam(); + origin[1] = origin[1] + normal[1]*bbGetInputParam(); + origin[2] = origin[2] + normal[2]*bbGetInputParam(); + + printf("EED PlaneWidget_Base::Process origin2 %f %f %f \n", origin[0],origin[1],origin[2] ); + + bbGetInputIn()->SetOrigin(origin); + bbGetInputIn()->Process(); + + } + printf("EED PlaneWidget_Base::Process 2 \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 PlaneWidget_Base::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputIn(NULL); + bbSetInputType(0); + bbSetInputParam(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 PlaneWidget_Base::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 PlaneWidget_Base::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbcreaVtk + + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget_Base.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget_Base.h new file mode 100644 index 0000000..f7d0aef --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget_Base.h @@ -0,0 +1,52 @@ +//===== +// 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 __bbcreaVtkPlaneWidget_Base_h_INCLUDED__ +#define __bbcreaVtkPlaneWidget_Base_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "creaVtkPlaneWidget.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT PlaneWidget_Base + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(PlaneWidget_Base,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, creaVtkPlaneWidget* ); + BBTK_DECLARE_INPUT(Type, int ); + BBTK_DECLARE_INPUT(Param, 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(PlaneWidget_Base,bbtk::AtomicBlackBox); + BBTK_NAME("PlaneWidget_Base"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(PlaneWidget_Base,In,"Base creaVtkPlaneWidget ", creaVtkPlaneWidget* ,""); + BBTK_INPUT(PlaneWidget_Base,Type,"(default 0) 0:nothing 1:Move Normal Direction (Param=step) ", int ,""); + BBTK_INPUT(PlaneWidget_Base,Param,"Type=1 step ", double ,""); +// BBTK_OUTPUT(PlaneWidget_Base,Out,"First output",double,""); +BBTK_END_DESCRIBE_BLACK_BOX(PlaneWidget_Base); +//===== +// 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 bbcreaVtk + +#endif // __bbcreaVtkPlaneWidget_Base_h_INCLUDED__ +