#include <RegionGrowFunctors/BinaryThreshold.h>
-#include <cpInstances/Image.h>
+#include <cpInstances/DataObjects/Image.h>
-#include <fpa/Image/Functors/RegionGrowBinaryThreshold.h>
+#include <fpa/Image/Functors/RegionGrow/BinaryThreshold.h>
#include <itkConstNeighborhoodIterator.h>
#include <vtkPolyData.h>
BinaryThreshold( )
: Superclass( )
{
- typedef cpPlugins::BaseObjects::DataObject _TData;
- typedef cpInstances::Image _TImage;
+ typedef cpPlugins::Pipeline::DataObject _TData;
+ typedef cpInstances::DataObjects::Image _TImage;
this->_ConfigureInput< _TImage >( "Input", true, false );
this->_ConfigureInput< _TData >( "Seeds", false, false );
this->_ConfigureOutput< _TData >( "Output" );
this->m_Parameters.ConfigureAsUint( "Radius", 1 );
- this->m_Parameters.ConfigureAsReal( "LowerThreshold", 0 );
- this->m_Parameters.ConfigureAsReal( "UpperThreshold", 0 );
+ this->m_Parameters.ConfigureAsReal( "Lower", 0 );
+ this->m_Parameters.ConfigureAsReal( "Upper", 0 );
}
// -------------------------------------------------------------------------
{
typedef itk::ConstNeighborhoodIterator< _TImage > _TInIt;
typedef
- fpa::Image::Functors::RegionGrowBinaryThreshold< _TImage >
+ fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage >
_TFunctor;
auto out = this->GetOutput( "Output" );
auto f = out->GetITK< _TFunctor >( );
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 );
} // 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 );
- f->SetLowerThreshold( v_min );
- f->SetUpperThreshold( v_max );
+ s = std::sqrt( s );
+ v_min = m - s;
+ v_max = m + s;
+ f->SetLower( v_min );
+ f->SetUpper( v_max );
+ this->m_Parameters.SetReal( "Lower", f->GetLower( ) );
+ this->m_Parameters.SetReal( "Upper", f->GetUpper( ) );
}
else
{
- f->SetLowerThreshold( this->m_Parameters.GetReal( "LowerThreshold" ) );
- f->SetUpperThreshold( this->m_Parameters.GetReal( "UpperThreshold" ) );
+ f->SetLower( this->m_Parameters.GetReal( "Lower" ) );
+ f->SetUpper( this->m_Parameters.GetReal( "Upper" ) );
} // fi
}