From 698969b05363b20aeb3311389ff70ad5716236e1 Mon Sep 17 00:00:00 2001 From: davila Date: Thu, 27 Mar 2014 14:33:19 +0100 Subject: [PATCH] 2346 creaMaracasVisu Feature New Normal ManualContour Box --- bbtk/bbs/appli/exampleManualContour.bbg | 58 ++++++-- bbtk/bbs/appli/exampleManualContour.bbs | 29 +++- .../boxes/ContourControlPoints_Interface.bbg | 128 ++++++++++++++++++ .../boxes/ContourControlPoints_Interface.bbs | 60 ++++++++ .../bbs/boxes/ContourControlPoints_Widget.bbg | 82 +++++++++++ .../bbs/boxes/ContourControlPoints_Widget.bbs | 42 ++++++ .../bbcreaMaracasVisuContourControlPoints.cxx | 66 ++++++--- .../bbcreaMaracasVisuContourControlPoints.h | 8 ++ 8 files changed, 433 insertions(+), 40 deletions(-) create mode 100644 bbtk/bbs/boxes/ContourControlPoints_Interface.bbg create mode 100644 bbtk/bbs/boxes/ContourControlPoints_Interface.bbs create mode 100644 bbtk/bbs/boxes/ContourControlPoints_Widget.bbg create mode 100644 bbtk/bbs/boxes/ContourControlPoints_Widget.bbs diff --git a/bbtk/bbs/appli/exampleManualContour.bbg b/bbtk/bbs/appli/exampleManualContour.bbg index de6ba24..24d8e2d 100644 --- a/bbtk/bbs/appli/exampleManualContour.bbg +++ b/bbtk/bbs/appli/exampleManualContour.bbg @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBG BlackBox Diagram file -# - /home/davila/Creatis/All/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleManualContour.bbg +# - /home/davila/Creatis/All-Vtk_5-10-1/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleManualContour.bbg # ---------------------------------- APP_START @@ -9,39 +9,67 @@ DESCRIPTION:Description ?? AUTHOR:Author ?? COMPLEXBOX:FALSE COMPLEXINPUTS:0 -BOXES:4 +BOXES:6 BOX vtk:LoadHola:Box00 ISEXEC:FALSE --2.186339:41.873746:-900.000000 -43.388661:31.873746:-900.000000 +9.775689:58.070893:-900.000000 +55.350689:48.070893:-900.000000 FIN_BOX BOX creaMaracasVisu:ViewerNV:Box01 +ISEXEC:FALSE +1.811309:39.787619:-900.000000 +62.451309:29.787619:-900.000000 +PORT +nTypeView:"5 1 3 0" +FIN_BOX +BOX +wx:LayoutSplit:Box05 ISEXEC:TRUE --7.855229:14.279667:-900.000000 -52.784771:4.279667:-900.000000 +-16.972896:-59.824624:-900.000000 +28.602104:-69.824624:-900.000000 +PORT +Orientation:"H" FIN_BOX BOX -creaMaracasVisu:ContourControlPoints:Box02 +wx:LayoutTab:Box06 ISEXEC:FALSE --20.955005:-30.491537:-900.000000 -50.219995:-40.491537:-900.000000 +17.460900:-20.765927:-900.000000 +75.020900:-30.765927:-900.000000 FIN_BOX BOX -wx:CommandButton:Box03 +creaMaracasVisu:ContourControlPoints_Widget:Box08 +ISEXEC:FALSE +9.134136:6.949863:-900.000000 +80.309136:-3.050137:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box09 ISEXEC:TRUE --69.773673:18.395444:-900.000000 --24.198673:8.395444:-900.000000 +-48.256510:-25.995767:-900.000000 +-2.681510:-35.995767:-900.000000 FIN_BOX -CONNECTIONS:3 +CONNECTIONS:7 CONNECTION Box00:Out:Box01:In NumberOfControlPoints:0 CONNECTION -Box03:BoxChange:Box02:BoxExecute +Box06:Widget:Box05:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box01:Widget:Box05:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box01:wxVtkBaseView4:Box08:wxvtkbaseview +NumberOfControlPoints:0 +CONNECTION +Box01:Renderer4:Box08:vtkRenderer +NumberOfControlPoints:0 +CONNECTION +Box08:BoxChange2:Box09:BoxExecute NumberOfControlPoints:0 CONNECTION -Box01:wxVtkBaseView4:Box02:wxVtkBaseView +Box08:Widget_Contour:Box06:Widget1 NumberOfControlPoints:0 APP_END diff --git a/bbtk/bbs/appli/exampleManualContour.bbs b/bbtk/bbs/appli/exampleManualContour.bbs index 34a1a43..7d15538 100644 --- a/bbtk/bbs/appli/exampleManualContour.bbs +++ b/bbtk/bbs/appli/exampleManualContour.bbs @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBS BlackBox Script -# - /home/davila/Creatis/All/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleManualContour.bbs +# - /home/davila/Creatis/All-Vtk_5-10-1/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleManualContour.bbs # ---------------------------------- # BBTK GEditor Script @@ -11,6 +11,7 @@ include itkvtk include vtk include creaMaracasVisu include wx +include std author "Author ??" description "Description ??" @@ -19,20 +20,34 @@ category "" new LoadHola Box00 new ViewerNV Box01 + set Box01.nTypeView "5 1 3 0" + +new LayoutSplit Box05 + set Box05.Orientation "H" -new ContourControlPoints Box02 +new LayoutTab Box06 -new CommandButton Box03 +new ContourControlPoints_Widget Box08 + +new MagicBox Box09 connect Box00.Out Box01.In -connect Box03.BoxChange Box02.BoxExecute +connect Box06.Widget Box05.Widget1 + +connect Box01.Widget Box05.Widget2 + +connect Box01.wxVtkBaseView4 Box08.wxvtkbaseview + +connect Box01.Renderer4 Box08.vtkRenderer + +connect Box08.BoxChange2 Box09.BoxExecute -connect Box01.wxVtkBaseView4 Box02.wxVtkBaseView +connect Box08.Widget_Contour Box06.Widget1 # Complex input ports -exec Box01 -exec Box03 +exec Box05 +exec Box09 diff --git a/bbtk/bbs/boxes/ContourControlPoints_Interface.bbg b/bbtk/bbs/boxes/ContourControlPoints_Interface.bbg new file mode 100644 index 0000000..7568864 --- /dev/null +++ b/bbtk/bbs/boxes/ContourControlPoints_Interface.bbg @@ -0,0 +1,128 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/All-Vtk_5-10-1/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/ContourControlPoints_Interface.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:TRUE +COMPLEXBOXNAME:ContourControlPoints_Interface +PACKAGENAME:creaMaracasVisu +COMPLEXOUTPUTS:5 +COMPLEX_PORT +BoxChange +-45.625038:-58.252488:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +Widget +53.307694:12.284354:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +Active +-12.613007:10.662969:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +OpenClose +7.673777:14.478311:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +Visible +28.929459:12.495353:-900.000000 +FIN_COMPLEX_PORT +COMPLEXINPUTS:0 +BOXES:5 +BOX +wx:CheckBox:Box00 +ISEXEC:FALSE +-67.328802:79.203296:-900.000000 +-21.753802:69.203296:-900.000000 +PORT +In:"false" +PORT +ReactiveOnKeystroke:"1" +PORT +Title:"Active" +PORT +WinTitle:"hola" +FIN_BOX +BOX +wx:LayoutLine:Box01 +ISEXEC:FALSE +49.343063:44.114029:-900.000000 +106.903063:34.114029:-900.000000 +PORT +WinTitle:"Manual Ruler" +FIN_BOX +BOX +wx:CheckBox:Box02 +ISEXEC:FALSE +-8.481818:79.669193:-900.000000 +37.093182:69.669193:-900.000000 +PORT +In:"true" +PORT +ReactiveOnKeystroke:"1" +PORT +Title:"Close/Open" +PORT +WinTitle:"hola" +FIN_BOX +BOX +wx:CheckBox:Box04 +ISEXEC:FALSE +50.284255:80.728582:-900.000000 +95.859255:70.728582:-900.000000 +PORT +In:"true" +PORT +ReactiveOnKeystroke:"1" +PORT +Title:"Visible" +PORT +WinTitle:"hola" +FIN_BOX +BOX +std:MultipleInputs:Box10 +ISEXEC:FALSE +-65.562552:26.529021:-900.000000 +-19.987552:16.529021:-900.000000 +PORT +BoxProcessMode:"Reactive" +FIN_BOX +CONNECTIONS:11 +CONNECTION +Box00:Out:Active:Active +NumberOfControlPoints:0 +CONNECTION +Box00:Widget:Box01:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box01:Widget:Widget:Widget +NumberOfControlPoints:0 +CONNECTION +Box02:Widget:Box01:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box02:Out:OpenClose:OpenClose +NumberOfControlPoints:0 +CONNECTION +Box04:Widget:Box01:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box04:Out:Visible:Visible +NumberOfControlPoints:0 +CONNECTION +Box00:BoxChange:Box10:In1 +NumberOfControlPoints:0 +CONNECTION +Box02:BoxChange:Box10:In2 +NumberOfControlPoints:0 +CONNECTION +Box04:BoxChange:Box10:In3 +NumberOfControlPoints:0 +CONNECTION +Box10:Out:BoxChange:BoxChange +NumberOfControlPoints:0 +APP_END diff --git a/bbtk/bbs/boxes/ContourControlPoints_Interface.bbs b/bbtk/bbs/boxes/ContourControlPoints_Interface.bbs new file mode 100644 index 0000000..65a87cf --- /dev/null +++ b/bbtk/bbs/boxes/ContourControlPoints_Interface.bbs @@ -0,0 +1,60 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) +# - /home/davila/Creatis/All-Vtk_5-10-1/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/ContourControlPoints_Interface.bbs +# ---------------------------------- + +include std +include itkvtk +include wx +include std + +define ContourControlPoints_Interface creaMaracasVisu + +author "Author ??" +description "Description ??" + +category "" + +new CheckBox Box00 + set Box00.In "false" + set Box00.ReactiveOnKeystroke "1" + set Box00.Title "Active" + set Box00.WinTitle "hola" + +new LayoutLine Box01 + set Box01.WinTitle "Manual Ruler" + +new CheckBox Box02 + set Box02.In "true" + set Box02.ReactiveOnKeystroke "1" + set Box02.Title "Close/Open" + set Box02.WinTitle "hola" + +new CheckBox Box04 + set Box04.In "true" + set Box04.ReactiveOnKeystroke "1" + set Box04.Title "Visible" + set Box04.WinTitle "hola" + +new MultipleInputs Box10 + set Box10.BoxProcessMode "Reactive" + + +connect Box00.Widget Box01.Widget1 +connect Box02.Widget Box01.Widget2 +connect Box04.Widget Box01.Widget3 +connect Box00.BoxChange Box10.In1 +connect Box02.BoxChange Box10.In2 +connect Box04.BoxChange Box10.In3 + +# Complex input ports + +# Complex output ports +output Active Box00.Out " " +output Widget Box01.Widget " " +output OpenClose Box02.Out " " +output Visible Box04.Out " " +output BoxChange Box10.Out " " + + +endefine diff --git a/bbtk/bbs/boxes/ContourControlPoints_Widget.bbg b/bbtk/bbs/boxes/ContourControlPoints_Widget.bbg new file mode 100644 index 0000000..65d7966 --- /dev/null +++ b/bbtk/bbs/boxes/ContourControlPoints_Widget.bbg @@ -0,0 +1,82 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/davila/Creatis/All-Vtk_5-10-1/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/ContourControlPoints_Widget.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:TRUE +COMPLEXBOXNAME:ContourControlPoints_Widget +PACKAGENAME:creaMaracasVisu +COMPLEXOUTPUTS:2 +COMPLEX_PORT +Widget_Contour +-19.036670:-57.788292:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +BoxChange2 +-35.299241:-57.197844:-900.000000 +FIN_COMPLEX_PORT +COMPLEXINPUTS:2 +COMPLEX_PORT +vtkRenderer +-66.952546:87.647568:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +wxvtkbaseview +38.396047:99.501040:-900.000000 +FIN_COMPLEX_PORT +BOXES:3 +BOX +creaMaracasVisu:ContourControlPoints_Interface:Box00 +ISEXEC:FALSE +-37.992664:58.266375:-900.000000 +33.182336:48.266375:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ContourControlPoints:Box01 +ISEXEC:FALSE +2.241014:-5.079632:-900.000000 +73.416014:-15.079632:-900.000000 +FIN_BOX +BOX +vtk:UpdateRender:Box02 +ISEXEC:FALSE +-73.654674:-4.042790:-900.000000 +-28.079674:-14.042790:-900.000000 +PORT +Active:"true" +PORT +BoxProcessMode:"Reactive" +FIN_BOX +CONNECTIONS:9 +CONNECTION +Box00:Active:Box01:Active +NumberOfControlPoints:0 +CONNECTION +Box00:BoxChange:Box02:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box00:Widget:Widget_Contour:Widget_Contour +NumberOfControlPoints:0 +CONNECTION +Box00:BoxChange:Box01:BoxExecute +NumberOfControlPoints:0 +CONNECTION +vtkRenderer:vtkRenderer:Box02:Renderer +NumberOfControlPoints:0 +CONNECTION +wxvtkbaseview:wxvtkbaseview:Box01:wxVtkBaseView +NumberOfControlPoints:0 +CONNECTION +Box00:OpenClose:Box01:OpenClose +NumberOfControlPoints:0 +CONNECTION +Box00:Visible:Box01:Visible +NumberOfControlPoints:0 +CONNECTION +Box00:BoxChange:BoxChange2:BoxChange2 +NumberOfControlPoints:0 +APP_END diff --git a/bbtk/bbs/boxes/ContourControlPoints_Widget.bbs b/bbtk/bbs/boxes/ContourControlPoints_Widget.bbs new file mode 100644 index 0000000..894a381 --- /dev/null +++ b/bbtk/bbs/boxes/ContourControlPoints_Widget.bbs @@ -0,0 +1,42 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) +# - /home/davila/Creatis/All-Vtk_5-10-1/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/ContourControlPoints_Widget.bbs +# ---------------------------------- + +include std +include itkvtk +include creaMaracasVisu +include vtk + +define ContourControlPoints_Widget creaMaracasVisu + +author "Author ??" +description "Description ??" + +category "" + +new ContourControlPoints_Interface Box00 + +new ContourControlPoints Box01 + +new UpdateRender Box02 + set Box02.Active "true" + set Box02.BoxProcessMode "Reactive" + + +connect Box00.Active Box01.Active +connect Box00.BoxChange Box02.BoxExecute +connect Box00.BoxChange Box01.BoxExecute +connect Box00.OpenClose Box01.OpenClose +connect Box00.Visible Box01.Visible + +# Complex input ports +input vtkRenderer Box02.Renderer " " +input wxvtkbaseview Box01.wxVtkBaseView " " + +# Complex output ports +output Widget_Contour Box00.Widget " " +output BoxChange2 Box00.BoxChange " " + + +endefine diff --git a/bbtk/src/bbcreaMaracasVisuContourControlPoints.cxx b/bbtk/src/bbcreaMaracasVisuContourControlPoints.cxx index a65b894..b59f6ae 100644 --- a/bbtk/src/bbcreaMaracasVisuContourControlPoints.cxx +++ b/bbtk/src/bbcreaMaracasVisuContourControlPoints.cxx @@ -16,7 +16,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ContourControlPoints,bbtk::AtomicBlackBox); //===== void ContourControlPoints::Process() { - +printf("EED ContourControlPoints::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 @@ -33,33 +33,57 @@ void ContourControlPoints::Process() // std::cout << "Output value = " <SetModel( _mContourModel_1 ); - _mViewContour_1->SetWxVtkBaseView( bbGetInputwxVtkBaseView() ); - _mViewContour_1->SetRange( 2 ); - _mViewContour_1->SetZ( 1000 ); + + if ( bbGetInputwxVtkBaseView() != NULL ) + { + if (_manContourControl_1==NULL) + { + _manContourControl_1 = new manualContourControler(); + _mContourModel_1 = new manualContourModel(); + _mViewContour_1 = new manualViewContour(); + + _mContourModel_1 -> SetCloseContour( bbGetInputOpenClose() ); + + _mViewContour_1->SetModel( _mContourModel_1 ); + _mViewContour_1->SetWxVtkBaseView( bbGetInputwxVtkBaseView() ); + _mViewContour_1->SetRange( 2 ); + _mViewContour_1->SetZ( 1000 ); //JSTG 18-06-07 - _mContourModel_1->SetNumberOfPointsSpline(100); + _mContourModel_1->SetNumberOfPointsSpline(100); //EED 3 oct 2006 -// _mViewContour_1->SetSpacing(spc); + double spc[3]; + bbGetInputwxVtkBaseView()->GetSpacing(spc); + _mViewContour_1->SetSpacing(spc); //EED 3 oct 2006 - _mViewContour_1->SetColorNormalContour(0, 0, 1); - _mViewContour_1->SetColorEditContour(0.5, 0.5, 0.5); + _mViewContour_1->SetColorNormalContour(0, 0, 1); + _mViewContour_1->SetColorEditContour(0.5, 0.5, 0.5); + + + _manContourControl_1->SetModelView( _mContourModel_1 , _mViewContour_1 ); + ((vtkInteractorStyleBaseView*)bbGetInputwxVtkBaseView()->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_1 ); + _manContourControl_1->CreateNewManualContour(); + _manContourControl_1->SetActive( bbGetInputActive() ); + _mViewContour_1->RefreshContour(); + } // _manContourControl_1 + _mContourModel_1 -> SetCloseContour( bbGetInputOpenClose() ); + _manContourControl_1->SetActive( bbGetInputActive() ); + if ( bbGetInputVisible() == true) + { + _mViewContour_1->AddCompleteContourActor (true); + } else { + _mViewContour_1->RemoveCompleteContourActor (); + } + _mViewContour_1->RefreshContour(); - _manContourControl_1->SetModelView( _mContourModel_1 , _mViewContour_1 ); - ((vtkInteractorStyleBaseView*)bbGetInputwxVtkBaseView()->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_1 ); - _manContourControl_1->CreateNewManualContour(); - _manContourControl_1->SetActive(true); - _mViewContour_1->RefreshContour(); + } // wxVtkBaseView +printf("EED ContourControlPoints::Process End\n"); } //===== @@ -70,7 +94,13 @@ void ContourControlPoints::bbUserSetDefaultValues() // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 - bbSetInputwxVtkBaseView(NULL); + bbSetInputActive(false); + bbSetInputVisible(true); + bbSetInputOpenClose(true); + bbSetInputwxVtkBaseView(NULL); + _manContourControl_1 = NULL; + _mContourModel_1 = NULL; + _mViewContour_1 = NULL; } //===== diff --git a/bbtk/src/bbcreaMaracasVisuContourControlPoints.h b/bbtk/src/bbcreaMaracasVisuContourControlPoints.h index 2efdba5..04d294f 100644 --- a/bbtk/src/bbcreaMaracasVisuContourControlPoints.h +++ b/bbtk/src/bbcreaMaracasVisuContourControlPoints.h @@ -23,6 +23,10 @@ class bbcreaMaracasVisu_EXPORT ContourControlPoints //===== // Before editing this file, make 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(Visible,bool); + BBTK_DECLARE_INPUT(Type,int); + BBTK_DECLARE_INPUT(OpenClose,bool); BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*); // BBTK_DECLARE_OUTPUT(Out,double); BBTK_PROCESS(Process); @@ -44,6 +48,10 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ContourControlPoints,bbtk::AtomicBlackBox); BBTK_DESCRIPTION("No Description."); BBTK_CATEGORY("empty"); + BBTK_INPUT(ContourControlPoints,Active,"Active (default false) ",bool,""); + BBTK_INPUT(ContourControlPoints,Type,"(0 Default) 0=Spline, ... .",int,""); + BBTK_INPUT(ContourControlPoints,OpenClose,"Open=true or Close=false contour (default false)",bool,""); + BBTK_INPUT(ContourControlPoints,Visible,"Visible (default true)",bool,""); BBTK_INPUT(ContourControlPoints,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,""); // BBTK_OUTPUT(ContourControlPoints,Out,"First output",double,""); -- 2.47.1