]> Creatis software - creaRigidRegistration.git/commitdiff
add options to convolution kerner 3x3x3 vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 22 Nov 2024 16:05:55 +0000 (17:05 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 22 Nov 2024 16:05:55 +0000 (17:05 +0100)
PackRecalage/bbs/boxes/CompareImagesSwitcherWidget_3Dp.bbg
PackRecalage/bbs/boxes/CompareImagesSwitcherWidget_3Dp.bbs
PackRecalage/src/bbPackRecalageImageConvolution.cxx
PackRecalage/src/bbPackRecalageImageConvolution.h
lib/Convolution.cxx
lib/Convolution.h

index fd05a8e45b165f8ad58732837681a14abf07077c..5529ef6fef9422cb940ce17faa8cb43fc501d435 100644 (file)
@@ -33,7 +33,7 @@ COMPLEX_PORT
 _VecImageLayer
 160.000262:115.179274:-900.000000
 FIN_COMPLEX_PORT
-BOXES:76
+BOXES:85
 BOX
 PackRecalage:ImageSwitcherBox:switch
 ISEXEC:FALSE
@@ -109,8 +109,8 @@ FIN_BOX
 BOX
 wx:LayoutSplit:Box12
 ISEXEC:FALSE
--93.887764:-111.585904:-900.000000
--71.127764:-114.085904:-900.000000
+-93.732506:-110.809616:-900.000000
+-70.972506:-113.309616:-900.000000
 FIN_BOX
 BOX
 PackRecalage:ImageSwitcherFilter:Box17
@@ -239,8 +239,8 @@ FIN_BOX
 BOX
 wx:LayoutLine:Box42
 ISEXEC:FALSE
--80.172913:-94.750733:-900.000000
--46.852913:-97.250733:-900.000000
+-74.350754:-87.220741:-900.000000
+-41.030754:-89.720741:-900.000000
 PORT
 WinTitle:"Plane XZ  (rotation/slice Y)"
 FIN_BOX
@@ -503,8 +503,8 @@ FIN_BOX
 BOX
 wx:Slider:Box99
 ISEXEC:FALSE
--123.474901:-74.501498:-900.000000
--93.674901:-77.001498:-900.000000
+-82.487827:-53.561725:-900.000000
+-52.687827:-56.061725:-900.000000
 PORT
 In:"0"
 PORT
@@ -598,7 +598,83 @@ ISEXEC:FALSE
 -22.117352:-157.289903:-900.000000
 0.527648:-159.789903:-900.000000
 FIN_BOX
-CONNECTIONS:127
+BOX
+wx:LayoutLine:Box116
+ISEXEC:FALSE
+-76.532877:-80.237058:-900.000000
+-43.212877:-82.737058:-900.000000
+PORT
+Orientation:"H"
+FIN_BOX
+BOX
+std:ConcatStrings:Box120
+ISEXEC:FALSE
+-19.249404:-164.916324:-900.000000
+3.510596:-167.416324:-900.000000
+FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box121
+ISEXEC:FALSE
+-22.077888:-171.201844:-900.000000
+1.157112:-173.701844:-900.000000
+PORT
+I:"0"
+FIN_BOX
+BOX
+std:GetVectorDoubleElement:Box122
+ISEXEC:FALSE
+12.192913:-171.015950:-900.000000
+35.427913:-173.515950:-900.000000
+PORT
+I:"1"
+FIN_BOX
+BOX
+std:ConcatStrings:Box123
+ISEXEC:FALSE
+-122.007325:-98.426263:-900.000000
+-99.247325:-100.926263:-900.000000
+PORT
+In2:"  "
+FIN_BOX
+BOX
+creaMaracasVisu:SliderMinMax-flexible:Box124
+ISEXEC:FALSE
+-106.780914:-47.752081:-900.000000
+-83.955914:-50.252081:-900.000000
+PORT
+showactual:"false"
+FIN_BOX
+BOX
+wx:LayoutLine:Box133
+ISEXEC:FALSE
+-123.043494:-82.238461:-900.000000
+-89.723494:-84.738461:-900.000000
+PORT
+Orientation:"V"
+FIN_BOX
+BOX
+wx:Slider:Box134
+ISEXEC:FALSE
+-126.310102:-73.742981:-900.000000
+-96.510102:-76.242981:-900.000000
+PORT
+Label:"true"
+PORT
+ReactiveOnTrack:"true"
+PORT
+Title:"Min color table&&2P&&"
+FIN_BOX
+BOX
+wx:Slider:Box135
+ISEXEC:FALSE
+-118.061111:-68.118047:-900.000000
+-88.261111:-70.618047:-900.000000
+PORT
+ReactiveOnTrack:"true"
+PORT
+Title:"Max color table&&2P&&"
+FIN_BOX
+CONNECTIONS:142
 CONNECTION
 checkS:Out:switch:On
 NumberOfControlPoints:0
@@ -894,9 +970,6 @@ CONNECTION
 Box99:Out:Box95:Opacity
 NumberOfControlPoints:0
 CONNECTION
-Box99:Widget:Box48:Widget3
-NumberOfControlPoints:0
-CONNECTION
 Box101:Out:Box100:In
 NumberOfControlPoints:0
 CONNECTION
@@ -957,27 +1030,75 @@ CONNECTION
 Box113:Out:Box118:In
 NumberOfControlPoints:0
 CONNECTION
-Box118:MinMax:Box106:lstRangeForColorBar
+Box57:BoxChange:Box117:In3
 NumberOfControlPoints:0
 CONNECTION
-Box118:MinMax:Box105:lstRangeForColorBar
+Box55:Out:Box24:WindowLevel
 NumberOfControlPoints:0
 CONNECTION
-Box118:MinMax:Box95:lstRangeForColorBar
+Box56:Out:Box24:ColorLevel
 NumberOfControlPoints:0
 CONNECTION
-Box57:BoxChange:Box117:In3
+Box55:Out:Box28:WindowLevel
 NumberOfControlPoints:0
 CONNECTION
-Box55:Out:Box24:WindowLevel
+Box56:Out:Box28:ColorLevel
 NumberOfControlPoints:0
 CONNECTION
-Box56:Out:Box24:ColorLevel
+Box99:Widget:Box116:Widget4
 NumberOfControlPoints:0
 CONNECTION
-Box55:Out:Box28:WindowLevel
+Box118:MinMax:Box120:In1
 NumberOfControlPoints:0
 CONNECTION
-Box56:Out:Box28:ColorLevel
+Box120:Out:Box121:In
+NumberOfControlPoints:0
+CONNECTION
+Box120:Out:Box122:In
+NumberOfControlPoints:0
+CONNECTION
+Box123:Out:Box95:lstRangeForColorBar
+NumberOfControlPoints:0
+CONNECTION
+Box123:Out:Box105:lstRangeForColorBar
+NumberOfControlPoints:0
+CONNECTION
+Box123:Out:Box106:lstRangeForColorBar
+NumberOfControlPoints:0
+CONNECTION
+Box116:Widget:Box48:Widget4
+NumberOfControlPoints:0
+CONNECTION
+Box134:Widget:Box133:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box135:Widget:Box133:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box121:Out:Box134:Min
+NumberOfControlPoints:0
+CONNECTION
+Box121:Out:Box135:Min
+NumberOfControlPoints:0
+CONNECTION
+Box122:Out:Box135:Max
+NumberOfControlPoints:0
+CONNECTION
+Box122:Out:Box134:Max
+NumberOfControlPoints:0
+CONNECTION
+Box133:Widget:Box116:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box134:Out:Box123:In1
+NumberOfControlPoints:0
+CONNECTION
+Box135:Out:Box123:In3
+NumberOfControlPoints:0
+CONNECTION
+Box57:BoxChange:Box135:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box57:BoxChange:Box134:BoxExecute
 NumberOfControlPoints:0
 APP_END
index f53cd70f238abde40d1668eafbab43a2de0d2fca..e7114b28adfaf176225957a860a1c40a574b7139 100644 (file)
@@ -224,6 +224,35 @@ new std:MultipleInputs Box117
 
 new vtk:ImageVtkProperties Box118
 
+new wx:LayoutLine Box116
+  set Box116.Orientation "H"
+
+new std:ConcatStrings Box120
+
+new std:GetVectorDoubleElement Box121
+  set Box121.I "0"
+
+new std:GetVectorDoubleElement Box122
+  set Box122.I "1"
+
+new std:ConcatStrings Box123
+  set Box123.In2 "  "
+
+new creaMaracasVisu:SliderMinMax-flexible Box124
+  set Box124.showactual "false"
+
+new wx:LayoutLine Box133
+  set Box133.Orientation "V"
+
+new wx:Slider Box134
+  set Box134.Label "true"
+  set Box134.ReactiveOnTrack "true"
+  set Box134.Title "Min color table:"
+
+new wx:Slider Box135
+  set Box135.ReactiveOnTrack "true"
+  set Box135.Title "Max color table:"
+
 
 connect checkS.Out switch.On
 connect sdrT.Out switch.Time
@@ -319,7 +348,6 @@ connect checkS.Out Box98.In1
 connect Box98.Out Box96.In2
 connect Box24.wxVtkBaseView1 Box95.WxVtkBaseView
 connect Box99.Out Box95.Opacity
-connect Box99.Widget Box48.Widget3
 connect Box101.Out Box100.In
 connect Box99.Out Box105.Opacity
 connect Box99.Out Box106.Opacity
@@ -339,14 +367,30 @@ connect Box117.BoxChange Box95.BoxExecute
 connect Box117.BoxChange Box105.BoxExecute
 connect Box117.BoxChange Box106.BoxExecute
 connect Box113.Out Box118.In
-connect Box118.MinMax Box106.lstRangeForColorBar
-connect Box118.MinMax Box105.lstRangeForColorBar
-connect Box118.MinMax Box95.lstRangeForColorBar
 connect Box57.BoxChange Box117.In3
 connect Box55.Out Box24.WindowLevel
 connect Box56.Out Box24.ColorLevel
 connect Box55.Out Box28.WindowLevel
 connect Box56.Out Box28.ColorLevel
+connect Box99.Widget Box116.Widget4
+connect Box118.MinMax Box120.In1
+connect Box120.Out Box121.In
+connect Box120.Out Box122.In
+connect Box123.Out Box95.lstRangeForColorBar
+connect Box123.Out Box105.lstRangeForColorBar
+connect Box123.Out Box106.lstRangeForColorBar
+connect Box116.Widget Box48.Widget4
+connect Box134.Widget Box133.Widget1
+connect Box135.Widget Box133.Widget2
+connect Box121.Out Box134.Min
+connect Box121.Out Box135.Min
+connect Box122.Out Box135.Max
+connect Box122.Out Box134.Max
+connect Box133.Widget Box116.Widget2
+connect Box134.Out Box123.In1
+connect Box135.Out Box123.In3
+connect Box57.BoxChange Box135.BoxExecute
+connect Box57.BoxChange Box134.BoxExecute
 
 # Complex input ports
 input ImageVector1 Box22.In " "
index f062a1c14adb8c7bd5d78877b5bbd4cc9b29e778..0b98cf44fe3690519f2707111f96298d28c09223 100644 (file)
@@ -23,7 +23,6 @@
 # ------------------------------------------------------------------------   
 */
 
-
 #include "bbPackRecalageImageConvolution.h"
 #include "bbPackRecalagePackage.h"
 namespace bbPackRecalage
@@ -35,9 +34,10 @@ void ImageConvolution::Process()
 {
        if(convolution != NULL && bbGetInputIn() != NULL)
        {
-               convolution->setImage(bbGetInputIn());
-               convolution->setFactor(bbGetInputFactor());
-               convolution->setOn(bbGetInputOn());
+               convolution->setImage( bbGetInputIn() );
+        convolution->setType( bbGetInputType() );
+               convolution->setFactor( bbGetInputFactor() );
+               convolution->setOn( bbGetInputOn() );
                convolution->Run();
                bbSetOutputOut(convolution->getImage());
        }// if
@@ -45,10 +45,11 @@ void ImageConvolution::Process()
 
 void ImageConvolution::bbUserSetDefaultValues()
 {
-       bbSetInputIn(NULL);
-       bbSetOutputOut(NULL);
+    bbSetInputIn(NULL);
+       bbSetInputType(0);
        bbSetInputFactor(5.0);
        bbSetInputOn(false);
+    bbSetOutputOut(NULL);
 }
 
 void ImageConvolution::bbUserInitializeProcessing()
index 873805c2f1e2e342344f961bae0b432652f20afe..45f96935c8d918e832cc3211b91a2ce494b22063 100644 (file)
@@ -23,7 +23,6 @@
 # ------------------------------------------------------------------------   
 */
 
-
 #ifndef __bbPackRecalageImageConvolution_h_INCLUDED__
 #define __bbPackRecalageImageConvolution_h_INCLUDED__
 #include "bbPackRecalage_EXPORT.h"
@@ -44,6 +43,7 @@ class bbPackRecalage_EXPORT ImageConvolution
   BBTK_DECLARE_INPUT(In,vtkImageData*);
   BBTK_DECLARE_INPUT(Factor,double);
   BBTK_DECLARE_INPUT(On,bool);
+  BBTK_DECLARE_INPUT(Type,int);
   BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
   BBTK_PROCESS(Process);
   void Process();
@@ -57,13 +57,11 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageConvolution,bbtk::AtomicBlackBox);
   BBTK_AUTHOR("jn.trillos44@uniandes.edu.co");
   BBTK_DESCRIPTION("Processes an image through different convolution matrix (Edge detect)");
   BBTK_CATEGORY("filter");
-
   BBTK_INPUT(ImageConvolution,In,"Image to be filetered",vtkImageData*,"");
   BBTK_INPUT(ImageConvolution,Factor,"Factor by how the edges will be represented",double,"");
   BBTK_INPUT(ImageConvolution,On,"(default false) Boolean that represents if the filter is turned on. True = On.",bool,"");
-
+  BBTK_INPUT(ImageConvolution,Type,"(default 0) 0: 2D_kernel3x3 (border Factor=4)    10: 3D_kernel3x3x3 (border Factor=6) 11: 3D_kernel3x3x3 (border Factor=26)",int,"");
   BBTK_OUTPUT(ImageConvolution,Out,"Filtered Image",vtkImageData*,"");
-
 BBTK_END_DESCRIBE_BLACK_BOX(ImageConvolution);
 }
 // EO namespace bbPackRecalage
