if( dynamic_cast< itk::Image< p2, d >* >( i ) != NULL ) \
r = this->f< p1, p2, d >( )
+// -------------------------------------------------------------------------
+std::string cpm::Plugins::SimpleFillRegion::
+GetClassName( ) const
+{
+ return( "cpm::Plugins::SimpleFillRegion" );
+}
+
// -------------------------------------------------------------------------
cpm::Plugins::SimpleFillRegion::
SimpleFillRegion( )
this->SetNumberOfOutputs( 1 );
this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
- this->m_DefaultParameters[ "MinDelta" ] = TParameter( "double", "0" );
- this->m_DefaultParameters[ "MaxDelta" ] = TParameter( "double", "0" );
- this->m_DefaultParameters[ "Seed" ] = TParameter( "point", "0:0:0" );
+ using namespace cpPlugins::Interface;
+ this->m_DefaultParameters.Configure( Parameters::Real, "MinDelta" );
+ this->m_DefaultParameters.Configure( Parameters::Real, "MaxDelta" );
+ this->m_DefaultParameters.Configure( Parameters::Point, "Seed" );
+
+ this->m_DefaultParameters.SetValueAsReal( "MinDelta", 0 );
+ this->m_DefaultParameters.SetValueAsReal( "MaxDelta", 0 );
+ this->m_DefaultParameters.SetValueAsPoint( "Seed", 3, 0.0, 0.0, 0.0 );
+ this->m_Parameters = this->m_DefaultParameters;
}
// -------------------------------------------------------------------------
{
}
-// -------------------------------------------------------------------------
-std::string cpm::Plugins::SimpleFillRegion::
-GetClassName( ) const
-{
- return( "cpm::Plugins::SimpleFillRegion" );
-}
-
// -------------------------------------------------------------------------
std::string cpm::Plugins::SimpleFillRegion::
_GenerateData( )
_TImage2* i2 = dynamic_cast< _TImage2* >( this->_GetInput( 1 ) );
// Transform input seed
- typename _TImage1::PointType pnt;
- TParameters::const_iterator sIt;
- sIt = this->m_Parameters.find( "Seed" );
- if( sIt == this->m_Parameters.end( ) )
- return( "cpm::Plugins::SimpleFillRegion: no seed given." );
- char* buff = new char[ sIt->second.second.size( ) + 1 ];
- std::memcpy( buff, sIt->second.second.c_str( ), sIt->second.second.size( ) );
- buff[ sIt->second.second.size( ) ] = '\0';
- char* tok = std::strtok( buff, ":" );
- for( unsigned int d = 0; d < D; ++d )
- {
- pnt[ d ] = std::atof( tok );
- tok = std::strtok( NULL, ":" );
-
- } // rof
- delete [] buff;
+ typename _TImage1::PointType pnt =
+ this->m_Parameters.GetValueAsPoint< typename _TImage1::PointType >( "Seed" );
typename _TImage1::IndexType idx;
- if( !( i1->TransformPhysicalPointToIndex( pnt, idx ) ) )
- return( "cpm::Plugins::SimpleFillRegion: seed is outside image regions." );
+ i1->TransformPhysicalPointToIndex( pnt, idx );
// Check spatial compatilibity
if( i1->GetLargestPossibleRegion( ) != i2->GetLargestPossibleRegion( ) )
return( "cpm::Plugins::SimpleFillRegion: incompatible directions." );
// Create output
- cpPlugins::Interface::Image* out_obj =
- dynamic_cast< cpPlugins::Interface::Image* >( this->GetOutput( 0 ) );
- typename _TImage2::Pointer out =
- dynamic_cast< _TImage2* >( out_obj->GetDataObject( ) );
- if( out.IsNull( ) )
- {
- out = _TImage2::New( );
- this->_SetOutput( 0, out );
-
- } // fi
+ typename _TImage2::Pointer out = _TImage2::New( );
+ this->_SetOutput( 0, out );
// Create memory, if needed
if(
} // fi
out->FillBuffer( P2( 0 ) );
- P1 min_delta = P1( std::atof( this->m_Parameters[ "MinDelta" ].second.c_str( ) ) );
- P1 max_delta = P1( std::atof( this->m_Parameters[ "MaxDelta" ].second.c_str( ) ) );
+ P1 min_delta = P1( this->m_Parameters.GetValueAsReal( "MinDelta" ) );
+ P1 max_delta = P1( this->m_Parameters.GetValueAsReal( "MaxDelta" ) );
P1 lower = i1->GetPixel( idx ) - min_delta;
P1 upper = i1->GetPixel( idx ) + min_delta;
public:
typedef SimpleFillRegion Self;
typedef cpPlugins::Interface::ImageToImageFilter Superclass;
-
- typedef Superclass::TParameter TParameter;
- typedef Superclass::TParameters TParameters;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
public:
- SimpleFillRegion( );
- virtual ~SimpleFillRegion( );
+ itkNewMacro( Self );
+ itkTypeMacro( SimpleFillRegion, cpPlugins_Interface_ImageToImageFilter );
virtual std::string GetClassName( ) const;
protected:
+ SimpleFillRegion( );
+ virtual ~SimpleFillRegion( );
+
virtual std::string _GenerateData( );
template< unsigned int D >
};
// ---------------------------------------------------------------------
- PLUMA_INHERIT_PROVIDER( SimpleFillRegion, cpPlugins::Interface::Object );
+ CPPLUGINS_INHERIT_PROVIDER( SimpleFillRegion );
} // ecapseman