From e696e979d6259eadb7c3825c6513c37231af6b09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Thu, 1 Dec 2016 17:24:23 -0500 Subject: [PATCH] ... --- plugins/ImageAlgorithms/RegionGrow.cxx | 17 +++++++++-------- plugins/RegionGrowFunctors/BinaryThreshold.cxx | 8 +++++++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/plugins/ImageAlgorithms/RegionGrow.cxx b/plugins/ImageAlgorithms/RegionGrow.cxx index f620b71..801c7f0 100644 --- a/plugins/ImageAlgorithms/RegionGrow.cxx +++ b/plugins/ImageAlgorithms/RegionGrow.cxx @@ -37,14 +37,15 @@ void fpaPluginsImageAlgorithms::RegionGrow:: _GD0( _TImage* image ) { auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" ); - if( rtype == "char" ) this->_GD1< _TImage, char >( image ); - if( rtype == "uchar" ) this->_GD1< _TImage, unsigned char >( image ); - if( rtype == "short" ) this->_GD1< _TImage, short >( image ); - if( rtype == "ushort" ) this->_GD1< _TImage, unsigned short >( image ); - if( rtype == "int" ) this->_GD1< _TImage, int >( image ); - if( rtype == "uint" ) this->_GD1< _TImage, unsigned int >( image ); - if( rtype == "long" ) this->_GD1< _TImage, long >( image ); - if( rtype == "ulong" ) this->_GD1< _TImage, unsigned long >( image ); + if( rtype == "char" ) this->_GD1< _TImage, char >( image ); + else if( rtype == "uchar" ) this->_GD1< _TImage, unsigned char >( image ); + else if( rtype == "short" ) this->_GD1< _TImage, short >( image ); + else if( rtype == "ushort" ) this->_GD1< _TImage, unsigned short >( image ); + else if( rtype == "int" ) this->_GD1< _TImage, int >( image ); + else if( rtype == "uint" ) this->_GD1< _TImage, unsigned int >( image ); + else if( rtype == "long" ) this->_GD1< _TImage, long >( image ); + else if( rtype == "ulong" ) this->_GD1< _TImage, unsigned long >( image ); + else this->_GD1< _TImage, char >( image ); } // ------------------------------------------------------------------------- diff --git a/plugins/RegionGrowFunctors/BinaryThreshold.cxx b/plugins/RegionGrowFunctors/BinaryThreshold.cxx index 05010ab..6888272 100644 --- a/plugins/RegionGrowFunctors/BinaryThreshold.cxx +++ b/plugins/RegionGrowFunctors/BinaryThreshold.cxx @@ -80,6 +80,7 @@ _GD0( _TImage* image ) typename _TImage::SizeType r; r.Fill( this->m_Parameters.GetUint( "Radius" ) ); + _TInIt iIt( r, image, image->GetRequestedRegion( ) ); double v_s1 = double( 0 ); double v_s2 = double( 0 ); @@ -101,10 +102,15 @@ _GD0( _TImage* image ) } // rof } // rof + double m = v_s1 / v_n; double s = ( v_s2 - ( ( v_s1 * v_s1 ) / v_n ) ) / ( v_n - double( 1 ) ); - s = std::sqrt( s ) / double( 2 ); + s = std::sqrt( s ); + v_min = m - s; + v_max = m + s; f->SetLowerThreshold( v_min ); f->SetUpperThreshold( v_max ); + this->m_Parameters.SetReal( "LowerThreshold", f->GetLowerThreshold( ) ); + this->m_Parameters.SetReal( "UpperThreshold", f->GetUpperThreshold( ) ); } else { -- 2.47.1