X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=plugins%2FImageThresholdFilters%2FImageToBoundingBoxFromThreshold.cxx;h=f472c47001b16843c12132479bf3ea8e7ed774b8;hb=8d542556415c0f37a325b1641bb51b2bc284a115;hp=6e2f15ff30432c1552b057fb6be860c080d6a0f3;hpb=3393941bf8f26babc7b592db434b40c1b747a687;p=cpPlugins.git diff --git a/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.cxx b/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.cxx index 6e2f15f..f472c47 100644 --- a/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.cxx +++ b/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.cxx @@ -1,23 +1,24 @@ -#include -#include -#include +#include +#include +#include +#include #include -#include // ------------------------------------------------------------------------- cpPluginsImageThresholdFilters::ImageToBoundingBoxFromThreshold:: ImageToBoundingBoxFromThreshold( ) : Superclass( ) { - this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false ); - this->_ConfigureOutput< cpPlugins::DataObjects::BoundingBox >( "Output" ); + typedef cpInstances::Image _TImage; + typedef cpInstances::BoundingBox _TBBox; - this->m_Parameters.ConfigureAsReal( "LowerThreshold" ); - this->m_Parameters.ConfigureAsReal( "UpperThreshold" ); + this->_ConfigureInput< _TImage >( "Input", true, false ); + this->_ConfigureOutput< _TBBox >( "Output" ); - this->m_Parameters.SetReal( "LowerThreshold", 0 ); - this->m_Parameters.SetReal( "LowerThreshold", 0 ); + this->m_Parameters.ConfigureAsUint( "PAD", 0 ); + this->m_Parameters.ConfigureAsReal( "LowerThreshold", 0 ); + this->m_Parameters.ConfigureAsReal( "UpperThreshold", 0 ); } // ------------------------------------------------------------------------- @@ -31,8 +32,8 @@ void cpPluginsImageThresholdFilters::ImageToBoundingBoxFromThreshold:: _GenerateData( ) { auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_ImageScalars_Dims( o, _GD0 ); - else this->_Error( "Invalid input image." ); + cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) + this->_Error( "Invalid input image." ); } // ------------------------------------------------------------------------- @@ -47,13 +48,14 @@ _GD0( _TImage* image ) // Configure filter _TFilter* filter = this->_CreateITK< _TFilter >( ); filter->SetImage( image ); + filter->SetPAD( this->m_Parameters.GetUint( "PAD" ) ); filter->SetLowerThreshold( this->m_Parameters.GetReal( "LowerThreshold" ) ); filter->SetUpperThreshold( this->m_Parameters.GetReal( "UpperThreshold" ) ); filter->Compute( ); // Create output auto reg = filter->GetRegion( ); - auto bb = this->GetOutput< cpPlugins::DataObjects::BoundingBox >( "Output" ); + auto bb = this->GetOutput< cpInstances::BoundingBox >( "Output" ); typename _TImage::PointType p0, p1; image->TransformIndexToPhysicalPoint( reg.GetIndex( ), p0 ); image->TransformIndexToPhysicalPoint( reg.GetIndex( ) + reg.GetSize( ), p1 );