index 4957b05952ed57b031ce28d8390f384a3863e646..66fd75a06e59dbd57b748543f762360a66fd7fef 100644 (file)
@@ -32,6 +32,7 @@
 //------------------------------------------------------------
 Convolution::Convolution()
 {
+    _type       = 0;
        _image          = NULL;
        _convolve       = vtkImageConvolve::New();
        _cast           = vtkImageCast::New();
@@ -74,33 +75,40 @@ void Convolution::setOn(bool on)
        _on = on;
 }
 
+void Convolution::setType(int type)
+{
+    _type = type;
+}
+
 void Convolution::Run()
 {
        if(_on==true)
        {
-//             double kernel[] = { 0.0,1.0,0.0,     1.0,-_factor,1.0,    0.0,1.0,0.0};
-//             _convolve->SetKernel3x3(kernel);
-  
-// falta
-        double kernel[] = {
-            0.0,0.0,0.0,     0.0,1,0.0,           0.0,0.0,0.0,
-            0.0,1.0,0.0,     1.0,-_factor,1.0,    0.0,1.0,0.0,
-            0.0,0.0,0.0,     0.0,1,0.0,           0.0,0.0,0.0
-        };
-        
-//bien
-//        double kernel[] = {
-//            1.0,1.0,1.0,     1.0,1.0,1.0,           1.0,1.0,1.0,
-//            1.0,1.0,1.0,     1.0,-_factor,1.0,    1.0,1.0,1.0,
-//            1.0,1.0,1.0,     1.0,1.0,1.0,           1.0,1.0,1.0
-//        };
-//        double kernel[] = {
-//            -1.0,-1.0,-1.0,     -1.0,-1.0,-1.0,           -1.0,-1.0,-1.0,
-//            -1.0,-1.0,-1.0,     -1.0,_factor,-1.0,        -1.0,-1.0,-1.0,
-//            -1.0,-1.0,-1.0,     -1.0,-1.0,-1.0,           -1.0,-1.0,-1.0
-//        };
-        
-        _convolve->SetKernel3x3x3(kernel);
+        if (_type==0)
+        {
+            double kernel[] = { 0.0,1.0,0.0,     1.0,-_factor,1.0,    0.0,1.0,0.0};
+            _convolve->SetKernel3x3(kernel);
+        } // if _type==0
+
+        if (_type==10)
+        {
+            double kernel[] = {
+                0.0,0.0,0.0,     0.0,1,0.0,           0.0,0.0,0.0,
+                0.0,1.0,0.0,     1.0,-_factor,1.0,    0.0,1.0,0.0,
+                0.0,0.0,0.0,     0.0,1,0.0,           0.0,0.0,0.0
+            };
+            _convolve->SetKernel3x3x3(kernel);
+        }
+
+        if (_type==11)
+        {
+            double kernel[] = {
+                1.0,1.0,1.0,     1.0,1.0,1.0,           1.0,1.0,1.0,
+                1.0,1.0,1.0,     1.0,-_factor,1.0,    1.0,1.0,1.0,
+                1.0,1.0,1.0,     1.0,1.0,1.0,           1.0,1.0,1.0
+            };
+            _convolve->SetKernel3x3x3(kernel);
+        }
 
                _convolve->Update();
 //EED 2017-01-01 Migration VTK7
index 3758a053144d49005fd5aae56c93bdacf325802b..888cf484d27dda955d16a077f322ec24803fc555 100644 (file)
@@ -38,31 +38,23 @@ class Convolution
        public: 
                Convolution();
                ~Convolution();
-
                //Gets the result
                vtkImageData* getImage();
-               
                void setImage(vtkImageData *image);
                void setFactor(double factor);
-               void setOn(bool on);
-
+        void setOn(bool on);
+        void setType(int type);
                void Run();
-               
        // --- Atributes --- //
-       private: 
-
+       private:
                //Original Image
                vtkImageData *_image;
-
                //Convolution factor
                double _factor;
-
                //Convolution Filter
                vtkImageConvolve *_convolve;
-
                //Casting Filter
                vtkImageCast *_cast;
-
                bool _on;
+        int  _type;
 };
-