From 5b6e06ea55193ecce4fe2c59b1f3cb698835020b Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 25 Jul 2013 16:27:54 +0200 Subject: [PATCH] 2075 creaRigidRegistration Feature New Normal Registration 3D 1P --- .../bbs/appli/ExampleRecalage3D1Point.bbg | 23 ++- .../bbs/appli/ExampleRecalage3D1Point.bbs | 15 +- .../bbs/boxes/CompareImagesWidget3D.bbg | 186 +++++++++++++++--- .../bbs/boxes/CompareImagesWidget3D.bbs | 52 ++++- PackRecalage/bbs/boxes/Getting3D1Point.bbg | 152 +++++++++----- PackRecalage/bbs/boxes/Getting3D1Point.bbs | 39 +++- PackRecalage/bbs/boxes/ImageCenter.bbg | 21 +- PackRecalage/bbs/boxes/ImageCenter.bbs | 5 +- .../src/bbPackRecalageFilter3DPointVector.cxx | 85 ++++++++ .../src/bbPackRecalageFilter3DPointVector.h | 50 +++++ .../src/bbPackRecalageReSlicerBox.cxx | 133 +++++++++---- PackRecalage/src/bbPackRecalageReSlicerBox.h | 6 + 12 files changed, 629 insertions(+), 138 deletions(-) create mode 100644 PackRecalage/src/bbPackRecalageFilter3DPointVector.cxx create mode 100644 PackRecalage/src/bbPackRecalageFilter3DPointVector.h diff --git a/PackRecalage/bbs/appli/ExampleRecalage3D1Point.bbg b/PackRecalage/bbs/appli/ExampleRecalage3D1Point.bbg index a4bb1e1..09dc15f 100644 --- a/PackRecalage/bbs/appli/ExampleRecalage3D1Point.bbg +++ b/PackRecalage/bbs/appli/ExampleRecalage3D1Point.bbg @@ -20,7 +20,7 @@ Orientation:"H" PORT Proportion:"50" PORT -WinTitle:"Input Images" +WinTitle:"1. Input Images" FIN_BOX BOX wx:LayoutSplit:resultLayout @@ -30,7 +30,7 @@ ISEXEC:FALSE PORT Proportion:"80" PORT -WinTitle:"Registration" +WinTitle:"2. Registration" FIN_BOX BOX vtk:vtkImageDataPointerRelay:Box22 @@ -49,12 +49,16 @@ creaImageIO:ImagesChooserDialogBox:Box24 ISEXEC:FALSE 33.462854:124.513351:-900.000000 104.637854:114.513351:-900.000000 +PORT +Title:"Fix Image" FIN_BOX BOX creaImageIO:ImagesChooserDialogBox:Box25 ISEXEC:FALSE 110.822562:122.452660:-900.000000 181.997562:112.452660:-900.000000 +PORT +Title:"Move Image" FIN_BOX BOX PackRecalage:Recalage3D1PointWidget:Box52 @@ -67,6 +71,8 @@ PackRecalage:CompareImagesWidget3D:Box20 ISEXEC:FALSE 76.232469:5.962266:-900.000000 147.407469:-4.037734:-900.000000 +PORT +WinTitle:"1. Compare 3D" FIN_BOX BOX PackRecalage:CompareImages_3DwithPlanes_Widget:Box11 @@ -74,7 +80,7 @@ ISEXEC:FALSE 82.677789:-18.202280:-900.000000 153.852789:-28.202280:-900.000000 PORT -WinTitle:"3D Planes" +WinTitle:"2. Planes 3D" FIN_BOX BOX wx:LayoutSplit:Box12 @@ -102,7 +108,7 @@ BOX wx:LayoutTab:Box15 ISEXEC:TRUE 5.719422:-104.975080:-900.000000 -63.279422:-114.975080:-900.000000 +51.294422:-114.975080:-900.000000 PORT WinHeight:"800" PORT @@ -120,7 +126,7 @@ ISEXEC:FALSE 4.338710:97.491790:-900.000000 49.913710:87.491790:-900.000000 PORT -Title:"Move Image" +Title:"2. Move Image" FIN_BOX BOX PackRecalage:Getting3D1Point:Box29 @@ -128,7 +134,7 @@ ISEXEC:FALSE -49.403978:96.251514:-900.000000 -3.828978:86.251514:-900.000000 PORT -Title:"Fix Image" +Title:"1. Fix Image" FIN_BOX BOX std:MultipleInputs:Box26 @@ -136,7 +142,7 @@ ISEXEC:FALSE 36.625880:71.083256:-900.000000 82.200880:61.083256:-900.000000 FIN_BOX -CONNECTIONS:29 +CONNECTIONS:30 CONNECTION Box22:Out:Box52:Image1 NumberOfControlPoints:0 @@ -224,4 +230,7 @@ NumberOfControlPoints:0 CONNECTION Box28:Point:Box52:OriginPoint NumberOfControlPoints:0 +CONNECTION +Box29:Point:Box20:CenterPoint +NumberOfControlPoints:0 APP_END diff --git a/PackRecalage/bbs/appli/ExampleRecalage3D1Point.bbs b/PackRecalage/bbs/appli/ExampleRecalage3D1Point.bbs index 4d791c5..084eb67 100644 --- a/PackRecalage/bbs/appli/ExampleRecalage3D1Point.bbs +++ b/PackRecalage/bbs/appli/ExampleRecalage3D1Point.bbs @@ -21,26 +21,29 @@ category "example" new LayoutSplit imagesLayout set imagesLayout.Orientation "H" set imagesLayout.Proportion "50" - set imagesLayout.WinTitle "Input Images" + set imagesLayout.WinTitle "1. Input Images" new LayoutSplit resultLayout set resultLayout.Proportion "80" - set resultLayout.WinTitle "Registration" + set resultLayout.WinTitle "2. Registration" new vtkImageDataPointerRelay Box22 new vtkImageDataPointerRelay Box23 new ImagesChooserDialogBox Box24 + set Box24.Title "Fix Image" new ImagesChooserDialogBox Box25 + set Box25.Title "Move Image" new Recalage3D1PointWidget Box52 new CompareImagesWidget3D Box20 + set Box20.WinTitle "1. Compare 3D" new CompareImages_3DwithPlanes_Widget Box11 - set Box11.WinTitle "3D Planes" + set Box11.WinTitle "2. Planes 3D" new LayoutSplit Box12 set Box12.Orientation "H" @@ -57,10 +60,10 @@ new LayoutTab Box15 new LoadHola Box27 new Getting3D1Point Box28 - set Box28.Title "Move Image" + set Box28.Title "2. Move Image" new Getting3D1Point Box29 - set Box29.Title "Fix Image" + set Box29.Title "1. Fix Image" new MultipleInputs Box26 @@ -123,6 +126,8 @@ connect Box29.Point Box52.CenterPoint connect Box28.Point Box52.OriginPoint +connect Box29.Point Box20.CenterPoint + # Complex input ports diff --git a/PackRecalage/bbs/boxes/CompareImagesWidget3D.bbg b/PackRecalage/bbs/boxes/CompareImagesWidget3D.bbg index b1e9b41..c2c9876 100644 --- a/PackRecalage/bbs/boxes/CompareImagesWidget3D.bbg +++ b/PackRecalage/bbs/boxes/CompareImagesWidget3D.bbg @@ -13,7 +13,7 @@ PACKAGENAME:PackRecalage COMPLEXOUTPUTS:3 COMPLEX_PORT Widget -9.292392:-218.781014:-900.000000 +126.723400:-220.750824:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT Point @@ -23,7 +23,7 @@ COMPLEX_PORT BoxChange 90.295201:-220.841208:-900.000000 FIN_COMPLEX_PORT -COMPLEXINPUTS:3 +COMPLEXINPUTS:5 COMPLEX_PORT BoxExecute 0.251103:33.549725:-900.000000 @@ -34,9 +34,17 @@ Image1 FIN_COMPLEX_PORT COMPLEX_PORT Image2 -27.974017:35.166416:-900.000000 +32.663128:31.942652:-900.000000 FIN_COMPLEX_PORT -BOXES:11 +COMPLEX_PORT +CenterPoint +-156.105292:57.141865:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +WinTitle +131.009927:24.861813:-900.000000 +FIN_COMPLEX_PORT +BOXES:22 BOX creaMaracasVisu:ViewerNV:viewerResult ISEXEC:FALSE @@ -48,22 +56,22 @@ FIN_BOX BOX vtk:vtkImageDataPointerRelay:Box23 ISEXEC:FALSE --75.501867:-0.885850:-900.000000 --4.326867:-10.885850:-900.000000 +-65.955863:3.508343:-900.000000 +5.219137:-6.491657:-900.000000 FIN_BOX BOX wx:LayoutTab:Box26 ISEXEC:FALSE -2.523718:-177.334792:-900.000000 -48.098718:-187.334792:-900.000000 +121.773012:-183.092699:-900.000000 +179.333012:-193.092699:-900.000000 PORT WinTitle:"2D-Compare" FIN_BOX BOX wx:LayoutSplit:Box28 ISEXEC:FALSE -6.651718:-153.503630:-900.000000 -52.226718:-163.503630:-900.000000 +126.658631:-167.004408:-900.000000 +172.233631:-177.004408:-900.000000 PORT Orientation:"H" PORT @@ -74,8 +82,8 @@ FIN_BOX BOX wx:LayoutLine:Box29 ISEXEC:FALSE --36.447166:-116.254418:-900.000000 -9.127834:-126.254418:-900.000000 +9.555484:-141.255858:-900.000000 +67.115484:-151.255858:-900.000000 FIN_BOX BOX wxvtk:IsoSurfaceWidget:Box30 @@ -83,7 +91,9 @@ ISEXEC:FALSE -60.189126:-48.428471:-900.000000 -14.614126:-58.428471:-900.000000 PORT -Title:"Reference image" +Colour:"1 1 0" +PORT +Title:"1. Reference image" PORT Vertical:"V" FIN_BOX @@ -93,21 +103,23 @@ ISEXEC:FALSE 8.304120:-51.097085:-900.000000 53.879120:-61.097085:-900.000000 PORT -Title:"Registration image" +Colour:"1 1 1" +PORT +Title:"2. Registration image" PORT Vertical:"V" FIN_BOX BOX wx:LayoutTab:Box38 ISEXEC:FALSE --13.417754:-99.991659:-900.000000 -32.157246:-109.991659:-900.000000 +12.583744:-117.159315:-900.000000 +70.143744:-127.159315:-900.000000 FIN_BOX BOX wx:LayoutTab:Box39 ISEXEC:FALSE --74.673912:-90.664048:-900.000000 --29.098912:-100.664048:-900.000000 +-58.491017:-109.429925:-900.000000 +-0.931017:-119.429925:-900.000000 FIN_BOX BOX std:MultipleInputs:Box19 @@ -121,13 +133,90 @@ ISEXEC:FALSE 23.468025:0.813061:-900.000000 94.643025:-9.186939:-900.000000 FIN_BOX -CONNECTIONS:21 +BOX +wxvtk:SphereListWidget:Box11 +ISEXEC:FALSE +-115.518205:-91.839067:-900.000000 +-69.943205:-101.839067:-900.000000 +PORT +WinTitle:"3. Center Point" +PORT +lstPointX:"10 10" +PORT +lstPointY:"10 20" +PORT +lstPointZ:"10 30" +FIN_BOX +BOX +wx:LayoutTab:Box12 +ISEXEC:FALSE +-123.764449:-107.772782:-900.000000 +-66.204449:-117.772782:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box13 +ISEXEC:FALSE +-168.817039:37.683974:-900.000000 +-123.242039:27.683974:-900.000000 +FIN_BOX +BOX +std:GetVectorIntElement:Box14 +ISEXEC:FALSE +-258.452043:18.793663:-900.000000 +-187.277043:8.793663:-900.000000 +PORT +I:"0" +FIN_BOX +BOX +std:ConcatStrings:Box15 +ISEXEC:FALSE +-261.247431:-4.799757:-900.000000 +-215.672431:-14.799757:-900.000000 +FIN_BOX +BOX +std:GetVectorIntElement:Box16 +ISEXEC:FALSE +-200.380289:3.854241:-900.000000 +-129.205289:-6.145759:-900.000000 +PORT +I:"1" +FIN_BOX +BOX +std:ConcatStrings:Box17 +ISEXEC:FALSE +-202.487274:-19.405069:-900.000000 +-156.912274:-29.405069:-900.000000 +FIN_BOX +BOX +std:GetVectorIntElement:Box18 +ISEXEC:FALSE +-145.890393:-11.394532:-900.000000 +-74.715393:-21.394532:-900.000000 +PORT +I:"2" +FIN_BOX +BOX +std:ConcatStrings:Box21 +ISEXEC:FALSE +-149.917836:-31.692110:-900.000000 +-104.342836:-41.692110:-900.000000 +FIN_BOX +BOX +vtk:ImageVtkProperties:Box22 +ISEXEC:FALSE +-92.732615:-29.168347:-900.000000 +-47.157615:-39.168347:-900.000000 +FIN_BOX +BOX +std:ConcatStrings:Box24 +ISEXEC:FALSE +-116.218816:-47.502737:-900.000000 +-70.643816:-57.502737:-900.000000 +FIN_BOX +CONNECTIONS:38 CONNECTION viewerResult:Widget:Box28:Widget2 -NumberOfControlPoints:3 -70.604240:-82.351540:-900.000000 -51.890862:-124.768517:-900.000000 -35.942902:-139.423691:-900.000000 +NumberOfControlPoints:0 CONNECTION Box28:Widget:Box26:Widget1 NumberOfControlPoints:0 @@ -194,4 +283,55 @@ NumberOfControlPoints:0 CONNECTION viewerResult:BoxChange:BoxChange:BoxChange NumberOfControlPoints:0 +CONNECTION +Box11:Widget:Box12:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box12:Widget:Box29:Widget3 +NumberOfControlPoints:0 +CONNECTION +viewerResult:Renderer1:Box11:Renderer +NumberOfControlPoints:0 +CONNECTION +CenterPoint:CenterPoint:Box13:In +NumberOfControlPoints:0 +CONNECTION +Box13:Out:Box14:In +NumberOfControlPoints:0 +CONNECTION +Box14:Out:Box15:In1 +NumberOfControlPoints:0 +CONNECTION +Box15:Out:Box11:lstPointX +NumberOfControlPoints:0 +CONNECTION +Box16:Out:Box17:In1 +NumberOfControlPoints:0 +CONNECTION +Box18:Out:Box21:In1 +NumberOfControlPoints:0 +CONNECTION +Box13:Out:Box16:In +NumberOfControlPoints:0 +CONNECTION +Box17:Out:Box11:lstPointY +NumberOfControlPoints:0 +CONNECTION +Box13:Out:Box18:In +NumberOfControlPoints:0 +CONNECTION +Box21:Out:Box11:lstPointZ +NumberOfControlPoints:0 +CONNECTION +Box23:Out:Box22:In +NumberOfControlPoints:0 +CONNECTION +Box22:Spacing:Box24:In1 +NumberOfControlPoints:0 +CONNECTION +Box24:Out:Box11:spc +NumberOfControlPoints:0 +CONNECTION +WinTitle:WinTitle:Box28:WinTitle +NumberOfControlPoints:0 APP_END diff --git a/PackRecalage/bbs/boxes/CompareImagesWidget3D.bbs b/PackRecalage/bbs/boxes/CompareImagesWidget3D.bbs index 6454c9c..6d2285f 100644 --- a/PackRecalage/bbs/boxes/CompareImagesWidget3D.bbs +++ b/PackRecalage/bbs/boxes/CompareImagesWidget3D.bbs @@ -34,11 +34,13 @@ new LayoutSplit Box28 new LayoutLine Box29 new IsoSurfaceWidget Box30 - set Box30.Title "Reference image" + set Box30.Colour "1 1 0" + set Box30.Title "1. Reference image" set Box30.Vertical "V" new IsoSurfaceWidget Box31 - set Box31.Title "Registration image" + set Box31.Colour "1 1 1" + set Box31.Title "2. Registration image" set Box31.Vertical "V" new LayoutTab Box38 @@ -49,6 +51,35 @@ new MultipleInputs Box19 new vtkImageDataPointerRelay Box20 +new SphereListWidget Box11 + set Box11.WinTitle "3. Center Point" + set Box11.lstPointX "10 10" + set Box11.lstPointY "10 20" + set Box11.lstPointZ "10 30" + +new LayoutTab Box12 + +new MagicBox Box13 + +new GetVectorIntElement Box14 + set Box14.I "0" + +new ConcatStrings Box15 + +new GetVectorIntElement Box16 + set Box16.I "1" + +new ConcatStrings Box17 + +new GetVectorIntElement Box18 + set Box18.I "2" + +new ConcatStrings Box21 + +new ImageVtkProperties Box22 + +new ConcatStrings Box24 + connect viewerResult.Widget Box28.Widget2 connect Box28.Widget Box26.Widget1 @@ -65,11 +96,28 @@ connect Box31.BoxChange Box19.In2 connect Box19.BoxChange viewerResult.BoxExecute connect Box20.Out viewerResult.In connect Box20.Out Box31.In +connect Box11.Widget Box12.Widget1 +connect Box12.Widget Box29.Widget3 +connect viewerResult.Renderer1 Box11.Renderer +connect Box13.Out Box14.In +connect Box14.Out Box15.In1 +connect Box15.Out Box11.lstPointX +connect Box16.Out Box17.In1 +connect Box18.Out Box21.In1 +connect Box13.Out Box16.In +connect Box17.Out Box11.lstPointY +connect Box13.Out Box18.In +connect Box21.Out Box11.lstPointZ +connect Box23.Out Box22.In +connect Box22.Spacing Box24.In1 +connect Box24.Out Box11.spc # Complex input ports input BoxExecute Box19.In3 " " input Image1 Box23.In " " input Image2 Box20.In " " +input CenterPoint Box13.In " " +input WinTitle Box28.WinTitle " " # Complex output ports output Widget Box26.Widget " " diff --git a/PackRecalage/bbs/boxes/Getting3D1Point.bbg b/PackRecalage/bbs/boxes/Getting3D1Point.bbg index df93520..2c77892 100644 --- a/PackRecalage/bbs/boxes/Getting3D1Point.bbg +++ b/PackRecalage/bbs/boxes/Getting3D1Point.bbg @@ -21,7 +21,7 @@ Point FIN_COMPLEX_PORT COMPLEX_PORT BoxChange --128.449648:-271.307624:-900.000000 +-246.560519:-265.938948:-900.000000 FIN_COMPLEX_PORT COMPLEXINPUTS:2 COMPLEX_PORT @@ -32,12 +32,12 @@ COMPLEX_PORT Title 44.647887:97.174128:-900.000000 FIN_COMPLEX_PORT -BOXES:15 +BOXES:20 BOX creaMaracasVisu:ViewerNV:viewer ISEXEC:FALSE --157.091707:27.264366:-900.000000 --96.451707:17.264366:-900.000000 +-155.258268:46.265461:-900.000000 +-94.618268:36.265461:-900.000000 PORT nTypeView:"6 1 2 0" FIN_BOX @@ -56,24 +56,28 @@ FIN_BOX BOX toolsbbtk:ImageVtkPropertiesWidget:Box21 ISEXEC:FALSE --12.508566:-13.602502:-900.000000 -58.666434:-23.602502:-900.000000 +12.780479:5.312695:-900.000000 +83.955479:-4.687305:-900.000000 FIN_BOX BOX wxvtk:IsoSurfaceWidget:Box05 ISEXEC:FALSE --63.363842:-15.816669:-900.000000 --17.788842:-25.816669:-900.000000 +-37.529020:-9.149618:-900.000000 +8.045980:-19.149618:-900.000000 PORT -Title:"Surface" +Colour:"1 1 0" +PORT +Title:"2. Surface" PORT Vertical:"V" FIN_BOX BOX creaMaracasVisu:ShowNPoints:Box08 ISEXEC:FALSE --127.952857:-14.914714:-900.000000 --79.632857:-24.914714:-900.000000 +-169.288572:-15.914772:-900.000000 +-120.968572:-25.914772:-900.000000 +PORT +Colour:"0.32 0.12 0.12" PORT Type:"1" PORT @@ -82,34 +86,34 @@ FIN_BOX BOX wx:LayoutTab:Box10 ISEXEC:FALSE --160.526380:-115.329572:-900.000000 --102.966380:-125.329572:-900.000000 +-199.261377:-115.705379:-900.000000 +-141.701377:-125.705379:-900.000000 FIN_BOX BOX wx:LayoutSplit:Box11 ISEXEC:FALSE --200.662523:-175.460575:-900.000000 --155.087523:-185.460575:-900.000000 +-89.191254:-205.280055:-900.000000 +-43.616254:-215.280055:-900.000000 FIN_BOX BOX wx:LayoutLine:Box12 ISEXEC:FALSE --73.961469:-153.530973:-900.000000 --16.401469:-163.530973:-900.000000 +-41.480979:-142.900995:-900.000000 +16.079021:-152.900995:-900.000000 PORT Orientation:"H" FIN_BOX BOX wx:LayoutTab:Box13 ISEXEC:FALSE --47.818195:-35.879715:-900.000000 -9.741805:-45.879715:-900.000000 +-35.572921:-39.706881:-900.000000 +21.987079:-49.706881:-900.000000 FIN_BOX BOX wx:LayoutTab:Box14 ISEXEC:FALSE -15.967926:-34.616102:-900.000000 -73.527926:-44.616102:-900.000000 +24.107639:-29.732274:-900.000000 +81.667639:-39.732274:-900.000000 FIN_BOX BOX wx:LayoutLine:Box17 @@ -120,16 +124,16 @@ FIN_BOX BOX wx:LayoutLine:Box18 ISEXEC:FALSE --161.088014:-92.384025:-900.000000 --103.528014:-102.384025:-900.000000 +-203.176527:-96.249471:-900.000000 +-145.616527:-106.249471:-900.000000 PORT -WinTitle:"Point selected" +WinTitle:"3. Point selected" FIN_BOX BOX std:ConcatStrings:Box19 ISEXEC:FALSE --101.661934:-50.610710:-900.000000 --56.086934:-60.610710:-900.000000 +-136.113017:-42.662700:-900.000000 +-90.538017:-52.662700:-900.000000 PORT In2:" " PORT @@ -138,10 +142,44 @@ FIN_BOX BOX wx:OutputText:Box20 ISEXEC:FALSE --133.512618:-72.203368:-900.000000 --87.937618:-82.203368:-900.000000 +-179.857655:-74.813216:-900.000000 +-134.282655:-84.813216:-900.000000 +FIN_BOX +BOX +PackRecalage:ImageCenter:Box22 +ISEXEC:FALSE +-84.504936:-69.123664:-900.000000 +-38.929936:-79.123664:-900.000000 +FIN_BOX +BOX +PackRecalage:Filter3DPointVector:Box24 +ISEXEC:FALSE +-96.146896:-105.082087:-900.000000 +-50.571896:-115.082087:-900.000000 +FIN_BOX +BOX +std:ConcatStrings:Box26 +ISEXEC:FALSE +-105.689497:-122.974401:-900.000000 +-60.114497:-132.974401:-900.000000 FIN_BOX -CONNECTIONS:31 +BOX +wx:LayoutLine:Box27 +ISEXEC:FALSE +20.306734:-12.644283:-900.000000 +77.866734:-22.644283:-900.000000 +PORT +WinTitle:"1. Image Properties" +FIN_BOX +BOX +std:ConcatStrings:Box28 +ISEXEC:FALSE +-169.506393:-59.052373:-900.000000 +-123.931393:-69.052373:-900.000000 +PORT +In1:"Selected Point&&2P&& " +FIN_BOX +CONNECTIONS:37 CONNECTION Box23:Out:viewer:In NumberOfControlPoints:0 @@ -176,20 +214,14 @@ CONNECTION Box05:Widget:Box13:Widget1 NumberOfControlPoints:0 CONNECTION -Box21:widget:Box14:Widget1 -NumberOfControlPoints:0 -CONNECTION -Box10:Widget:Box12:Widget1 -NumberOfControlPoints:0 -CONNECTION Box13:Widget:Box12:Widget2 NumberOfControlPoints:0 CONNECTION -Box14:Widget:Box12:Widget3 -NumberOfControlPoints:0 -CONNECTION viewer:Widget:Box11:Widget2 -NumberOfControlPoints:0 +NumberOfControlPoints:3 +-181.481094:-43.100628:-900.000000 +-204.101791:-126.506638:-900.000000 +-89.748993:-174.556290:-900.000000 CONNECTION Box12:Widget:Box11:Widget1 NumberOfControlPoints:0 @@ -207,9 +239,6 @@ Title:Title:Box17:WinTitle NumberOfControlPoints:1 86.409637:-25.629166:-900.000000 CONNECTION -Box08:Widget:Box18:Widget1 -NumberOfControlPoints:0 -CONNECTION Box18:Widget:Box10:Widget1 NumberOfControlPoints:0 CONNECTION @@ -222,18 +251,49 @@ CONNECTION Box08:lstPointsZ:Box19:In5 NumberOfControlPoints:0 CONNECTION -Box19:Out:Box20:In +Box08:BoxChange:Box20:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box23:Out:Box22:In +NumberOfControlPoints:0 +CONNECTION +Box19:Out:Box24:In +NumberOfControlPoints:0 +CONNECTION +Box22:Point:Box24:Initial +NumberOfControlPoints:0 +CONNECTION +Box24:Out:Box26:In1 +NumberOfControlPoints:0 +CONNECTION +Box26:Out:Point:Point +NumberOfControlPoints:0 +CONNECTION +Box21:widget:Box27:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box27:Widget:Box14:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box10:Widget:Box12:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box14:Widget:Box12:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box08:Widget:Box18:Widget1 NumberOfControlPoints:0 CONNECTION Box20:Widget:Box18:Widget2 NumberOfControlPoints:0 CONNECTION -Box08:BoxChange:Box20:BoxExecute +Box19:Out:Box28:In2 NumberOfControlPoints:0 CONNECTION -Box19:Out:Point:Point +Box28:Out:Box20:In NumberOfControlPoints:0 CONNECTION Box08:BoxChange:BoxChange:BoxChange -NumberOfControlPoints:0 +NumberOfControlPoints:1 +-228.959229:-90.159050:-900.000000 APP_END diff --git a/PackRecalage/bbs/boxes/Getting3D1Point.bbs b/PackRecalage/bbs/boxes/Getting3D1Point.bbs index aeeca01..aa38cd4 100644 --- a/PackRecalage/bbs/boxes/Getting3D1Point.bbs +++ b/PackRecalage/bbs/boxes/Getting3D1Point.bbs @@ -11,6 +11,7 @@ include wx include toolsbbtk include wxvtk include std +include PackRecalage define Getting3D1Point PackRecalage @@ -29,10 +30,12 @@ new LayoutTab Box16 new ImageVtkPropertiesWidget Box21 new IsoSurfaceWidget Box05 - set Box05.Title "Surface" + set Box05.Colour "1 1 0" + set Box05.Title "2. Surface" set Box05.Vertical "V" new ShowNPoints Box08 + set Box08.Colour "0.32 0.12 0.12" set Box08.Type "1" set Box08.WinTitle "Point select" @@ -50,7 +53,7 @@ new LayoutTab Box14 new LayoutLine Box17 new LayoutLine Box18 - set Box18.WinTitle "Point selected" + set Box18.WinTitle "3. Point selected" new ConcatStrings Box19 set Box19.In2 " " @@ -58,6 +61,18 @@ new ConcatStrings Box19 new OutputText Box20 +new ImageCenter Box22 + +new Filter3DPointVector Box24 + +new ConcatStrings Box26 + +new LayoutLine Box27 + set Box27.WinTitle "1. Image Properties" + +new ConcatStrings Box28 + set Box28.In1 "Selected Point: " + connect Box23.Out viewer.In connect Box23.Out Box21.in @@ -69,22 +84,28 @@ connect viewer.Point Box08.In connect viewer.Renderer1 Box08.Renderer connect Box23.Out Box08.Image connect Box05.Widget Box13.Widget1 -connect Box21.widget Box14.Widget1 -connect Box10.Widget Box12.Widget1 connect Box13.Widget Box12.Widget2 -connect Box14.Widget Box12.Widget3 connect viewer.Widget Box11.Widget2 connect Box12.Widget Box11.Widget1 connect Box11.Widget Box17.Widget1 connect Box17.Widget Box16.Widget1 -connect Box08.Widget Box18.Widget1 connect Box18.Widget Box10.Widget1 connect Box08.lstPointsX Box19.In1 connect Box08.lstPointsY Box19.In3 connect Box08.lstPointsZ Box19.In5 -connect Box19.Out Box20.In -connect Box20.Widget Box18.Widget2 connect Box08.BoxChange Box20.BoxExecute +connect Box23.Out Box22.In +connect Box19.Out Box24.In +connect Box22.Point Box24.Initial +connect Box24.Out Box26.In1 +connect Box21.widget Box27.Widget1 +connect Box27.Widget Box14.Widget1 +connect Box10.Widget Box12.Widget3 +connect Box14.Widget Box12.Widget1 +connect Box08.Widget Box18.Widget1 +connect Box20.Widget Box18.Widget2 +connect Box19.Out Box28.In2 +connect Box28.Out Box20.In # Complex input ports input Image Box23.In " " @@ -92,7 +113,7 @@ input Title Box17.WinTitle " " # Complex output ports output Widget Box16.Widget " " -output Point Box19.Out " " +output Point Box26.Out " " output BoxChange Box08.BoxChange " " diff --git a/PackRecalage/bbs/boxes/ImageCenter.bbg b/PackRecalage/bbs/boxes/ImageCenter.bbg index fbb9728..b50248b 100644 --- a/PackRecalage/bbs/boxes/ImageCenter.bbg +++ b/PackRecalage/bbs/boxes/ImageCenter.bbg @@ -13,14 +13,14 @@ PACKAGENAME:PackRecalage COMPLEXOUTPUTS:1 COMPLEX_PORT Point --72.503093:-7.990137:-900.000000 +-85.141093:-32.830343:-900.000000 FIN_COMPLEX_PORT COMPLEXINPUTS:1 COMPLEX_PORT In -76.988002:78.025263:-900.000000 FIN_COMPLEX_PORT -BOXES:3 +BOXES:4 BOX std:ConcatStrings:Box00 ISEXEC:FALSE @@ -30,8 +30,8 @@ FIN_BOX BOX std:VectorRescaleSlope:Box01 ISEXEC:FALSE --74.431594:12.921868:-900.000000 --28.856594:2.921868:-900.000000 +-85.108525:12.486075:-900.000000 +-39.533525:2.486075:-900.000000 PORT A:"0.5" FIN_BOX @@ -41,7 +41,13 @@ ISEXEC:FALSE -84.548002:56.225263:-900.000000 -38.973002:46.225263:-900.000000 FIN_BOX -CONNECTIONS:4 +BOX +std:ConcatStrings:Box03 +ISEXEC:FALSE +-88.248101:-8.824810:-900.000000 +-42.673101:-18.824810:-900.000000 +FIN_BOX +CONNECTIONS:5 CONNECTION Box02:Size:Box00:In1 NumberOfControlPoints:0 @@ -52,6 +58,9 @@ CONNECTION In:In:Box02:In NumberOfControlPoints:0 CONNECTION -Box01:Out:Point:Point +Box01:Out:Box03:In1 +NumberOfControlPoints:0 +CONNECTION +Box03:Out:Point:Point NumberOfControlPoints:0 APP_END diff --git a/PackRecalage/bbs/boxes/ImageCenter.bbs b/PackRecalage/bbs/boxes/ImageCenter.bbs index 4bba8fc..727a454 100644 --- a/PackRecalage/bbs/boxes/ImageCenter.bbs +++ b/PackRecalage/bbs/boxes/ImageCenter.bbs @@ -22,15 +22,18 @@ new VectorRescaleSlope Box01 new ImageVtkProperties Box02 +new ConcatStrings Box03 + connect Box02.Size Box00.In1 connect Box00.Out Box01.In +connect Box01.Out Box03.In1 # Complex input ports input In Box02.In " " # Complex output ports -output Point Box01.Out " " +output Point Box03.Out " " endefine diff --git a/PackRecalage/src/bbPackRecalageFilter3DPointVector.cxx b/PackRecalage/src/bbPackRecalageFilter3DPointVector.cxx new file mode 100644 index 0000000..b5f17d3 --- /dev/null +++ b/PackRecalage/src/bbPackRecalageFilter3DPointVector.cxx @@ -0,0 +1,85 @@ +//===== +// 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 "bbPackRecalageFilter3DPointVector.h" +#include "bbPackRecalagePackage.h" +namespace bbPackRecalage +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,Filter3DPointVector) +BBTK_BLACK_BOX_IMPLEMENTATION(Filter3DPointVector,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 Filter3DPointVector::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 = " < vec; + vec.push_back(0); + vec.push_back(0); + vec.push_back(0); + bbSetInputIn(vec); + bbSetInputInitial(vec); + +} +//===== +// 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 Filter3DPointVector::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 Filter3DPointVector::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbPackRecalage + + diff --git a/PackRecalage/src/bbPackRecalageFilter3DPointVector.h b/PackRecalage/src/bbPackRecalageFilter3DPointVector.h new file mode 100644 index 0000000..e59d77e --- /dev/null +++ b/PackRecalage/src/bbPackRecalageFilter3DPointVector.h @@ -0,0 +1,50 @@ +//===== +// 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 __bbPackRecalageFilter3DPointVector_h_INCLUDED__ +#define __bbPackRecalageFilter3DPointVector_h_INCLUDED__ +#include "bbPackRecalage_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +namespace bbPackRecalage +{ + +class bbPackRecalage_EXPORT Filter3DPointVector + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(Filter3DPointVector,bbtk::AtomicBlackBox); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== + BBTK_DECLARE_INPUT(In,std::vector); + BBTK_DECLARE_INPUT(Initial,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) +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(Filter3DPointVector,bbtk::AtomicBlackBox); + BBTK_NAME("Filter3DPointVector"); + BBTK_AUTHOR("Info-Dev"); + BBTK_DESCRIPTION("If the point vector is empty the initial value es taken"); + BBTK_CATEGORY("filter"); + + BBTK_INPUT(Filter3DPointVector,In,"Point Vector",std::vector,""); + BBTK_INPUT(Filter3DPointVector,Initial,"Initical values of the vector",std::vector,""); + + BBTK_OUTPUT(Filter3DPointVector,Out,"Out vector",std::vector,""); + +BBTK_END_DESCRIBE_BLACK_BOX(Filter3DPointVector); +//===== +// 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 bbPackRecalage + +#endif // __bbPackRecalageFilter3DPointVector_h_INCLUDED__ + diff --git a/PackRecalage/src/bbPackRecalageReSlicerBox.cxx b/PackRecalage/src/bbPackRecalageReSlicerBox.cxx index 29953b0..984f454 100644 --- a/PackRecalage/src/bbPackRecalageReSlicerBox.cxx +++ b/PackRecalage/src/bbPackRecalageReSlicerBox.cxx @@ -30,6 +30,50 @@ namespace bbPackRecalage { + +//----------------------------------------------------------------------------- +void ReSlicerBox::GetBackInfo(double *backInfo, vtkMatrix4x4 *vtkmatrix, std::vector point ) +{ + + backInfo[0]=vtkmatrix->GetElement(0,0); + backInfo[1]=vtkmatrix->GetElement(0,1); + backInfo[2]=vtkmatrix->GetElement(0,2); + backInfo[3]=vtkmatrix->GetElement(0,3); + backInfo[4]=vtkmatrix->GetElement(1,0); + backInfo[5]=vtkmatrix->GetElement(1,1); + backInfo[6]=vtkmatrix->GetElement(1,2); + backInfo[7]=vtkmatrix->GetElement(1,3); + backInfo[8]=vtkmatrix->GetElement(2,0); + backInfo[9]=vtkmatrix->GetElement(2,1); + backInfo[10]=vtkmatrix->GetElement(2,2); + backInfo[11]=vtkmatrix->GetElement(2,3); + backInfo[12]=vtkmatrix->GetElement(3,0); + backInfo[13]=vtkmatrix->GetElement(3,1); + backInfo[14]=vtkmatrix->GetElement(3,2); + backInfo[15]=vtkmatrix->GetElement(3,3); + + backInfo[16]=-point[0]; + backInfo[17]=-point[1];; + backInfo[18]=-point[2];; +} + +//----------------------------------------------------------------------------- +bool ReSlicerBox::CompareBackInfo(double* backInfoA, double * backInfoB) +{ + bool ok=true; + int i; + for (i=0; iCenterImageOn(); } - //slicer =vtkImageReslice::New(); - slicer->SetInput( image->GetOutput() ); - slicer->SetInformationInput( image->GetOutput() ); - slicer->SetResliceTransform(bbGetInputTransform()); - slicer->SetOutputOrigin( -(bbGetInputOrigin()[0]) , -(bbGetInputOrigin()[1]) , -(bbGetInputOrigin()[2]) ); - + double tmpbackInfo[19]; + GetBackInfo(tmpbackInfo,bbGetInputTransform()->GetMatrix(),bbGetInputOrigin() ); - if(bbGetInputInterpolate()) + if ( CompareBackInfo(backInfoA,tmpbackInfo)==false ) { - slicer->InterpolateOn(); - } - slicer->Update(); - - //imageResult = vtkImageChangeInformation::New(); - imageResult->SetInput( slicer->GetOutput() ); - double spc[3]; - bbGetInputIn()->GetSpacing(spc); - imageResult->SetOutputSpacing( spc ); - imageResult->SetOutputOrigin( 0,0,0 ); + GetBackInfo(backInfoA,bbGetInputTransform()->GetMatrix(),bbGetInputOrigin() ); + + //slicer =vtkImageReslice::New(); + slicer->SetInput( image->GetOutput() ); + slicer->SetInformationInput( image->GetOutput() ); + slicer->SetResliceTransform(bbGetInputTransform()); + slicer->SetOutputOrigin( -(bbGetInputOrigin()[0]) , -(bbGetInputOrigin()[1]) , -(bbGetInputOrigin()[2]) ); + + if(bbGetInputInterpolate()) + { + slicer->InterpolateOn(); + } + slicer->Update(); + + //imageResult = vtkImageChangeInformation::New(); + imageResult->SetInput( slicer->GetOutput() ); + double spc[3]; + bbGetInputIn()->GetSpacing(spc); + imageResult->SetOutputSpacing( spc ); + imageResult->SetOutputOrigin( 0,0,0 ); - bbSetOutputOut( imageResult->GetOutput() ); - - if (bbGetInputTransform()!=NULL) - { - bbGetInputTransform()->Update(); - vtkMatrix4x4 *m = bbGetInputTransform()->GetMatrix(); - if (m!=NULL) - { - printf("EED ReSlicerBox::Process Translation %d %d %d \n",-(bbGetInputOrigin()[0]),-(bbGetInputOrigin()[1]),-(bbGetInputOrigin()[2])); - printf("EED ReSlicerBox::Process Matrix %f %f %f %f\n", m->GetElement(0,0),m->GetElement(0,1),m->GetElement(0,2),m->GetElement(0,3)); - printf("EED ReSlicerBox::Process Matrix %f %f %f %f\n", m->GetElement(1,0),m->GetElement(1,1),m->GetElement(1,2),m->GetElement(1,3)); - printf("EED ReSlicerBox::Process Matrix %f %f %f %f\n", m->GetElement(2,0),m->GetElement(2,1),m->GetElement(2,2),m->GetElement(2,3)); - printf("EED ReSlicerBox::Process Matrix %f %f %f %f\n", m->GetElement(3,0),m->GetElement(3,1),m->GetElement(3,2),m->GetElement(3,3)); - } // if m - } // if Transform - } - else - { - bbSetOutputOut( NULL ); + bbSetOutputOut( imageResult->GetOutput() ); + + if (bbGetInputTransform()!=NULL) + { + bbGetInputTransform()->Update(); + vtkMatrix4x4 *m = bbGetInputTransform()->GetMatrix(); + if (m!=NULL) + { + printf("EED ReSlicerBox::Process Translation %d %d %d \n",-(bbGetInputOrigin()[0]),-(bbGetInputOrigin()[1]),-(bbGetInputOrigin()[2])); + printf("EED ReSlicerBox::Process Matrix %f %f %f %f\n", m->GetElement(0,0),m->GetElement(0,1),m->GetElement(0,2),m->GetElement(0,3)); + printf("EED ReSlicerBox::Process Matrix %f %f %f %f\n", m->GetElement(1,0),m->GetElement(1,1),m->GetElement(1,2),m->GetElement(1,3)); + printf("EED ReSlicerBox::Process Matrix %f %f %f %f\n", m->GetElement(2,0),m->GetElement(2,1),m->GetElement(2,2),m->GetElement(2,3)); + printf("EED ReSlicerBox::Process Matrix %f %f %f %f\n", m->GetElement(3,0),m->GetElement(3,1),m->GetElement(3,2),m->GetElement(3,3)); + } // if m + } // if Transform + } // Compare BackInfo + } else { + bbSetOutputOut( NULL ); } } @@ -92,12 +141,18 @@ void ReSlicerBox::bbUserSetDefaultValues() { std::vector empty; bbSetInputOrigin(empty); - bbSetInputIn(NULL); - bbSetInputTransform(NULL); - bbSetOutputOut(NULL); + bbSetInputIn(NULL); + bbSetInputTransform(NULL); + bbSetOutputOut(NULL); + bbSetInputCentered(false); bbSetInputInterpolate(false); + sizeBackInfo=19; + for (int i=0; i point ); + bool CompareBackInfo(double* , double *); }; BBTK_BEGIN_DESCRIBE_BLACK_BOX(ReSlicerBox,bbtk::AtomicBlackBox); -- 2.47.1