From 83e946f1e96c001dde06a2785473d08468e28b2e Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Sat, 2 Jan 2016 21:54:25 -0500 Subject: [PATCH] Kind of bored: graph editor debugged --- appli/cpPipelineEditor/QNodesEditor.cxx | 93 ++++++---- appli/cpPipelineEditor/cpPipelineEditor.cxx | 1 + appli/examples/example_TestParameters.cxx | 14 +- lib/cpPlugins/Interface/Parameters.cxx | 118 ++++++------ lib/cpPlugins/Interface/Parameters.h | 32 ++-- lib/cpPlugins/Interface/Parameters.hxx | 75 ++------ lib/cpPlugins/Interface/WorkspaceIO.cxx | 169 +++++++----------- .../BasicFilters/BinaryErodeImageFilter.cxx | 3 +- .../BinaryThresholdImageFilter.cxx | 13 +- .../BasicFilters/DoubleFloodImageFilter.cxx | 18 +- .../BasicFilters/ExtractSliceImageFilter.cxx | 7 +- .../BasicFilters/FloodFillImageFilter.cxx | 16 +- .../Plugins/BasicFilters/MacheteFilter.cxx | 11 +- .../BasicFilters/MacheteImageFilter.cxx | 16 +- .../BasicFilters/MedianImageFilter.cxx | 3 +- .../BasicFilters/OtsuThresholdImageFilter.cxx | 10 +- .../Plugins/BasicFilters/SphereMeshSource.cxx | 13 +- lib/cpPlugins/Plugins/IO/DicomSeriesReader.h | 4 +- lib/cpPlugins/Plugins/IO/ImageReader.cxx | 3 +- lib/cpPlugins/Plugins/IO/ImageReader.h | 4 +- lib/cpPlugins/Plugins/IO/ImageWriter.cxx | 3 +- lib/cpPlugins/Plugins/IO/ImageWriter.h | 4 +- lib/cpPlugins/Plugins/IO/MeshReader.cxx | 6 +- lib/cpPlugins/Plugins/IO/MeshReader.h | 4 +- lib/cpPlugins/Plugins/IO/MeshWriter.cxx | 3 +- lib/cpPlugins/Plugins/IO/MeshWriter.h | 4 +- 26 files changed, 287 insertions(+), 360 deletions(-) diff --git a/appli/cpPipelineEditor/QNodesEditor.cxx b/appli/cpPipelineEditor/QNodesEditor.cxx index 039b45e..a499e94 100644 --- a/appli/cpPipelineEditor/QNodesEditor.cxx +++ b/appli/cpPipelineEditor/QNodesEditor.cxx @@ -81,49 +81,70 @@ setWorkspace( TWorkspace* ws ) this->m_Workspace = ws; this->m_Graph = TGraph::New( ); - /* TODO - QGraphicsScene* scene = this->scene( ); - // Add vertices and keep track of ports - std::map< std::string, std::map< std::string, QNEPort* > > - in_ports, out_ports; - auto vIt = this->m_Workspace->GetGraph( )->BeginVertices( ); - auto vIt_end = this->m_Workspace->GetGraph( )->EndVertices( ); - for( ; vIt != vIt_end; ++vIt ) - { - this->_createBlock( dynamic_cast< TFilter* >( vIt->second.GetPointer( ) ) ); + // Create blocks + auto vIt = this->m_Workspace->GetGraph( )->BeginVertices( ); + auto vIt_end = this->m_Workspace->GetGraph( )->EndVertices( ); + for( ; vIt != vIt_end; ++vIt ) + { + this->_CreateBlock( + dynamic_cast< TFilter* >( vIt->second.GetPointer( ) ), + QPointF( ) + ); - } // rof - */ + } // rof // Add edges - /* TODO - auto rIt = this->m_Workspace->GetGraph( )->BeginEdgesRows( ); - auto rIt_end = this->m_Workspace->GetGraph( )->EndEdgesRows( ); - for( ; rIt != rIt_end; ++rIt ) - { - auto cIt = rIt->second.begin( ); - for( ; cIt != rIt->second.end( ); ++cIt ) - { - auto eIt = cIt->second.begin( ); - for( ; eIt != cIt->second.end( ); ++eIt ) - { - QNEPort* p1 = out_ports[ rIt->first ][ eIt->first ]; - QNEPort* p2 = in_ports[ cIt->first ][ eIt->second ]; - if( p1 != NULL && p2 != NULL ) - { - QNEConnection* conn = new QNEConnection( 0, scene ); - conn->setPort1( p1 ); - conn->setPort2( p2 ); - this->m_Graph->AddConnection( rIt->first, cIt->first, conn ); + auto rIt = this->m_Workspace->GetGraph( )->BeginEdgesRows( ); + auto rIt_end = this->m_Workspace->GetGraph( )->EndEdgesRows( ); + for( ; rIt != rIt_end; ++rIt ) + { + if( !this->m_Graph->HasVertexIndex( rIt->first ) ) + continue; + QNEBlock* orig = this->m_Graph->GetVertex( rIt->first ); + if( orig == NULL ) + continue; + QVector< QNEOutputPort* >& oPorts = orig->outputPorts( ); + + auto cIt = rIt->second.begin( ); + for( ; cIt != rIt->second.end( ); ++cIt ) + { + if( !this->m_Graph->HasVertexIndex( cIt->first ) ) + continue; + QNEBlock* dest = this->m_Graph->GetVertex( cIt->first ); + if( dest == NULL ) + continue; + QVector< QNEInputPort* >& iPorts = dest->inputPorts( ); + + auto eIt = cIt->second.begin( ); + for( ; eIt != cIt->second.end( ); ++eIt ) + { + QNEOutputPort* op = NULL; + auto opIt = oPorts.begin( ); + for( ; opIt != oPorts.end( ) && op == NULL; ++opIt ) + if( ( *opIt )->name( ).toStdString( ) == eIt->first ) + op = *opIt; - } // fi + QNEInputPort* ip = NULL; + auto ipIt = iPorts.begin( ); + for( ; ipIt != iPorts.end( ) && ip == NULL; ++ipIt ) + if( ( *ipIt )->name( ).toStdString( ) == eIt->second ) + ip = *ipIt; - } // rof + if( op == NULL || ip == NULL ) + continue; - } // rof + QNEConnection* conn = new QNEConnection( 0, this->m_Scene ); + conn->setPort1( op ); + conn->setPort2( ip ); + conn->updatePosFromPorts( ); + conn->updatePath( ); + this->m_Graph->AddConnection( rIt->first, cIt->first, conn ); - } // rof - */ + } // rof + + } // rof + + } // rof } // ------------------------------------------------------------------------- diff --git a/appli/cpPipelineEditor/cpPipelineEditor.cxx b/appli/cpPipelineEditor/cpPipelineEditor.cxx index 872b4f4..957158a 100644 --- a/appli/cpPipelineEditor/cpPipelineEditor.cxx +++ b/appli/cpPipelineEditor/cpPipelineEditor.cxx @@ -193,6 +193,7 @@ _ActionOpenWorkspace( ) if( err == "" ) { this->m_UI->Canvas->editor( )->setWorkspace( this->m_Workspace ); + this->_UpdateLoadedPlugins( ); } else { diff --git a/appli/examples/example_TestParameters.cxx b/appli/examples/example_TestParameters.cxx index c728bb2..807b4d9 100644 --- a/appli/examples/example_TestParameters.cxx +++ b/appli/examples/example_TestParameters.cxx @@ -29,13 +29,13 @@ int main( int argc, char* argv[] ) TIndex idx; idx[ 0 ] = 1; idx[ 1 ] = 2; idx[ 2 ] = 3; TPoint pnt; pnt[ 0 ] = 3.1; pnt[ 1 ] = 2.2; pnt[ 2 ] = 1.3; - parameters->ConfigureAsString( "StringParam", "String_Value" ); - parameters->ConfigureAsBool( "BoolParam", false ); - parameters->ConfigureAsInt( "IntParam", -314 ); - parameters->ConfigureAsUint( "UintParam", 314 ); - parameters->ConfigureAsReal( "RealParam", 3.14 ); - parameters->ConfigureAsIndex( "IndexParam", 3, idx ); - parameters->ConfigureAsPoint( "PointParam", 3, pnt ); + parameters->ConfigureAsString( "StringParam" ); + parameters->ConfigureAsBool( "BoolParam" ); + parameters->ConfigureAsInt( "IntParam" ); + parameters->ConfigureAsUint( "UintParam" ); + parameters->ConfigureAsReal( "RealParam" ); + parameters->ConfigureAsIndex( "IndexParam" ); + parameters->ConfigureAsPoint( "PointParam" ); parameters->ConfigureAsStringList( "StringListParam" ); parameters->ConfigureAsBoolList( "BoolListParam" ); parameters->ConfigureAsIntList( "IntListParam" ); diff --git a/lib/cpPlugins/Interface/Parameters.cxx b/lib/cpPlugins/Interface/Parameters.cxx index e584b5e..52b2e47 100644 --- a/lib/cpPlugins/Interface/Parameters.cxx +++ b/lib/cpPlugins/Interface/Parameters.cxx @@ -44,50 +44,31 @@ Clear( ) } // ------------------------------------------------------------------------- -void cpPlugins::Interface::Parameters:: -ConfigureAsString( const TString& name, const TString& v ) -{ - this->m_Parameters[ name ] = - TParameter( Self::String, TValues( v, v ) ); - this->Modified( ); -} - -// ------------------------------------------------------------------------- -#define cpPlugins_Parameters_Configure( Y ) \ - void cpPlugins::Interface::Parameters:: \ - ConfigureAs##Y( const TString& name, const T##Y& v ) \ - { \ - std::stringstream str; \ - str << v; \ - std::string s = str.str( ); \ - this->m_Parameters[ name ] = \ - TParameter( Self::Y, TValues( s, s ) ); \ - this->Modified( ); \ +#define cpPlugins_Parameters_Configure( Y ) \ + void cpPlugins::Interface::Parameters:: \ + ConfigureAs##Y( const TString& name ) \ + { \ + this->m_Parameters[ name ] = TParameter( Self::Y, "" ); \ + this->Modified( ); \ } +cpPlugins_Parameters_Configure( String ); cpPlugins_Parameters_Configure( Bool ); cpPlugins_Parameters_Configure( Int ); cpPlugins_Parameters_Configure( Uint ); cpPlugins_Parameters_Configure( Real ); - -// ------------------------------------------------------------------------- -#define cpPlugins_Parameters_List_Configure( Y ) \ - void cpPlugins::Interface::Parameters:: \ - ConfigureAs##Y##List( const TString& name ) \ - { \ - this->m_Parameters[ name ] = \ - TParameter( Self::Y##List, TValues( "", "" ) ); \ - this->Modified( ); \ - } - -cpPlugins_Parameters_List_Configure( String ); -cpPlugins_Parameters_List_Configure( Bool ); -cpPlugins_Parameters_List_Configure( Int ); -cpPlugins_Parameters_List_Configure( Uint ); -cpPlugins_Parameters_List_Configure( Real ); -cpPlugins_Parameters_List_Configure( Index ); -cpPlugins_Parameters_List_Configure( Point ); -cpPlugins_Parameters_List_Configure( Vector ); +cpPlugins_Parameters_Configure( Index ); +cpPlugins_Parameters_Configure( Point ); +cpPlugins_Parameters_Configure( Vector ); +cpPlugins_Parameters_Configure( StringList ); +cpPlugins_Parameters_Configure( BoolList ); +cpPlugins_Parameters_Configure( IntList ); +cpPlugins_Parameters_Configure( UintList ); +cpPlugins_Parameters_Configure( RealList ); +cpPlugins_Parameters_Configure( IndexList ); +cpPlugins_Parameters_Configure( PointList ); +cpPlugins_Parameters_Configure( VectorList ); +cpPlugins_Parameters_Configure( Choices ); // ------------------------------------------------------------------------- void cpPlugins::Interface::Parameters:: @@ -103,8 +84,9 @@ ConfigureAsChoices( str_choices << choices[ 0 ]; for( unsigned int i = 1; i < choices.size( ); ++i ) str_choices << "#" << choices[ i ]; + str_choices << "@"; this->m_Parameters[ name ] = - TParameter( Self::Choices, TValues( str_choices.str( ), "" ) ); + TParameter( Self::Choices, str_choices.str( ) ); this->Modified( ); } @@ -169,7 +151,7 @@ GetString( const TString& name, bool force ) const if( i != this->m_Parameters.end( ) ) { if( i->second.first == Self::String || !force ) - return( i->second.second.second ); + return( i->second.second ); } // fi return( "" ); @@ -184,7 +166,7 @@ GetBool( const TString& name ) const if( i != this->m_Parameters.end( ) ) { if( i->second.first == Self::Bool ) - return( std::atoi( i->second.second.second.c_str( ) ) == 1 ); + return( std::atoi( i->second.second.c_str( ) ) == 1 ); } // fi return( false ); @@ -199,7 +181,7 @@ GetInt( const TString& name ) const if( i != this->m_Parameters.end( ) ) { if( i->second.first == Self::Int ) - return( TInt( std::atoi( i->second.second.second.c_str( ) ) ) ); + return( TInt( std::atoi( i->second.second.c_str( ) ) ) ); } // fi return( TInt( 0 ) ); @@ -214,7 +196,7 @@ GetUint( const TString& name ) const if( i != this->m_Parameters.end( ) ) { if( i->second.first == Self::Uint ) - return( TUint( std::atoi( i->second.second.second.c_str( ) ) ) ); + return( TUint( std::atoi( i->second.second.c_str( ) ) ) ); } // fi return( TUint( 0 ) ); @@ -230,7 +212,7 @@ GetReal( const TString& name ) const { if( i->second.first == Self::Real ) { - std::istringstream tok_str( i->second.second.second ); + std::istringstream tok_str( i->second.second ); float v; tok_str >> v; return( TReal( v ) ); @@ -252,7 +234,7 @@ GetStringList( std::vector< TString >& lst, const TString& name ) const if( i->second.first != Self::StringList ) return; - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; while( std::getline( str, token, '#' ) ) lst.push_back( token ); @@ -269,7 +251,7 @@ GetBoolList( std::vector< TBool >& lst, const TString& name ) const if( i->second.first != Self::BoolList ) return; - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; while( std::getline( str, token, '#' ) ) lst.push_back( std::atoi( token.c_str( ) ) == 1 ); @@ -286,7 +268,7 @@ GetIntList( std::vector< TInt >& lst, const TString& name ) const if( i->second.first != Self::IntList ) return; - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; while( std::getline( str, token, '#' ) ) lst.push_back( TInt( std::atoi( token.c_str( ) ) ) ); @@ -303,7 +285,7 @@ GetUintList( std::vector< TUint >& lst, const TString& name ) const if( i->second.first != Self::UintList ) return; - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; while( std::getline( str, token, '#' ) ) lst.push_back( TUint( std::atoi( token.c_str( ) ) ) ); @@ -320,7 +302,7 @@ GetRealList( std::vector< TReal >& lst, const TString& name ) const if( i->second.first != Self::RealList ) return; - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; while( std::getline( str, token, '#' ) ) { @@ -343,7 +325,10 @@ GetChoices( std::vector< TString >& choices, const TString& name ) const if( i->second.first != Self::Choices ) return; - std::istringstream str( i->second.second.first ); + std::istringstream str_choices( i->second.second ); + std::string real_choices; + std::getline( str_choices, real_choices, '@' ); + std::istringstream str( real_choices ); std::string token; while( std::getline( str, token, '#' ) ) choices.push_back( token ); @@ -359,7 +344,12 @@ GetSelectedChoice( const TString& name ) const return( "" ); if( i->second.first != Self::Choices ) return( "" ); - return( i->second.second.second ); + + std::istringstream str_choices( i->second.second ); + std::string real_choice; + std::getline( str_choices, real_choice, '@' ); + std::getline( str_choices, real_choice, '@' ); + return( real_choice ); } // ------------------------------------------------------------------------- @@ -371,7 +361,7 @@ SetString( const TString& name, const TString& v, bool force ) return; if( i->second.first != Self::String && force ) return; - i->second.second.second = v; + i->second.second = v; this->Modified( ); } @@ -387,7 +377,7 @@ SetString( const TString& name, const TString& v, bool force ) return; \ std::stringstream str; \ str << v; \ - i->second.second.second = str.str( ); \ + i->second.second = str.str( ); \ this->Modified( ); \ } @@ -407,11 +397,11 @@ cpPlugins_Parameters_Set( Real ); if( i->second.first != Self::Y##List ) \ return; \ std::stringstream str; \ - if( i->second.second.second == "" ) \ + if( i->second.second == "" ) \ str << v; \ else \ str << "#" << v; \ - i->second.second.second += str.str( ); \ + i->second.second += str.str( ); \ this->Modified( ); \ } @@ -431,7 +421,7 @@ cpPlugins_Parameters_Add( Real ); return; \ if( i->second.first != Self::Y##List ) \ return; \ - i->second.second.second = ""; \ + i->second.second = ""; \ this->Modified( ); \ } @@ -453,10 +443,17 @@ SetSelectedChoice( const TString& name, const TString& choice ) return( false ); if( i->second.first != Self::Choices ) return( false ); - if( i->second.second.first.find( choice ) != std::string::npos ) + + std::vector< TString > c; + this->GetChoices( c, name ); + if( std::find( c.begin( ), c.end( ), choice ) != c.end( ) ) { - i->second.second.second = choice; - this->Modified( ); + std::istringstream str_choices( i->second.second ); + std::string choices; + std::getline( str_choices, choices, '@' ); + std::stringstream new_choices; + new_choices << choices << "@" << choice; + i->second.second = new_choices.str( ); return( true ); } else @@ -487,8 +484,7 @@ PrintSelf( std::ostream& os, itk::Indent indent ) const os << indent << i->first << ": (" << i->second.first << " | " - << i->second.second.first << " | " - << i->second.second.second << ")" + << i->second.second << ")" << std::endl; } diff --git a/lib/cpPlugins/Interface/Parameters.h b/lib/cpPlugins/Interface/Parameters.h index 9c97639..dfcfc79 100644 --- a/lib/cpPlugins/Interface/Parameters.h +++ b/lib/cpPlugins/Interface/Parameters.h @@ -45,9 +45,7 @@ namespace cpPlugins typedef double TReal; typedef std::string TString; - // NOTE: std::pair< default, value > - typedef std::pair< TString, TString > TValues; - typedef std::pair< Self::Type, TValues > TParameter; + typedef std::pair< Self::Type, TString > TParameter; typedef std::map< TString, TParameter > TParameters; public: @@ -64,25 +62,14 @@ namespace cpPlugins // Parameters container configuration void Clear( ); - void ConfigureAsString( const TString& name, const TString& v ); - void ConfigureAsBool( const TString& name, const TBool& v ); - void ConfigureAsInt( const TString& name, const TInt& v ); - void ConfigureAsUint( const TString& name, const TUint& v ); - void ConfigureAsReal( const TString& name, const TReal& v ); - - template< class I > - inline void ConfigureAsIndex( - const TString& name, const TUint& dim, const I& v - ); - template< class P > - inline void ConfigureAsPoint( - const TString& name, const TUint& dim, const P& v - ); - template< class V > - inline void ConfigureAsVector( - const TString& name, const TUint& dim, const V& v - ); - + void ConfigureAsString( const TString& name ); + void ConfigureAsBool( const TString& name ); + void ConfigureAsInt( const TString& name ); + void ConfigureAsUint( const TString& name ); + void ConfigureAsReal( const TString& name ); + void ConfigureAsIndex( const TString& name ); + void ConfigureAsPoint( const TString& name ); + void ConfigureAsVector( const TString& name ); void ConfigureAsStringList( const TString& name ); void ConfigureAsBoolList( const TString& name ); void ConfigureAsIntList( const TString& name ); @@ -91,6 +78,7 @@ namespace cpPlugins void ConfigureAsIndexList( const TString& name ); void ConfigureAsPointList( const TString& name ); void ConfigureAsVectorList( const TString& name ); + void ConfigureAsChoices( const TString& name ); void ConfigureAsChoices( const TString& name, const std::vector< TString >& choices ); diff --git a/lib/cpPlugins/Interface/Parameters.hxx b/lib/cpPlugins/Interface/Parameters.hxx index b633f87..d0fb9c2 100644 --- a/lib/cpPlugins/Interface/Parameters.hxx +++ b/lib/cpPlugins/Interface/Parameters.hxx @@ -1,51 +1,6 @@ #ifndef __CPPLUGINS__INTERFACE__PARAMETERS__HXX__ #define __CPPLUGINS__INTERFACE__PARAMETERS__HXX__ -// ------------------------------------------------------------------------- -template< class I > -void cpPlugins::Interface::Parameters:: -ConfigureAsIndex( const TString& name, const TUint& dim, const I& v ) -{ - std::stringstream str; - str << v[ 0 ]; - for( unsigned int d = 1; d < dim; ++d ) - str << ";" << v[ d ]; - std::string s = str.str( ); - this->m_Parameters[ name ] = - TParameter( Self::Index, TValues( s, s ) ); - this->Modified( ); -} - -// ------------------------------------------------------------------------- -template< class P > -void cpPlugins::Interface::Parameters:: -ConfigureAsPoint( const TString& name, const TUint& dim, const P& v ) -{ - std::stringstream str; - str << v[ 0 ]; - for( unsigned int d = 1; d < dim; ++d ) - str << ";" << v[ d ]; - std::string s = str.str( ); - this->m_Parameters[ name ] = - TParameter( Self::Point, TValues( s, s ) ); - this->Modified( ); -} - -// ------------------------------------------------------------------------- -template< class V > -void cpPlugins::Interface::Parameters:: -ConfigureAsVector( const TString& name, const TUint& dim, const V& v ) -{ - std::stringstream str; - str << v[ 0 ]; - for( unsigned int d = 1; d < dim; ++d ) - str << ";" << v[ d ]; - std::string s = str.str( ); - this->m_Parameters[ name ] = - TParameter( Self::Vector, TValues( s, s ) ); - this->Modified( ); -} - // ------------------------------------------------------------------------- template< class I > I cpPlugins::Interface::Parameters:: @@ -57,7 +12,7 @@ GetIndex( const TString& name, const TUint& dim ) const { if( i->second.first == Self::Index ) { - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; unsigned int d = 0; while( std::getline( str, token, ';' ) && d < dim ) @@ -89,7 +44,7 @@ GetPoint( const TString& name, const TUint& dim ) const { if( i->second.first == Self::Point ) { - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; unsigned int d = 0; while( std::getline( str, token, ';' ) && d < dim ) @@ -122,7 +77,7 @@ GetVector( const TString& name, const TUint& dim ) const { if( i->second.first == Self::Vector ) { - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; unsigned int d = 0; while( std::getline( str, token, ';' ) && d < dim ) @@ -159,7 +114,7 @@ GetIndexList( if( i->second.first == Self::IndexList ) return; - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; unsigned int d = 0; while( std::getline( str, token, '#' ) ) @@ -194,7 +149,7 @@ GetPointList( if( i->second.first == Self::PointList ) return; - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; unsigned int d = 0; while( std::getline( str, token, '#' ) ) @@ -230,7 +185,7 @@ GetVectorList( if( i->second.first == Self::VectorList ) return; - std::istringstream str( i->second.second.second ); + std::istringstream str( i->second.second ); std::string token; unsigned int d = 0; while( std::getline( str, token, '#' ) ) @@ -266,7 +221,7 @@ SetIndex( const TString& name, const TUint& dim, const I& v ) str << v[ 0 ]; for( unsigned int d = 1; d < dim; ++d ) str << ";" << v[ d ]; - i->second.second.second = str.str( ); + i->second.second = str.str( ); this->Modified( ); } @@ -285,7 +240,7 @@ SetPoint( const TString& name, const TUint& dim, const P& v ) str << v[ 0 ]; for( unsigned int d = 1; d < dim; ++d ) str << ";" << v[ d ]; - i->second.second.second = str.str( ); + i->second.second = str.str( ); this->Modified( ); } @@ -304,7 +259,7 @@ SetVector( const TString& name, const TUint& dim, const V& v ) str << v[ 0 ]; for( unsigned int d = 1; d < dim; ++d ) str << ";" << v[ d ]; - i->second.second.second = str.str( ); + i->second.second = str.str( ); this->Modified( ); } @@ -320,13 +275,13 @@ AddToIndexList( const TString& name, const TUint& dim, const I& v ) return; std::stringstream str; - if( i->second.second.second == "" ) + if( i->second.second == "" ) str << v[ 0 ]; else str << "#" << v[ 0 ]; for( unsigned int d = 1; d < dim; ++d ) str << ";" << v[ d ]; - i->second.second.second += str.str( ); + i->second.second += str.str( ); this->Modified( ); } @@ -342,13 +297,13 @@ AddToPointList( const TString& name, const TUint& dim, const P& v ) return; std::stringstream str; - if( i->second.second.second == "" ) + if( i->second.second == "" ) str << v[ 0 ]; else str << "#" << v[ 0 ]; for( unsigned int d = 1; d < dim; ++d ) str << ";" << v[ d ]; - i->second.second.second += str.str( ); + i->second.second += str.str( ); this->Modified( ); } @@ -364,13 +319,13 @@ AddToVectorList( const TString& name, const TUint& dim, const V& v ) return; std::stringstream str; - if( i->second.second.second == "" ) + if( i->second.second == "" ) str << v[ 0 ]; else str << "#" << v[ 0 ]; for( unsigned int d = 1; d < dim; ++d ) str << ";" << v[ d ]; - i->second.second.second += str.str( ); + i->second.second += str.str( ); this->Modified( ); } diff --git a/lib/cpPlugins/Interface/WorkspaceIO.cxx b/lib/cpPlugins/Interface/WorkspaceIO.cxx index b623ad9..d1578ba 100644 --- a/lib/cpPlugins/Interface/WorkspaceIO.cxx +++ b/lib/cpPlugins/Interface/WorkspaceIO.cxx @@ -59,6 +59,8 @@ LoadWorkspace( const std::string& fname ) { // Read parameters TParameters* parameters = this->GetParameters( name_value ); + parameters->Clear( ); + TiXmlElement* param = filter->FirstChildElement( "parameter" ); while( param != NULL ) { @@ -70,121 +72,42 @@ LoadWorkspace( const std::string& fname ) const char* value = param->Attribute( "value" ); if( value != NULL ) { - std::istringstream value_str( value ); if( param_type_str == "String" ) - parameters->SetString( param_name, value ); + parameters->ConfigureAsString( param_name ); else if( param_type_str == "Bool" ) - parameters->SetBool( param_name, value[ 0 ] != '0' ); + parameters->ConfigureAsBool( param_name ); else if( param_type_str == "Int" ) - { - TParameters::TInt v; - value_str >> v; - parameters->SetInt( param_name, v ); - } + parameters->ConfigureAsInt( param_name ); else if( param_type_str == "Uint" ) - { - TParameters::TUint v; - value_str >> v; - parameters->SetUint( param_name, v ); - } + parameters->ConfigureAsUint( param_name ); else if( param_type_str == "Real" ) - { - TParameters::TReal v; - value_str >> v; - parameters->SetReal( param_name, v ); - } - /* TODO - else if( param_type_str == "Index" ) - else if( param_type_str == "Point" ) - else if( param_type_str == "Vector" ) - */ - } - else - { - if( param_type_str == "StringList" ) - { - TiXmlElement* item = param->FirstChildElement( "item" ); - while( item != NULL ) - { - value = item->Attribute( "value" ); - if( value != NULL ) - parameters->AddToStringList( param_name, value ); - item = item->NextSiblingElement( "item" ); - - } // elihw - } + parameters->ConfigureAsReal( param_name ); + else if( param_type_str == "Index" ) + parameters->ConfigureAsIndex( param_name ); + else if( param_type_str == "Point" ) + parameters->ConfigureAsPoint( param_name ); + else if( param_type_str == "Vector" ) + parameters->ConfigureAsVector( param_name ); + else if( param_type_str == "StringList" ) + parameters->ConfigureAsStringList( param_name ); else if( param_type_str == "BoolList" ) - { - TiXmlElement* item = param->FirstChildElement( "item" ); - while( item != NULL ) - { - value = item->Attribute( "value" ); - if( value != NULL ) - parameters->AddToBoolList( param_name, value[ 0 ] != '0' ); - item = item->NextSiblingElement( "item" ); - - } // elihw - } + parameters->ConfigureAsBoolList( param_name ); else if( param_type_str == "IntList" ) - { - TiXmlElement* item = param->FirstChildElement( "item" ); - while( item != NULL ) - { - value = item->Attribute( "value" ); - if( value != NULL ) - { - std::istringstream value_str( value ); - TParameters::TInt v; - value_str >> v; - parameters->AddToIntList( param_name, v ); - - } // fi - item = item->NextSiblingElement( "item" ); - - } // elihw - } + parameters->ConfigureAsIntList( param_name ); else if( param_type_str == "UintList" ) - { - TiXmlElement* item = param->FirstChildElement( "item" ); - while( item != NULL ) - { - value = item->Attribute( "value" ); - if( value != NULL ) - { - std::istringstream value_str( value ); - TParameters::TUint v; - value_str >> v; - parameters->AddToUintList( param_name, v ); - - } // fi - item = item->NextSiblingElement( "item" ); - - } // elihw - } + parameters->ConfigureAsUintList( param_name ); else if( param_type_str == "RealList" ) - { - TiXmlElement* item = param->FirstChildElement( "item" ); - while( item != NULL ) - { - value = item->Attribute( "value" ); - if( value != NULL ) - { - std::istringstream value_str( value ); - TParameters::TReal v; - value_str >> v; - parameters->AddToRealList( param_name, v ); + parameters->ConfigureAsRealList( param_name ); + else if( param_type_str == "IndexList" ) + parameters->ConfigureAsIndexList( param_name ); + else if( param_type_str == "PointList" ) + parameters->ConfigureAsPointList( param_name ); + else if( param_type_str == "VectorList" ) + parameters->ConfigureAsVectorList( param_name ); + else if( param_type_str == "Choices" ) + parameters->ConfigureAsChoices( param_name ); + parameters->SetString( param_name, value, false ); - } // fi - item = item->NextSiblingElement( "item" ); - - } // elihw - } - /* TODO - else if( param_type_str == "IndexList" ) - else if( param_type_str == "PointList" ) - else if( param_type_str == "VectorList" ) - else if( param_type_str == "Choices" ); - */ } // fi } // fi @@ -203,7 +126,7 @@ LoadWorkspace( const std::string& fname ) } // elihw - // Read filters + // Read connections TiXmlElement* connection = root->FirstChildElement( "connection" ); while( connection != NULL ) { @@ -271,7 +194,6 @@ SaveWorkspace( const std::string& fname ) const { TiXmlElement* p = new TiXmlElement( "parameter" ); p->SetAttribute( "name", nIt->c_str( ) ); - //const char* param_type = param->Attribute( "type" ); if( params->HasString( *nIt ) ) p->SetAttribute( "type", "String" ); else if( params->HasBool( *nIt ) ) @@ -306,7 +228,9 @@ SaveWorkspace( const std::string& fname ) const p->SetAttribute( "type", "VectorList" ); else if( params->HasChoices( *nIt ) ) p->SetAttribute( "type", "Choices" ); - p->SetAttribute( "value", params->GetString( *nIt, false ).c_str( ) ); + p->SetAttribute( + "value", params->GetString( *nIt, false ).c_str( ) + ); e->LinkEndChild( p ); } // rof @@ -314,10 +238,39 @@ SaveWorkspace( const std::string& fname ) const } else if( data != NULL ) { + // TODO } // fi } // rof + // Save connections + auto mIt = this->m_Graph->BeginEdgesRows( ); + for( ; mIt != this->m_Graph->EndEdgesRows( ); ++mIt ) + { + auto rIt = mIt->second.begin( ); + for( ; rIt != mIt->second.end( ); ++rIt ) + { + auto eIt = rIt->second.begin( ); + for( ; eIt != rIt->second.end( ); ++eIt ) + { + TiXmlElement* conn = new TiXmlElement( "connection" ); + TiXmlElement* orig = new TiXmlElement( "origin" ); + TiXmlElement* dest = new TiXmlElement( "destination" ); + orig->SetAttribute( "filter", mIt->first.c_str( ) ); + orig->SetAttribute( "name", eIt->first.c_str( ) ); + dest->SetAttribute( "filter", rIt->first.c_str( ) ); + dest->SetAttribute( "name", eIt->second.c_str( ) ); + + conn->LinkEndChild( orig ); + conn->LinkEndChild( dest ); + root->LinkEndChild( conn ); + + } // rof + + } // rof + + } // rof + // Physical write and return doc->LinkEndChild( root ); doc->SaveFile( fname.c_str( ) ); diff --git a/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx index 7460520..55b2eed 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx @@ -13,7 +13,8 @@ BinaryErodeImageFilter( ) this->_AddInput( "Input" ); this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); - this->m_Parameters->ConfigureAsUint( "Radius", 2 ); + this->m_Parameters->ConfigureAsUint( "Radius" ); + this->m_Parameters->SetUint( "Radius", 2 ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx index 5dc60cb..09ba2c3 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx @@ -11,10 +11,15 @@ BinaryThresholdImageFilter( ) this->_AddInput( "Input" ); this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); - this->m_Parameters->ConfigureAsReal( "LowerThresholdValue", 0 ); - this->m_Parameters->ConfigureAsReal( "UpperThresholdValue", 10000 ); - this->m_Parameters->ConfigureAsUint( "InsideValue", 1 ); - this->m_Parameters->ConfigureAsUint( "OutsideValue", 0 ); + this->m_Parameters->ConfigureAsReal( "LowerThresholdValue" ); + this->m_Parameters->ConfigureAsReal( "UpperThresholdValue" ); + this->m_Parameters->ConfigureAsUint( "InsideValue" ); + this->m_Parameters->ConfigureAsUint( "OutsideValue" ); + + this->m_Parameters->SetReal( "LowerThresholdValue", 0 ); + this->m_Parameters->SetReal( "UpperThresholdValue", 10000 ); + this->m_Parameters->SetUint( "InsideValue", 1 ); + this->m_Parameters->SetUint( "OutsideValue", 0 ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.cxx index 2dbbf27..c6aef7e 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.cxx @@ -169,13 +169,17 @@ DoubleFloodImageFilter( ) this->_AddInput( "Input" ); this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); - double seed[ 3 ] = { double( 0 ) }; - this->m_Parameters->ConfigureAsPoint( "Seed0", 3, seed ); - this->m_Parameters->ConfigureAsPoint( "Seed1", 3, seed ); - this->m_Parameters->ConfigureAsReal( "Window", 0 ); - this->m_Parameters->ConfigureAsReal( "Level", 0 ); - this->m_Parameters->ConfigureAsUint( "InsideValue", 255 ); - this->m_Parameters->ConfigureAsUint( "OutsideValue", 0 ); + this->m_Parameters->ConfigureAsPoint( "Seed0" ); + this->m_Parameters->ConfigureAsPoint( "Seed1" ); + this->m_Parameters->ConfigureAsReal( "Window" ); + this->m_Parameters->ConfigureAsReal( "Level" ); + this->m_Parameters->ConfigureAsUint( "InsideValue" ); + this->m_Parameters->ConfigureAsUint( "OutsideValue" ); + + this->m_Parameters->SetReal( "Window", 0 ); + this->m_Parameters->SetReal( "Level", 0 ); + this->m_Parameters->SetUint( "InsideValue", 255 ); + this->m_Parameters->SetUint( "OutsideValue", 0 ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx index 65a7080..5a65ca6 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx @@ -11,8 +11,11 @@ ExtractSliceImageFilter( ) this->_AddInput( "Input" ); this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); - this->m_Parameters->ConfigureAsUint( "Axis", 0 ); - this->m_Parameters->ConfigureAsInt( "Slice", 0 ); + this->m_Parameters->ConfigureAsUint( "Axis" ); + this->m_Parameters->ConfigureAsInt( "Slice" ); + + this->m_Parameters->SetUint( "Axis", 0 ); + this->m_Parameters->SetInt( "Slice", 0 ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/BasicFilters/FloodFillImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/FloodFillImageFilter.cxx index 71f90cc..376602b 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/FloodFillImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/FloodFillImageFilter.cxx @@ -12,12 +12,16 @@ FloodFillImageFilter( ) this->_AddInput( "Input" ); this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); - double seed[ 3 ] = { double( 0 ) }; - this->m_Parameters->ConfigureAsPoint( "Seed", 3, seed ); - this->m_Parameters->ConfigureAsReal( "Window", 0 ); - this->m_Parameters->ConfigureAsReal( "Level", 0 ); - this->m_Parameters->ConfigureAsUint( "InsideValue", 0 ); - this->m_Parameters->ConfigureAsUint( "OutsideValue", 255 ); + this->m_Parameters->ConfigureAsPoint( "Seed" ); + this->m_Parameters->ConfigureAsReal( "Window" ); + this->m_Parameters->ConfigureAsReal( "Level" ); + this->m_Parameters->ConfigureAsUint( "InsideValue" ); + this->m_Parameters->ConfigureAsUint( "OutsideValue" ); + + this->m_Parameters->SetReal( "Window", 0 ); + this->m_Parameters->SetReal( "Level", 0 ); + this->m_Parameters->SetUint( "InsideValue", 0 ); + this->m_Parameters->SetUint( "OutsideValue", 255 ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx index f07b60e..8116e21 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx @@ -195,15 +195,8 @@ MacheteFilter( ) this->_MakeOutput< cpPlugins::Interface::DataObject >( "PositiveOutput" ); this->_MakeOutput< cpPlugins::Interface::DataObject >( "NegativeOutput" ); - itk::Point< double, 3 > center; - itk::Vector< double, 3 > normal; - - center.Fill( double( 0 ) ); - normal.Fill( double( 0 ) ); - normal[ 0 ] = double( 1 ); - - this->m_Parameters->ConfigureAsPoint( "PlaneCenter", 3, center ); - this->m_Parameters->ConfigureAsVector( "PlaneNormal", 3, normal ); + this->m_Parameters->ConfigureAsPoint( "PlaneCenter" ); + this->m_Parameters->ConfigureAsVector( "PlaneNormal" ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx index f56c6e1..e40ecb1 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx @@ -15,13 +15,17 @@ MacheteImageFilter() this->_AddInput("Input"); this->_MakeOutput< cpPlugins::Interface::Image >("Output"); - this->m_Parameters->ConfigureAsReal("Radius", 20); + this->m_Parameters->ConfigureAsReal("Radius"); //this->m_Parameters->ConfigureAsPoint("Point", 3, 3); - this->m_Parameters->ConfigureAsReal("X", 30); - this->m_Parameters->ConfigureAsReal("Y", 30); - this->m_Parameters->ConfigureAsReal("Z", 30); - - + this->m_Parameters->ConfigureAsReal("X"); + this->m_Parameters->ConfigureAsReal("Y"); + this->m_Parameters->ConfigureAsReal("Z"); + + this->m_Parameters->SetReal("Radius", 20); + //this->m_Parameters->SetPoint("Point", 3, 3); + this->m_Parameters->SetReal("X", 30); + this->m_Parameters->SetReal("Y", 30); + this->m_Parameters->SetReal("Z", 30); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx index d47b500..da2f7f3 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx @@ -11,7 +11,8 @@ MedianImageFilter( ) this->_AddInput( "Input" ); this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); - this->m_Parameters->ConfigureAsUint( "Radius", 3 ); + this->m_Parameters->ConfigureAsUint( "Radius" ); + this->m_Parameters->SetUint( "Radius", 3 ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx index 22df71a..ed8b95a 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx @@ -11,9 +11,13 @@ OtsuThresholdImageFilter( ) this->_AddInput( "Input" ); this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); - this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins", 100 ); - this->m_Parameters->ConfigureAsUint( "InsideValue", 255 ); - this->m_Parameters->ConfigureAsUint( "OutsideValue", 0 ); + this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins" ); + this->m_Parameters->ConfigureAsUint( "InsideValue" ); + this->m_Parameters->ConfigureAsUint( "OutsideValue" ); + + this->m_Parameters->SetUint( "NumberOfHistogramBins", 100 ); + this->m_Parameters->SetUint( "InsideValue", 255 ); + this->m_Parameters->SetUint( "OutsideValue", 0 ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx b/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx index c7c671b..2ed0b7d 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx @@ -12,11 +12,14 @@ SphereMeshSource( ) { this->_MakeOutput< cpPlugins::Interface::Mesh >( "Output" ); - double point[ 3 ] = { double( 0 ) }; - this->m_Parameters->ConfigureAsPoint( "Center", 3, point ); - this->m_Parameters->ConfigureAsReal( "Radius", 1 ); - this->m_Parameters->ConfigureAsUint( "PhiResolution", 8 ); - this->m_Parameters->ConfigureAsUint( "ThetaResolution", 8 ); + this->m_Parameters->ConfigureAsPoint( "Center" ); + this->m_Parameters->ConfigureAsReal( "Radius" ); + this->m_Parameters->ConfigureAsUint( "PhiResolution" ); + this->m_Parameters->ConfigureAsUint( "ThetaResolution" ); + + this->m_Parameters->SetReal( "Radius", 1 ); + this->m_Parameters->SetUint( "PhiResolution", 8 ); + this->m_Parameters->SetUint( "ThetaResolution", 8 ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h b/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h index c912476..c74d52a 100644 --- a/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h +++ b/lib/cpPlugins/Plugins/IO/DicomSeriesReader.h @@ -32,9 +32,7 @@ namespace cpPlugins public: itkNewMacro( Self ); itkTypeMacro( DicomSeriesReader, ImageReader ); - cpPlugins_Id_Macro( - cpPlugins::IO::DicomSeriesReader, "DicomSeriesReader" - ); + cpPlugins_Id_Macro( cpPlugins::IO::DicomSeriesReader, "IO" ); public: virtual DialogResult ExecConfigurationDialog( QWidget* parent ); diff --git a/lib/cpPlugins/Plugins/IO/ImageReader.cxx b/lib/cpPlugins/Plugins/IO/ImageReader.cxx index 8866f7d..17744fa 100644 --- a/lib/cpPlugins/Plugins/IO/ImageReader.cxx +++ b/lib/cpPlugins/Plugins/IO/ImageReader.cxx @@ -58,7 +58,8 @@ ImageReader( ) this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); this->m_Parameters->ConfigureAsStringList( "FileNames" ); - this->m_Parameters->ConfigureAsBool( "VectorType", false ); + this->m_Parameters->ConfigureAsBool( "VectorType" ); + this->m_Parameters->SetBool( "VectorType", false ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/IO/ImageReader.h b/lib/cpPlugins/Plugins/IO/ImageReader.h index 822c5fd..50f0b0a 100644 --- a/lib/cpPlugins/Plugins/IO/ImageReader.h +++ b/lib/cpPlugins/Plugins/IO/ImageReader.h @@ -32,9 +32,7 @@ namespace cpPlugins public: itkNewMacro( Self ); itkTypeMacro( ImageReader, cpPluginsInterfaceImageSource ); - cpPlugins_Id_Macro( - cpPlugins::IO::ImageReader, "ImageReader" - ); + cpPlugins_Id_Macro( cpPlugins::IO::ImageReader, "IO" ); public: virtual DialogResult ExecConfigurationDialog( QWidget* parent ); diff --git a/lib/cpPlugins/Plugins/IO/ImageWriter.cxx b/lib/cpPlugins/Plugins/IO/ImageWriter.cxx index 519adb6..67b1390 100644 --- a/lib/cpPlugins/Plugins/IO/ImageWriter.cxx +++ b/lib/cpPlugins/Plugins/IO/ImageWriter.cxx @@ -47,8 +47,7 @@ ImageWriter( ) : Superclass( ) { this->_AddInput( "Input" ); - - this->m_Parameters->ConfigureAsString( "FileName", "" ); + this->m_Parameters->ConfigureAsString( "FileName" ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/IO/ImageWriter.h b/lib/cpPlugins/Plugins/IO/ImageWriter.h index a9db113..5394749 100644 --- a/lib/cpPlugins/Plugins/IO/ImageWriter.h +++ b/lib/cpPlugins/Plugins/IO/ImageWriter.h @@ -22,9 +22,7 @@ namespace cpPlugins public: itkNewMacro( Self ); itkTypeMacro( ImageWriter, cpPluginsInterfaceImageSink ); - cpPlugins_Id_Macro( - cpPlugins::IO::ImageWriter, "ImageWriter" - ); + cpPlugins_Id_Macro( cpPlugins::IO::ImageWriter, "IO" ); public: virtual DialogResult ExecConfigurationDialog( QWidget* parent ); diff --git a/lib/cpPlugins/Plugins/IO/MeshReader.cxx b/lib/cpPlugins/Plugins/IO/MeshReader.cxx index f8c3b84..35b95d4 100644 --- a/lib/cpPlugins/Plugins/IO/MeshReader.cxx +++ b/lib/cpPlugins/Plugins/IO/MeshReader.cxx @@ -48,9 +48,11 @@ MeshReader( ) std::vector< TParameters::TString > valid_types; valid_types.push_back( "float" ); valid_types.push_back( "double" ); - this->m_Parameters->ConfigureAsString( "FileName", "" ); + this->m_Parameters->ConfigureAsString( "FileName" ); this->m_Parameters->ConfigureAsChoices( "PixelType", valid_types ); - this->m_Parameters->ConfigureAsUint( "Dimension", 3 ); + this->m_Parameters->ConfigureAsUint( "Dimension" ); + + this->m_Parameters->SetUint( "Dimension", 3 ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/IO/MeshReader.h b/lib/cpPlugins/Plugins/IO/MeshReader.h index 6724cd5..6e18ff9 100644 --- a/lib/cpPlugins/Plugins/IO/MeshReader.h +++ b/lib/cpPlugins/Plugins/IO/MeshReader.h @@ -24,9 +24,7 @@ namespace cpPlugins public: itkNewMacro( Self ); itkTypeMacro( MeshReader, cpPluginsInterfaceMeshSource ); - cpPlugins_Id_Macro( - cpPlugins::IO::MeshReader, "MeshReader" - ); + cpPlugins_Id_Macro( cpPlugins::IO::MeshReader, "IO" ); public: virtual DialogResult ExecConfigurationDialog( QWidget* parent ); diff --git a/lib/cpPlugins/Plugins/IO/MeshWriter.cxx b/lib/cpPlugins/Plugins/IO/MeshWriter.cxx index 13531a5..e3408b2 100644 --- a/lib/cpPlugins/Plugins/IO/MeshWriter.cxx +++ b/lib/cpPlugins/Plugins/IO/MeshWriter.cxx @@ -49,8 +49,7 @@ MeshWriter( ) : Superclass( ) { this->_AddInput( "Input" ); - - this->m_Parameters->ConfigureAsString( "FileName", "" ); + this->m_Parameters->ConfigureAsString( "FileName" ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/Plugins/IO/MeshWriter.h b/lib/cpPlugins/Plugins/IO/MeshWriter.h index 3666864..51224fe 100644 --- a/lib/cpPlugins/Plugins/IO/MeshWriter.h +++ b/lib/cpPlugins/Plugins/IO/MeshWriter.h @@ -24,9 +24,7 @@ namespace cpPlugins public: itkNewMacro( Self ); itkTypeMacro( MeshWriter, cpPluginsInterfaceMeshSink ); - cpPlugins_Id_Macro( - cpPlugins::IO::MeshWriter, "MeshWriter" - ); + cpPlugins_Id_Macro( cpPlugins::IO::MeshWriter, "IO" ); public: virtual DialogResult ExecConfigurationDialog( QWidget* parent ); -- 2.47.1