From: Leonardo Florez-Valencia Date: Fri, 16 Jan 2015 18:53:21 +0000 (-0500) Subject: Parameters class fully added X-Git-Tag: v0.1~421 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cf01030f78d919f66b53a80831e1e89b0cb13397;p=cpPlugins.git Parameters class fully added --- diff --git a/appli/ImageMPR/CMakeLists.txt b/appli/ImageMPR/CMakeLists.txt index 8b4f684..5660c19 100644 --- a/appli/ImageMPR/CMakeLists.txt +++ b/appli/ImageMPR/CMakeLists.txt @@ -58,6 +58,9 @@ IF(USE_QT4) TARGET_LINK_LIBRARIES( ${App_NAME} cpPlugins_Interface + ${QT_LIBRARIES} + vtkGUISupportQt + ) ENDIF(USE_QT4) diff --git a/appli/ImageMPR/ImageMPR.cxx b/appli/ImageMPR/ImageMPR.cxx index 025b8c8..76daaa5 100644 --- a/appli/ImageMPR/ImageMPR.cxx +++ b/appli/ImageMPR/ImageMPR.cxx @@ -116,10 +116,10 @@ _triggered_actionOpenInputImage( ) ); TParameters reader_params = reader->GetDefaultParameters( ); - reader_params[ "FileName" ].second = fname; - reader_params[ "PixelType" ].second = "short"; - reader_params[ "ImageDimension" ].second = "3"; - reader_params[ "IsColorImage" ].second = "0"; + reader_params.SetValueAsString( "FileName", fname ); + reader_params.SetValueAsString( "PixelType", "short" ); + reader_params.SetValueAsUint( "ImageDimension", 3 ); + reader_params.SetValueAsUint( "IsColorImage", 0 ); reader->SetParameters( reader_params ); std::string err = reader->Update( ); diff --git a/appli/ImageMPR/ImageMPR.h b/appli/ImageMPR/ImageMPR.h index c9bb20f..4f51444 100644 --- a/appli/ImageMPR/ImageMPR.h +++ b/appli/ImageMPR/ImageMPR.h @@ -39,7 +39,7 @@ public: typedef cpPlugins::Interface::DataObject TPluginData; typedef cpPlugins::Interface::Image TPluginImage; typedef cpPlugins::Interface::ProcessObject TPlugin; - typedef TPlugin::TParameters TParameters; + typedef cpPlugins::Interface::Parameters TParameters; typedef std::map< std::string, std::string > TStringMap; typedef cpPlugins::Extensions::Visualization::MPRWithDifferentWindows TMPR; diff --git a/appli/examples/example_MPR.cxx b/appli/examples/example_MPR.cxx index 9a8865c..6b37e2a 100644 --- a/appli/examples/example_MPR.cxx +++ b/appli/examples/example_MPR.cxx @@ -40,7 +40,7 @@ int main( int argc, char* argv[] ) // Create objects typedef cpPlugins::Interface::ProcessObject TProcessObject; - typedef TProcessObject::TParameters TParameters; + typedef cpPlugins::Interface::Parameters TParameters; cpPlugins::Interface::ProcessObject::Pointer reader; reader = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageReader" ); @@ -53,9 +53,10 @@ int main( int argc, char* argv[] ) // Configure reader TParameters reader_params = reader->GetDefaultParameters( ); - reader_params[ "FileName" ].second = input_image_file; - reader_params[ "PixelType" ].second = pixel_type; - reader_params[ "ImageDimension" ].second = "3"; + reader_params.SetValueAsString( "FileName", input_image_file ); + reader_params.SetValueAsString( "PixelType", pixel_type ); + reader_params.SetValueAsUint( "ImageDimension", 3 ); + reader_params.SetValueAsUint( "IsColorImage", 0 ); reader->SetParameters( reader_params ); // Execute reader diff --git a/appli/examples/example_RGBImageToHSVChannels.cxx b/appli/examples/example_RGBImageToHSVChannels.cxx index 9a2a468..84b9d3c 100644 --- a/appli/examples/example_RGBImageToHSVChannels.cxx +++ b/appli/examples/example_RGBImageToHSVChannels.cxx @@ -11,7 +11,7 @@ typedef cpPlugins::Interface::Interface TInterface; typedef cpPlugins::Interface::DataObject TDataObject; typedef TInterface::TClasses TClasses; typedef cpPlugins::Interface::ProcessObject TProcessObject; -typedef TProcessObject::TParameters TParameters; +typedef cpPlugins::Interface::Parameters TParameters; // ------------------------------------------------------------------------- void SaveImage( @@ -28,7 +28,7 @@ void SaveImage( } // fi // Configure reader TParameters writer_params = writer->GetDefaultParameters( ); - writer_params[ "FileName" ].second = fname; + writer_params.SetValueAsString( "FileName", fname ); writer->SetParameters( writer_params ); writer->SetInput( 0, image ); @@ -56,7 +56,7 @@ int main( int argc, char* argv[] ) std::string output_hue_image_file = argv[ 3 ]; std::string output_saturation_image_file = argv[ 4 ]; std::string output_value_image_file = argv[ 5 ]; - std::string dimensions = argv[ 6 ]; + unsigned int dimensions = std::atoi( argv[ 6 ] ); std::string pixel_type = argv[ 7 ]; // Create interface @@ -85,10 +85,10 @@ int main( int argc, char* argv[] ) // Configure reader TParameters reader_params = reader->GetDefaultParameters( ); - reader_params[ "FileName" ].second = input_image_file; - reader_params[ "PixelType" ].second = pixel_type; - reader_params[ "ImageDimension" ].second = dimensions; - reader_params[ "IsColorImage" ].second = "1"; + reader_params.SetValueAsString( "FileName", input_image_file ); + reader_params.SetValueAsString( "PixelType", pixel_type ); + reader_params.SetValueAsUint( "ImageDimension", dimensions ); + reader_params.SetValueAsUint( "IsColorImage", 1 ); reader->SetParameters( reader_params ); // Connect pipeline diff --git a/appli/examples/example_ReadImageSeriesWriteImage.cxx b/appli/examples/example_ReadImageSeriesWriteImage.cxx index e2216ff..c0bc7ad 100644 --- a/appli/examples/example_ReadImageSeriesWriteImage.cxx +++ b/appli/examples/example_ReadImageSeriesWriteImage.cxx @@ -1,7 +1,7 @@ #include #include -#include #include +#include #include #include @@ -20,14 +20,14 @@ int main( int argc, char* argv[] ) } // fi std::string plugins_file = argv[ 1 ]; std::string output_image_file = argv[ 2 ]; - std::string dimensions = argv[ 3 ]; + unsigned int dimensions = std::atoi( argv[ 3 ] ); std::string pixel_type = argv[ 4 ]; bool is_color = ( std::atoi( argv[ 5 ] ) == 1 ); - std::stringstream input_image_files; + std::vector< std::string > input_image_files; for( int i = 6; i < argc; ++i ) - input_image_files << argv[ i ] << ";"; - + input_image_files.push_back( argv[ i ] ); + // Create interface typedef cpPlugins::Interface::Interface TInterface; typedef TInterface::TClasses TClasses; @@ -37,7 +37,7 @@ int main( int argc, char* argv[] ) // Create objects typedef cpPlugins::Interface::ProcessObject TProcessObject; - typedef TProcessObject::TParameters TParameters; + typedef cpPlugins::Interface::Parameters TParameters; cpPlugins::Interface::ProcessObject::Pointer reader; cpPlugins::Interface::ProcessObject::Pointer writer; @@ -59,15 +59,19 @@ int main( int argc, char* argv[] ) // Configure reader TParameters reader_params = reader->GetDefaultParameters( ); - reader_params[ "FileNames" ].second = input_image_files.str( ); - reader_params[ "PixelType" ].second = pixel_type; - reader_params[ "ImageDimension" ].second = dimensions; - reader_params[ "IsColorImage" ].second = ( is_color )? "1": "0"; + reader_params.SetValueAsStringList( + "FileNames", + input_image_files.begin( ), + input_image_files.end( ) + ); + reader_params.SetValueAsString( "PixelType", pixel_type ); + reader_params.SetValueAsUint( "ImageDimension", dimensions ); + reader_params.SetValueAsUint( "IsColorImage", ( is_color? 1: 0 ) ); reader->SetParameters( reader_params ); // Configure reader TParameters writer_params = writer->GetDefaultParameters( ); - writer_params[ "FileName" ].second = output_image_file; + writer_params.SetValueAsString( "FileName", output_image_file ); writer->SetParameters( writer_params ); // Connect pipeline diff --git a/appli/examples/example_ReadQuadEdgeMesh.cxx b/appli/examples/example_ReadQuadEdgeMesh.cxx index 94b6d6c..49f7d6a 100644 --- a/appli/examples/example_ReadQuadEdgeMesh.cxx +++ b/appli/examples/example_ReadQuadEdgeMesh.cxx @@ -19,7 +19,7 @@ int main( int argc, char* argv[] ) } // fi std::string plugins_file = argv[ 1 ]; std::string input_mesh_file = argv[ 2 ]; - std::string dimensions = argv[ 3 ]; + unsigned int dimensions = std::atoi( argv[ 3 ] ); std::string pixel_type = argv[ 4 ]; // Create interface @@ -31,7 +31,7 @@ int main( int argc, char* argv[] ) // Create objects typedef cpPlugins::Interface::ProcessObject TProcessObject; - typedef TProcessObject::TParameters TParameters; + typedef cpPlugins::Interface::Parameters TParameters; cpPlugins::Interface::ProcessObject::Pointer reader; reader = plugins.CreateProcessObject( "cpPlugins::Plugins::MeshReader" ); @@ -44,9 +44,9 @@ int main( int argc, char* argv[] ) // Configure reader TParameters reader_params = reader->GetDefaultParameters( ); - reader_params[ "FileName" ].second = input_mesh_file; - reader_params[ "PixelType" ].second = pixel_type; - reader_params[ "MeshDimension" ].second = dimensions; + reader_params.SetValueAsString( "FileName", input_mesh_file ); + reader_params.SetValueAsString( "PixelType", pixel_type ); + reader_params.SetValueAsUint( "MeshDimension", dimensions ); reader->SetParameters( reader_params ); // Execute reader diff --git a/appli/examples/example_ReadWriteImage.cxx b/appli/examples/example_ReadWriteImage.cxx index d1419d9..728f817 100644 --- a/appli/examples/example_ReadWriteImage.cxx +++ b/appli/examples/example_ReadWriteImage.cxx @@ -20,7 +20,7 @@ int main( int argc, char* argv[] ) std::string plugins_file = argv[ 1 ]; std::string input_image_file = argv[ 2 ]; std::string output_image_file = argv[ 3 ]; - std::string dimensions = argv[ 4 ]; + unsigned int dimensions = std::atoi( argv[ 4 ] ); std::string pixel_type = argv[ 5 ]; bool is_color = ( std::atoi( argv[ 6 ] ) == 1 ); @@ -33,7 +33,7 @@ int main( int argc, char* argv[] ) // Create objects typedef cpPlugins::Interface::ProcessObject TProcessObject; - typedef TProcessObject::TParameters TParameters; + typedef cpPlugins::Interface::Parameters TParameters; cpPlugins::Interface::ProcessObject::Pointer reader; cpPlugins::Interface::ProcessObject::Pointer writer; @@ -54,15 +54,15 @@ int main( int argc, char* argv[] ) // Configure reader TParameters reader_params = reader->GetDefaultParameters( ); - reader_params[ "FileName" ].second = input_image_file; - reader_params[ "PixelType" ].second = pixel_type; - reader_params[ "ImageDimension" ].second = dimensions; - reader_params[ "IsColorImage" ].second = ( is_color )? "1": "0"; + reader_params.SetValueAsString( "FileName", input_image_file ); + reader_params.SetValueAsString( "PixelType", pixel_type ); + reader_params.SetValueAsUint( "ImageDimension", dimensions ); + reader_params.SetValueAsUint( "IsColorImage", ( is_color? 1: 0 ) ); reader->SetParameters( reader_params ); // Configure reader TParameters writer_params = writer->GetDefaultParameters( ); - writer_params[ "FileName" ].second = output_image_file; + writer_params.SetValueAsString( "FileName", output_image_file ); writer->SetParameters( writer_params ); // Connect pipeline diff --git a/appli/examples/example_RenderQuadEdgeMesh.cxx b/appli/examples/example_RenderQuadEdgeMesh.cxx index 9fcd519..6380660 100644 --- a/appli/examples/example_RenderQuadEdgeMesh.cxx +++ b/appli/examples/example_RenderQuadEdgeMesh.cxx @@ -28,7 +28,7 @@ int main( int argc, char* argv[] ) } // fi std::string plugins_file = argv[ 1 ]; std::string input_mesh_file = argv[ 2 ]; - std::string dimensions = argv[ 3 ]; + unsigned int dimensions = std::atoi( argv[ 3 ] ); std::string pixel_type = argv[ 4 ]; // Create interface @@ -40,7 +40,7 @@ int main( int argc, char* argv[] ) // Create objects typedef cpPlugins::Interface::ProcessObject TProcessObject; - typedef TProcessObject::TParameters TParameters; + typedef cpPlugins::Interface::Parameters TParameters; cpPlugins::Interface::ProcessObject::Pointer reader; reader = plugins.CreateProcessObject( "cpPlugins::Plugins::MeshReader" ); @@ -53,9 +53,9 @@ int main( int argc, char* argv[] ) // Configure reader TParameters reader_params = reader->GetDefaultParameters( ); - reader_params[ "FileName" ].second = input_mesh_file; - reader_params[ "PixelType" ].second = pixel_type; - reader_params[ "MeshDimension" ].second = dimensions; + reader_params.SetValueAsString( "FileName", input_mesh_file ); + reader_params.SetValueAsString( "PixelType", pixel_type ); + reader_params.SetValueAsUint( "MeshDimension", dimensions ); reader->SetParameters( reader_params ); // Execute reader diff --git a/lib/cpPlugins/Extensions/CMakeLists.txt b/lib/cpPlugins/Extensions/CMakeLists.txt index 550daf7..f9d6d98 100644 --- a/lib/cpPlugins/Extensions/CMakeLists.txt +++ b/lib/cpPlugins/Extensions/CMakeLists.txt @@ -71,8 +71,9 @@ GENERATE_EXPORT_HEADER( ) TARGET_LINK_LIBRARIES( ${LIBRARY_NAME} - ${ITK_LIBRARIES} - ${VTK_LIBRARIES} + ITKCommon + ITKVtkGlue + vtkInteractionWidgets ) ## eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/Parameters.hxx b/lib/cpPlugins/Interface/Parameters.hxx index f0c3a27..0a73b37 100644 --- a/lib/cpPlugins/Interface/Parameters.hxx +++ b/lib/cpPlugins/Interface/Parameters.hxx @@ -2,6 +2,7 @@ #define __CPPLUGINS__INTERFACE__PARAMETERS__HXX__ #include +#include #include // ------------------------------------------------------------------------- @@ -18,7 +19,7 @@ std::stringstream ss; \ for( I i = b; i != e; ++i ) \ ss << *i << ":"; \ - pIt->second = ss.str( ); \ + pIt->second.second = ss.str( ); \ } cpPlugins_Interface_Parameters_SetListMacro( String ); @@ -95,6 +96,7 @@ GetValueAsIndexList( std::vector< I >& lst, const TString& name ) const return; // TODO: + std::cerr << "TODO GetValueAsIndexList" << std::endl; } // ------------------------------------------------------------------------- @@ -110,6 +112,7 @@ GetValueAsPointList( std::vector< P >& lst, const TString& name ) const return; // TODO: + std::cerr << "TODO GetValueAsPointList" << std::endl; } #endif // __CPPLUGINS__INTERFACE__PARAMETERS__HXX__ diff --git a/lib/cpPlugins/Plugins/CMakeLists.txt b/lib/cpPlugins/Plugins/CMakeLists.txt index d32fafb..372b150 100644 --- a/lib/cpPlugins/Plugins/CMakeLists.txt +++ b/lib/cpPlugins/Plugins/CMakeLists.txt @@ -32,6 +32,7 @@ GENERATE_EXPORT_HEADER( TARGET_LINK_LIBRARIES( ${LIBRARY_NAME} cpPlugins_Interface + ${ITK_LIBRARIES} ) ## eof - $RCSfile$ diff --git a/lib/cpPlugins/Plugins/ImageSeriesReader.cxx b/lib/cpPlugins/Plugins/ImageSeriesReader.cxx index d6fbfa6..30585e7 100644 --- a/lib/cpPlugins/Plugins/ImageSeriesReader.cxx +++ b/lib/cpPlugins/Plugins/ImageSeriesReader.cxx @@ -25,11 +25,15 @@ ImageSeriesReader( ) this->SetNumberOfOutputs( 1 ); this->_MakeOutput< cpPlugins::Interface::Image >( 0 ); - this->m_DefaultParameters[ "FileNames" ] = - TParameter( "string", "file_name1;file_name2;file_name3;..." ); - this->m_DefaultParameters[ "PixelType" ] = TParameter( "type", "uchar" ); - this->m_DefaultParameters[ "ImageDimension" ] = TParameter( "int", "3" ); - this->m_DefaultParameters[ "IsColorImage" ] = TParameter( "bool", "0" ); + using namespace cpPlugins::Interface; + this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" ); + this->m_DefaultParameters.Configure( Parameters::String, "PixelType" ); + this->m_DefaultParameters.Configure( Parameters::Uint, "Dimension" ); + this->m_DefaultParameters.Configure( Parameters::Uint, "IsColorImage" ); + this->m_DefaultParameters.SetValueAsString( "PixelType", "uchar" ); + this->m_DefaultParameters.SetValueAsUint( "Dimension", 3 ); + this->m_DefaultParameters.SetValueAsUint( "IsColorImage", 0 ); + this->m_Parameters = this->m_DefaultParameters; } // ------------------------------------------------------------------------- @@ -42,17 +46,13 @@ cpPlugins::Plugins::ImageSeriesReader:: std::string cpPlugins::Plugins::ImageSeriesReader:: _GenerateData( ) { - TParameters::const_iterator dIt; - - // Get image dimension - dIt = this->m_Parameters.find( "ImageDimension" ); - if( dIt == this->m_Parameters.end( ) ) - dIt = this->m_DefaultParameters.find( "ImageDimension" ); + using namespace cpPlugins::Interface; + Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" ); std::string r = "cpPlugins::Plugins::ImageSeriesReader: itk::Image dimension not supported."; - if( dIt->second.second == "2" ) r = this->_GD0< 2 >( ); - else if( dIt->second.second == "3" ) r = this->_GD0< 3 >( ); - else if( dIt->second.second == "4" ) r = this->_GD0< 4 >( ); + if ( dim == 2 ) r = this->_GD0< 2 >( ); + else if( dim == 3 ) r = this->_GD0< 3 >( ); + else if( dim == 4 ) r = this->_GD0< 4 >( ); return( r ); } @@ -62,61 +62,55 @@ template< unsigned int D > std::string cpPlugins::Plugins::ImageSeriesReader:: _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" ); - cIt = this->m_Parameters.find( "IsColorImage" ); - if( cIt == this->m_Parameters.end( ) ) - cIt = this->m_DefaultParameters.find( "IsColorImage" ); + using namespace cpPlugins::Interface; + Parameters::TString pt = this->m_Parameters.GetValueAsString( "PixelType" ); + Parameters::TUint ci = this->m_Parameters.GetValueAsUint( "IsColorImage" ); std::string r = "cpPlugins::Plugins::ImageSeriesReader: itk::Image pixel type not supported"; - if( cIt->second.second == "0" ) + if( ci == 0 ) { - if( tIt->second.second == "char" ) + if( pt == "char" ) r = this->_GD1< char, D >( ); - else if( tIt->second.second == "short" ) + else if( pt == "short" ) r = this->_GD1< short, D >( ); - else if( tIt->second.second == "int" ) + else if( pt == "int" ) r = this->_GD1< int, D >( ); - else if( tIt->second.second == "long" ) + else if( pt == "long" ) r = this->_GD1< long, D >( ); - else if( tIt->second.second == "uchar" ) + else if( pt == "uchar" ) r = this->_GD1< unsigned char, D >( ); - else if( tIt->second.second == "ushort" ) + else if( pt == "ushort" ) r = this->_GD1< unsigned short, D >( ); - else if( tIt->second.second == "uint" ) + else if( pt == "uint" ) r = this->_GD1< unsigned int, D >( ); - else if( tIt->second.second == "ulong" ) + else if( pt == "ulong" ) r = this->_GD1< unsigned long, D >( ); - else if( tIt->second.second == "float" ) + else if( pt == "float" ) r = this->_GD1< float, D >( ); - else if( tIt->second.second == "double" ) + else if( pt == "double" ) r = this->_GD1< double, D >( ); } - else if( cIt->second.second == "1" ) + else if( ci == 1 ) { - if( tIt->second.second == "char" ) + if( pt == "char" ) r = this->_GD1< itk::RGBPixel< char >, D >( ); - else if( tIt->second.second == "short" ) + else if( pt == "short" ) r = this->_GD1< itk::RGBPixel< short >, D >( ); - else if( tIt->second.second == "int" ) + else if( pt == "int" ) r = this->_GD1< itk::RGBPixel< int >, D >( ); - else if( tIt->second.second == "long" ) + else if( pt == "long" ) r = this->_GD1< itk::RGBPixel< long >, D >( ); - else if( tIt->second.second == "uchar" ) + else if( pt == "uchar" ) r = this->_GD1< itk::RGBPixel< unsigned char >, D >( ); - else if( tIt->second.second == "ushort" ) + else if( pt == "ushort" ) r = this->_GD1< itk::RGBPixel< unsigned short >, D >( ); - else if( tIt->second.second == "uint" ) + else if( pt == "uint" ) r = this->_GD1< itk::RGBPixel< unsigned int >, D >( ); - else if( tIt->second.second == "ulong" ) + else if( pt == "ulong" ) r = this->_GD1< itk::RGBPixel< unsigned long >, D >( ); - else if( tIt->second.second == "float" ) + else if( pt == "float" ) r = this->_GD1< itk::RGBPixel< float >, D >( ); - else if( tIt->second.second == "double" ) + else if( pt == "double" ) r = this->_GD1< itk::RGBPixel< double >, D >( ); } // fi return( r ); @@ -127,17 +121,12 @@ template< class P, unsigned int D > std::string cpPlugins::Plugins::ImageSeriesReader:: _GD1( ) { - TParameters::const_iterator fIt; - - // Get filenames - std::set< std::string > filenames; - fIt = this->m_Parameters.find( "FileNames" ); - if( fIt == this->m_Parameters.end( ) ) - fIt = this->m_DefaultParameters.find( "FileName" ); - std::istringstream filenames_stream( fIt->second.second ); - std::string filename; - while( std::getline( filenames_stream, filename, ';' ) ) - filenames.insert( filename ); + using namespace cpPlugins::Interface; + std::vector< Parameters::TString > unordered_names; + this->m_Parameters.GetValueAsStringList( unordered_names, "FileNames" ); + std::set< std::string > ordered_names; + for( unsigned int i = 0; i < unordered_names.size( ); ++i ) + ordered_names.insert( unordered_names[ i ] ); // Reader typedef itk::Image< P, D > _TImage; @@ -152,8 +141,8 @@ _GD1( ) dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) ); } // fi - std::set< std::string >::const_iterator fnIt = filenames.begin( ); - for( ; fnIt != filenames.end( ); ++fnIt ) + std::set< std::string >::const_iterator fnIt = ordered_names.begin( ); + for( ; fnIt != ordered_names.end( ); ++fnIt ) reader->AddFileName( *fnIt ); try { diff --git a/lib/cpPlugins/Plugins/ImageWriter.cxx b/lib/cpPlugins/Plugins/ImageWriter.cxx index aea4a21..de74e90 100644 --- a/lib/cpPlugins/Plugins/ImageWriter.cxx +++ b/lib/cpPlugins/Plugins/ImageWriter.cxx @@ -37,8 +37,9 @@ ImageWriter( ) { this->SetNumberOfInputs( 1 ); - this->m_DefaultParameters[ "FileName" ] = - TParameter( "string", "no_file_name" ); + using namespace cpPlugins::Interface; + this->m_DefaultParameters.Configure( Parameters::String, "FileName" ); + this->m_Parameters = this->m_DefaultParameters; } // ------------------------------------------------------------------------- @@ -101,12 +102,10 @@ _GD1( ) typedef itk::Image< P, D > _TImage; typedef itk::ImageFileWriter< _TImage > _TWriter; - TParameters::const_iterator fIt; - - // Get image pixelType - fIt = this->m_Parameters.find( "FileName" ); - if( fIt == this->m_Parameters.end( ) ) - fIt = this->m_DefaultParameters.find( "FileName" ); + // Get filename + using namespace cpPlugins::Interface; + Parameters::TString fname = + this->m_Parameters.GetValueAsString( "FileName" ); _TWriter* writer = dynamic_cast< _TWriter* >( this->m_RealProcessObject.GetPointer( ) ); @@ -117,7 +116,7 @@ _GD1( ) dynamic_cast< _TWriter* >( this->m_RealProcessObject.GetPointer( ) ); } // fi - writer->SetFileName( fIt->second.second ); + writer->SetFileName( fname ); writer->SetInput( dynamic_cast< _TImage* >( this->_GetInput( 0 ) ) ); try {