X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FMeshReader.cxx;fp=lib%2FcpPlugins%2FPlugins%2FMeshReader.cxx;h=b7ce4ba88e3d5667232cef35c237d82a95854295;hb=e286ff49ea3582a5f4fad437dd133ec6c05c34dc;hp=b219899fa930cb525f21dd8a2486bf78e3ecee56;hpb=73b0cfaebc440484dbc92a3a3404a0ee0859008e;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/MeshReader.cxx b/lib/cpPlugins/Plugins/MeshReader.cxx index b219899..b7ce4ba 100644 --- a/lib/cpPlugins/Plugins/MeshReader.cxx +++ b/lib/cpPlugins/Plugins/MeshReader.cxx @@ -19,10 +19,13 @@ MeshReader( ) this->SetNumberOfOutputs( 1 ); this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 ); - this->m_DefaultParameters[ "FileName" ] = - TParameter( "string", "no_file_name" ); - this->m_DefaultParameters[ "PixelType" ] = TParameter( "type", "float" ); - this->m_DefaultParameters[ "MeshDimension" ] = TParameter( "int", "3" ); + using namespace cpPlugins::Interface; + this->m_DefaultParameters.Configure( Parameters::String, "FileName" ); + this->m_DefaultParameters.Configure( Parameters::String, "PixelType" ); + this->m_DefaultParameters.Configure( Parameters::Uint, "Dimension" ); + this->m_DefaultParameters.SetValueAsString( "PixelType", "float" ); + this->m_DefaultParameters.SetValueAsUint( "Dimension", 3 ); + this->m_Parameters = this->m_DefaultParameters; } // ------------------------------------------------------------------------- @@ -35,16 +38,11 @@ cpPlugins::Plugins::MeshReader:: std::string cpPlugins::Plugins::MeshReader:: _GenerateData( ) { - TParameters::const_iterator dIt; - - // Get image dimension - dIt = this->m_Parameters.find( "MeshDimension" ); - if( dIt == this->m_Parameters.end( ) ) - dIt = this->m_DefaultParameters.find( "MeshDimension" ); - + using namespace cpPlugins::Interface; + Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" ); std::string r = "cpPlugins::Plugins::MeshReader: itk::Mesh dimension not supported."; - if( dIt->second.second == "3" ) r = this->_GD0< 3 >( ); - + if( dim == 3 ) + r = this->_GD0< 3 >( ); return( r ); } @@ -53,18 +51,11 @@ template< unsigned int D > std::string cpPlugins::Plugins::MeshReader:: _GD0( ) { - TParameters::const_iterator tIt, cIt; - - // Get image pixel type - tIt = this->m_Parameters.find( "PixelType" ); - if( tIt == this->m_Parameters.end( ) ) - tIt = this->m_DefaultParameters.find( "PixelType" ); - + using namespace cpPlugins::Interface; + Parameters::TString pt = this->m_Parameters.GetValueAsString( "PixelType" ); std::string r = "cpPlugins::Plugins::MeshReader: itk::Mesh pixel type not supported"; - if( tIt->second.second == "float" ) - r = this->_GD1< float, D >( ); - else if( tIt->second.second == "double" ) - r = this->_GD1< double, D >( ); + if( pt == "float" ) r = this->_GD1< float, D >( ); + else if( pt == "double" ) r = this->_GD1< double, D >( ); return( r ); } @@ -73,12 +64,10 @@ template< class P, unsigned int D > std::string cpPlugins::Plugins::MeshReader:: _GD1( ) { - TParameters::const_iterator fIt; - // Get filename - fIt = this->m_Parameters.find( "FileName" ); - if( fIt == this->m_Parameters.end( ) ) - fIt = this->m_DefaultParameters.find( "FileName" ); + using namespace cpPlugins::Interface; + Parameters::TString fname = + this->m_Parameters.GetValueAsString( "FileName" ); using namespace cpPlugins::Extensions; typedef DataStructures::QuadEdgeMesh< P, D > _TMesh; @@ -93,7 +82,7 @@ _GD1( ) dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) ); } // fi - reader->SetFileName( fIt->second.second ); + reader->SetFileName( fname ); try { reader->Update( );