]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/BaseObjects/Parameters.cxx
Cast image filter added. ROI filter modified.
[cpPlugins.git] / lib / cpPlugins / BaseObjects / Parameters.cxx
index d55278661dc18c0c6d1b77ce2b8635607b5c8c49..4025461f345cc060d294880281c3c9f9b4d989f3 100644 (file)
@@ -1,10 +1,12 @@
 #include <cpPlugins/BaseObjects/Parameters.h>
-#include <cpExtensions/Utility.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+#include <cpPlugins/Utility.h>
 #include <tinyxml2/tinyxml2.h>
 
 // -------------------------------------------------------------------------
 cpPlugins::BaseObjects::Parameters::
 Parameters( )
+  : m_ProcessObject( NULL )
 {
   this->Clear( );
 }
@@ -15,18 +17,34 @@ cpPlugins::BaseObjects::Parameters::
 {
 }
 
+// -------------------------------------------------------------------------
+cpPlugins::BaseObjects::ProcessObject* cpPlugins::BaseObjects::Parameters::
+GetProcessObject( )
+{
+  return( this->m_ProcessObject );
+}
+
+// -------------------------------------------------------------------------
+const
+cpPlugins::BaseObjects::ProcessObject* cpPlugins::BaseObjects::Parameters::
+GetProcessObject( ) const
+{
+  return( this->m_ProcessObject );
+}
+
 // -------------------------------------------------------------------------
 void cpPlugins::BaseObjects::Parameters::
-Modified( ) const
+SetProcessObject( cpPlugins::BaseObjects::ProcessObject* po )
 {
-  this->m_TimeStamp.Modified( );
+  this->m_ProcessObject = po;
 }
 
 // -------------------------------------------------------------------------
-itk::ModifiedTimeType cpPlugins::BaseObjects::Parameters::
-GetMTime( ) const
+void cpPlugins::BaseObjects::Parameters::
+Modified( ) const
 {
-  return( this->m_TimeStamp.GetMTime( ) );
+  if( this->m_ProcessObject != NULL )
+    this->m_ProcessObject->Modified( );
 }
 
 // -------------------------------------------------------------------------
@@ -174,6 +192,53 @@ ConfigureAsChoices(
   this->Modified( );
 }
 
+// -------------------------------------------------------------------------
+void cpPlugins::BaseObjects::Parameters::
+ConfigureAsRealTypesChoices( const std::string& name )
+{
+  std::vector< std::string > choices;
+  choices.push_back( "float" );
+  choices.push_back( "double" );
+  this->ConfigureAsChoices( name, choices );
+  this->SetSelectedChoice( name, "float" );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::BaseObjects::Parameters::
+ConfigureAsIntTypesChoices( const std::string& name )
+{
+  std::vector< std::string > choices;
+  choices.push_back( "char" );
+  choices.push_back( "uchar" );
+  choices.push_back( "short" );
+  choices.push_back( "ushort" );
+  choices.push_back( "int" );
+  choices.push_back( "uint" );
+  choices.push_back( "long" );
+  choices.push_back( "ulong" );
+  this->ConfigureAsChoices( name, choices );
+  this->SetSelectedChoice( name, "char" );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::BaseObjects::Parameters::
+ConfigureAsScalarTypesChoices( const std::string& name )
+{
+  std::vector< std::string > choices;
+  choices.push_back( "char" );
+  choices.push_back( "uchar" );
+  choices.push_back( "short" );
+  choices.push_back( "ushort" );
+  choices.push_back( "int" );
+  choices.push_back( "uint" );
+  choices.push_back( "long" );
+  choices.push_back( "ulong" );
+  choices.push_back( "float" );
+  choices.push_back( "double" );
+  this->ConfigureAsChoices( name, choices );
+  this->SetSelectedChoice( name, "char" );
+}
+
 // -------------------------------------------------------------------------
 std::vector< std::string > cpPlugins::BaseObjects::Parameters::
 GetChoices( const std::string& name ) const
@@ -447,11 +512,11 @@ AddToOpenFileNameList(
   {
     if( i->second.first == OpenFileNameList )
     {
-      auto pos = name.find_last_of( "/\\" );
+      auto pos = v.find_last_of( "/\\" );
       if( i->second.second == "" )
-        i->second.second = name.substr( 0, pos );
+        i->second.second = v.substr( 0, pos );
       i->second.second += std::string( "#" );
-      i->second.second += name.substr( pos + 1 );
+      i->second.second += v.substr( pos + 1 );
       this->Modified( );
 
     } // fi
@@ -486,11 +551,11 @@ AddToSaveFileNameList(
   {
     if( i->second.first == SaveFileNameList )
     {
-      auto pos = name.find_last_of( "/\\" );
+      auto pos = v.find_last_of( "/\\" );
       if( i->second.second == "" )
-        i->second.second = name.substr( 0, pos );
+        i->second.second = v.substr( 0, pos );
       i->second.second += std::string( "#" );
-      i->second.second += name.substr( pos + 1 );
+      i->second.second += v.substr( pos + 1 );
       this->Modified( );
 
     } // fi
@@ -610,7 +675,7 @@ _GetList( const std::string& name ) const
     if( i->second.first == ( Self::Type )( _Enum ) )
     {
       std::vector< std::string > tokens;
-      cpExtensions::Tokenize( tokens, i->second.second, "#" );
+      cpPlugins::Tokenize( tokens, i->second.second, "#" );
       for( auto t = tokens.begin( ); t != tokens.end( ); ++t )
       {
         if( typeid( _Type ) != typeid( std::string ) )