From acfd5a304b14d72c35188b3360f4b63cc4decf6a Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 19 Jul 2023 10:28:44 +0200 Subject: [PATCH] #3524 TransformWidget2 --- bbtk/bbs/appli/exampleTransformWidget2.bbg | 850 ++++++++++++++++++ bbtk/bbs/appli/exampleTransformWidget2.bbs | 447 +++++++++ .../src/bbcreaMaracasVisuTransformWidget2.cxx | 158 ++-- bbtk/src/bbcreaMaracasVisuTransformWidget2.h | 2 +- 4 files changed, 1402 insertions(+), 55 deletions(-) create mode 100644 bbtk/bbs/appli/exampleTransformWidget2.bbg create mode 100644 bbtk/bbs/appli/exampleTransformWidget2.bbs diff --git a/bbtk/bbs/appli/exampleTransformWidget2.bbg b/bbtk/bbs/appli/exampleTransformWidget2.bbg new file mode 100644 index 0000000..7a942fc --- /dev/null +++ b/bbtk/bbs/appli/exampleTransformWidget2.bbg @@ -0,0 +1,850 @@ +# ---------------------------------- +# - BBTKGEditor v 1.5 BBG BlackBox Diagram file +# - /Users/davila/Creatis/C23/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleTransformWidget2.bbg +# ---------------------------------- + +APP_START +CATEGORY:demo +DESCRIPTION:Show N Points +AUTHOR:info-dev@creatis.insa-lyon.fr +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:58 +BOX +creaMaracasVisu:ViewerNV:viewer +ISEXEC:FALSE +85.967077:143.268387:-900.000000 +107.557077:140.768387:-900.000000 +PORT +nTypeView:"5 1 2 0" +FIN_BOX +BOX +creaMaracasVisu:ShowNPoints:showNpoints +ISEXEC:FALSE +208.256761:44.671338:-900.000000 +245.096761:42.171338:-900.000000 +PORT +Radio:"2" +PORT +Type:"4" +FIN_BOX +BOX +wx:LayoutSplit:main +ISEXEC:TRUE +45.687058:-119.933737:-900.000000 +67.352058:-122.433737:-900.000000 +PORT +Orientation:"H" +PORT +Proportion:"10" +FIN_BOX +BOX +vtk:MetaImageReader:Box04 +ISEXEC:FALSE +93.477283:203.365927:-900.000000 +115.937283:200.865927:-900.000000 +PORT +In:"/Users/davila/CreatisWork/tmpJCR/results/Experimental-XXXXX2/FG101-VT-B/images/Inspi-B.mhd" +FIN_BOX +BOX +vtk:vtkImageDataPointerRelay:Box05 +ISEXEC:FALSE +89.516479:153.129177:-900.000000 +112.726479:150.629177:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ImageChangeInformation:Box06 +ISEXEC:FALSE +98.101265:186.052051:-900.000000 +121.251265:183.552051:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ManualContourModel_Box:Box07 +ISEXEC:FALSE +194.916832:2.707670:-900.000000 +219.436832:0.207670:-900.000000 +PORT +DoubleContour:"0" +PORT +NbPoints:"100" +FIN_BOX +BOX +creaMaracasVisu:DrawAxisTree3D:Box08 +ISEXEC:FALSE +182.751933:-6.684443:-900.000000 +210.791933:-9.184443:-900.000000 +PORT +Colour:"0 0 1" +PORT +LineWidth:"2" +PORT +Opacity:"1" +FIN_BOX +BOX +std:VectorFilterDouble:Box09 +ISEXEC:FALSE +216.450684:21.779405:-900.000000 +242.730684:19.279405:-900.000000 +PORT +Type:"11" +FIN_BOX +BOX +vtk:ImageVtkProperties:Box10 +ISEXEC:FALSE +-38.467279:72.794940:-900.000000 +16.720000:70.294940:-900.000000 +FIN_BOX +BOX +wx:LayoutLine:Box12 +ISEXEC:FALSE +-66.572804:-26.022814:-900.000000 +-33.252804:-28.522814:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +creaMaracasVisu:SliceImage:Box21 +ISEXEC:FALSE +-80.494473:39.228278:-900.000000 +-58.769473:36.728278:-900.000000 +PORT +InterpolationMode:"1" +PORT +Slice:"0" +PORT +TypeOrientation:"3" +PORT +Z:"0" +FIN_BOX +BOX +creaVtk:TransformVector:Box25 +ISEXEC:FALSE +-81.471694:78.694065:-900.000000 +-59.261694:76.194065:-900.000000 +PORT +InX:"1 0 0" +PORT +InY:"0 1 0" +PORT +InZ:"0 0 1" +FIN_BOX +BOX +creaMaracasVisu:ImageActor:Box34 +ISEXEC:FALSE +-75.127992:1.355089:-900.000000 +15.720000:-1.144911:-900.000000 +PORT +InterpolationMode:"1" +FIN_BOX +BOX +vtk:UpdateRender:Box35 +ISEXEC:FALSE +-36.550423:-14.754442:-900.000000 +8.680000:-17.254442:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +vtk:Transform:Box36 +ISEXEC:FALSE +-52.487360:57.978654:-900.000000 +17.480000:55.478654:-900.000000 +FIN_BOX +BOX +creaVtk:ConcatTransform:Box37 +ISEXEC:FALSE +-59.880124:50.051963:-900.000000 +-37.600124:47.551963:-900.000000 +FIN_BOX +BOX +std:ConcatStrings:Box38 +ISEXEC:FALSE +-61.804071:72.216477:-900.000000 +-39.044071:69.716477:-900.000000 +FIN_BOX +BOX +std:ConcatStrings:Box42 +ISEXEC:FALSE +-83.220618:67.537653:-900.000000 +22.760000:65.037653:-900.000000 +PORT +In2:" " +PORT +In4:" " +FIN_BOX +BOX +creaVtk:ScalarsToColors:Box48 +ISEXEC:FALSE +-98.732708:19.851377:-900.000000 +13.960000:17.351377:-900.000000 +PORT +BelowAboveRangeTransparence:"false" +PORT +Type:"101" +FIN_BOX +BOX +vtk:ImageVtkProperties:Box56 +ISEXEC:FALSE +192.119298:113.667910:-900.000000 +214.654298:111.167910:-900.000000 +FIN_BOX +BOX +vtk:vtkImageDataPointerRelay:Box57 +ISEXEC:FALSE +-37.376549:80.928257:-900.000000 +-14.166549:78.428257:-900.000000 +FIN_BOX +BOX +wx:LayoutLine:Box59 +ISEXEC:FALSE +12.895337:-90.189618:-900.000000 +34.555337:-92.689618:-900.000000 +PORT +WinTitle:"Plane" +FIN_BOX +BOX +std:MagicBox:Box60 +ISEXEC:FALSE +-8.381788:38.267560:-900.000000 +13.218212:35.767560:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ManualContourModel_Box:Box61 +ISEXEC:FALSE +164.264334:43.516761:-900.000000 +188.784334:41.016761:-900.000000 +PORT +DoubleContour:"1" +PORT +NbPoints:"200" +PORT +OpenClose2:"true" +FIN_BOX +BOX +creaVtk:CreateMeshFromPoints:Box62 +ISEXEC:FALSE +159.141951:32.031198:-900.000000 +181.996951:29.531198:-900.000000 +PORT +CloseSurface:"false" +FIN_BOX +BOX +creaMaracasVisu:PolyDataToActor_Widget:Box63 +ISEXEC:FALSE +174.158043:14.525211:-900.000000 +197.178043:12.025211:-900.000000 +PORT +active:"true" +FIN_BOX +BOX +creaVtk:PointPicker:Box64 +ISEXEC:FALSE +197.861316:104.022642:-900.000000 +219.556316:101.522642:-900.000000 +PORT +DefaultPoint:"50 50 50" +PORT +TypeEvent:"2" +FIN_BOX +BOX +std:MathOperationVector:Box66 +ISEXEC:FALSE +215.151739:90.391295:-900.000000 +239.671739:87.891295:-900.000000 +PORT +Type:"3" +FIN_BOX +BOX +std:MathOperationVector:Box67 +ISEXEC:FALSE +217.157253:84.979067:-900.000000 +241.677253:82.479067:-900.000000 +PORT +Type:"23" +FIN_BOX +BOX +creaMaracasVisu:SetPosition:Box68 +ISEXEC:FALSE +212.247618:76.740872:-900.000000 +233.907618:74.240872:-900.000000 +FIN_BOX +BOX +std:MultipleInputs:Box69 +ISEXEC:TRUE +127.775959:-119.745040:-900.000000 +149.745959:-122.245040:-900.000000 +FIN_BOX +BOX +wx:LayoutTab:Box70 +ISEXEC:FALSE +23.590887:-104.478048:-900.000000 +45.205887:-106.978048:-900.000000 +FIN_BOX +BOX +wx:LayoutLine:Box71 +ISEXEC:FALSE +176.518334:134.643148:-900.000000 +198.178334:132.143148:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +PackRecalage:ImageConvolution:Box72 +ISEXEC:FALSE +112.327108:162.476513:-900.000000 +134.762108:159.976513:-900.000000 +FIN_BOX +BOX +vtk:vtkImageDataPointerRelay:Box74 +ISEXEC:FALSE +99.646770:172.833935:-900.000000 +122.856770:170.333935:-900.000000 +FIN_BOX +BOX +wx:Slider:Box75 +ISEXEC:FALSE +160.291919:181.728860:-900.000000 +181.446919:179.228860:-900.000000 +PORT +In:"-12000" +PORT +Label:"true" +PORT +Max:"12000" +PORT +Min:"-12000" +PORT +ReactiveOnTrack:"true" +PORT +Title:"Convolution1" +PORT +WinTitle:"Convolution1" +FIN_BOX +BOX +std:Div:Box76 +ISEXEC:FALSE +155.280291:174.925137:-900.000000 +176.205291:172.425137:-900.000000 +PORT +In2:"100" +FIN_BOX +BOX +wx:LayoutLine:Box78 +ISEXEC:FALSE +56.989262:-89.883471:-900.000000 +78.649262:-92.383471:-900.000000 +PORT +WinTitle:"Config Image" +FIN_BOX +BOX +wx:CheckBox:Box80 +ISEXEC:FALSE +148.962639:168.375469:-900.000000 +170.592639:165.875469:-900.000000 +PORT +Title:"Convolution" +FIN_BOX +BOX +std:StringSelect:Box81 +ISEXEC:FALSE +187.500455:163.866474:-900.000000 +212.020455:161.366474:-900.000000 +PORT +In0:"380 80" +PORT +In1:"10800 4300" +FIN_BOX +BOX +std:GetVectorStringElement:Box82 +ISEXEC:FALSE +185.527769:152.171268:-900.000000 +208.482769:149.671268:-900.000000 +PORT +I:"0" +FIN_BOX +BOX +std:GetVectorStringElement:Box83 +ISEXEC:FALSE +220.142331:152.591387:-900.000000 +243.097331:150.091387:-900.000000 +PORT +I:"1" +FIN_BOX +BOX +vtk:LoadHola:Box84 +ISEXEC:FALSE +62.963791:203.624575:-900.000000 +84.513791:201.124575:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:wxVtkBaseView_Info:Box92 +ISEXEC:FALSE +-106.107062:85.120138:-900.000000 +-78.827062:82.620138:-900.000000 +PORT +InteractionType:"12" +FIN_BOX +BOX +creaMaracasVisu:MeshContours_Widget:Box93 +ISEXEC:FALSE +192.848525:10.509373:-900.000000 +215.643525:8.009373:-900.000000 +PORT +colorMesh:"1 1 0" +FIN_BOX +BOX +wx:CheckBox:Box94 +ISEXEC:FALSE +-34.183836:17.553423:-900.000000 +21.000000:15.053423:-900.000000 +PORT +Title:"Pivot plane" +FIN_BOX +BOX +creaMaracasVisu:DrawAxisTree3D:Box100 +ISEXEC:FALSE +-17.199624:5.214616:-900.000000 +28.040000:2.714616:-900.000000 +PORT +Colour:"1 0 0 1 1 0 0 0 1" +PORT +ColourLaw:"2" +PORT +LineWidth:"2" +PORT +lstIndexs:"2 2 2" +PORT +lstPointX:"0 20 0 0 0 0" +PORT +lstPointY:"0 0 0 80 0 0" +PORT +lstPointZ:"0 0 0 0 0 20" +FIN_BOX +BOX +creaMaracasVisu:TransformWidget2:Box105 +ISEXEC:FALSE +-73.017326:113.168725:-900.000000 +-50.562326:110.668725:-900.000000 +PORT +Type:"1" +FIN_BOX +BOX +wx:LayoutSplit:Box96 +ISEXEC:FALSE +77.617610:-105.424097:-900.000000 +99.282610:-107.924097:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box97 +ISEXEC:FALSE +92.465258:-89.416058:-900.000000 +114.055258:-91.916058:-900.000000 +PORT +nTypeView:"0" +FIN_BOX +BOX +creaMaracasVisu:ImageChangeInformation:Box98 +ISEXEC:FALSE +95.452651:-82.308567:-900.000000 +118.602651:-84.808567:-900.000000 +FIN_BOX +BOX +std:GetVectorDoubleElement:Box99 +ISEXEC:FALSE +123.804357:-63.316601:-900.000000 +146.929357:-65.816601:-900.000000 +PORT +I:"0" +FIN_BOX +BOX +std:GetVectorDoubleElement:Box101 +ISEXEC:FALSE +103.401113:-66.196632:-900.000000 +126.636113:-68.696632:-900.000000 +PORT +I:"1" +FIN_BOX +BOX +creaImageIO:ImagesChooserDialogBox:Box102 +ISEXEC:FALSE +122.236090:203.990799:-900.000000 +145.391090:201.490799:-900.000000 +FIN_BOX +BOX +std:MathOperationVector:Box104 +ISEXEC:FALSE +-48.533350:63.839056:-900.000000 +-24.013350:61.339056:-900.000000 +PORT +Type:"2" +FIN_BOX +BOX +std:MultipleInputs:Box106 +ISEXEC:FALSE +-35.585238:-5.984095:-900.000000 +-13.505238:-8.484095:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:wxVtkBaseView_Info:Box107 +ISEXEC:FALSE +73.772005:45.069956:-900.000000 +101.052005:42.569956:-900.000000 +PORT +InteractionType:"12" +FIN_BOX +CONNECTIONS:118 +CONNECTION +viewer:Renderer1:showNpoints:Renderer +NumberOfControlPoints:0 +CONNECTION +viewer:Point:showNpoints:In +NumberOfControlPoints:0 +CONNECTION +viewer:BoxChange:showNpoints:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box05:Out:showNpoints:Image +NumberOfControlPoints:0 +CONNECTION +Box05:Out:viewer:In +NumberOfControlPoints:0 +CONNECTION +showNpoints:lstIndexs:Box07:LstIndexsIn +NumberOfControlPoints:0 +CONNECTION +Box07:LstContourPointsX:Box08:lstPointX +NumberOfControlPoints:0 +CONNECTION +Box07:LstContourPointsY:Box08:lstPointY +NumberOfControlPoints:0 +CONNECTION +Box07:LstContourPointsZ:Box08:lstPointZ +NumberOfControlPoints:0 +CONNECTION +Box07:LstIndexsOut:Box08:lstIndexs +NumberOfControlPoints:0 +CONNECTION +viewer:Renderer1:Box08:Renderer +NumberOfControlPoints:0 +CONNECTION +showNpoints:BoxChange:Box08:BoxExecute +NumberOfControlPoints:0 +CONNECTION +showNpoints:lstPointsX:Box09:In0 +NumberOfControlPoints:0 +CONNECTION +showNpoints:lstPointsY:Box09:In1 +NumberOfControlPoints:0 +CONNECTION +showNpoints:lstPointsZ:Box09:In2 +NumberOfControlPoints:0 +CONNECTION +Box09:Out0:Box07:LstControlPointsX +NumberOfControlPoints:0 +CONNECTION +Box09:Out1:Box07:LstControlPointsY +NumberOfControlPoints:0 +CONNECTION +Box09:Out2:Box07:LstControlPointsZ +NumberOfControlPoints:0 +CONNECTION +Box21:Out:Box34:In +NumberOfControlPoints:0 +CONNECTION +Box38:Out:Box21:AxisOrigin +NumberOfControlPoints:0 +CONNECTION +Box36:Out:Box37:In3 +NumberOfControlPoints:0 +CONNECTION +Box37:Out:Box34:Transform +NumberOfControlPoints:0 +CONNECTION +Box25:OutX:Box42:In1 +NumberOfControlPoints:0 +CONNECTION +Box25:OutY:Box42:In3 +NumberOfControlPoints:0 +CONNECTION +Box25:OutZ:Box42:In5 +NumberOfControlPoints:0 +CONNECTION +Box42:Out:Box21:ResliceAxesDirectionCosines +NumberOfControlPoints:0 +CONNECTION +Box48:LookupTable:Box34:LookupTable +NumberOfControlPoints:0 +CONNECTION +Box05:Out:Box56:In +NumberOfControlPoints:0 +CONNECTION +Box56:Spacing:Box09:k1 +NumberOfControlPoints:0 +CONNECTION +Box57:Out:Box21:In +NumberOfControlPoints:0 +CONNECTION +Box57:Out:Box10:In +NumberOfControlPoints:0 +CONNECTION +showNpoints:Widget:Box59:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box12:Widget:Box59:Widget3 +NumberOfControlPoints:0 +CONNECTION +viewer:Renderer1:Box60:In +NumberOfControlPoints:0 +CONNECTION +Box60:Out:Box34:Renderer +NumberOfControlPoints:0 +CONNECTION +Box60:Out:Box35:Renderer +NumberOfControlPoints:0 +CONNECTION +Box09:Out0:Box61:LstControlPointsX +NumberOfControlPoints:0 +CONNECTION +Box09:Out1:Box61:LstControlPointsY +NumberOfControlPoints:0 +CONNECTION +Box09:Out2:Box61:LstControlPointsZ +NumberOfControlPoints:0 +CONNECTION +showNpoints:lstIndexs:Box61:LstIndexsIn +NumberOfControlPoints:0 +CONNECTION +Box61:LstContourPointsX:Box62:LstX +NumberOfControlPoints:0 +CONNECTION +Box61:LstContourPointsY:Box62:LstY +NumberOfControlPoints:0 +CONNECTION +Box61:LstContourPointsZ:Box62:LstZ +NumberOfControlPoints:0 +CONNECTION +Box61:LstIndexsOut:Box62:LstIndexs +NumberOfControlPoints:0 +CONNECTION +Box62:Out:Box63:polydata +NumberOfControlPoints:0 +CONNECTION +viewer:Renderer1:Box63:render +NumberOfControlPoints:0 +CONNECTION +Box63:widget:Box59:Widget4 +NumberOfControlPoints:0 +CONNECTION +Box56:Spacing:Box66:In1 +NumberOfControlPoints:0 +CONNECTION +Box66:Out:Box67:In0 +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView1:Box68:wxVtkBaseView +NumberOfControlPoints:0 +CONNECTION +Box67:Out:Box68:Point +NumberOfControlPoints:0 +CONNECTION +Box64:BoxChange:Box68:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box64:BoxChange:Box69:In1 +NumberOfControlPoints:0 +CONNECTION +Box59:Widget:Box70:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box70:Widget:main:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box74:Out:Box72:In +NumberOfControlPoints:0 +CONNECTION +Box75:Out:Box76:In1 +NumberOfControlPoints:0 +CONNECTION +Box76:Out:Box72:Factor +NumberOfControlPoints:0 +CONNECTION +Box75:BoxChange:Box72:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box71:Widget:Box78:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box78:Widget:Box70:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box75:Widget:Box71:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box06:Out:Box74:In +NumberOfControlPoints:0 +CONNECTION +Box80:Widget:Box71:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box80:Out:Box72:On +NumberOfControlPoints:0 +CONNECTION +Box72:Out:Box05:In +NumberOfControlPoints:0 +CONNECTION +Box80:Out:Box81:In +NumberOfControlPoints:0 +CONNECTION +Box81:Out:Box82:In +NumberOfControlPoints:0 +CONNECTION +Box82:Out:viewer:WindowLevel +NumberOfControlPoints:0 +CONNECTION +Box81:Out:Box83:In +NumberOfControlPoints:0 +CONNECTION +Box83:Out:viewer:ColorLevel +NumberOfControlPoints:0 +CONNECTION +viewer:Renderer1:Box64:Renderer +NumberOfControlPoints:0 +CONNECTION +Box64:Point:Box66:In0 +NumberOfControlPoints:0 +CONNECTION +Box92:WindowColorLevel:Box48:WindowColorLevel +NumberOfControlPoints:0 +CONNECTION +Box92:BoxChange:Box48:BoxExecute +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView2:Box92:wxVtkBaseView +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView3:Box92:wxVtkBaseView2 +NumberOfControlPoints:0 +CONNECTION +Box62:Out:Box93:_polydata +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView2:Box93:_wxvtkbaseview2D1 +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView3:Box93:_wxvtkbaseview2D2 +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView4:Box93:_wxvtkbaseview2D3 +NumberOfControlPoints:0 +CONNECTION +Box93:_widget:Box59:Widget6 +NumberOfControlPoints:0 +CONNECTION +viewer:BoxChange:Box93:_execute +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView1:Box93:_wxvtkbaseview3D1 +NumberOfControlPoints:0 +CONNECTION +Box94:Out:Box34:Opacity +NumberOfControlPoints:0 +CONNECTION +Box94:Widget:Box12:Widget4 +NumberOfControlPoints:0 +CONNECTION +Box37:Out:Box100:Transform +NumberOfControlPoints:0 +CONNECTION +Box60:Out:Box100:Renderer +NumberOfControlPoints:0 +CONNECTION +Box105:Out:Box25:Transform +NumberOfControlPoints:0 +CONNECTION +Box105:Out:Box37:In1 +NumberOfControlPoints:0 +CONNECTION +Box105:Widget:Box12:Widget2 +NumberOfControlPoints:0 +CONNECTION +viewer:Widget:Box96:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box96:Widget:main:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box97:Widget:Box96:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box21:BoxChange:Box97:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box21:Out:Box98:In +NumberOfControlPoints:0 +CONNECTION +Box98:Out:Box97:In +NumberOfControlPoints:0 +CONNECTION +Box99:Out:Box97:WindowLevel +NumberOfControlPoints:0 +CONNECTION +Box101:Out:Box97:ColorLevel +NumberOfControlPoints:0 +CONNECTION +Box38:Out:Box104:In0 +NumberOfControlPoints:0 +CONNECTION +Box10:Spacing:Box104:In1 +NumberOfControlPoints:0 +CONNECTION +Box104:Out:Box36:Translate +NumberOfControlPoints:0 +CONNECTION +Box84:Out:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box105:ActualPoint:Box38:In1 +NumberOfControlPoints:0 +CONNECTION +Box94:Out:Box100:Active +NumberOfControlPoints:0 +CONNECTION +Box34:BoxChange:Box106:In1 +NumberOfControlPoints:0 +CONNECTION +Box100:BoxChange:Box106:In2 +NumberOfControlPoints:0 +CONNECTION +Box106:BoxChange:Box35:BoxExecute +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView4:Box92:wxVtkBaseView3 +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView2:Box107:wxVtkBaseView +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView3:Box107:wxVtkBaseView2 +NumberOfControlPoints:0 +CONNECTION +viewer:wxVtkBaseView4:Box107:wxVtkBaseView3 +NumberOfControlPoints:0 +CONNECTION +Box107:WindowColorLevel:Box101:In +NumberOfControlPoints:0 +CONNECTION +Box107:WindowColorLevel:Box99:In +NumberOfControlPoints:0 +CONNECTION +Box105:BoxChange:Box100:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box92:Image:Box57:In +NumberOfControlPoints:0 +CONNECTION +viewer:Point:Box105:PossiblePoint +NumberOfControlPoints:0 +CONNECTION +Box94:Out:Box35:Active +NumberOfControlPoints:0 +APP_END diff --git a/bbtk/bbs/appli/exampleTransformWidget2.bbs b/bbtk/bbs/appli/exampleTransformWidget2.bbs new file mode 100644 index 0000000..dd7cff3 --- /dev/null +++ b/bbtk/bbs/appli/exampleTransformWidget2.bbs @@ -0,0 +1,447 @@ +# ---------------------------------- +# - BBTKGEditor v 1.5 BBS BlackBox Script +# - /Users/davila/Creatis/C23/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleTransformWidget2.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaMaracasVisu +include wx +include vtk +include std +include creaVtk +include PackRecalage +include creaImageIO + +author "info-dev@creatis.insa-lyon.fr" +description "Show N Points" +category "demo" + +new creaMaracasVisu:ViewerNV viewer + set viewer.nTypeView "5 1 2 0" + +new creaMaracasVisu:ShowNPoints showNpoints + set showNpoints.Radio "2" + set showNpoints.Type "4" + +new wx:LayoutSplit main + set main.Orientation "H" + set main.Proportion "10" + +new vtk:MetaImageReader Box04 + set Box04.In "/Users/davila/CreatisWork/tmpJCR/results/Experimental-XXXXX2/FG101-VT-B/images/Inspi-B.mhd" + +new vtk:vtkImageDataPointerRelay Box05 + +new creaMaracasVisu:ImageChangeInformation Box06 + +new creaMaracasVisu:ManualContourModel_Box Box07 + set Box07.DoubleContour "0" + set Box07.NbPoints "100" + +new creaMaracasVisu:DrawAxisTree3D Box08 + set Box08.Colour "0 0 1" + set Box08.LineWidth "2" + set Box08.Opacity "1" + +new std:VectorFilterDouble Box09 + set Box09.Type "11" + +new vtk:ImageVtkProperties Box10 + +new wx:LayoutLine Box12 + set Box12.Orientation "H" + +new creaMaracasVisu:SliceImage Box21 + set Box21.InterpolationMode "1" + set Box21.Slice "0" + set Box21.TypeOrientation "3" + set Box21.Z "0" + +new creaVtk:TransformVector Box25 + set Box25.InX "1 0 0" + set Box25.InY "0 1 0" + set Box25.InZ "0 0 1" + +new creaMaracasVisu:ImageActor Box34 + set Box34.InterpolationMode "1" + +new vtk:UpdateRender Box35 + set Box35.Active "true" + +new vtk:Transform Box36 + +new creaVtk:ConcatTransform Box37 + +new std:ConcatStrings Box38 + +new std:ConcatStrings Box42 + set Box42.In2 " " + set Box42.In4 " " + +new creaVtk:ScalarsToColors Box48 + set Box48.BelowAboveRangeTransparence "false" + set Box48.Type "101" + +new vtk:ImageVtkProperties Box56 + +new vtk:vtkImageDataPointerRelay Box57 + +new wx:LayoutLine Box59 + set Box59.WinTitle "Plane" + +new std:MagicBox Box60 + +new creaMaracasVisu:ManualContourModel_Box Box61 + set Box61.DoubleContour "1" + set Box61.NbPoints "200" + set Box61.OpenClose2 "true" + +new creaVtk:CreateMeshFromPoints Box62 + set Box62.CloseSurface "false" + +new creaMaracasVisu:PolyDataToActor_Widget Box63 + set Box63.active "true" + +new creaVtk:PointPicker Box64 + set Box64.DefaultPoint "50 50 50" + set Box64.TypeEvent "2" + +new std:MathOperationVector Box66 + set Box66.Type "3" + +new std:MathOperationVector Box67 + set Box67.Type "23" + +new creaMaracasVisu:SetPosition Box68 + +new std:MultipleInputs Box69 + +new wx:LayoutTab Box70 + +new wx:LayoutLine Box71 + set Box71.Orientation "H" + +new PackRecalage:ImageConvolution Box72 + +new vtk:vtkImageDataPointerRelay Box74 + +new wx:Slider Box75 + set Box75.In "-12000" + set Box75.Label "true" + set Box75.Max "12000" + set Box75.Min "-12000" + set Box75.ReactiveOnTrack "true" + set Box75.Title "Convolution1" + set Box75.WinTitle "Convolution1" + +new std:Div Box76 + set Box76.In2 "100" + +new wx:LayoutLine Box78 + set Box78.WinTitle "Config Image" + +new wx:CheckBox Box80 + set Box80.Title "Convolution" + +new std:StringSelect Box81 + set Box81.In0 "380 80" + set Box81.In1 "10800 4300" + +new std:GetVectorStringElement Box82 + set Box82.I "0" + +new std:GetVectorStringElement Box83 + set Box83.I "1" + +new vtk:LoadHola Box84 + +new creaMaracasVisu:wxVtkBaseView_Info Box92 + set Box92.InteractionType "12" + +new creaMaracasVisu:MeshContours_Widget Box93 + set Box93.colorMesh "1 1 0" + +new wx:CheckBox Box94 + set Box94.Title "Pivot plane" + +new creaMaracasVisu:DrawAxisTree3D Box100 + set Box100.Colour "1 0 0 1 1 0 0 0 1" + set Box100.ColourLaw "2" + set Box100.LineWidth "2" + set Box100.lstIndexs "2 2 2" + set Box100.lstPointX "0 20 0 0 0 0" + set Box100.lstPointY "0 0 0 80 0 0" + set Box100.lstPointZ "0 0 0 0 0 20" + +new creaMaracasVisu:TransformWidget2 Box105 + set Box105.Type "1" + +new wx:LayoutSplit Box96 + +new creaMaracasVisu:ViewerNV Box97 + set Box97.nTypeView "0" + +new creaMaracasVisu:ImageChangeInformation Box98 + +new std:GetVectorDoubleElement Box99 + set Box99.I "0" + +new std:GetVectorDoubleElement Box101 + set Box101.I "1" + +new creaImageIO:ImagesChooserDialogBox Box102 + +new std:MathOperationVector Box104 + set Box104.Type "2" + +new std:MultipleInputs Box106 + +new creaMaracasVisu:wxVtkBaseView_Info Box107 + set Box107.InteractionType "12" + + +connect viewer.Renderer1 showNpoints.Renderer + +connect viewer.Point showNpoints.In + +connect viewer.BoxChange showNpoints.BoxExecute + +connect Box05.Out showNpoints.Image + +connect Box05.Out viewer.In + +connect showNpoints.lstIndexs Box07.LstIndexsIn + +connect Box07.LstContourPointsX Box08.lstPointX + +connect Box07.LstContourPointsY Box08.lstPointY + +connect Box07.LstContourPointsZ Box08.lstPointZ + +connect Box07.LstIndexsOut Box08.lstIndexs + +connect viewer.Renderer1 Box08.Renderer + +connect showNpoints.BoxChange Box08.BoxExecute + +connect showNpoints.lstPointsX Box09.In0 + +connect showNpoints.lstPointsY Box09.In1 + +connect showNpoints.lstPointsZ Box09.In2 + +connect Box09.Out0 Box07.LstControlPointsX + +connect Box09.Out1 Box07.LstControlPointsY + +connect Box09.Out2 Box07.LstControlPointsZ + +connect Box21.Out Box34.In + +connect Box38.Out Box21.AxisOrigin + +connect Box36.Out Box37.In3 + +connect Box37.Out Box34.Transform + +connect Box25.OutX Box42.In1 + +connect Box25.OutY Box42.In3 + +connect Box25.OutZ Box42.In5 + +connect Box42.Out Box21.ResliceAxesDirectionCosines + +connect Box48.LookupTable Box34.LookupTable + +connect Box05.Out Box56.In + +connect Box56.Spacing Box09.k1 + +connect Box57.Out Box21.In + +connect Box57.Out Box10.In + +connect showNpoints.Widget Box59.Widget1 + +connect Box12.Widget Box59.Widget3 + +connect viewer.Renderer1 Box60.In + +connect Box60.Out Box34.Renderer + +connect Box60.Out Box35.Renderer + +connect Box09.Out0 Box61.LstControlPointsX + +connect Box09.Out1 Box61.LstControlPointsY + +connect Box09.Out2 Box61.LstControlPointsZ + +connect showNpoints.lstIndexs Box61.LstIndexsIn + +connect Box61.LstContourPointsX Box62.LstX + +connect Box61.LstContourPointsY Box62.LstY + +connect Box61.LstContourPointsZ Box62.LstZ + +connect Box61.LstIndexsOut Box62.LstIndexs + +connect Box62.Out Box63.polydata + +connect viewer.Renderer1 Box63.render + +connect Box63.widget Box59.Widget4 + +connect Box56.Spacing Box66.In1 + +connect Box66.Out Box67.In0 + +connect viewer.wxVtkBaseView1 Box68.wxVtkBaseView + +connect Box67.Out Box68.Point + +connect Box64.BoxChange Box68.BoxExecute + +connect Box64.BoxChange Box69.In1 + +connect Box59.Widget Box70.Widget1 + +connect Box70.Widget main.Widget1 + +connect Box74.Out Box72.In + +connect Box75.Out Box76.In1 + +connect Box76.Out Box72.Factor + +connect Box75.BoxChange Box72.BoxExecute + +connect Box71.Widget Box78.Widget1 + +connect Box78.Widget Box70.Widget2 + +connect Box75.Widget Box71.Widget3 + +connect Box06.Out Box74.In + +connect Box80.Widget Box71.Widget1 + +connect Box80.Out Box72.On + +connect Box72.Out Box05.In + +connect Box80.Out Box81.In + +connect Box81.Out Box82.In + +connect Box82.Out viewer.WindowLevel + +connect Box81.Out Box83.In + +connect Box83.Out viewer.ColorLevel + +connect viewer.Renderer1 Box64.Renderer + +connect Box64.Point Box66.In0 + +connect Box92.WindowColorLevel Box48.WindowColorLevel + +connect Box92.BoxChange Box48.BoxExecute + +connect viewer.wxVtkBaseView2 Box92.wxVtkBaseView + +connect viewer.wxVtkBaseView3 Box92.wxVtkBaseView2 + +connect Box62.Out Box93._polydata + +connect viewer.wxVtkBaseView2 Box93._wxvtkbaseview2D1 + +connect viewer.wxVtkBaseView3 Box93._wxvtkbaseview2D2 + +connect viewer.wxVtkBaseView4 Box93._wxvtkbaseview2D3 + +connect Box93._widget Box59.Widget6 + +connect viewer.BoxChange Box93._execute + +connect viewer.wxVtkBaseView1 Box93._wxvtkbaseview3D1 + +connect Box94.Out Box34.Opacity + +connect Box94.Widget Box12.Widget4 + +connect Box37.Out Box100.Transform + +connect Box60.Out Box100.Renderer + +connect Box105.Out Box25.Transform + +connect Box105.Out Box37.In1 + +connect Box105.Widget Box12.Widget2 + +connect viewer.Widget Box96.Widget1 + +connect Box96.Widget main.Widget2 + +connect Box97.Widget Box96.Widget2 + +connect Box21.BoxChange Box97.BoxExecute + +connect Box21.Out Box98.In + +connect Box98.Out Box97.In + +connect Box99.Out Box97.WindowLevel + +connect Box101.Out Box97.ColorLevel + +connect Box38.Out Box104.In0 + +connect Box10.Spacing Box104.In1 + +connect Box104.Out Box36.Translate + +connect Box84.Out Box06.In + +connect Box105.ActualPoint Box38.In1 + +connect Box94.Out Box100.Active + +connect Box34.BoxChange Box106.In1 + +connect Box100.BoxChange Box106.In2 + +connect Box106.BoxChange Box35.BoxExecute + +connect viewer.wxVtkBaseView4 Box92.wxVtkBaseView3 + +connect viewer.wxVtkBaseView2 Box107.wxVtkBaseView + +connect viewer.wxVtkBaseView3 Box107.wxVtkBaseView2 + +connect viewer.wxVtkBaseView4 Box107.wxVtkBaseView3 + +connect Box107.WindowColorLevel Box101.In + +connect Box107.WindowColorLevel Box99.In + +connect Box105.BoxChange Box100.BoxExecute + +connect Box92.Image Box57.In + +connect viewer.Point Box105.PossiblePoint + +connect Box94.Out Box35.Active + + + +# Complex input ports +exec main +exec Box69 diff --git a/bbtk/src/bbcreaMaracasVisuTransformWidget2.cxx b/bbtk/src/bbcreaMaracasVisuTransformWidget2.cxx index f00e527..b19b40e 100644 --- a/bbtk/src/bbcreaMaracasVisuTransformWidget2.cxx +++ b/bbtk/src/bbcreaMaracasVisuTransformWidget2.cxx @@ -6,7 +6,6 @@ namespace bbcreaMaracasVisu { - // The widget created by the box class TransformWidgetPanel : public wxPanel { @@ -14,10 +13,13 @@ public: TransformWidgetPanel(TransformWidget2* box, wxWindow *parent); ~TransformWidgetPanel (); void OnSetPoint (wxCommandEvent& event); - void Release (wxSlider *slider); - void Track (double angle ,int idVector); + void ReleaseAngle (wxSlider *slider); + void TrackAngle (double angle ,int idVector); void SetPossiblePoint (std::vector possiblePoint); - void _OnSetPoint(); + void _OnSetPoint (); + void ReleaseCenter (wxSlider *slider); + void TrackCenter (double step); + // Type : Module A void OnSliderTrackX (wxScrollEvent& event); @@ -41,6 +43,7 @@ public: private: vtkTransform *t; vtkTransform *tt; + std::vector mttActualPoint; std::vector mPossiblePoint; std::vector mActualPoint; TransformWidget2 *mBox; @@ -64,6 +67,10 @@ TransformWidgetPanel::TransformWidgetPanel(TransformWidget2* box, wxWindow *pare { t = vtkTransform::New(); tt = vtkTransform::New(); + mttActualPoint.push_back(0); + mttActualPoint.push_back(0); + mttActualPoint.push_back(0); + mActualPoint.push_back(0); mActualPoint.push_back(0); mActualPoint.push_back(0); @@ -103,46 +110,41 @@ TransformWidgetPanel::TransformWidgetPanel(TransformWidget2* box, wxWindow *pare if (mBox->bbGetInputType()==1) { - mTool=0; sizeSliderWidget.Set(250,-1 ); sizeButton.Set( 65 , -1 ); - wxRadioButton *rBtnX = new wxRadioButton( this, -1, _T("X") ,wxDefaultPosition, wxDefaultSize, wxRB_GROUP); - wxRadioButton *rBtnY = new wxRadioButton( this, -1, _T("Y") ,wxDefaultPosition, wxDefaultSize, 0); - wxRadioButton *rBtnZ = new wxRadioButton( this, -1, _T("Z") ,wxDefaultPosition, wxDefaultSize, 0); - wxRadioButton *rBtnN = new wxRadioButton( this, -1, _T("N") ,wxDefaultPosition, wxDefaultSize, 0); - mSliderGeneral = new wxSlider( this, -1, 0 , -180, 180 , wxDefaultPosition,sizeSliderWidget, wxSL_HORIZONTAL, wxDefaultValidator ); - wxButton *mBtnMoveDown = new wxButton( this, -1, _T("-") , wxDefaultPosition, sizeButton ); - wxButton *mBtnMoveUp = new wxButton( this, -1, _T("+") , wxDefaultPosition, sizeButton ); - wxButton *mBtnSetPoint = new wxButton( this, -1, _T("Set") , wxDefaultPosition, sizeButton ); - wxButton *mBtnReset = new wxButton( this, -1, _T("Reset") , wxDefaultPosition, sizeButton ); - Connect( rBtnX->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &TransformWidgetPanel::OnRadioButtonX ); - Connect( rBtnY->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &TransformWidgetPanel::OnRadioButtonY ); - Connect( rBtnZ->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &TransformWidgetPanel::OnRadioButtonZ ); - Connect( rBtnN->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &TransformWidgetPanel::OnRadioButtonN ); - Connect(mBtnSetPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSetPoint ); - Connect(mBtnReset->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnReset ); - Connect(mBtnMoveDown->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnMoveDown ); - Connect(mBtnMoveUp->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnMoveUp ); - Connect( mSliderGeneral->GetId(), wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderGeneralRelease ); - Connect( mSliderGeneral->GetId(), wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderGeneralTrack ); - Connect( mSliderGeneral->GetId(), wxEVT_SCROLL_CHANGED , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderGeneralTrack ); - rBtnX->SetValue(true); + wxRadioButton *rBtnX = new wxRadioButton( this, -1, _T("ri") , wxDefaultPosition, wxDefaultSize, wxRB_GROUP); + wxRadioButton *rBtnY = new wxRadioButton( this, -1, _T("rj") , wxDefaultPosition, wxDefaultSize, 0); + wxRadioButton *rBtnZ = new wxRadioButton( this, -1, _T("rk") , wxDefaultPosition, wxDefaultSize, 0); + wxRadioButton *rBtnC = new wxRadioButton( this, -1, _T("C.") , wxDefaultPosition, wxDefaultSize, 0); + rBtnC->SetValue(true); mTool=3; + mSliderGeneral = new wxSlider( this, -1, 0 , -180, 180 , wxDefaultPosition,sizeSliderWidget, wxSL_HORIZONTAL, wxDefaultValidator ); + wxButton *mBtnMoveDown = new wxButton( this, -1, _T("-") , wxDefaultPosition, sizeButton ); + wxButton *mBtnMoveUp = new wxButton( this, -1, _T("+") , wxDefaultPosition, sizeButton ); + wxButton *mBtnReset = new wxButton( this, -1, _T("Reset") , wxDefaultPosition, sizeButton ); + Connect( rBtnX->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &TransformWidgetPanel::OnRadioButtonX ); + Connect( rBtnY->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &TransformWidgetPanel::OnRadioButtonY ); + Connect( rBtnZ->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &TransformWidgetPanel::OnRadioButtonZ ); + Connect( rBtnC->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &TransformWidgetPanel::OnRadioButtonN ); + Connect(mBtnReset->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnReset ); + Connect(mBtnMoveDown->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnMoveDown ); + Connect(mBtnMoveUp->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnMoveUp ); + Connect( mSliderGeneral->GetId(), wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderGeneralRelease ); + Connect( mSliderGeneral->GetId(), wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderGeneralTrack ); + Connect( mSliderGeneral->GetId(), wxEVT_SCROLL_CHANGED , (wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderGeneralTrack ); - wxBoxSizer *sizerD = new wxBoxSizer(wxHORIZONTAL); - sizerD->Add( mBtnSetPoint , 1 ); - sizerD->Add( mBtnReset , 1 ); + wxBoxSizer *sizerA = new wxBoxSizer(wxHORIZONTAL); + sizerA->Add( rBtnC , 1 ); sizerA->Add( rBtnX , 1 ); sizerA->Add( rBtnY , 1 ); sizerA->Add( rBtnZ , 1 ); - sizerA->Add( rBtnN , 1 ); wxBoxSizer *sizerB = new wxBoxSizer(wxHORIZONTAL); sizerB->Add( mSliderGeneral , 0 ); wxBoxSizer *sizerC = new wxBoxSizer(wxHORIZONTAL); + sizerC->Add( mBtnReset , 1 ); sizerC->Add( mBtnMoveDown , 1 ); sizerC->Add( mBtnMoveUp , 1 ); wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - sizer->Add( sizerD , 0 ); sizer->Add( sizerA , 0 ); sizer->Add( sizerB , 0 ); sizer->Add( sizerC , 0 ); @@ -156,7 +158,7 @@ TransformWidgetPanel::~TransformWidgetPanel() { } -void TransformWidgetPanel::Release( wxSlider * slider ) +void TransformWidgetPanel::ReleaseAngle( wxSlider * slider ) { if (slider!=NULL) { @@ -172,20 +174,20 @@ void TransformWidgetPanel::Release( wxSlider * slider ) void TransformWidgetPanel::OnSliderReleaseX(wxScrollEvent& event) { - Release( mSliderRotationX ); + ReleaseAngle( mSliderRotationX ); } void TransformWidgetPanel::OnSliderReleaseY(wxScrollEvent& event) { - Release( mSliderRotationY ); + ReleaseAngle( mSliderRotationY ); } void TransformWidgetPanel::OnSliderReleaseZ(wxScrollEvent& event) { - Release( mSliderRotationZ ); + ReleaseAngle( mSliderRotationZ ); } -void TransformWidgetPanel::Track( double angle, int idVector) +void TransformWidgetPanel::TrackAngle( double angle, int idVector) { // out = t*tt if (tt!=NULL) @@ -199,7 +201,7 @@ void TransformWidgetPanel::Track( double angle, int idVector) tt = vtkTransform::New(); tt->PostMultiply(); - angle = angle/2; +// angle = angle/2; tt->RotateWXYZ( angle , tvx,tvy,tvz); tt->Update(); vtkTransform *result=vtkTransform::New(); result->PostMultiply(); @@ -211,17 +213,17 @@ void TransformWidgetPanel::Track( double angle, int idVector) void TransformWidgetPanel::OnSliderTrackX(wxScrollEvent& event) { - Track(mSliderRotationX->GetValue() ,0); + TrackAngle(mSliderRotationX->GetValue() ,0); } void TransformWidgetPanel::OnSliderTrackY(wxScrollEvent& event) { - Track(mSliderRotationY->GetValue() ,1); + TrackAngle(mSliderRotationY->GetValue() ,1); } void TransformWidgetPanel::OnSliderTrackZ(wxScrollEvent& event) { - Track(mSliderRotationZ->GetValue() ,2); + TrackAngle(mSliderRotationZ->GetValue() ,2); } void TransformWidgetPanel::SetPossiblePoint(std::vector possiblePoint) @@ -271,52 +273,100 @@ void TransformWidgetPanel::OnReset(wxCommandEvent& event) t->GetMatrix()->Identity(); t->Update(); if (mTool==0) { - Release( NULL ); + ReleaseAngle( NULL ); } // if - if (mTool==1) { t->RotateWXYZ( 90 , 1,0,0); tt->Update(); - Release( NULL ); + ReleaseAngle( NULL ); } // if - if (mTool==2) { t->RotateWXYZ( 90 , 0,1,0); tt->Update(); - Release( NULL ); + ReleaseAngle( NULL ); } // if } // if mTool >=0 <=2 + if (mTool==3) + { + _OnSetPoint(); + } // if mTool == 3 +} + + + +void TransformWidgetPanel::ReleaseCenter( wxSlider * slider ) +{ + if (slider!=NULL) + { + slider->SetValue(0); + } + mActualPoint[0] = mttActualPoint[0]; + mActualPoint[1] = mttActualPoint[1]; + mActualPoint[2] = mttActualPoint[2]; +} + +void TransformWidgetPanel::TrackCenter( double step ) +{ + vtkMatrix4x4 *tm = t->GetMatrix(); + mttActualPoint[0] = mActualPoint[0] + tm->GetElement(0,2)*step; + mttActualPoint[1] = mActualPoint[1] + tm->GetElement(1,2)*step; + mttActualPoint[2] = mActualPoint[2] + tm->GetElement(2,2)*step; + mBox->bbSetOutputActualPoint( mttActualPoint ); + mBox->bbSignalOutputModification(std::string("ActualPoint")); + mBox->bbSetOutputOut( t ); + mBox->bbSignalOutputModification(std::string("Out")); } void TransformWidgetPanel::OnMoveDown(wxCommandEvent& event) { if ((mTool>=0) && (mTool<=2)) { - Track( -2 , mTool ); - Release( NULL ); + TrackAngle( -1 , mTool ); + ReleaseAngle( NULL ); } + if (mTool==3) + { + TrackCenter( -1 ); + ReleaseCenter( NULL ); + } // if mTool == 3 } void TransformWidgetPanel::OnMoveUp(wxCommandEvent& event) { if ((mTool>=0) && (mTool<=2)) { - Track( 2 , mTool ); - Release( NULL ); - } + TrackAngle( 1 , mTool ); + ReleaseAngle( NULL ); + } // if mTool == 0 1 2 + if (mTool==3) + { + TrackCenter( 1 ); + ReleaseCenter( NULL ); + } // if mTool == 3 } void TransformWidgetPanel::OnSliderGeneralRelease(wxScrollEvent& event) { - Release( mSliderGeneral ); + if ((mTool>=0) && (mTool<=2)) + { + ReleaseAngle( mSliderGeneral ); + } // if mTool == 0 1 2 + if (mTool==3) + { + ReleaseCenter( mSliderGeneral ); + } // if mTool == 3 } void TransformWidgetPanel::OnSliderGeneralTrack(wxScrollEvent& event) { if ((mTool>=0) && (mTool<=2)) { - Track( mSliderGeneral->GetValue() , mTool ); - } + TrackAngle( mSliderGeneral->GetValue() , mTool ); + } // if mTool == 0 1 2 + if (mTool==3) + { + TrackCenter( mSliderGeneral->GetValue() ); + } // if mTool == 3 } @@ -355,7 +405,7 @@ void TransformWidget2::CreateWidget(wxWindow* parent) void TransformWidget2::bbUserSetDefaultValues() { firsttime=true; - bbSetInputType(0); + bbSetInputType(1); } //===== diff --git a/bbtk/src/bbcreaMaracasVisuTransformWidget2.h b/bbtk/src/bbcreaMaracasVisuTransformWidget2.h index e603bc3..1e2e884 100644 --- a/bbtk/src/bbcreaMaracasVisuTransformWidget2.h +++ b/bbtk/src/bbcreaMaracasVisuTransformWidget2.h @@ -40,7 +40,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(TransformWidget2,bbtk::WxBlackBox); BBTK_AUTHOR("InfoDev"); BBTK_DESCRIPTION("No Description."); BBTK_CATEGORY("__CategoryBlackBox__"); - BBTK_INPUT(TransformWidget2,Type,"(default 0) 0:mode A with 3 sliders 1:mode B with radio buttons,",int,""); + BBTK_INPUT(TransformWidget2,Type,"(default 1) 0:mode A with 3 sliders 1:mode B with radio buttons,",int,""); BBTK_INPUT(TransformWidget2,PossiblePoint,"Potential Point [x y z]",std::vector,""); BBTK_OUTPUT(TransformWidget2,Out,"vtkTransform result",vtkLinearTransform *,""); BBTK_OUTPUT(TransformWidget2,ActualPoint,"Origin [x,y,z]",std::vector,""); -- 2.47.1