From f8423bfeaa7913646856bc2bfd1a61a91002d50e Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 3 Jul 2019 16:27:43 +0200 Subject: [PATCH] #3271 creaRigidRegistration Bug New Normal - Convolution --- .../src/bbPackRecalageImageConvolution.h | 19 +++++++++++-------- lib/Convolution.cxx | 14 +++++++------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/PackRecalage/src/bbPackRecalageImageConvolution.h b/PackRecalage/src/bbPackRecalageImageConvolution.h index 5e17543..873805c 100644 --- a/PackRecalage/src/bbPackRecalageImageConvolution.h +++ b/PackRecalage/src/bbPackRecalageImageConvolution.h @@ -53,14 +53,17 @@ class bbPackRecalage_EXPORT ImageConvolution }; BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageConvolution,bbtk::AtomicBlackBox); -BBTK_NAME("ImageConvolution"); -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,"Boolean that represents if the filter is turned on. True = On.",bool,""); -BBTK_OUTPUT(ImageConvolution,Out,"Filtered Image",vtkImageData*,""); + BBTK_NAME("ImageConvolution"); + 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_OUTPUT(ImageConvolution,Out,"Filtered Image",vtkImageData*,""); + BBTK_END_DESCRIBE_BLACK_BOX(ImageConvolution); } // EO namespace bbPackRecalage diff --git a/lib/Convolution.cxx b/lib/Convolution.cxx index 796a059..810ec96 100644 --- a/lib/Convolution.cxx +++ b/lib/Convolution.cxx @@ -43,8 +43,8 @@ Convolution::Convolution() //------------------------------------------------------------ Convolution::~Convolution() { - if (_convolve != NULL ) { _convolve->Delete(); } - if (_cast != NULL ) { _cast->Delete(); } + if (_convolve != NULL ) { _convolve->Delete(); } + if (_cast != NULL ) { _cast->Delete(); } } vtkImageData *Convolution::getImage() @@ -65,7 +65,9 @@ void Convolution::setImage(vtkImageData *image) void Convolution::setFactor(double factor) { - _factor = (factor/100.0)*5.0; + +// _factor = (factor/100.0)*5.0; + _factor = factor; } void Convolution::setOn(bool on) @@ -75,7 +77,7 @@ void Convolution::setOn(bool on) void Convolution::Run() { - if(_on) + 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); @@ -88,9 +90,7 @@ void Convolution::Run() #endif //_cast->SetOutputScalarTypeToDouble(); _cast->Update(); - } - else - { + } else { //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 _cast->SetInput(_image); -- 2.45.0